aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxes.java
blob: 24f53889b319ac7ccba774538094a6e40aa6c128 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.vaadin.tests.components.checkbox;

import java.util.Date;

import com.vaadin.server.Resource;
import com.vaadin.server.ThemeResource;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.CheckBox;

public class CheckBoxes extends ComponentTestCase<CheckBox> {

    private ThemeResource SMALL_ICON = new ThemeResource(
            "../runo/icons/16/ok.png");
    private ThemeResource LARGE_ICON = new ThemeResource(
            "../runo/icons/64/document.png");
    private ThemeResource LARGE_ICON_NOCACHE = new ThemeResource(
            "../runo/icons/64/document.png?" + new Date().getTime());

    @Override
    protected Class<CheckBox> getTestClass() {
        return CheckBox.class;
    }

    @Override
    protected void initializeComponents() {

        setTheme("tests-tickets");
        CheckBox cb;

        cb = createCheckBox("CheckBox with normal text");
        addTestComponent(cb);

        cb = createCheckBox("CheckBox with large text");
        cb.setStyleName("large");
        addTestComponent(cb);

        cb = createCheckBox("CheckBox with normal text and small icon",
                SMALL_ICON);
        addTestComponent(cb);
        cb = createCheckBox("CheckBox with large text and small icon",
                SMALL_ICON);
        cb.setStyleName("large");
        addTestComponent(cb);

        cb = createCheckBox("CheckBox with normal text and large icon",
                LARGE_ICON);
        addTestComponent(cb);
        cb = createCheckBox("CheckBox with large text and large icon",
                LARGE_ICON_NOCACHE);
        cb.setStyleName("large");
        addTestComponent(cb);

    }

    private CheckBox createCheckBox(String caption, Resource icon) {
        CheckBox cb = createCheckBox(caption);
        cb.setIcon(icon);

        return cb;
    }

    private CheckBox createCheckBox(String caption) {
        return new CheckBox(caption);
    }

    @Override
    protected String getDescription() {
        return "A generic test for CheckBoxes in different configurations";
    }

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

}