~dandrader/unity8/miral

« back to all changes in this revision

Viewing changes to tests/qmltests/Dash/Previews/tst_Preview.qml

  • Committer: Bileto Bot
  • Author(s): Albert Astals Cid
  • Date: 2016-12-07 13:44:42 UTC
  • mfrom: (2704.2.1 audio_playback_focus)
  • Revision ID: ci-train-bot@canonical.com-20161207134442-gz78utoqgs2yv2bd
Bring back fix for 1517830

Now with autotest \o/ (LP: #1517830)

Approved by: Andrea Cimitan, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        id: mockPreviewModel
38
38
    }
39
39
 
 
40
    ListModel {
 
41
        id: tracksModel
 
42
        Component.onCompleted:
 
43
        {
 
44
            tracksModel.append( { "type" : "audio1",
 
45
                                  "widgetId" : "audiopw1",
 
46
                                  "properties" : { "tracks" : [
 
47
                                                                { title: "Some track name", length: "30", source: "/not/existinga/path/testsound1" }
 
48
                                                              ]
 
49
                                                 }
 
50
                                }
 
51
                              );
 
52
            tracksModel.append(
 
53
                                { "type" : "audio",
 
54
                                  "widgetId" : "audiopw",
 
55
                                  "properties" : { "tracks" : [
 
56
                                                                { title: "Some track name", length: "30", source: "/not/existing/path/testsound1" },
 
57
                                                                { title: "Some other track name", subtitle: "Subtitle", length: "83", source: "/not/existing/path/testsound2" },
 
58
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound3" },
 
59
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound4" },
 
60
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound5" },
 
61
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound6" },
 
62
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound7" },
 
63
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound8" },
 
64
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound9" },
 
65
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound10" },
 
66
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound11" },
 
67
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound12" },
 
68
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound13" },
 
69
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound14" },
 
70
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound15" },
 
71
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound16" },
 
72
                                                                { title: "And another one", length: "7425", source: "/not/existing/path/testsound17" }
 
73
                                                              ]
 
74
                                                 }
 
75
                                } );
 
76
        }
 
77
    }
 
78
 
 
79
    QtObject {
 
80
        id: audiosModel
 
81
        property int widgetColumnCount: 1
 
82
        property var columnModel: { tracksModel }
 
83
    }
 
84
 
40
85
    Preview {
41
86
        id: preview
42
87
        anchors.fill: parent
57
102
        function init() {
58
103
            var widget = findChild(preview, "previewListRow0");
59
104
            widget.positionViewAtBeginning();
 
105
            preview.previewModel = mockPreviewModel;
60
106
        }
61
107
 
62
108
        function test_triggered() {
147
193
                skip("preview %1 or widget %2 have been destroyed, thus we can't safely continue this test".arg(preview_str).arg(widget_str))
148
194
            }
149
195
        }
 
196
 
 
197
        function test_audios() {
 
198
            preview.previewModel = audiosModel;
 
199
            waitForRendering(preview);
 
200
 
 
201
            // Scroll down
 
202
            var previewListRow0 = findChild(preview, "previewListRow0");
 
203
            flickToYEnd(previewListRow0);
 
204
 
 
205
            var previewsContentY = previewListRow0.contentY;
 
206
 
 
207
            var trackItem = findChild(preview, "trackItem16");
 
208
            mouseClick(findChild(trackItem, "playButton"));
 
209
 
 
210
            expectFail("", "Clicking on a track should not change contentY.");
 
211
            tryCompareFunction(function () { return previewsContentY != previewListRow0.contentY; }, true);
 
212
        }
150
213
    }
151
214
}