@@ -1,5 +1,5 @@
11/*
2− * Copyright 2014 Canonical Ltd.
2+ * Copyright 2015 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -18,44 +18,89 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import "../../../../qml/Dash/Previews"
2020import Unity.Test 0.1 as UT
21+import Ubuntu.Components 1.2
22+import QtMultimedia 5.0
2123
2224Rectangle {
23− id: root
24− width: units.gu(40)
25+ width: units.gu(70)
2526 height: units.gu(80)
2627 color: "lightgrey"
2728
2829 property var widgetData0: {
29− "source": "",
30− "screenshot": ""
30+ "source": "file:///test-video1",
31+ "screenshot": Qt.resolvedUrl("../artwork/avatar.png")
3132 }
3233
3334 property var widgetData1: {
34− "source": "",
35− "screenshot": "../../../tests/qmltests/Components/tst_LazyImage/square.png"
35+ "source": "file:///test-video2",
36+ "screenshot": "file:///test-video2-screenshot"
3637 }
3738
38− property var widgetData2: {
39− "source": "file:///path/to/local/file",
40− "screenshot": ""
39+ MediaDataSource {
40+ source: "file:///test-video1"
41+ duration: 6000000
42+ metaData: {
43+ "title" : "TEST MPEG",
44+ "resolution" : { "width": 1920, "height": 1080 }
45+ }
4146 }
4247
43− PreviewVideoPlayback {
44− id: videoPlayback
45− width: parent.width
46− widgetData: widgetData1
48+ Item {
49+ anchors.fill: parent
50+
51+ Item {
52+ id: inner
53+ anchors {
54+ top: parent.top
55+ bottom: parent.bottom
56+ left: parent.left
57+ right: controls.left
58+ }
59+
60+ Item {
61+ anchors.fill: parent
62+ anchors.margins: units.gu(2)
63+
64+ PreviewVideoPlayback {
65+ id: videoPlayback
66+ width: parent.width
67+ widgetData: widgetData0
68+
69+ rootItem: inner
70+ }
71+ }
72+
73+ }
74+
75+ Rectangle {
76+ id: controls
77+ color: "darkgrey"
78+ anchors {
79+ top: parent.top
80+ bottom: parent.bottom
81+ right: parent.right
82+ }
83+ width: units.gu(30)
84+
85+ Column {
86+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
87+
88+ UT.MouseTouchEmulationCheckbox {}
89+ }
90+ }
4791 }
4892
4993 UT.UnityTestCase {
50− name: "PreviewVideoPlaybackTest"
94+ name: "PreviewInlineVideoTest"
5195 when: windowShown
5296
5397 function test_loadScreenshot() {
5498 var screenshot = findChild(videoPlayback, "screenshot");
99+ verify(screenshot !== null);
55100
56− videoPlayback.widgetData = widgetData2;
101+ videoPlayback.widgetData = widgetData1;
57102 var screenshotSource = screenshot.source
58− verify(screenshotSource.toString().indexOf("image://thumbnailer/") === 0)
103+ compare(screenshotSource.toString(), "file:///test-video2-screenshot");
59104 }
60105 }
61106}