on xenial help sign in
Remove tests for dead files
commit854d060c99f7f53ed3653d4be8bc6fd820b4db3c authorAlbert Astals <albert.astals@canonical.com> dateMon 24 Feb 2014, 16:03 (13 years ago) parent5afde4e
9 files changed−1009
tests/qmltests/CMakeLists.txt−7 tests/qmltests/Components/tst_RatingStars.qml−62 tests/qmltests/Components/tst_Tile.qml−71 tests/qmltests/Dash/Apps/tst_AppPreview.qml−276 tests/qmltests/Dash/Movie/tst_MoviePreview.qml−86 tests/qmltests/Dash/Music/tst_MusicPreview.qml−174 tests/qmltests/Dash/tst_DashPreview.qml−202 tests/qmltests/Dash/tst_GenericPreview.qml−125 tests/qmltests/Dash/tst_GenericScopeView.qml−6
tests/qmltests/CMakeLists.txt−7
@@ -13,7 +13,6 @@ set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
1313set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
1414add_qml_test(Components AnimationControllerWithSignals)
1515add_qml_test(Components Carousel)
16−add_qml_test(Components RatingStars)
1716add_qml_test(Panel IndicatorItem)
1817add_qml_test(utils/Unity/Test UnityTest)
1918
@@ -37,12 +36,9 @@ add_qml_test(Components Showable)
3736add_qml_test(Components Stage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
3837 ${CMAKE_BINARY_DIR}/tests/mocks
3938 ${CMAKE_BINARY_DIR}/plugins)
40−add_qml_test(Components Tile)
4139add_qml_test(Components PageHeaderLabel)
4240add_qml_test(Dash Dash IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
4341add_qml_test(Dash DashContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
44−add_qml_test(Dash DashPreview)
45−add_qml_test(Dash GenericPreview)
4642add_qml_test(Dash Card)
4743add_qml_test(Dash CardHeader)
4844add_qml_test(Dash CardTool)
@@ -52,9 +48,6 @@ add_qml_test(Dash FilterGrids IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMA
5248add_qml_test(Dash/Apps RunningApplicationsGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
5349 ${CMAKE_BINARY_DIR}/tests/mocks
5450 ${CMAKE_BINARY_DIR}/plugins)
55−add_qml_test(Dash/Apps AppPreview IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
56−add_qml_test(Dash/Movie MoviePreview IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
57−add_qml_test(Dash/Music MusicPreview IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
5851add_qml_test(Dash/Previews Preview IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
5952add_qml_test(Dash/Previews PreviewActions IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
6053add_qml_test(Dash/Previews PreviewAudioPlayback IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
tests/qmltests/Components/tst_RatingStars.qmldeleted−62
@@ -1,62 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../qml/Components"
20−
21−TestCase {
22− name: "RatingStars"
23−
24− property int maximumRating: 5
25− property int rating: 3
26− property alias effectiveRating: ratingStars.effectiveRating
27−
28− RatingStars {
29− id: ratingStars
30− maximumRating: parent.maximumRating
31− rating: parent.rating
32− }
33−
34− function test_rating_init() {
35− compare(effectiveRating, rating, "EffectiveRating not initialized properly")
36− }
37−
38− function test_rating_negative() {
39− rating = -3
40− compare(effectiveRating, 0, "EffectiveRating not calculated correctly")
41− }
42−
43− function test_rating_set_ok() {
44− rating = 2
45− compare(effectiveRating, rating, "EffectiveRating not calculated correctly")
46− }
47−
48− function test_rating_set_too_big() {
49− rating = 200
50− compare(effectiveRating, maximumRating, "EffectiveRating not calculated correctly")
51− }
52−
53− function test_rating_set_min() {
54− rating = 0
55− compare(effectiveRating, 0, "EffectiveRating not calculated correctly")
56− }
57−
58− function test_rating_set_max() {
59− rating = maximumRating
60− compare(effectiveRating, maximumRating, "EffectiveRating not calculated correctly")
61− }
62−}
tests/qmltests/Components/tst_Tile.qmldeleted−71
@@ -1,71 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import ".."
20−import "../../../qml/Components"
21−import Ubuntu.Components 0.1
22−import Unity.Test 0.1 as UT
23−
24−Item {
25− id: root
26− width: units.gu(20)
27− height: units.gu(24)
28−
29− property bool helper: false
30−
31− Tile {
32− id: tile
33− anchors.fill: parent
34− source: "../../../graphics/clock@18.png"
35− text: "Testing rocks, debugging sucks!"
36− imageWidth: width
37− imageHeight: width
38− }
39−
40− UT.UnityTestCase {
41− name: "Tile"
42− when: windowShown
43−
44− function test_click_highlight() {
45− var border = findChild(tile, "borderPressed")
46− compare(border.opacity, 0)
47− mousePress(root, 1, 1)
48− tryCompare(border, "opacity", 1)
49− mouseRelease(root, 1, 1)
50− tryCompare(border, "opacity", 0)
51− }
52−
53− function test_resize_image_data() {
54− return [
55− {tag: "small", w: 1, h: 1, click: true},
56− {tag: "large", w: units.gu(20), h: units.gu(20), click: true},
57− // If image is too large to fit, text will be moved outside of the scene and click should fail
58− {tag: "too large", w: units.gu(40), h: units.gu(40), click: false}
59− ]
60− }
61−
62− function test_resize_image(data) {
63− tile.imageWidth = data.w
64− tile.imageHeight = data.h
65− var label = findChild(tile, "label")
66− mousePress(label, 1, 1)
67− tryCompare(tile, "pressed", data.click)
68− mouseRelease(label, 1, 1)
69− }
70− }
71−}
tests/qmltests/Dash/Apps/tst_AppPreview.qmldeleted−276
@@ -1,276 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import Ubuntu.Components 0.1
20−import "../../../../qml/Dash/Apps"
21−import Unity.Test 0.1 as UT
22−
23−Item {
24− id: root
25− width: units.gu(60)
26− height: units.gu(80)
27−
28− // Fake shell
29− QtObject { id: shell; property int height: appPreview.height }
30−
31− property var calls: []
32−
33− SignalSpy {
34− id: sendPreviewSpy
35− target: appPreview
36− signalName: "sendUserReview"
37− }
38−
39− property string commentary: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus a mi vitae augue rhoncus lobortis ut rutrum metus. Curabitur tortor leo, tristique sed mollis quis, condimentum venenatis nibh.";
40− QtObject { id: screenshots; property var value: ["fake_image1.png", "fake_image2.png", "fake_image3.png"] }
41− QtObject { id: rating; property real value: 0.8 }
42− QtObject { id: rated; property int value: 120 }
43− QtObject { id: reviews; property int value: 8 }
44− QtObject { id: progress; property string value: "source" }
45− QtObject { id: publisher; property string value: "Ubuntu Developer" }
46− QtObject { id: comments; property var value: [
47− ["Unity User", 4, "08/20/2013", root.commentary],
48− ["Unity User", 8, "01/15/2013", root.commentary],
49− ["Unity User", 10, "10/02/2013", root.commentary],
50− ]
51− }
52− QtObject { id: showProgress; property bool value: true }
53− QtObject { id: progressSource; property string value: "service" }
54−
55− QtObject {
56− id: data
57− property string title: "Unity App"
58− property string appIcon: "fake_image.png"
59− property string description: "This is an Application description"
60− property real rating: rating.value
61− property int numRatings: reviews.value
62− property var execute: root.fake_call
63− property var infoMap: {
64− "more-screenshots": screenshots,
65− "rated": rated,
66− "comments": comments,
67− "publisher": publisher
68− }
69− property var actions: [
70− { "id": 123, "displayName": "action1" },
71− { "id": 456, "displayName": "action2" },
72− { "id": 789, "displayName": "action3" },
73− ]
74− }
75−
76− QtObject {
77− id: dataProgress
78− property string title: "Unity App"
79− property string appIcon: "fake_image.png"
80− property string description: "This is an Application description"
81− property real rating: rating.value
82− property int numRatings: reviews.value
83− property var execute: root.fake_call
84− property var infoMap: {
85− "show_progressbar": showProgress,
86− "more-screenshots": screenshots,
87− "rated": rated,
88− "comments": comments,
89− "publisher": publisher,
90− "progressbar_source": progressSource
91− }
92− property var actions: [
93− { "id": 123, "displayName": "action1" },
94− { "id": 456, "displayName": "action2" },
95− { "id": 789, "displayName": "action3" },
96− ]
97− }
98−
99− function fake_call(id, data){
100− root.calls[root.calls.length] = [id, data];
101− }
102−
103− // The component under test
104− AppPreview {
105− id: appPreview
106− anchors.fill: parent
107−
108− previewData: data
109− }
110−
111− UT.UnityTestCase {
112− name: "AppPreview"
113− when: windowShown
114−
115− function init() {
116− waitForRendering(appPreview)
117− }
118−
119− function cleanup() {
120− root.calls = new Array();
121− sendPreviewSpy.clear();
122− // TODO: This doesn't work right now as Reviews are disabled
123− //var reviewField = findChild(appPreview, "reviewField");
124− //reviewField.focus = false;
125− //reviewField.text = "";
126− //data.rating = rating.value;
127− dataProgress.infoMap["progressbar_source"].value = "service";
128− //var appReviews = findChild(appPreview, "appReviews");
129− //appReviews.visible = false;
130− //appPreview.keyboardSize = 0;
131− }
132−
133− function test_actions() {
134− var buttons = findChild(appPreview, "buttonList");
135− compare(buttons.count, 3, "Not the proper amount of actions detected.");
136−
137− for(var i = 0; i < buttons.count; i++) {
138− var button = findChild(appPreview, "button" + i);
139− mouseClick(button, 1, 1);
140− appPreview.showProcessingAction = false;
141− }
142−
143− var actions = data.actions;
144− for(var j = 0; j < actions.length; j++) {
145− compare(root.calls[j][0], actions[j].id, "Id of action not found.");
146− }
147− }
148−
149− function test_check_app_info() {
150− var appInfo = findChild(appPreview, "previewHeader");
151− var titleLabel = findChild(appInfo, "titleLabel");
152− var subtitleLabel = findChild(appInfo, "subtitleLabel");
153− compare(titleLabel.text, data.title, "App Title doesn't match.");
154− compare(subtitleLabel.text, publisher.value, "Publisher name doesn't match.");
155− }
156−
157− function test_rated() {
158− var rated = findChild(appPreview, "ratedLabel");
159− compare(rated.text, "(120)", "Rates not equal");
160− }
161−
162− function test_reviews() {
163− var rated = findChild(appPreview, "reviewsLabel");
164− compare(rated.text, "8 reviews", "Reviews don't match");
165− }
166−
167− // TODO: Disabled as reviewing and commenting is currently disabled
168− function test_send_review() {
169− skip();
170− var appReviews = findChild(appPreview, "appReviews");
171− appReviews.sendReview("review");
172− sendPreviewSpy.wait();
173− }
174−
175− function test_review_focus() {
176− skip();
177− var columnReviewRating = findChild(appPreview, "columnReviewRating");
178− columnReviewRating.visible = true;
179− var appReviews = findChild(appPreview, "appReviews");
180− appReviews.visible = true;
181− var sendButton = findChild(appReviews, "sendButton");
182− var reviewField = findChild(appReviews, "reviewField");
183−
184− compare(reviewField.focus, false, "ReviewField shouldn't have focus");
185− compare(appReviews.state, "", "State should be empty");
186−
187− mouseClick(reviewField, reviewField.width/2, reviewField.height/2);
188− compare(reviewField.focus, true, "Review Field should have focus");
189− compare(appReviews.state, "editing", "State should be 'editing'");
190− }
191−
192− function test_comments() {
193− skip();
194− var commentsArea = findChild(appPreview, "commentsArea");
195− compare(commentsArea.count, 3);
196− for(var i = 0; i < 3; i++) {
197− var username = commentsArea.itemAt(i).children[0].children[0].text
198− var rate = commentsArea.itemAt(i).children[0].children[1].children[0].rating
199− var date = commentsArea.itemAt(i).children[0].children[1].children[1].text
200− var comment = commentsArea.itemAt(i).children[1].text
201− compare(username, comments.value[i][0], "Username don't match");
202− compare(rate, comments.value[i][1], "Rating don't match");
203− compare(date, comments.value[i][2], "Date don't match");
204− compare(comment, comments.value[i][3], "Comment don't match");
205− }
206− }
207−
208− function test_negative_rating() {
209− skip();
210− data.rating = -1.0;
211− var rated = findChild(appPreview, "reviewsLabel");
212− verify(rated.visible == false);
213− var commentsArea = findChild(appPreview, "commentsArea");
214− verify(commentsArea.visible == false);
215− var appReviews = findChild(appPreview, "appReviews");
216− verify(appReviews.visible == false);
217− var buttons = findChild(appPreview, "gridButtons");
218− verify(buttons.visible == true);
219− }
220−
221− function test_automatic_scroll_on_keyboard_shown() {
222− skip();
223− waitForRendering(appPreview);
224− var appReviews = findChild(appPreview, "appReviews");
225− appReviews.visible = true;
226−
227− var leftFlickable = findChild(appPreview, "leftFlickable");
228− leftFlickable.contentY = leftFlickable.contentHeight;
229− var reviewField = findChild(appReviews, "reviewField");
230− appPreview.keyboardSize = 400;
231− appReviews.editing(reviewField);
232− var newFlickPos = leftFlickable.contentY;
233− var keyboardY = shell.height - appPreview.keyboardSize;
234− verify(newFlickPos < keyboardY);
235− }
236−
237− function test_progress_show() {
238− appPreview.previewData = dataProgress;
239− var progress = findChild(appPreview, "progressBar");
240− verify(progress.visible == true);
241− }
242−
243− function test_progress_download_finish() {
244− appPreview.previewData = dataProgress;
245− var progress = findChild(appPreview, "progressBar");
246− dataProgress.infoMap["progressbar_source"].value = "finish";
247−
248− var actions = dataProgress.actions;
249− compare(root.calls[0][0], actions[0].id, "Id of action not found.");
250− compare(root.calls[0][1], {}, "Data of action not found.");
251− }
252−
253− function test_progress_download_error() {
254− appPreview.previewData = dataProgress;
255− var progress = findChild(appPreview, "progressBar");
256− dataProgress.infoMap["progressbar_source"].value = "error";
257−
258− var actions = dataProgress.actions;
259− compare(root.calls[0][0], actions[1].id, "Id of action not found.");
260− compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
261− }
262−
263− function test_placeholderScreenshot() {
264− var placeholderScreenshot = findChild(appPreview, "placeholderScreenshot");
265− compare(placeholderScreenshot.visible, false);
266−
267− data.infoMap["more-screenshots"] = [];
268− appPreview.previewData = data;
269− tryCompare(placeholderScreenshot, "visible", true);
270−
271− data.infoMap["more-screenshots"] = screenshots;
272− appPreview.previewData = data;
273− tryCompare(placeholderScreenshot, "visible", false);
274− }
275− }
276−}
tests/qmltests/Dash/Movie/tst_MoviePreview.qmldeleted−86
@@ -1,86 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../../qml/Dash/Movie"
20−import Unity.Test 0.1 as UT
21−
22−Item {
23− id: root
24− width: units.gu(60)
25− height: units.gu(80)
26−
27− property var calls: []
28− property int counter: 0
29−
30− function get_actions_data() {
31− return [
32− { id: 123, displayName: "Play", iconHint: "image://theme/search" },
33− { id: 456, displayName: "Buy", iconHint: "image://theme/search" },
34− { id: 789, displayName: "Delete", iconHint: "image//theme/search" }
35− ]
36− }
37−
38− function fake_callback(id, data){
39− root.calls[root.calls.length] = id;
40− }
41−
42− // The component under test
43− MoviePreview {
44− id: moviePreview
45− anchors.fill: parent
46−
47− previewData: QtObject {
48− property string rendererName: "preview-movie"
49− property string title: "Unity Movie"
50− property string subtitle: "Subtitle"
51− property string description: "This is the description"
52− property string image: "../../tests/qmltests/Components/tst_LazyImage/square.png"
53− property var actions: get_actions_data()
54− property string year: "2013"
55− property real rating: 0.3
56− property int numRatings: 1
57− property var execute: fake_callback
58− }
59− }
60−
61− UT.UnityTestCase {
62− name: "MoviePreviewTest"
63− when: windowShown
64−
65− function init() {
66− waitForRendering(moviePreview);
67− root.calls = new Array();
68− }
69−
70− function test_actions() {
71− var buttons = findChild(moviePreview, "buttonList");
72− compare(buttons.count, 3);
73−
74− for(var i = 0; i < buttons.count; i++) {
75− var button = findChild(moviePreview, "button" + i);
76− mouseClick(button, 1, 1);
77− moviePreview.showProcessingAction = false;
78− }
79−
80− var actions = get_actions_data();
81− for(var i = 0; i < actions.length; i++) {
82− compare(root.calls[i], actions[i].id);
83− }
84− }
85− }
86−}
tests/qmltests/Dash/Music/tst_MusicPreview.qmldeleted−174
@@ -1,174 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../../qml/Dash/Music"
20−import Unity.Test 0.1 as UT
21−import QtMultimedia 5.0
22−
23−Rectangle {
24− id: root
25− width: units.gu(60)
26− height: units.gu(80)
27− color: "lightgrey"
28−
29− MusicPreview {
30− id: musicPreview
31− anchors.fill: parent
32− isCurrent: true
33−
34− previewData: QtObject {
35− property string rendererName: "preview-music"
36− property string title: "Music Preview"
37− property string subtitle: "Subtitle"
38− property string description: "This is the description"
39− property string image: "../../tests/qmltests/Components/tst_LazyImage/square.png"
40− property var actions: [
41− { id: 123, displayName: "Play"},
42− { id: 456, displayName: "Show in folder"}
43− ]
44− property var tracks: tracksModel2
45− }
46− }
47−
48− ListModel {
49− id: tracksModel0
50− }
51− ListModel {
52− id: tracksModel1
53− ListElement { uri: "../../tests/qmltests/Dash/Music/data/testsound1.ogg"; trackNo: 1; title: "Some track name"; length: "0:30"}
54− }
55− ListModel {
56− id: tracksModel2
57− ListElement { uri: "../../tests/qmltests/Dash/Music/data/testsound1.ogg"; trackNo: 1; title: "Some track name"; length: "0:30"}
58− ListElement { uri: "../../tests/qmltests/Dash/Music/data/testsound1.ogg"; trackNo: 2; title: "Some track name"; length: "0:30"}
59− ListElement { uri: "../../tests/qmltests/Dash/Music/data/testsound2.ogg"; trackNo: 3; title: "Some other track name"; length: "1:23"}
60− ListElement { uri: "../../tests/qmltests/Dash/Music/data/testsound3.ogg"; trackNo: 4; title: "And another one"; length: "123:45"}
61− }
62−
63− UT.UnityTestCase {
64− name: "MusicPreviewTest"
65− when: windowShown
66−
67− function init() {
68− waitForRendering(musicPreview);
69− }
70−
71− function test_tracks_data() {
72− return [
73− {tag: "0 tracks", tracksModel: tracksModel0, dividerVisible: false},
74− {tag: "1 track", tracksModel: tracksModel1, dividerVisible: true},
75− {tag: "4 track", tracksModel: tracksModel2, dividerVisible: true}
76− ];
77− }
78−
79− function test_tracks(data) {
80− musicPreview.previewData.tracks = data.tracksModel;
81− waitForRendering(musicPreview);
82−
83− var trackRepeater = findChild(musicPreview, "trackRepeater");
84− compare(trackRepeater.count, data.tracksModel.count)
85−
86− var topDivider = findChild(musicPreview, "topDivider");
87− compare(topDivider.visible, data.dividerVisible);
88−
89− for (var i = 0; i < data.tracksModel.count; ++i) {
90− var trackItem = findChild(musicPreview, "trackItem" + i);
91− var titleLabel = findChild(trackItem, "trackTitleLabel");
92− compare(titleLabel.text, data.tracksModel.get(i).title)
93− var timeLabel = findChild(trackItem, "timeLabel");
94− compare(timeLabel.text, data.tracksModel.get(i).length)
95− }
96− }
97−
98− function checkPlayerUri(index) {
99− var modelFilename = musicPreview.previewData.tracks.get(index).uri.replace(/^.*[\\\/]/, '');
100− var playerFilename = findInvisibleChild(musicPreview, "audioPlayer").source.toString().replace(/^.*[\\\/]/, '');
101−
102− compare(modelFilename, playerFilename, "Player source is not set correctly.");
103− }
104−
105− function test_playback() {
106− musicPreview.previewData.tracks = tracksModel2;
107− waitForRendering(musicPreview);
108−
109− var track0Item = findChild(musicPreview, "trackItem0");
110− var track1Item = findChild(musicPreview, "trackItem1");
111− var track2Item = findChild(musicPreview, "trackItem2");
112−
113− var track0ProgressBar = findChild(track0Item, "progressBarFill");
114− var track1ProgressBar = findChild(track1Item, "progressBarFill");
115− var track2ProgressBar = findChild(track2Item, "progressBarFill");
116−
117− var track0PlayButton = findChild(track0Item, "playButton");
118− var track1PlayButton = findChild(track1Item, "playButton");
119− var track2PlayButton = findChild(track2Item, "playButton");
120−
121− var audioPlayer = findInvisibleChild(musicPreview, "audioPlayer");
122−
123− // All progress bars must be hidden in the beginning
124− compare(track0ProgressBar.visible, false);
125− compare(track1ProgressBar.visible, false);
126− compare(track2ProgressBar.visible, false);
127−
128− // Playing track 0 should make progress bar 0 visible
129− mouseClick(track0PlayButton, track0PlayButton.width / 2, track0PlayButton.height / 2);
130−
131− tryCompare(audioPlayer, "playbackState", Audio.PlayingState);
132− checkPlayerUri(0);
133−
134− tryCompare(track0ProgressBar, "visible", true);
135− tryCompare(track1ProgressBar, "visible", false);
136− tryCompare(track2ProgressBar, "visible", false);
137−
138− // Clicking the button again should pause it. The progress bar should stay visible
139− mouseClick(track0PlayButton, track0PlayButton.width / 2, track0PlayButton.height / 2);
140− tryCompare(audioPlayer, "playbackState", Audio.PausedState);
141− checkPlayerUri(0);
142− tryCompare(track0ProgressBar, "visible", true);
143−
144− // Continue playback
145− mouseClick(track0PlayButton, track0PlayButton.width / 2, track0PlayButton.height / 2);
146− tryCompare(audioPlayer, "playbackState", Audio.PlayingState);
147− checkPlayerUri(0);
148−
149− // Playing track 1 should make progress bar 1 visible and hide progress bar 0 again
150− mouseClick(track1PlayButton, track1PlayButton.width / 2, track1PlayButton.height / 2);
151−
152− tryCompare(audioPlayer, "playbackState", Audio.PlayingState);
153− checkPlayerUri(1);
154−
155− tryCompare(track0ProgressBar, "visible", false);
156− tryCompare(track1ProgressBar, "visible", true);
157− tryCompare(track2ProgressBar, "visible", false);
158−
159− // Playing track 2 should make progress bar 1 visible and hide progress bar 0 again
160− mouseClick(track2PlayButton, track2PlayButton.width / 2, track2PlayButton.height / 2);
161−
162− tryCompare(audioPlayer, "playbackState", Audio.PlayingState);
163− checkPlayerUri(2);
164−
165− tryCompare(track0ProgressBar, "visible", false);
166− tryCompare(track1ProgressBar, "visible", false);
167− tryCompare(track2ProgressBar, "visible", true);
168−
169− // Switching away from this preview should make all players shut up!
170− musicPreview.isCurrent = false
171− tryCompare(audioPlayer, "playbackState", Audio.StoppedState);
172− }
173− }
174−}
tests/qmltests/Dash/tst_DashPreview.qmldeleted−202
@@ -1,202 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import ".."
20−import "../../../qml/Dash"
21−import Ubuntu.Components 0.1
22−import Unity.Test 0.1 as UT
23−
24−Item {
25− id: root
26− width: units.gu(120)
27− height: units.gu(80)
28−
29− property bool helper: false
30−
31− DashPreview {
32− id: preview
33− anchors.fill: parent
34−
35− previewImages: Rectangle {
36− width: parent.width
37− height: units.gu(20)
38− color: "honeydew"
39− Label {
40− anchors.centerIn: parent
41− text: "Preview images"
42− }
43− }
44−
45− header: Rectangle {
46− width: parent.width
47− height: units.gu(10)
48− color: "papayawhip"
49− Label {
50− anchors.centerIn: parent
51− text: "Caption label"
52− }
53− }
54−
55− actions: Row {
56− width: parent.width
57− height: units.gu(5)
58− Rectangle {
59− width: parent.width / 3
60− height: parent.height
61− color: "blue"
62− Label {
63− anchors.centerIn: parent
64− text: "Button 1"
65− }
66− MouseArea {
67− id: buttonMouseArea
68− objectName: "buttonMouseArea"
69− anchors.fill: parent
70− onClicked: root.helper = true
71− }
72− }
73− Rectangle {
74− width: parent.width / 3
75− height: parent.height
76− color: "green"
77− Label {
78− anchors.centerIn: parent
79− text: "Button 2"
80− }
81−
82− }
83− }
84−
85− description: Column {
86− id: testContent
87− objectName: "testContent"
88− width: parent.width
89− height: units.gu(50)
90− Rectangle {
91− width: parent.width
92− height: parent.height / 3
93− color: "green"
94− Label {
95− anchors.centerIn: parent
96− text: "Description part 1"
97− }
98− }
99− Rectangle {
100− width: parent.width
101− height: parent.height / 3
102− color: "red"
103− Label {
104− anchors.centerIn: parent
105− text: "Description part 2"
106− }
107− }
108− Rectangle {
109− width: parent.width
110− height: parent.height / 3
111− color: "blue"
112− Label {
113− anchors.centerIn: parent
114− text: "Description part 3"
115− }
116− }
117− }
118−
119− ratings: Rectangle {
120− objectName: "ratings"
121− width: parent.width
122− height: units.gu(20)
123− Label {
124− anchors.centerIn: parent
125− text: "Ratings"
126− }
127− }
128− }
129−
130− SignalSpy {
131− id: closeSpy
132− target: preview
133− signalName: "close"
134− }
135−
136− SignalSpy {
137− id: previewClickedSpy
138− target: preview
139− signalName: "previewImageClicked"
140− }
141−
142− UT.UnityTestCase {
143− name: "DashPreview"
144− when: windowShown
145−
146− function test_columns_data() {
147− return [
148− {tag: "1 columns", width: units.gu(5), height: units.gu(10), columns: 1},
149− {tag: "3 columns", width: units.gu(50), height: units.gu(10), columns: 3}
150− ]
151− }
152−
153− function test_columns(data) {
154− var leftCol = findChild(preview, "leftColumn")
155− var centerCol = findChild(preview, "centerColumn")
156− var rightCol = findChild(preview, "rightColumn")
157−
158− root.width = data.width
159− root.height = data.height
160−
161− // there are 3 columns in DashPreview. On portrait form factors
162− // only the left one is used and the center and right ones should be empty.
163− // To find out if the content is in the correct column, we get a
164− // reference to the column objects and search only the subtree
165− // to see if the content is in the correct column.
166− // 1 colum -> all content should be in leftColumn
167− // 3 colums -> content should be in centerColumn, rating in rightColumn
168−
169− switch(data.columns) {
170− case 1:
171− var testContent = findChild(leftCol, "testContent")
172− compare(testContent.objectName, "testContent")
173− testContent = findChild(leftCol, "ratings")
174− compare(testContent.objectName, "ratings")
175− break
176− case 3:
177− var testContent = findChild(centerCol, "testContent")
178− compare(testContent.objectName, "testContent")
179− testContent = findChild(rightCol, "ratings")
180− compare(testContent.objectName, "ratings")
181− break
182− }
183−
184− // reset to initial values to not disturb other tests
185− root.width = units.gu(120)
186− root.height = units.gu(80)
187− }
188−
189− // This test just checks if Components assigned to the
190− // "buttons" property are actually put somewhere on the
191− // screen. the mouseClick would fail if they are not used/painted
192− function test_ensure_buttons_visible() {
193− waitForRendering(preview)
194−
195− var button = findChild(preview, "buttonMouseArea")
196− mouseClick(button, 1, 1)
197− tryCompare(root, "helper", true)
198− // reset to false in case any other test wants to use it
199− root.helper = false
200− }
201− }
202−}
tests/qmltests/Dash/tst_GenericPreview.qmldeleted−125
@@ -1,125 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
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
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import "../../../qml/Dash/Generic"
20−import Unity.Test 0.1 as UT
21−
22−Item {
23− id: root
24− width: units.gu(60)
25− height: units.gu(80)
26−
27− property var calls: []
28− property int counter: 0
29−
30− function get_actions_data() {
31− return [
32− { id: 123, displayName: "Button 1", iconHint: "image://theme/search" },
33− { id: 456, displayName: "Button 2", iconHint: "image://theme/search" },
34− { id: 789, displayName: "Button 3", iconHint: "image://theme/search" }
35− ]
36− }
37−
38− function fake_callback(id, data){
39− root.calls[root.calls.length] = id;
40− }
41−
42− // The component under test
43− GenericPreview {
44− id: genericPreview
45− anchors.fill: parent
46−
47− previewData: QtObject {
48− id: dataObject
49− property string rendererName: "preview-generic"
50− property string title: "Unity Generic Preview"
51− property string subtitle: "Subtitle"
52− property string description: "This is the description"
53− property string image: "../../tests/qmltests/Components/tst_LazyImage/square.png"
54− property var actions: get_actions_data()
55− property string year: "2013"
56− property var execute: fake_callback
57− property var infoHints: [{displayName: "info 1", value: "value 1"},
58− {displayName: "info 2", value: "value 2"}
59− ]
60− }
61− }
62−
63− UT.UnityTestCase {
64− name: "GenericPreviewTest"
65− when: windowShown
66−
67− function init() {
68− waitForRendering(genericPreview)
69− root.calls = new Array();
70− }
71−
72− function test_actions() {
73− var buttons = findChild(genericPreview, "buttonList");
74− compare(buttons.count, 3);
75−
76− for(var i = 0; i < buttons.count; i++) {
77− var button = findChild(genericPreview, "button" + i);
78− mouseClick(button, 1, 1);
79− genericPreview.showProcessingAction = false;
80− }
81−
82− var actions = get_actions_data();
83− for(var i = 0; i < actions.length; i++) {
84− compare(root.calls[i], actions[i].id);
85− }
86− }
87−
88− function test_title() {
89− var titleLabel = findChild(genericPreview, "titleLabel");
90− compare(titleLabel.text, dataObject.title)
91− }
92−
93− function test_subtitle() {
94− var subtitleLabel = findChild(genericPreview, "subtitleLabel");
95− compare(subtitleLabel.text, dataObject.subtitle)
96− }
97−
98− function test_image() {
99− var image = findChild(genericPreview, "genericPreviewImage");
100− tryCompare(image, "height", genericPreview.width - units.gu(6))
101− }
102−
103− function test_infoHints() {
104− var infoHintColumn = findChild(genericPreview, "infoHintColumn")
105− var infoHintRepeater = findChild(genericPreview, "infoHintRepeater")
106− compare(infoHintRepeater.count, dataObject.infoHints.length)
107−
108− for (var i = 0; i < dataObject.infoHints.length; ++i) {
109− var infoItem = findChild(infoHintColumn, "infoHintItem" + i)
110− var displayName = findChild(infoItem, "displayNameLabel")
111− compare(displayName.text, dataObject.infoHints[i].displayName)
112− var value = findChild(infoItem, "valueLabel")
113− compare(value.text, dataObject.infoHints[i].value)
114− }
115− }
116−
117− function test_showProcessing() {
118− var button = findChild(genericPreview, "button1");
119− mouseClick(button, 1, 1);
120− tryCompare(genericPreview, "showProcessingAction", true);
121− genericPreview.previewDataChanged();
122− tryCompare(genericPreview, "showProcessingAction", false);
123− }
124− }
125−}
tests/qmltests/Dash/tst_GenericScopeView.qml−6
@@ -41,12 +41,6 @@ Item {
4141 signal mainStageFocusedApplicationChanged()
4242 }
4343
44− DashContentOpenEffect {
45− id: openEffect
46− previewListView: previewListView
47− sourceItem: genericScopeView
48− }
49−
5044 PageHeaderLabel {
5145 id: pageHeader
5246 searchHistory: SearchHistoryModel {}