diff options
author | Olli Tietäväinen <ollit@vaadin.com> | 2017-03-22 10:41:37 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-03-22 10:41:37 +0200 |
commit | d01a6ef0271f5238ffcd0f986a30fc0d68102f72 (patch) | |
tree | 14f9eca1e87fa62775cb1943826e22375cad4845 /uitest | |
parent | baa0baf8d6f06dc234c610a0ed558cd66c6c67b4 (diff) | |
download | vaadin-framework-d01a6ef0271f5238ffcd0f986a30fc0d68102f72.tar.gz vaadin-framework-d01a6ef0271f5238ffcd0f986a30fc0d68102f72.zip |
Fix Flash expanding with percentage sizing (#8898)
Allows Flash embed to expand if percentage dimensions given
Fixes #4035
Diffstat (limited to 'uitest')
-rwxr-xr-x | uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java | 48 | ||||
-rwxr-xr-x | uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java | 45 |
2 files changed, 93 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java b/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java new file mode 100755 index 0000000000..4dd9568682 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2017 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.flash; + +import com.vaadin.server.ClassResource; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Flash; + +public class FlashExpansion extends TestBase { + + Flash player = new Flash(); + + @Override + protected void setup() { + + player.setWidth("400px"); + player.setHeight("300px"); + player.setSource(new ClassResource("simple.swf")); + addComponent(player); + Button button = new Button("click", e -> player.setSizeFull()); + addComponent(button); + } + + @Override + protected String getDescription() { + return "Flash object should expand according to percentile sizes"; + } + + @Override + protected Integer getTicketNumber() { + return 4035; + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java b/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java new file mode 100755 index 0000000000..923ad2b779 --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.components.flash; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.FlashElement; +import com.vaadin.testbench.parallel.Browser; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class FlashExpansionTest extends MultiBrowserTest { + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + return getBrowsersSupportingFlash(); + } + + private final By locator = By.tagName("embed"); + + @Test + public void testFlashIsExpanded() throws Exception { + openTestURL(); + /* Allow the flash plugin to load */ + waitForElementPresent(locator); + WebElement embed = $(FlashElement.class).first().findElement(locator); + String width = embed.getAttribute("width"); + Assert.assertTrue("Width is not 400.0px initially", + "400.0px".equals(width)); + $(ButtonElement.class).first().click(); + String widthAfterExpansion = embed.getAttribute("width"); + Assert.assertFalse("Width is still 400.0px after expansion", + "400.0px".equals(widthAfterExpansion)); + } + + private List<DesiredCapabilities> getBrowsersSupportingFlash() { + // No Flash support in Chrome, FF, PhantomJS + return getBrowserCapabilities(Browser.IE8, Browser.IE9, Browser.IE10, + Browser.IE11); + } +} |