aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/popupview/PopupViewNullValues.java
blob: 80840c8088711df23b185bbe6737845b137a138b (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
77
package com.vaadin.tests.components.popupview;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Notification;
import com.vaadin.ui.PopupView;
import com.vaadin.v7.ui.TextField;

public class PopupViewNullValues extends TestBase {

    private PopupView pv[] = new PopupView[4];
    private Button b[] = new Button[4];

    @Override
    protected void setup() {
        try {
            pv[0] = new PopupView("Popupview 1 - no component", null);
            addComponent(pv[0]);
            b[0] = new Button("Open popupview 1",
                    event -> pv[0].setPopupVisible(true));
        } catch (Exception e) {
            getMainWindow().showNotification(
                    "Error, 'null content' should not throw an exception at this point",
                    Notification.TYPE_ERROR_MESSAGE);
        }

        try {
            pv[1] = new PopupView(null,
                    new TextField("Empty html, contains component"));
            addComponent(pv[1]);
            b[1] = new Button("Open popupview 2",
                    event -> pv[1].setPopupVisible(true));
        } catch (Exception e) {
            getMainWindow().showNotification(
                    "Error, 'null html', should not throw an exception at this point",
                    Notification.TYPE_ERROR_MESSAGE);
        }

        try {
            pv[2] = new PopupView(null, null);
            addComponent(pv[2]);
            b[2] = new Button("Open popupview 3",
                    event -> pv[2].setPopupVisible(true));
        } catch (Exception e) {
            getMainWindow().showNotification(
                    "Error, 'null html, null content', should not throw an exception at this point",
                    Notification.TYPE_ERROR_MESSAGE);
        }
        try {
            pv[3] = new PopupView("Popupview 4 - has component",
                    new TextField("This is the content of popupview 4"));
            addComponent(pv[3]);
            b[3] = new Button("Open popupview 4",
                    event -> pv[3].setPopupVisible(true));
        } catch (Exception e) {
            getMainWindow().showNotification(
                    "Error, 'null html, null content', should not throw an exception at this point",
                    Notification.TYPE_ERROR_MESSAGE);
        }

        addComponent(b[0]);
        addComponent(b[1]);
        addComponent(b[2]);
        addComponent(b[3]);
    }

    @Override
    protected String getDescription() {
        return "This test case contains 3 popupviews. Only the second and the forth popup views have non-null components and can be opened. 1 and 3 will produce an exception if you try to open them.";
    }

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

}