on xenial help sign in
Try new test
commitf495691f0d9e4bfc3ef086cef1f6e528af79d7f1 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateThu 28 Jul 2016, 11:55 (10 years ago) parent5a9f1ee
1 file changed+18−5
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+18−5
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+18−5
@@ -115,6 +115,11 @@ Rectangle {
115115 }
116116 }
117117
118+ SignalSpy {
119+ id: spy
120+ signalName: "playing"
121+ }
122+
118123 UT.UnityTestCase {
119124 name: "PreviewInlineVideoTest"
120125 when: windowShown
@@ -129,16 +134,24 @@ Rectangle {
129134 }
130135
131136 function test_singleton() {
132− mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
133− wait(3000);
134137 var services = findChild(videoPlaybackLoader, "services");
135− verify(services.position > 2000);
138+ spy.clear();
139+ spy.target = services.mediaPlayer;
140+ mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
141+ tryCompare(spy, "count", 1);
142+ tryCompareFunction(function() { return services.position > 3000; }, true);
143+
144+ // Simulate widget being destroyed and recreated
136145 videoPlaybackLoader.active = false;
137146 videoPlaybackLoader.active = true;
147+
138148 services = findChild(videoPlaybackLoader, "services");
149+ spy.clear();
150+ spy.target = services.mediaPlayer;
151+ compare(services.position, 0);
139152 mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
140− wait(500);
141− verify(services.position > 2000);
153+ tryCompare(spy, "count", 1);
154+ tryCompareFunction(function() { return services.position > 3000; }, true, 1000);
142155 }
143156 }
144157}