@@ -0,0 +1,3448 @@
+package com.vaadin.tests.components.label;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport com.vaadin.tests.components.ComponentTestCase;%0Aimport com.vaadin.ui.Button;%0Aimport com.vaadin.ui.CheckBox;%0Aimport com.vaadin.ui.Component;%0Aimport com.vaadin.ui.Label;%0Aimport com.vaadin.ui.Button.ClickEvent;%0A%0Apublic class LabelModes extends ComponentTestCase %7B%0A%0A    Label label%5B%5D = new Label%5B20%5D;%0A%0A    @Override%0A    protected void setup() %7B%0A        super.setup();%0A%0A        Label l;%0A        l = createLabel(%22This is an undefined wide label with default content mode%22);%0A        l.setWidth(null);%0A        addTestComponent(l);%0A%0A        l = createLabel(%22This label                       contains%5Cnnewlines and spaces%5Cnbut is in%5Cndefault content mode%22);%0A        l.setWidth(null);%0A        addTestComponent(l);%0A%0A        l = createLabel(%22This label                       contains%5Cnnewlines and spaces%5Cnand is in%5Cnpreformatted mode%22);%0A        l.setContentMode(Label.CONTENT_PREFORMATTED);%0A        l.setWidth(null);%0A        addTestComponent(l);%0A%0A        l = createLabel(%22This label                       contains%5Cnnewlines and spaces%5Cnand is in%5Cnhtml mode%22);%0A        l.setContentMode(Label.CONTENT_XHTML);%0A        l.setWidth(null);%0A        addTestComponent(l);%0A%0A        l = createLabel(%22This label                       contains%5Cnnewlines and spaces%5Cnand is in%5Cnraw mode%22);%0A        l.setContentMode(Label.CONTENT_RAW);%0A        l.setWidth(null);%0A        addTestComponent(l);%0A%0A    %7D%0A%0A    private Label createLabel(String text, String caption) %7B%0A        Label l = new Label(text);%0A        l.setCaption(caption);%0A%0A        return l;%0A    %7D%0A%0A    private Label createLabel(String text) %7B%0A        return createLabel(text, null);%0A    %7D%0A%0A    @Override%0A    protected String getDescription() %7B%0A        return %22A generic test for Labels in different configurations%22;%0A    %7D%0A%0A    @Override%0A    protected List%3CComponent%3E createActions() %7B%0A        ArrayList%3CComponent%3E actions = new ArrayList%3CComponent%3E();%0A%0A        CheckBox errorIndicators = new CheckBox(%22Error indicators%22,%0A                new Button.ClickListener() %7B%0A                    public void buttonClick(ClickEvent event) %7B%0A                        Button b = event.getButton();%0A                        boolean enabled = (Boolean) b.getValue();%0A                        setErrorIndicators(enabled);%0A%0A                    %7D%0A                %7D);%0A%0A        CheckBox enabled = new CheckBox(%22Enabled%22, new Button.ClickListener() %7B%0A            public void buttonClick(ClickEvent event) %7B%0A                Button b = event.getButton();%0A                boolean enabled = (Boolean) b.getValue();%0A                setEnabled(enabled);%0A            %7D%0A        %7D);%0A%0A        CheckBox readonly = new CheckBox(%22Readonly%22,%0A                new Button.ClickListener() %7B%0A                    public void buttonClick(ClickEvent event) %7B%0A                        Button b = event.getButton();%0A                        boolean enabled = (Boolean) b.getValue();%0A                        setReadOnly(enabled);%0A                    %7D%0A                %7D);%0A%0A        errorIndicators.setValue(new Boolean(false));%0A        readonly.setValue(new Boolean(false));%0A        enabled.setValue(new Boolean(true));%0A%0A        errorIndicators.setImmediate(true);%0A        readonly.setImmediate(true);%0A        enabled.setImmediate(true);%0A%0A        actions.add(errorIndicators);%0A        actions.add(readonly);%0A        actions.add(enabled);%0A%0A        return actions;%0A    %7D%0A%0A%7D%0A

Test case for Label modes