@@ -42,6 +42,7 @@ Item {
42 QtObject { id: rated; property int value: 120 }
42 QtObject { id: rated; property int value: 120 }
43 QtObject { id: reviews; property int value: 8 }
43 QtObject { id: reviews; property int value: 8 }
44 QtObject { id: progress; property string value: "source" }
44 QtObject { id: progress; property string value: "source" }
45+ QtObject { id: publisher; property string value: "Ubuntu Developer" }
45 QtObject { id: comments; property var value: [
46 QtObject { id: comments; property var value: [
46 ["Unity User", 4, "08/20/2013", root.commentary],
47 ["Unity User", 4, "08/20/2013", root.commentary],
47 ["Unity User", 8, "01/15/2013", root.commentary],
48 ["Unity User", 8, "01/15/2013", root.commentary],
@@ -62,7 +63,8 @@ Item {
62 property var infoMap: {
63 property var infoMap: {
63 "more-screenshots": screenshots,
64 "more-screenshots": screenshots,
64 "rated": rated,
65 "rated": rated,
65− "comments": comments
66+ "comments": comments,
67+ "publisher": publisher
67 property var actions: [
69 property var actions: [
68 { "id": 123, "displayName": "action1" },
70 { "id": 123, "displayName": "action1" },
@@ -84,6 +86,7 @@ Item {
84 "more-screenshots": screenshots,
86 "more-screenshots": screenshots,
85 "rated": rated,
87 "rated": rated,
86 "comments": comments,
88 "comments": comments,
89+ "publisher": publisher,
87 "progressbar_source": progressSource
90 "progressbar_source": progressSource
89 property var actions: [
92 property var actions: [
@@ -109,26 +112,31 @@ Item {
109 name: "AppPreview"
112 name: "AppPreview"
110 when: windowShown
113 when: windowShown
116+ waitForRendering(appPreview)
112 function cleanup() {
119 function cleanup() {
113 root.calls = new Array();
120 root.calls = new Array();
114 sendPreviewSpy.clear();
121 sendPreviewSpy.clear();
122+ // TODO: This doesn't work right now as Reviews are disabled
115− var reviewField = findChild(appPreview, "reviewField");
123+ //var reviewField = findChild(appPreview, "reviewField");
116− reviewField.focus = false;
124+ //reviewField.focus = false;
117− reviewField.text = "";
125+ //reviewField.text = "";
118− data.rating = rating.value;
126+ //data.rating = rating.value;
119 dataProgress.infoMap["progressbar_source"].value = "service";
127 dataProgress.infoMap["progressbar_source"].value = "service";
120− var appReviews = findChild(appPreview, "appReviews");
128+ //var appReviews = findChild(appPreview, "appReviews");
121− appReviews.visible = false;
129+ //appReviews.visible = false;
122− appPreview.keyboardSize = 0;
130+ //appPreview.keyboardSize = 0;
125 function test_actions() {
133 function test_actions() {
126− var buttons = findChild(appPreview, "gridButtons");
134+ var buttons = findChild(appPreview, "buttonList");
127 compare(buttons.count, 3, "Not the proper amount of actions detected.");
135 compare(buttons.count, 3, "Not the proper amount of actions detected.");
129 for(var i = 0; i < buttons.count; i++) {
137 for(var i = 0; i < buttons.count; i++) {
130− buttons.currentIndex = i;
138+ var button = findChild(appPreview, "button" + i);
131− buttons.currentItem.clicked();
139+ mouseClick(button, 1, 1);
134 var actions = data.actions;
142 var actions = data.actions;
@@ -137,6 +145,14 @@ Item {
148+ function test_check_app_info() {
149+ var appInfo = findChild(appPreview, "previewHeader");
150+ var titleLabel = findChild(appInfo, "titleLabel");
151+ var subtitleLabel = findChild(appInfo, "subtitleLabel");
152+ compare(titleLabel.text, data.title, "App Title doesn't match.");
153+ compare(subtitleLabel.text, publisher.value, "Publisher name doesn't match.");
140 function test_rated() {
156 function test_rated() {
141 var rated = findChild(appPreview, "ratedLabel");
157 var rated = findChild(appPreview, "ratedLabel");
142 compare(rated.text, "(120)", "Rates not equal");
158 compare(rated.text, "(120)", "Rates not equal");
@@ -147,13 +163,18 @@ Item {
147 compare(rated.text, "8 reviews", "Reviews don't match");
163 compare(rated.text, "8 reviews", "Reviews don't match");
166+ // TODO: Disabled as reviewing and commenting is currently disabled
150 function test_send_review() {
167 function test_send_review() {
151 var appReviews = findChild(appPreview, "appReviews");
169 var appReviews = findChild(appPreview, "appReviews");
152 appReviews.sendReview("review");
170 appReviews.sendReview("review");
153 sendPreviewSpy.wait();
171 sendPreviewSpy.wait();
156 function test_review_focus() {
174 function test_review_focus() {
176+ var columnReviewRating = findChild(appPreview, "columnReviewRating");
177+ columnReviewRating.visible = true;
157 var appReviews = findChild(appPreview, "appReviews");
178 var appReviews = findChild(appPreview, "appReviews");
158 appReviews.visible = true;
179 appReviews.visible = true;
159 var sendButton = findChild(appReviews, "sendButton");
180 var sendButton = findChild(appReviews, "sendButton");
@@ -168,6 +189,7 @@ Item {
170 function test_comments() {
191 function test_comments() {
171 var commentsArea = findChild(appPreview, "commentsArea");
193 var commentsArea = findChild(appPreview, "commentsArea");
172 compare(commentsArea.count, 3);
194 compare(commentsArea.count, 3);
173 for(var i = 0; i < 3; i++) {
195 for(var i = 0; i < 3; i++) {
@@ -183,6 +205,7 @@ Item {
185 function test_negative_rating() {
207 function test_negative_rating() {
186 data.rating = -1.0;
209 data.rating = -1.0;
187 var rated = findChild(appPreview, "reviewsLabel");
210 var rated = findChild(appPreview, "reviewsLabel");
188 verify(rated.visible == false);
211 verify(rated.visible == false);
@@ -194,6 +217,22 @@ Item {
194 verify(buttons.visible == true);
217 verify(buttons.visible == true);
220+ function test_automatic_scroll_on_keyboard_shown() {
222+ waitForRendering(appPreview);
223+ var appReviews = findChild(appPreview, "appReviews");
224+ appReviews.visible = true;
226+ var leftFlickable = findChild(appPreview, "leftFlickable");
227+ leftFlickable.contentY = leftFlickable.contentHeight;
228+ var reviewField = findChild(appReviews, "reviewField");
229+ appPreview.keyboardSize = 400;
230+ appReviews.editing(reviewField);
231+ var newFlickPos = leftFlickable.contentY;
232+ var keyboardY = shell.height - appPreview.keyboardSize;
233+ verify(newFlickPos < keyboardY);
197 function test_progress_show() {
236 function test_progress_show() {
198 appPreview.previewData = dataProgress;
237 appPreview.previewData = dataProgress;
199 var progress = findChild(appPreview, "progressBar");
238 var progress = findChild(appPreview, "progressBar");
@@ -220,20 +259,17 @@ Item {
220 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
259 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
223− function test_automatic_scroll_on_keyboard_shown() {
262+ function test_placeholderScreenshot() {
224− waitForRendering(appPreview);
225− var appReviews = findChild(appPreview, "appReviews");
263+ var placeholderScreenshot = findChild(appPreview, "placeholderScreenshot");
226− appReviews.visible = true;
264+ compare(placeholderScreenshot.visible, false);
228− var leftFlickable = findChild(appPreview, "leftFlickable");
266+ data.infoMap["more-screenshots"] = [];
229− leftFlickable.contentY = leftFlickable.contentHeight;
267+ appPreview.previewData = data;
230− var reviewField = findChild(appReviews, "reviewField");
268+ tryCompare(placeholderScreenshot, "visible", true);
231− appPreview.keyboardSize = 400;
232− appReviews.editing(reviewField);
233− var newFlickPos = leftFlickable.contentY;
234− var keyboardY = shell.height - appPreview.keyboardSize;
235− verify(newFlickPos < keyboardY);
270+ data.infoMap["more-screenshots"] = screenshots;
271+ appPreview.previewData = data;
272+ tryCompare(placeholderScreenshot, "visible", false);