summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorJouni Koivuviita <jouni@vaadin.com>2014-06-13 17:21:21 +0300
committerJouni Koivuviita <jouni@vaadin.com>2014-06-18 07:56:11 +0000
commit357238351c386d3b9e657eff6100f35650734782 (patch)
tree34b45c3257dd8dfdb550359231b50577bbbcdd46 /uitest
parent00ff22ee1950756185da3aa1c03b2451b7cefac1 (diff)
downloadvaadin-framework-357238351c386d3b9e657eff6100f35650734782.tar.gz
vaadin-framework-357238351c386d3b9e657eff6100f35650734782.zip
Update ValoThemeTest
New tab sheet test with more flexibility in testing all the different combinations of styles. Test slider min-max ranges with the “ticks” style. Change-Id: Id64f28f79fc7c660948519dea85110516966093f
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/CommonParts.java13
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Sliders.java6
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java110
3 files changed, 100 insertions, 29 deletions
diff --git a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
index 902ad82508..94363687b6 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/CommonParts.java
@@ -42,6 +42,8 @@ import com.vaadin.ui.MenuBar.MenuItem;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
+import com.vaadin.ui.TabSheet.SelectedTabChangeListener;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
@@ -492,6 +494,17 @@ public class CommonParts extends VerticalLayout implements View {
tabs.addTab(new Label("&nbsp;", ContentMode.HTML),
"One more");
tabs.addStyleName("padded-tabbar");
+ tabs.addSelectedTabChangeListener(new SelectedTabChangeListener() {
+ @Override
+ public void selectedTabChange(
+ SelectedTabChangeEvent event) {
+ try {
+ Thread.sleep(600);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
content = tabs;
} else if (!autoHeight) {
Panel p = new Panel();
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
index a39b67ba5d..363c698c32 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Sliders.java
@@ -71,8 +71,9 @@ public class Sliders extends VerticalLayout implements View {
row.addComponent(slider);
slider = new Slider("With ticks (not in IE8 & IE9)");
- slider.setValue(50.0);
+ slider.setValue(3.0);
slider.setWidth("200px");
+ slider.setMax(4);
slider.addStyleName("ticks");
row.addComponent(slider);
@@ -123,8 +124,9 @@ public class Sliders extends VerticalLayout implements View {
row.addComponent(slider);
slider = new Slider("With ticks");
- slider.setValue(50.0);
+ slider.setValue(3.0);
slider.setHeight("200px");
+ slider.setMax(4);
slider.addStyleName("ticks");
slider.setOrientation(SliderOrientation.VERTICAL);
row.addComponent(slider);
diff --git a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
index b98d2d398c..cf1fa699c8 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/Tabsheets.java
@@ -20,12 +20,18 @@ import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
+import com.vaadin.ui.TabSheet.SelectedTabChangeListener;
import com.vaadin.ui.TabSheet.Tab;
import com.vaadin.ui.VerticalLayout;
public class Tabsheets extends VerticalLayout implements View {
+
+ TabSheet tabs;
+
public Tabsheets() {
setMargin(true);
@@ -33,8 +39,9 @@ public class Tabsheets extends VerticalLayout implements View {
h1.addStyleName("h1");
addComponent(h1);
- final VerticalLayout wrap = new VerticalLayout();
+ final HorizontalLayout wrap = new HorizontalLayout();
wrap.setSpacing(true);
+ wrap.addStyleName("wrapping");
addComponent(wrap);
final CheckBox closable = new CheckBox("Closable");
@@ -45,60 +52,109 @@ public class Tabsheets extends VerticalLayout implements View {
overflow.setImmediate(true);
wrap.addComponent(overflow);
+ final CheckBox caption = new CheckBox("Captions", true);
+ caption.setImmediate(true);
+ wrap.addComponent(caption);
+
final CheckBox icon = new CheckBox("Icons");
icon.setImmediate(true);
wrap.addComponent(icon);
+ final CheckBox framed = new CheckBox("Framed", true);
+ framed.setImmediate(true);
+ wrap.addComponent(framed);
+
+ final CheckBox centered = new CheckBox("Centered Tabs");
+ centered.setImmediate(true);
+ wrap.addComponent(centered);
+
+ final CheckBox equal = new CheckBox("Equal-width tabs");
+ equal.setImmediate(true);
+ wrap.addComponent(equal);
+
+ final CheckBox padded = new CheckBox("Padded tabbar");
+ padded.setImmediate(true);
+ wrap.addComponent(padded);
+
+ final CheckBox iconsOnTop = new CheckBox("Icons on top");
+ iconsOnTop.setImmediate(true);
+ wrap.addComponent(iconsOnTop);
+
+ final CheckBox selectedOnly = new CheckBox("Selected tab closable");
+ selectedOnly.setImmediate(true);
+ wrap.addComponent(selectedOnly);
+
ValueChangeListener update = new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
- wrap.removeAllComponents();
-
- wrap.addComponents(closable, overflow, icon);
-
- wrap.addComponent(getTabSheet("Normal", null,
- closable.getValue(), overflow.getValue(),
- icon.getValue()));
- wrap.addComponent(getTabSheet("Centered tabs", "centered-tabs",
+ String style = framed.getValue() ? "framed " : "";
+ style += centered.getValue() ? " centered-tabs" : "";
+ style += equal.getValue() ? " equal-width-tabs" : "";
+ style += padded.getValue() ? " padded-tabbar" : "";
+ style += iconsOnTop.getValue() ? " icons-on-top" : "";
+ style += selectedOnly.getValue() ? " only-selected-closable"
+ : "";
+
+ if (tabs != null) {
+ removeComponent(tabs);
+ }
+ tabs = getTabSheet(caption.getValue(), style.trim(),
closable.getValue(), overflow.getValue(),
- icon.getValue()));
- wrap.addComponent(getTabSheet("Equal-width tabs",
- "equal-width-tabs", closable.getValue(),
- overflow.getValue(), icon.getValue()));
- wrap.addComponent(getTabSheet("Icons on top + padded tabbar",
- "icons-on-top padded-tabbar", closable.getValue(),
- overflow.getValue(), icon.getValue()));
- wrap.addComponent(getTabSheet("Only selected tab is closable",
- "only-selected-closable", closable.getValue(),
- overflow.getValue(), icon.getValue()));
+ icon.getValue());
+ addComponent(tabs);
}
};
closable.addValueChangeListener(update);
overflow.addValueChangeListener(update);
+ caption.addValueChangeListener(update);
icon.addValueChangeListener(update);
+ framed.addValueChangeListener(update);
+ centered.addValueChangeListener(update);
+ equal.addValueChangeListener(update);
+ padded.addValueChangeListener(update);
+ iconsOnTop.addValueChangeListener(update);
+ selectedOnly.addValueChangeListener(update);
// Generate initial view
icon.setValue(true);
}
- TabSheet getTabSheet(String caption, String style, boolean closable,
+ TabSheet getTabSheet(boolean caption, String style, boolean closable,
boolean scrolling, boolean icon) {
TabSheet ts = new TabSheet();
ts.addStyleName(style);
- ts.setCaption(caption);
- for (int i = 0; i < (scrolling ? 10 : 3); i++) {
- String tabcaption = ValoThemeTest.nextString(true);
- if (i == 0 && icon) {
- tabcaption = null;
+ for (int i = 1; i <= (scrolling ? 10 : 3); i++) {
+ String tabcaption = caption ? ValoThemeTest.nextString(true) + " "
+ + ValoThemeTest.nextString(false) : null;
+
+ VerticalLayout content = new VerticalLayout();
+ content.setMargin(true);
+ content.setSpacing(true);
+ content.addComponent(new Label("Content for tab " + i));
+ if (i == 2) {
+ content.addComponent(new Label(
+ "Excepteur sint obcaecat cupiditat non proident culpa. Magna pars studiorum, prodita quaerimus."));
}
- Tab t = ts.addTab(new Label(" "), tabcaption);
+ Tab t = ts.addTab(content, tabcaption);
t.setClosable(closable);
if (icon) {
- t.setIcon(TestIcon.get(i == 2));
+ t.setIcon(TestIcon.get(false));
}
}
+
+ ts.addSelectedTabChangeListener(new SelectedTabChangeListener() {
+ @Override
+ public void selectedTabChange(SelectedTabChangeEvent event) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
return ts;
}