diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-02-14 12:48:07 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-02-14 12:48:07 +0200 |
commit | 0628eea037ebb9f47ad77f37c59145082fc2e74c (patch) | |
tree | b9ed441c79ba1e4acad13aa70ffdb4379cac5ea9 /tests | |
parent | ecd80181d160b58a281eb92fabaa2a10ea0adac2 (diff) | |
parent | 36f749b4f83086a5306726ad607c9bb3a0fa7526 (diff) | |
download | vaadin-framework-0628eea037ebb9f47ad77f37c59145082fc2e74c.tar.gz vaadin-framework-0628eea037ebb9f47ad77f37c59145082fc2e74c.zip |
Merge remote branch 'origin/6.8'
Conflicts:
WebContent/release-notes.html
tests/test.xml
tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java
Diffstat (limited to 'tests')
8 files changed, 322 insertions, 8 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java index 3115ce49c8..453aab5af8 100644 --- a/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java +++ b/tests/server-side/com/vaadin/tests/server/SourceFileChecker.java @@ -134,20 +134,37 @@ public class SourceFileChecker extends TestCase { } } - class DosNewlineDetector implements FileValidator { - + abstract class FileContentsValidator implements FileValidator { public void validateFile(File f) throws Exception { - String contents = IOUtils.toString(new FileInputStream(f)); + FileInputStream fis = new FileInputStream(f); + String contents = IOUtils.toString(fis); + fis.close(); + validateContents(f, contents); + } + + protected abstract void validateContents(File f, String contents) + throws Exception; + + } + + class DosNewlineDetector extends FileContentsValidator { + + @Override + protected void validateContents(File f, String contents) + throws Exception { if (contents.contains("\r\n")) { throw new IllegalArgumentException(); } } + } - class LicenseChecker implements FileValidator { - public void validateFile(File f) throws Exception { - String contents = IOUtils.toString(new FileInputStream(f)); + class LicenseChecker extends FileContentsValidator { + + @Override + protected void validateContents(File f, String contents) + throws Exception { if (!contents.contains("@" + "VaadinApache2LicenseForJavaFiles" + "@")) { throw new IllegalArgumentException(); diff --git a/tests/test.xml b/tests/test.xml index 2baa26218a..f3233de014 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -11,7 +11,7 @@ <!-- Configuration --> <!-- ================================================================== --> <!-- Browsers to use for testing --> - <property name="browsers-windows" value="winxp-ie8,win7-ie9,winxp-firefox10,winxp-safari5,winxp-googlechrome-stable,winxp-opera11" /> + <property name="browsers-windows" value="winxp-ie8,win7-ie9,winxp-firefox10,winxp-safari5,winxp-googlechrome-17,winxp-opera11" /> <property name="browsers-linux" value="linux-firefox3,linux-opera10,linux-googlechrome8" /> <property name="browsers-mac" value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" /> diff --git a/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html b/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html new file mode 100644 index 0000000000..ddcdc68691 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/checkbox/CheckBoxDisabledReadOnlyValueChange.html @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.checkbox.CheckBoxes2?restartApplication</td> + <td></td> +</tr> +<!--add icon--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>32,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item1</td> + <td>50,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item3</td> + <td>48,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[2]/VMenuBar[0]#item1</td> + <td>24,9</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>off</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td> + <td>9,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<!--disable--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>22,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>33,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>51,9</td> +</tr> +<!--click on caption and icon and assert checked state does not change. Cannot test checkbox click due to Opera problems--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[2]</td> + <td>8,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td> + <td>5,10</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<!--enable and set to read only--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>33,14</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>30,3</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>62,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_Smenu#item0</td> + <td>42,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>40,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::Root/VOverlay[1]/VMenuBar[0]#item2</td> + <td>58,14</td> +</tr> +<!--click on caption and icon and assert checked state does not change. Cannot test checkbox click due to Opera problems--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[2]</td> + <td>8,7</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[1]</td> + <td>5,10</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentscheckboxCheckBoxes2::PID_StestComponent/domChild[0]</td> + <td>on</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java index 6d64898e28..b87c458c01 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldPopupOffScreen.java @@ -1,6 +1,7 @@ package com.vaadin.tests.components.datefield; -import java.sql.Date; +import java.util.Date; +import java.util.Locale; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.ui.Alignment; @@ -56,6 +57,7 @@ public class DateFieldPopupOffScreen extends AbstractTestCase { private DateField createDateField() { DateField df = new DateField(); + df.setLocale(new Locale("fi")); df.setResolution(Resolution.SECOND); df.setDescription("This is a long, multiline tooltip.<br/>It should always be on screen so it can be read."); df.setValue(new Date(1000000L)); diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java index 3c42d71af5..44260e9247 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java @@ -13,6 +13,7 @@ public class DatePopupStyleName extends TestBase { final DateField df = new DateField(); df.setValue(new Date(1203910239L)); + df.setResolution(DateField.RESOLUTION_SEC); df.setWidth("200px"); df.setRequired(true); df.setComponentError(new UserError("abc")); diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java index 517bf2ee76..88542751c3 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java @@ -14,6 +14,7 @@ public class WidthRecalculationOnEnableStateChange extends TestBase { final DateField df = new DateField(); df.setValue(new Date(1203910239L)); + df.setResolution(DateField.RESOLUTION_SEC); df.setWidth("200px"); df.addStyleName("enabled-readonly-styled"); addComponent(df); diff --git a/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.html b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.html new file mode 100644 index 0000000000..82778d5bac --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.html @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>LongMultiselect</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">LongMultiselect</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.table.LongMultiselect?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[1]</td> + <td>38,13</td> +</tr> +<tr> + <td>scroll</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td> + <td>18330</td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<tr> + <td>scroll</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td> + <td>18330</td> +</tr> +<tr> + <td>pause</td> + <td>300</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[22]/domChild[0]/domChild[0]</td> + <td>41,-1823:shift</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>selected-5-99</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[18]/domChild[1]/domChild[0]</td> + <td>updated</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstableLongMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[19]/domChild[1]</td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java new file mode 100644 index 0000000000..4db9b69070 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/LongMultiselect.java @@ -0,0 +1,74 @@ +package com.vaadin.tests.components.table; + +import java.util.Collection; + +import com.vaadin.Application; +import com.vaadin.data.Property; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Label; +import com.vaadin.ui.Table; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class LongMultiselect extends TestBase { + + private enum ItemProperty { + COLUMN1, + COLUMN2 + } + + @Override + protected void setup() { + VerticalLayout layout = generateLayout(); + addComponent(layout); + layout.setSizeFull(); + } + + private VerticalLayout generateLayout() { + VerticalLayout layout = new VerticalLayout(); + + final Table table = new Table("Ticket #8264 table"); + layout.addComponent(table); + table.setWidth("200px"); + table.setHeight("170px"); + table.setSelectable(true); + table.setMultiSelect(true); + table.setImmediate(true); + + // Create example data + table.addContainerProperty(ItemProperty.COLUMN1, String.class, null); + table.addContainerProperty(ItemProperty.COLUMN2, String.class, null); + for (int i=1;i<100;i++) { + table.addItem(new String[]{"Item " + i, null}, i); + } + + //Add action button + layout.addComponent(new Button("Do It", new Button.ClickListener() { + public void buttonClick(Button.ClickEvent event) { + // Set ItemProperty.COLUMN2 for all selected values of table + Collection selectedIds = (Collection)table.getValue(); + for (final Object itemId : selectedIds) { + final Property p = table.getItem(itemId).getItemProperty(ItemProperty.COLUMN2); + if (p.getValue() instanceof String) { + p.setValue(null); + } else { + p.setValue("updated"); + } + } + } + })); + + return layout; + } + + @Override + protected String getDescription() { + return "Multiselecting 94 rows (from \"item 5\" to \"item 98\") and modifying second column of each row selected (press Do It). This should work (update the 2nd column) and not cause JS exception."; + } + + @Override + protected Integer getTicketNumber() { + return 8264; + } +} |