@@ -1,5 +1,5 @@
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2015 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -18,44 +18,89 @@ import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import "../../../../qml/Dash/Previews"
19import "../../../../qml/Dash/Previews"
20import Unity.Test 0.1 as UT
20import Unity.Test 0.1 as UT
21+import Ubuntu.Components 1.2
22+import QtMultimedia 5.0
22Rectangle {
24Rectangle {
24− width: units.gu(40)
25+ width: units.gu(70)
25 height: units.gu(80)
26 height: units.gu(80)
26 color: "lightgrey"
27 color: "lightgrey"
28 property var widgetData0: {
29 property var widgetData0: {
29− "source": "",
30+ "source": "file:///test-video1",
30− "screenshot": ""
31+ "screenshot": Qt.resolvedUrl("../artwork/avatar.png")
33 property var widgetData1: {
34 property var widgetData1: {
34− "source": "",
35+ "source": "file:///test-video2",
35− "screenshot": "../../../tests/qmltests/Components/tst_LazyImage/square.png"
36+ "screenshot": "file:///test-video2-screenshot"
38− property var widgetData2: {
39+ MediaDataSource {
39− "source": "file:///path/to/local/file",
40+ source: "file:///test-video1"
40− "screenshot": ""
41+ duration: 6000000
43+ "title" : "TEST MPEG",
44+ "resolution" : { "width": 1920, "height": 1080 }
55+ bottom: parent.bottom
62+ anchors.margins: units.gu(2)
43− PreviewVideoPlayback {
64+ PreviewVideoPlayback {
44− id: videoPlayback
65+ id: videoPlayback
45− width: parent.width
66+ width: parent.width
46− widgetData: widgetData1
67+ widgetData: widgetData0
80+ bottom: parent.bottom
86+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
88+ UT.MouseTouchEmulationCheckbox {}
49 UT.UnityTestCase {
93 UT.UnityTestCase {
50− name: "PreviewVideoPlaybackTest"
94+ name: "PreviewInlineVideoTest"
51 when: windowShown
95 when: windowShown
53 function test_loadScreenshot() {
97 function test_loadScreenshot() {
54 var screenshot = findChild(videoPlayback, "screenshot");
98 var screenshot = findChild(videoPlayback, "screenshot");
99+ verify(screenshot !== null);
56− videoPlayback.widgetData = widgetData2;
101+ videoPlayback.widgetData = widgetData1;
57 var screenshotSource = screenshot.source
102 var screenshotSource = screenshot.source
58− verify(screenshotSource.toString().indexOf("image://thumbnailer/") === 0)
103+ compare(screenshotSource.toString(), "file:///test-video2-screenshot");