summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-03-23 09:52:33 +0200
committerArtur Signell <artur@vaadin.com>2012-03-23 09:52:33 +0200
commitb052e30bb6aad20a4a7f840ff4fa646c2967e290 (patch)
treef11e9108119ec519810cf27c112fd855a5095148
parentdd06b3cb695567379b381e4be28fb609d0c70074 (diff)
parent2296d93d648857c248162a1261a15e7a8c7ca378 (diff)
downloadvaadin-framework-b052e30bb6aad20a4a7f840ff4fa646c2967e290.tar.gz
vaadin-framework-b052e30bb6aad20a4a7f840ff4fa646c2967e290.zip
Merge remote-tracking branch 'origin/6.8'
Conflicts: src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.java
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java1
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java96
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java4
-rw-r--r--src/com/vaadin/ui/Button.java15
-rw-r--r--src/com/vaadin/ui/Embedded.java33
-rw-r--r--tests/server-side/com/vaadin/tests/server/component/button/ButtonClick.java47
-rw-r--r--tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.html47
-rw-r--r--tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.java48
-rw-r--r--tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.html42
-rw-r--r--tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.java10
-rw-r--r--tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigation.java1
-rw-r--r--tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboard.html140
13 files changed, 368 insertions, 131 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java b/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java
index d57f56d9ef..b724e8fe9e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/EmbeddedConnector.java
@@ -27,6 +27,7 @@ import com.vaadin.terminal.gwt.client.VTooltip;
public class EmbeddedConnector extends AbstractComponentConnector {
public static final String CLICK_EVENT_IDENTIFIER = "click";
+ public static final String ALTERNATE_TEXT = "alt";
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java b/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java
index 71240d9c1d..26b45d10e1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VEmbedded.java
@@ -152,6 +152,11 @@ public class VEmbedded extends HTML {
// End embed tag
html.append("></embed>");
+ if (uidl.hasAttribute(EmbeddedConnector.ALTERNATE_TEXT)) {
+ html.append(uidl
+ .getStringAttribute(EmbeddedConnector.ALTERNATE_TEXT));
+ }
+
// End object tag
html.append("</object>");
@@ -207,8 +212,14 @@ public class VEmbedded extends HTML {
// Force browser to fire unload event when component is detached
// from the view (IE doesn't do this automatically)
if (browserElement != null) {
- DOM.setElementAttribute(browserElement, "src",
- "javascript:false");
+ /*
+ * src was previously set to javascript:false, but this was not
+ * enough to overcome a bug when detaching an iframe with a pdf
+ * loaded in IE9. about:blank seems to cause the adobe reader
+ * plugin to unload properly before the iframe is removed. See
+ * #7855
+ */
+ DOM.setElementAttribute(browserElement, "src", "about:blank");
}
}
super.onDetach();
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java
index c375648bed..a68f313c20 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VMenuBar.java
@@ -760,7 +760,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
public void setSelected(boolean selected) {
- if (selected && !isSeparator) {
+ if (selected && isSelectable()) {
addStyleDependentName("selected");
// needed for IE6 to have a single style name to match for an
// element
@@ -941,6 +941,15 @@ public class VMenuBar extends SimpleFocusablePanel implements
return menubar;
}
+ /**
+ * Checks if the item can be selected.
+ *
+ * @return true if it is possible to select this item, false otherwise
+ */
+ public boolean isSelectable() {
+ return !isSeparator() && isEnabled();
+ }
+
}
/**
@@ -1163,11 +1172,11 @@ public class VMenuBar extends SimpleFocusablePanel implements
if (getSelected() == null) {
// If nothing is selected then select the last item
setSelected(items.get(items.size() - 1));
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
} else if (visibleChildMenu == null && getParentMenu() == null) {
- // If this is the root menu then move to the right
+ // If this is the root menu then move to the left
int idx = items.indexOf(getSelected());
if (idx > 0) {
setSelected(items.get(idx - 1));
@@ -1175,7 +1184,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
setSelected(items.get(items.size() - 1));
}
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
} else if (visibleChildMenu != null) {
@@ -1183,8 +1192,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
visibleChildMenu.handleNavigation(keycode, ctrl, shift);
} else if (getParentMenu().getParentMenu() == null) {
-
- // Get the root menu
+ // Inside a sub menu, whose parent is a root menu item
VMenuBar root = getParentMenu();
root.getSelected().getSubMenu().setSelected(null);
@@ -1201,12 +1209,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
root.setSelected(selected);
- root.showChildMenu(selected);
- VMenuBar submenu = selected.getSubMenu();
-
- // Select the first item in the newly open submenu
- submenu.setSelected(submenu.getItems().get(0));
-
+ openMenuAndFocusFirstIfPossible(selected);
} else {
getParentMenu().getSelected().getSubMenu().setSelected(null);
getParentMenu().hideChildren();
@@ -1219,7 +1222,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
if (getSelected() == null) {
// If nothing is selected then select the first item
setSelected(items.get(0));
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
} else if (visibleChildMenu == null && getParentMenu() == null) {
@@ -1232,7 +1235,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
setSelected(items.get(0));
}
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
} else if (visibleChildMenu == null
@@ -1264,12 +1267,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
}
root.setSelected(selected);
- root.showChildMenu(selected);
- VMenuBar submenu = selected.getSubMenu();
-
- // Select the first item in the newly open submenu
- submenu.setSelected(submenu.getItems().get(0));
-
+ openMenuAndFocusFirstIfPossible(selected);
} else if (visibleChildMenu != null) {
// Redirect all navigation to the submenu
visibleChildMenu.handleNavigation(keycode, ctrl, shift);
@@ -1282,7 +1280,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
if (getSelected() == null) {
// If nothing is selected then select the last item
setSelected(items.get(items.size() - 1));
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
} else if (visibleChildMenu != null) {
@@ -1297,7 +1295,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
setSelected(items.get(items.size() - 1));
}
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
}
@@ -1308,16 +1306,11 @@ public class VMenuBar extends SimpleFocusablePanel implements
if (getSelected() == null) {
// If nothing is selected then select the first item
- setSelected(items.get(0));
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
- handleNavigation(keycode, ctrl, shift);
- }
+ selectFirstItem();
} else if (visibleChildMenu == null && getParentMenu() == null) {
// If this is the root menu the show the child menu with arrow
- // down
- showChildMenu(getSelected());
- menuVisible = true;
- visibleChildMenu.handleNavigation(keycode, ctrl, shift);
+ // down, if there is a child menu
+ openMenuAndFocusFirstIfPossible(getSelected());
} else if (visibleChildMenu != null) {
// Redirect all navigation to the submenu
visibleChildMenu.handleNavigation(keycode, ctrl, shift);
@@ -1330,7 +1323,7 @@ public class VMenuBar extends SimpleFocusablePanel implements
setSelected(items.get(0));
}
- if (getSelected().isSeparator() || !getSelected().isEnabled()) {
+ if (!getSelected().isSelectable()) {
handleNavigation(keycode, ctrl, shift);
}
}
@@ -1342,17 +1335,18 @@ public class VMenuBar extends SimpleFocusablePanel implements
menuVisible = false;
} else if (keycode == getNavigationSelectKey()) {
- if (visibleChildMenu != null) {
+ if (getSelected() == null) {
+ // If nothing is selected then select the first item
+ selectFirstItem();
+ } else if (visibleChildMenu != null) {
// Redirect all navigation to the submenu
visibleChildMenu.handleNavigation(keycode, ctrl, shift);
menuVisible = false;
} else if (visibleChildMenu == null
&& getSelected().getSubMenu() != null) {
- // If the item has a submenu then show it and move the selection
- // there
- showChildMenu(getSelected());
- menuVisible = true;
- visibleChildMenu.handleNavigation(keycode, ctrl, shift);
+ // If the item has a sub menu then show it and move the
+ // selection there
+ openMenuAndFocusFirstIfPossible(getSelected());
} else {
Command command = getSelected().getCommand();
if (command != null) {
@@ -1367,6 +1361,34 @@ public class VMenuBar extends SimpleFocusablePanel implements
return false;
}
+ private void selectFirstItem() {
+ for (int i = 0; i < items.size(); i++) {
+ CustomMenuItem item = items.get(i);
+ if (!item.isSelectable()) {
+ continue;
+ }
+
+ setSelected(item);
+ break;
+ }
+ }
+
+ private void openMenuAndFocusFirstIfPossible(CustomMenuItem menuItem) {
+ VMenuBar subMenu = menuItem.getSubMenu();
+ if (subMenu == null) {
+ // No child menu? Nothing to do
+ return;
+ }
+
+ VMenuBar parentMenu = menuItem.getParentMenu();
+ parentMenu.showChildMenu(menuItem);
+
+ menuVisible = true;
+ // Select the first item in the newly open submenu
+ subMenu.setSelected(subMenu.getItems().get(0));
+
+ }
+
/*
* (non-Javadoc)
*
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
index c96f955870..004e8dc078 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDragAndDropManager.java
@@ -168,6 +168,8 @@ public class VDragAndDropManager {
// ApplicationConnection.getConsole().log(
// "DropHandler now"
// + currentDropHandler.getPaintable());
+ currentDrag
+ .setElementOver((com.google.gwt.user.client.Element) targetElement);
target.dragEnter(currentDrag);
} else if (target == null && currentDropHandler != null) {
// ApplicationConnection.getConsole().log("Invalid state!?");
@@ -198,6 +200,8 @@ public class VDragAndDropManager {
case Event.ONMOUSEMOVE:
case Event.ONTOUCHMOVE:
if (currentDropHandler != null) {
+ currentDrag
+ .setElementOver((com.google.gwt.user.client.Element) targetElement);
currentDropHandler.dragOver(currentDrag);
}
nativeEvent.preventDefault();
diff --git a/src/com/vaadin/ui/Button.java b/src/com/vaadin/ui/Button.java
index 2e23d4ae74..dbebd9200c 100644
--- a/src/com/vaadin/ui/Button.java
+++ b/src/com/vaadin/ui/Button.java
@@ -311,6 +311,17 @@ public class Button extends AbstractComponent implements
}
/**
+ * Simulates a button click, notifying all server-side listeners.
+ *
+ * No action is taken is the button is disabled.
+ */
+ public void click() {
+ if (isEnabled() && !isReadOnly()) {
+ fireClick();
+ }
+ }
+
+ /**
* Fires a click event to all listeners without any event details.
*
* In subclasses, override {@link #fireClick(MouseEventDetails)} instead of
@@ -445,9 +456,7 @@ public class Button extends AbstractComponent implements
@Override
public void handleAction(Object sender, Object target) {
- if (button.isEnabled() && !button.isReadOnly()) {
- button.fireClick();
- }
+ button.click();
}
}
diff --git a/src/com/vaadin/ui/Embedded.java b/src/com/vaadin/ui/Embedded.java
index bc4c2a3ff4..906f1ca1ed 100644
--- a/src/com/vaadin/ui/Embedded.java
+++ b/src/com/vaadin/ui/Embedded.java
@@ -78,6 +78,8 @@ public class Embedded extends AbstractComponent {
private String archive = null;
+ private String altText;
+
/**
* Creates a new empty Embedded object.
*/
@@ -146,6 +148,9 @@ public class Embedded extends AbstractComponent {
if (archive != null && !"".equals(archive)) {
target.addAttribute("archive", archive);
}
+ if (altText != null && !"".equals(altText)) {
+ target.addAttribute(EmbeddedConnector.ALTERNATE_TEXT, altText);
+ }
// Params
for (final Iterator<String> i = getParameterNames(); i.hasNext();) {
@@ -158,6 +163,34 @@ public class Embedded extends AbstractComponent {
}
/**
+ * Sets this component's "alt-text", that is, an alternate text that can be
+ * presented instead of this component's normal content, for accessibility
+ * purposes. Does not work when {@link #setType(int)} has been called with
+ * {@link #TYPE_BROWSER}.
+ *
+ * @param altText
+ * A short, human-readable description of this component's
+ * content.
+ * @since 6.8
+ */
+ public void setAlternateText(String altText) {
+ if (altText != this.altText
+ || (altText != null && !altText.equals(this.altText))) {
+ this.altText = altText;
+ requestRepaint();
+ }
+ }
+
+ /**
+ * Gets this component's "alt-text".
+ *
+ * @see #setAlternateText(String)
+ */
+ public String getAlternateText() {
+ return altText;
+ }
+
+ /**
* Sets an object parameter. Parameters are optional information, and they
* are passed to the instantiated object. Parameters are are stored as name
* value pairs. This overrides the previous value assigned to this
diff --git a/tests/server-side/com/vaadin/tests/server/component/button/ButtonClick.java b/tests/server-side/com/vaadin/tests/server/component/button/ButtonClick.java
new file mode 100644
index 0000000000..464d131996
--- /dev/null
+++ b/tests/server-side/com/vaadin/tests/server/component/button/ButtonClick.java
@@ -0,0 +1,47 @@
+package com.vaadin.tests.server.component.button;
+
+import static org.junit.Assert.assertEquals;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+import org.junit.Test;
+
+/**
+ * Tests the public click() method.
+ */
+public class ButtonClick {
+ private boolean clicked = false;
+
+ @Test
+ public void testClick() {
+ getButton().click();
+ assertEquals(clicked, true);
+ }
+
+ @Test
+ public void testClickDisabled() {
+ Button b = getButton();
+ b.setEnabled(false);
+ b.click();
+ assertEquals(clicked, false);
+ }
+
+ @Test
+ public void testClickReadOnly() {
+ Button b = getButton();
+ b.setReadOnly(true);
+ b.click();
+ assertEquals(clicked, false);
+ }
+
+ private Button getButton() {
+ Button b = new Button();
+ b.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent ev) {
+ clicked = true;
+ }
+ });
+ return b;
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.html b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.html
new file mode 100644
index 0000000000..066c55fe55
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.html
@@ -0,0 +1,47 @@
+<?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:8068" />
+<title>EmbeddedAltText</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">EmbeddedAltText</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.embedded.EmbeddedAltText?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedAltText::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VEmbedded[0]/domChild[0]@alt</td>
+ <td>Alt text of the image</td>
+</tr>
+<tr>
+ <td>assertHtmlSource</td>
+ <td>*Alt text of the object*</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedAltText::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertAttribute</td>
+ <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedAltText::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VEmbedded[0]/domChild[0]@alt</td>
+ <td>New alt text of the image!</td>
+</tr>
+<tr>
+ <td>assertHtmlSource</td>
+ <td>*New alt text of the object!*</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.java b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.java
new file mode 100644
index 0000000000..f8874810fc
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedAltText.java
@@ -0,0 +1,48 @@
+package com.vaadin.tests.components.embedded;
+
+import com.vaadin.terminal.ExternalResource;
+import com.vaadin.terminal.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Embedded;
+
+public class EmbeddedAltText extends TestBase {
+ @Override
+ protected String getDescription() {
+ return "It should be possible to set an alternative text on an image or object.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2853;
+ }
+
+ @Override
+ protected void setup() {
+ final Embedded e = new Embedded("Caption", new ThemeResource(
+ "../runo/icons/64/ok.png"));
+ e.setAlternateText("Alt text of the image");
+ addComponent(e);
+ final Embedded player = new Embedded();
+ player.setAlternateText("Alt text of the object");
+ player.setType(Embedded.TYPE_OBJECT);
+ player.setWidth("400px");
+ player.setHeight("300px");
+ player.setMimeType("application/x-shockwave-flash");
+ String url = "http://www.youtube.com/v/qQ9N742QB4g&autoplay=1";
+ player.setSource(new ExternalResource(url));
+ player.setParameter("movie", "someRandomValue");
+ player.setParameter("allowFullScreen", "true");
+ addComponent(player);
+
+ Button changeAltTexts = new Button("Change alt texts",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ e.setAlternateText("New alt text of the image!");
+ player.setAlternateText("New alt text of the object!");
+ }
+ });
+ addComponent(changeAltTexts);
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.html b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.html
new file mode 100644
index 0000000000..758a004445
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.html
@@ -0,0 +1,42 @@
+<?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="" />
+<title>EmbeddedClickListenerRelativeCoordinates</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">EmbeddedClickListenerRelativeCoordinates</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.embedded.EmbeddedPdf?restartApplication</td>
+ <td></td>
+</tr>
+<!-- Pause to let the PDF controls fade away -->
+<tr>
+ <td>pause</td>
+ <td></td>
+ <td>4000</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>with-pdf</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsembeddedEmbeddedPdf::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>without-pdf</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.java b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.java
index e551e153db..d507cebebc 100644
--- a/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.java
+++ b/tests/testbench/com/vaadin/tests/components/embedded/EmbeddedPdf.java
@@ -2,6 +2,8 @@ package com.vaadin.tests.components.embedded;
import com.vaadin.terminal.ClassResource;
import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Window;
@@ -19,13 +21,19 @@ public class EmbeddedPdf extends TestBase {
@Override
public void setup() {
- Embedded player = new Embedded();
+ final Embedded player = new Embedded();
player.setType(Embedded.TYPE_BROWSER);
player.setWidth("400px");
player.setHeight("300px");
player.setSource(new ClassResource(getClass(), "test.pdf", this));
addComponent(player);
+ addComponent(new Button("Remove pdf", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ removeComponent(player);
+ }
+ }));
+
player.getRoot().addWindow(new Window("Testwindow"));
}
diff --git a/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigation.java b/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigation.java
index 7e801a9faf..ede0c0c5a5 100644
--- a/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigation.java
+++ b/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigation.java
@@ -34,7 +34,6 @@ public class MenuBarNavigation extends TestBase implements Command {
addComponent(mb);
log = new Log(5);
- log.setNumberLogRows(false);
addComponent(log);
}
diff --git a/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboard.html b/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboard.html
index 9791c95f80..6a7dccb6ed 100644
--- a/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboard.html
+++ b/tests/testbench/com/vaadin/tests/components/menubar/MenuBarNavigationKeyboard.html
@@ -17,84 +17,44 @@
<td></td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]#menu0</td>
<td>3,10</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
<td>down</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
<td>down</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
<td>down</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
<td>down</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
<td>right</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
<td>enter</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>MenuItem File/Export../As PDF... selected</td>
+ <td>1. MenuItem File/Export../As PDF... selected</td>
</tr>
<tr>
<td>mouseClick</td>
@@ -102,9 +62,9 @@
<td>0,7</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
+ <td>right</td>
</tr>
<tr>
<td>pressSpecialKey</td>
@@ -112,44 +72,49 @@
<td>right</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
+ <td>right</td>
</tr>
<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
- <td>right</td>
+ <td>enter</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>2. MenuItem Help selected</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]#menu1</td>
+ <td>4,7</td>
</tr>
<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
- <td>right</td>
+ <td>left</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
+ <td>down</td>
</tr>
<tr>
<td>pressSpecialKey</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
- <td>enter</td>
+ <td>down</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
+ <td>enter</td>
</tr>
<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>MenuItem Help selected</td>
+ <td>3. MenuItem Edit/Cut selected</td>
</tr>
<tr>
<td>mouseClick</td>
@@ -157,56 +122,57 @@
<td>4,7</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
-</tr>
-<tr>
<td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
- <td>left</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]</td>
+ <td>enter</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
+ <td>3. MenuItem Edit/Cut selected</td>
</tr>
<tr>
<td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
- <td>down</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]</td>
+ <td>enter</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
+ <td>4. MenuItem Edit/Copy selected</td>
</tr>
+<!--Enter while menubar has focus but no selection should focus "File"-->
<tr>
<td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
- <td>down</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]</td>
+ <td>enter</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
+ <td>4. MenuItem Edit/Copy selected</td>
</tr>
+<!--Enter again should open File and focus Open-->
<tr>
<td>pressSpecialKey</td>
- <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VMenuBar[0]</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]</td>
<td>enter</td>
</tr>
<tr>
- <td>waitForVaadin</td>
- <td></td>
- <td></td>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
+ <td>4. MenuItem Edit/Copy selected</td>
+</tr>
+<tr>
+ <td>pressSpecialKey</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VMenuBar[0]</td>
+ <td>enter</td>
</tr>
<tr>
<td>assertText</td>
- <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
- <td>MenuItem Edit/Cut selected</td>
+ <td>vaadin=runcomvaadintestscomponentsmenubarMenuBarNavigation::/VVerticalLayout[0]/VVerticalLayout[0]/VVerticalLayout[0]/VLabel[0]</td>
+ <td>5. MenuItem File/Open selected</td>
</tr>
-
</tbody></table>
</body>
</html>