on xenial help sign in
Simplify AppPreview tests.
ce9c47bMichał Sawicz
tests/qmltests/Dash/Apps/tst_AppPreview.qml+13−29
@@ -33,32 +33,6 @@ Item {
33 signalName: "sendUserReview"
33 signalName: "sendUserReview"
34 }
34 }
35
35
36− function get_actions() {
37− var a1 = new Object();
38− a1.id = 123;
39− a1.displayName = "action1";
40− var a2 = new Object();
41− a2.id = 456;
42− a2.displayName = "action2";
43− var a3 = new Object();
44− a3.id = 789;
45− a3.displayName = "action3";
46−
47− return [a1, a2, a3];
48− }
49−
50− function get_infomap() {
51− var map = {
52− "more-screenshots": screenshots,
53− "rating": rating,
54− "rated": rated,
55− "reviews": reviews,
56− "comments": comments
57− }
58−
59− return map;
60− }
61−
62 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.";
36 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.";
63 QtObject { id: screenshots; property var value: ["fake_image1.png", "fake_image2.png", "fake_image3.png"] }
37 QtObject { id: screenshots; property var value: ["fake_image1.png", "fake_image2.png", "fake_image3.png"] }
64 QtObject { id: rating; property int value: 8 }
38 QtObject { id: rating; property int value: 8 }
@@ -78,8 +52,18 @@ Item {
78 property string appIcon: "fake_image.png"
52 property string appIcon: "fake_image.png"
79 property string description: "This is an Application description"
53 property string description: "This is an Application description"
80 property var execute: root.fake_call
54 property var execute: root.fake_call
81− property var infoMap: get_infomap()
55+ property var infoMap: {
56+ "more-screenshots": screenshots,
57+ "rating": rating,
58+ "rated": rated,
59+ "reviews": reviews,
60+ "comments": comments
61+ }
82− property var actions: get_actions()
62+ property var actions: [
63+ { "id": 123, "displayName": "action1" },
64+ { "id": 456, "displayName": "action2" },
65+ { "id": 789, "displayName": "action3" },
66+ ]
83 }
67 }
84
68
85 function fake_call(id, data){
69 function fake_call(id, data){
@@ -115,7 +99,7 @@ Item {
115 buttons.currentItem.clicked();
99 buttons.currentItem.clicked();
116 }
100 }
117
101
118− var actions = get_actions();
102+ var actions = data.actions;
119 for(var i = 0; i < actions.length; i++) {
103 for(var i = 0; i < actions.length; i++) {
120 compare(root.calls[i], actions[i].id, "Id of action not found.");
104 compare(root.calls[i], actions[i].id, "Id of action not found.");
121 }
105 }