on xenial help sign in
Try new test
f495691Andrea Cimitan
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+18−5
@@ -115,6 +115,11 @@ Rectangle {
115 }
115 }
116 }
116 }
117
117
118+ SignalSpy {
119+ id: spy
120+ signalName: "playing"
121+ }
122+
118 UT.UnityTestCase {
123 UT.UnityTestCase {
119 name: "PreviewInlineVideoTest"
124 name: "PreviewInlineVideoTest"
120 when: windowShown
125 when: windowShown
@@ -129,16 +134,24 @@ Rectangle {
129 }
134 }
130
135
131 function test_singleton() {
136 function test_singleton() {
132− mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
133− wait(3000);
134 var services = findChild(videoPlaybackLoader, "services");
137 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
136 videoPlaybackLoader.active = false;
145 videoPlaybackLoader.active = false;
137 videoPlaybackLoader.active = true;
146 videoPlaybackLoader.active = true;
147+
138 services = findChild(videoPlaybackLoader, "services");
148 services = findChild(videoPlaybackLoader, "services");
149+ spy.clear();
150+ spy.target = services.mediaPlayer;
151+ compare(services.position, 0);
139 mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
152 mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
140− wait(500);
153+ tryCompare(spy, "count", 1);
141− verify(services.position > 2000);
154+ tryCompareFunction(function() { return services.position > 3000; }, true, 1000);
142 }
155 }
143 }
156 }
144}
157}