diff options
author | Miki <miki@vaadin.com> | 2015-02-06 14:49:03 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-03-26 13:53:58 +0000 |
commit | b96861c1809d12f2d1339fd64f825a3c513977d2 (patch) | |
tree | 3adc4a233dee7b53347148640500acada4ea268d /server/tests | |
parent | ebcf64b94911597a123a599cd758e36b4abfe8bf (diff) | |
download | vaadin-framework-b96861c1809d12f2d1339fd64f825a3c513977d2.tar.gz vaadin-framework-b96861c1809d12f2d1339fd64f825a3c513977d2.zip |
Fix declarative support for AbstractMedia (#16330 #16331 #16332)
Also fixes HTTPS resource handling (#17267)
Contains tests for both Audio and Video.
Change-Id: Id4a7325f0d29f6857ff2236757b28b9eb911e39a
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java | 63 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java | 59 |
2 files changed, 122 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java new file mode 100644 index 0000000000..4390499c4e --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/audio/AudioDeclarativeTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2000-2014 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.server.component.audio; + +import java.io.File; + +import org.junit.Test; + +import com.vaadin.server.ExternalResource; +import com.vaadin.server.FileResource; +import com.vaadin.tests.design.DeclarativeTestBase; +import com.vaadin.ui.Audio; + +/** + * Tests specs of declarative support for abstract media and its + * implementations. + * + * @since 7.4 + * @author Vaadin Ltd + */ +public class AudioDeclarativeTest extends DeclarativeTestBase<Audio> { + + @Test + public void testEmptyAudio() { + String design = "<v-audio />"; + Audio audio = new Audio(); + testRead(design, audio); + testWrite(design, audio); + } + + @Test + public void testAudioMultipleSources() { + String design = "<v-audio muted='true' show-controls='false'>" + + "some <b>text</b>" // + + "<source href='http://foo.pl' />" + + "<source href='https://bar.pl' />" // + + "<source href='ohai' />" // + + "</v-audio>"; + Audio audio = new Audio(); + audio.setAltText("some <b>text</b>"); + audio.setAutoplay(false); + audio.setMuted(true); + audio.setShowControls(false); + audio.setSources(new ExternalResource("http://foo.pl"), + new ExternalResource("https://bar.pl"), new FileResource( + new File("ohai"))); + testRead(design, audio); + testWrite(design, audio); + } +} diff --git a/server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java b/server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java new file mode 100644 index 0000000000..fc0b3d9512 --- /dev/null +++ b/server/tests/src/com/vaadin/tests/server/component/audio/VideoDeclarativeTest.java @@ -0,0 +1,59 @@ +/* + * Copyright 2000-2014 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.server.component.audio; + +import java.io.File; + +import org.junit.Test; + +import com.vaadin.server.ExternalResource; +import com.vaadin.server.FileResource; +import com.vaadin.tests.design.DeclarativeTestBase; +import com.vaadin.ui.Video; + +public class VideoDeclarativeTest extends DeclarativeTestBase<Video> { + + @Test + public void testEmptyVideo() { + String design = "<v-video />"; + Video audio = new Video(); + testRead(design, audio); + testWrite(design, audio); + } + + @Test + public void testVideoMultipleSources() { + String design = "<v-video muted='true' show-controls='false'>" + + "some <b>text</b>" // + + "<source href='http://foo.pl' />" + + "<source href='https://bar.pl' />" // + + "<source href='ohai' />" // + + "<poster href='http://foo.pl/poster' />" // + + "</v-video>"; + Video video = new Video(); + video.setAltText("some <b>text</b>"); + video.setAutoplay(false); + video.setMuted(true); + video.setShowControls(false); + video.setSources(new ExternalResource("http://foo.pl"), + new ExternalResource("https://bar.pl"), new FileResource( + new File("ohai"))); + video.setPoster(new ExternalResource("http://foo.pl/poster")); + testRead(design, video); + testWrite(design, video); + } + +} |