aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java
blob: f88ed0c67cd4d66b4d3d6198e079caa0b390cc74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.vaadin.tests.components.richtextarea;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.VerticalLayout;

public class RichTextAreaScrolling extends TestBase {

    @Override
    protected String getDescription() {
        return "A read-only RichTextArea should be (touch) scrollable";
    }

    @Override
    protected Integer getTicketNumber() {
        return 7036;
    }

    @Override
    protected void setup() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 50; ++i) {
            sb.append("A long string with several lines<br/>");
        }

        HorizontalLayout main = new HorizontalLayout();
        main.setSpacing(true);
        addComponent(main);

        RichTextArea first = new RichTextArea("Defined height");
        RichTextArea second = new RichTextArea("Full height");
        RichTextArea third = new RichTextArea("Undefined height");

        first.setValue(sb);
        second.setValue(sb);
        third.setValue(sb);

        first.setReadOnly(true);
        second.setReadOnly(true);
        third.setReadOnly(true);

        first.setWidth("200px");
        first.setHeight("400px");
        second.setSizeFull();
        third.setSizeUndefined();

        VerticalLayout secondLayout = new VerticalLayout();
        secondLayout.setWidth("200px");
        secondLayout.setHeight("200px");
        secondLayout.addComponent(second);

        main.addComponent(first);
        main.addComponent(secondLayout);
        main.addComponent(third);
    }
}