on xenial help sign in
add test
5a9f1eeAndrea Cimitan
qml/Dash/Previews/PreviewInlineVideo.qml+1
@@ -65,6 +65,7 @@ PreviewWidget {
65
65
66 MediaServices {
66 MediaServices {
67 id: services
67 id: services
68+ objectName: "services"
68 width: parent.width
69 width: parent.width
69
70
70 actions: sharingAction
71 actions: sharingAction
tests/mocks/QtMultimedia/mediaplayer.cpp+1
@@ -161,6 +161,7 @@ void MediaPlayer::play()
161 if (m_playbackState != PlayingState) {
161 if (m_playbackState != PlayingState) {
162 m_playbackState = PlayingState;
162 m_playbackState = PlayingState;
163 Q_EMIT playbackStateChanged(m_playbackState);
163 Q_EMIT playbackStateChanged(m_playbackState);
164+ Q_EMIT playing();
164
165
165 m_timer.start();
166 m_timer.start();
166 }
167 }
tests/mocks/QtMultimedia/mediaplayer.h+1
@@ -131,6 +131,7 @@ public Q_SLOTS:
131
131
132Q_SIGNALS:
132Q_SIGNALS:
133 void playlistChanged();
133 void playlistChanged();
134+ void playing();
134 void sourceChanged(const QUrl &source);
135 void sourceChanged(const QUrl &source);
135 void playbackStateChanged(PlaybackState playbackState);
136 void playbackStateChanged(PlaybackState playbackState);
136 void positionChanged(int position);
137 void positionChanged(int position);
tests/qmltests/Dash/Previews/tst_PreviewInlineVideo.qml+30
@@ -76,6 +76,23 @@ Rectangle {
76
76
77 rootItem: inner
77 rootItem: inner
78 }
78 }
79+
80+ Loader {
81+ id: videoPlaybackLoader
82+ anchors {
83+ left: parent.left
84+ right: parent.right
85+ top: videoPlayback.bottom
86+ topMargin: units.gu(2)
87+ }
88+
89+ sourceComponent: PreviewInlineVideo {
90+ width: parent.width
91+ widgetData: widgetData0
92+
93+ rootItem: inner
94+ }
95+ }
79 }
96 }
80
97
81 }
98 }
@@ -110,5 +127,18 @@ Rectangle {
110 var screenshotSource = screenshot.source
127 var screenshotSource = screenshot.source
111 compare(screenshotSource.toString(), "file:///test-video2-screenshot");
128 compare(screenshotSource.toString(), "file:///test-video2-screenshot");
112 }
129 }
130+
131+ function test_singleton() {
132+ mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
133+ wait(3000);
134+ var services = findChild(videoPlaybackLoader, "services");
135+ verify(services.position > 2000);
136+ videoPlaybackLoader.active = false;
137+ videoPlaybackLoader.active = true;
138+ services = findChild(videoPlaybackLoader, "services");
139+ mouseClick(videoPlaybackLoader, videoPlaybackLoader.width / 2, videoPlaybackLoader.height / 2);
140+ wait(500);
141+ verify(services.position > 2000);
142+ }
113 }
143 }
114}
144}