diff options
author | Olli Tietäväinen <ollit@vaadin.com> | 2017-03-21 10:28:22 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-03-21 10:28:22 +0200 |
commit | a3899faa81169801e0cf27bc1e595bcd14d1606a (patch) | |
tree | 5bb90714c46016e353ffbd1248e3757a77c454c0 /uitest | |
parent | 93a42883a47908b573e27947a0f55ef77ed27aee (diff) | |
download | vaadin-framework-a3899faa81169801e0cf27bc1e595bcd14d1606a.tar.gz vaadin-framework-a3899faa81169801e0cf27bc1e595bcd14d1606a.zip |
Fix Flash expanding with percentage sizing (#8552)
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 | 57 | ||||
-rwxr-xr-x | uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java | 45 |
2 files changed, 102 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..e504c1bb7c --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java @@ -0,0 +1,57 @@ +/* + * 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.Button.ClickEvent; +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"); + button.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + 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); + } +} |