diff options
author | Sami Viitanen <sami.viitanen@vaadin.com> | 2012-06-28 15:43:11 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-06-28 16:49:54 +0300 |
commit | 18ac8b25501e28cfcfc3271d2c6722a00fa01b98 (patch) | |
tree | 3e2b4d90e98c3531e9bd4ac4847cf48a70a6b70d /tests | |
parent | 92784107eddb53bd1a5f651775937a3caf2eeae0 (diff) | |
download | vaadin-framework-18ac8b25501e28cfcfc3271d2c6722a00fa01b98.tar.gz vaadin-framework-18ac8b25501e28cfcfc3271d2c6722a00fa01b98.zip |
Tooltips are now handled by the connector and not the widget (#8425)
Diffstat (limited to 'tests')
3 files changed, 224 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java b/tests/testbench/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java new file mode 100644 index 0000000000..17cc4270fb --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/abstractcomponent/AllComponentTooltipTest.java @@ -0,0 +1,50 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ +package com.vaadin.tests.components.abstractcomponent; + +import com.vaadin.terminal.WrappedRequest; +import com.vaadin.tests.VaadinClasses; +import com.vaadin.tests.components.AbstractTestRoot; +import com.vaadin.ui.AbstractComponent; +import com.vaadin.ui.Component; +import com.vaadin.ui.GridLayout; + +public class AllComponentTooltipTest extends AbstractTestRoot { + + @Override + protected void setup(WrappedRequest request) { + setContent(new GridLayout(5, 5)); + for (Class<? extends Component> cls : VaadinClasses.getComponents()) { + try { + AbstractComponent c = (AbstractComponent) cls.newInstance(); + if (c instanceof LegacyWindow) { + continue; + } + + c.setDebugId(cls.getName()); + c.setCaption(cls.getName()); + c.setDescription(cls.getName()); + c.setWidth("100px"); + c.setHeight("100px"); + getContent().addComponent(c); + System.out.println("Added " + cls.getName()); + } catch (Exception e) { + System.err.println("Could not instatiate " + cls.getName()); + } + } + } + + @Override + protected String getTestDescription() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html b/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html new file mode 100644 index 0000000000..a1d4fc9b35 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.html @@ -0,0 +1,77 @@ +<?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>TooltipTests</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">TooltipTests</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.abstractcomponent.TooltipTests?restartApplication</td> + <td></td> +</tr> +<tr> + <td>showTooltip</td> + <td>//div[@id='label']</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>no_tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VCheckBox[0]/domChild[0]</td> + <td>10,7</td> +</tr> +<tr> + <td>showTooltip</td> + <td>//div[@id='label']</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>panel_tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VCheckBox[1]/domChild[0]</td> + <td>8,6</td> +</tr> +<tr> + <td>showTooltip</td> + <td>//div[@id='label']</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>layout_tooltip</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsabstractcomponentTooltipTests::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VCheckBox[2]/domChild[0]</td> + <td>5,5</td> +</tr> +<tr> + <td>showTooltip</td> + <td>//div[@id='label']</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>label_tooltip</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.java b/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.java new file mode 100644 index 0000000000..c009e1d7bc --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/abstractcomponent/TooltipTests.java @@ -0,0 +1,97 @@ +package com.vaadin.tests.components.abstractcomponent; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.Panel; +import com.vaadin.ui.VerticalLayout; + +public class TooltipTests extends TestBase { + + private Panel panel; + private VerticalLayout layout; + private Label label; + + @Override + protected String getDescription() { + return "Generic tooltip handling tests"; + } + + @Override + protected Integer getTicketNumber() { + return 8425; + } + + @Override + protected void setup() { + HorizontalLayout topLayout = new HorizontalLayout(); + addComponent(topLayout); + CheckBox panelCbox = new CheckBox("Panel"); + panelCbox.addListener(panelListener); + topLayout.addComponent(panelCbox); + CheckBox layoutCbox = new CheckBox("Layout"); + layoutCbox.addListener(layoutListener); + topLayout.addComponent(layoutCbox); + CheckBox labelCbox = new CheckBox("Label"); + topLayout.addComponent(labelCbox); + labelCbox.addListener(labelListener); + + panel = new Panel(); + panel.setCaption("Panel caption"); + panel.setDebugId("panel"); + addComponent(panel); + + layout = new VerticalLayout(); + layout.setDebugId("layout"); + layout.setMargin(true); + layout.setSpacing(true); + panel.setContent(layout); + + label = new Label("Hover me!"); + label.setDebugId("label"); + layout.addComponent(label); + } + + private final Property.ValueChangeListener panelListener = new Property.ValueChangeListener() { + + public void valueChange(ValueChangeEvent event) { + boolean value = (Boolean) (event.getProperty().getValue()); + if (value) { + panel.setDescription("I'm panel!"); + } else { + panel.setDescription(""); + } + } + + }; + + private final Property.ValueChangeListener layoutListener = new Property.ValueChangeListener() { + + public void valueChange(ValueChangeEvent event) { + boolean value = (Boolean) (event.getProperty().getValue()); + if (value) { + layout.setDescription("I'm layout!"); + } else { + layout.setDescription(""); + } + } + + }; + + private final Property.ValueChangeListener labelListener = new Property.ValueChangeListener() { + + public void valueChange(ValueChangeEvent event) { + boolean value = (Boolean) (event.getProperty().getValue()); + if (value) { + label.setDescription("I'm label!"); + } else { + label.setDescription(""); + } + } + + }; + +} |