forked from vaadin/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Flash expanding with percentage sizing (vaadin#8552)
Allows Flash embed to expand if percentage dimensions given Fixes vaadin#4035
- Loading branch information
1 parent
6e662c4
commit 686def8
Showing
4 changed files
with
209 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
uitest/src/test/java/com/vaadin/tests/components/flash/FlashExpansionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |