on xenial help sign in
add publisher information to App's header. Disable rating completely (including star rating)
48f63b9Diego Sarmentero
Dash/Apps/AppPreview.qml+8−3
@@ -32,7 +32,9 @@ GenericPreview {
32 actions: root.previewData.infoMap["show_progressbar"] ? progressComponent : buttonsComponent
32 actions: root.previewData.infoMap["show_progressbar"] ? progressComponent : buttonsComponent
33 description: descriptionComponent
33 description: descriptionComponent
34 header: headerComponent
34 header: headerComponent
35+
36+ // TODO: Ratings are not yet complete... enable this once they work
35− ratings: ratingsComponent
37+ //ratings: ratingsComponent
36
38
37 Component {
39 Component {
38 id: previewImagesComponent
40 id: previewImagesComponent
@@ -64,8 +66,10 @@ GenericPreview {
64 Component {
66 Component {
65 id: headerComponent
67 id: headerComponent
66 Header {
68 Header {
69+ objectName: "previewHeader"
67 title: previewData.title
70 title: previewData.title
68 icon: previewData.appIcon
71 icon: previewData.appIcon
72+ subtitle: root.previewData.infoMap["publisher"] ? root.previewData.infoMap["publisher"].value : ""
69 rating: Math.round(root.previewData.rating * 10)
73 rating: Math.round(root.previewData.rating * 10)
70 reviews: root.previewData.numRatings
74 reviews: root.previewData.numRatings
71 rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
75 rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
@@ -157,7 +161,10 @@ GenericPreview {
157 Component {
161 Component {
158 id: ratingsComponent
162 id: ratingsComponent
159 Column {
163 Column {
164+ id: columnReviewRating
165+ objectName: "columnReviewRating"
160 visible: root.previewData.rating >= 0
166 visible: root.previewData.rating >= 0
167+
161 spacing: units.gu(1)
168 spacing: units.gu(1)
162 height: childrenRect.height
169 height: childrenRect.height
163
170
@@ -192,8 +199,6 @@ GenericPreview {
192 Reviews {
199 Reviews {
193 id: appReviews
200 id: appReviews
194 objectName: "appReviews"
201 objectName: "appReviews"
195− // TODO: This should make this visible when the feature for reviews/comments is complete.
196− visible: false; height: 0
197
202
198 anchors { left: parent.left; right: parent.right }
203 anchors { left: parent.left; right: parent.right }
199
204
Dash/Generic/GenericPreview.qml−1
@@ -29,7 +29,6 @@ DashPreview {
29 header: headerComponent
29 header: headerComponent
30 actions: actionsComponent
30 actions: actionsComponent
31 description: descriptionComponent
31 description: descriptionComponent
32− ratings: ratingsComponent
33
32
34 Component {
33 Component {
35 id: previewImagesComponent
34 id: previewImagesComponent
Dash/Previews/Header.qml+7−3
@@ -31,8 +31,8 @@ Row {
31
31
32 UbuntuShape {
32 UbuntuShape {
33 id: imageShape
33 id: imageShape
34− width: units.gu(6)
34+ width: height
35− height: units.gu(6)
35+ height: Math.max(units.gu(6), contentColumn.height)
36 visible: image.source.toString().length > 0
36 visible: image.source.toString().length > 0
37 image: Image {
37 image: Image {
38 id: image
38 id: image
@@ -43,10 +43,12 @@ Row {
43 }
43 }
44
44
45 Column {
45 Column {
46+ id: contentColumn
46 spacing: units.gu(1)
47 spacing: units.gu(1)
47
48
48 Label {
49 Label {
49 id: titleLabel
50 id: titleLabel
51+ objectName: "titleLabel"
50 fontSize: "large"
52 fontSize: "large"
51 color: "white"
53 color: "white"
52 style: Text.Raised
54 style: Text.Raised
@@ -64,15 +66,17 @@ Row {
64 style: Text.Raised
66 style: Text.Raised
65 styleColor: "black"
67 styleColor: "black"
66 opacity: .6
68 opacity: .6
69+ visible: text.length > 0
67 }
70 }
68
71
69 Row {
72 Row {
70− visible: root.rating >= 0 && subtitleLabel.text.length == 0
73+ visible: root.rating >= 0
71 spacing: units.gu(1)
74 spacing: units.gu(1)
72
75
73 RatingStars {
76 RatingStars {
74 id: ratingStars
77 id: ratingStars
75 maximumRating: 10
78 maximumRating: 10
79+ rating: -1
76 }
80 }
77
81
78 Label {
82 Label {
tests/qmltests/Dash/Apps/tst_AppPreview.qml+40−25
@@ -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
66 }
68 }
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
88 }
91 }
89 property var actions: [
92 property var actions: [
@@ -112,14 +115,15 @@ Item {
112 function cleanup() {
115 function cleanup() {
113 root.calls = new Array();
116 root.calls = new Array();
114 sendPreviewSpy.clear();
117 sendPreviewSpy.clear();
118+ // TODO: This doesn't work right now as Reviews are disabled
115− var reviewField = findChild(appPreview, "reviewField");
119+ //var reviewField = findChild(appPreview, "reviewField");
116− reviewField.focus = false;
120+ //reviewField.focus = false;
117− reviewField.text = "";
121+ //reviewField.text = "";
118− data.rating = rating.value;
122+ //data.rating = rating.value;
119 dataProgress.infoMap["progressbar_source"].value = "service";
123 dataProgress.infoMap["progressbar_source"].value = "service";
120− var appReviews = findChild(appPreview, "appReviews");
124+ //var appReviews = findChild(appPreview, "appReviews");
121− appReviews.visible = false;
125+ //appReviews.visible = false;
122− appPreview.keyboardSize = 0;
126+ //appPreview.keyboardSize = 0;
123 }
127 }
124
128
125 function test_actions() {
129 function test_actions() {
@@ -137,6 +141,14 @@ Item {
137 }
141 }
138 }
142 }
139
143
144+ function test_check_app_info() {
145+ var appInfo = findChild(appPreview, "previewHeader");
146+ var titleLabel = findChild(appInfo, "titleLabel");
147+ var subtitleLabel = findChild(appInfo, "subtitleLabel");
148+ compare(titleLabel.text, data.title, "App Title doesn't match.");
149+ compare(subtitleLabel.text, publisher.value, "Publisher name doesn't match.");
150+ }
151+
140 function test_rated() {
152 function test_rated() {
141 var rated = findChild(appPreview, "ratedLabel");
153 var rated = findChild(appPreview, "ratedLabel");
142 compare(rated.text, "(120)", "Rates not equal");
154 compare(rated.text, "(120)", "Rates not equal");
@@ -147,13 +159,16 @@ Item {
147 compare(rated.text, "8 reviews", "Reviews don't match");
159 compare(rated.text, "8 reviews", "Reviews don't match");
148 }
160 }
149
161
162+ // TODO: Disabled as reviewing and commenting is currently disabled
150− function test_send_review() {
163+/* function test_send_review() {
151 var appReviews = findChild(appPreview, "appReviews");
164 var appReviews = findChild(appPreview, "appReviews");
152 appReviews.sendReview("review");
165 appReviews.sendReview("review");
153 sendPreviewSpy.wait();
166 sendPreviewSpy.wait();
154 }
167 }
155
168
156 function test_review_focus() {
169 function test_review_focus() {
170+ var columnReviewRating = findChild(appPreview, "columnReviewRating");
171+ columnReviewRating.visible = true;
157 var appReviews = findChild(appPreview, "appReviews");
172 var appReviews = findChild(appPreview, "appReviews");
158 appReviews.visible = true;
173 appReviews.visible = true;
159 var sendButton = findChild(appReviews, "sendButton");
174 var sendButton = findChild(appReviews, "sendButton");
@@ -194,6 +209,22 @@ Item {
194 verify(buttons.visible == true);
209 verify(buttons.visible == true);
195 }
210 }
196
211
212+ function test_automatic_scroll_on_keyboard_shown() {
213+ waitForRendering(appPreview);
214+ var appReviews = findChild(appPreview, "appReviews");
215+ appReviews.visible = true;
216+
217+ var leftFlickable = findChild(appPreview, "leftFlickable");
218+ leftFlickable.contentY = leftFlickable.contentHeight;
219+ var reviewField = findChild(appReviews, "reviewField");
220+ appPreview.keyboardSize = 400;
221+ appReviews.editing(reviewField);
222+ var newFlickPos = leftFlickable.contentY;
223+ var keyboardY = shell.height - appPreview.keyboardSize;
224+ verify(newFlickPos < keyboardY);
225+ }
226+
227+*/
197 function test_progress_show() {
228 function test_progress_show() {
198 appPreview.previewData = dataProgress;
229 appPreview.previewData = dataProgress;
199 var progress = findChild(appPreview, "progressBar");
230 var progress = findChild(appPreview, "progressBar");
@@ -219,21 +250,5 @@ Item {
219 compare(root.calls[0][0], actions[1].id, "Id of action not found.");
250 compare(root.calls[0][0], actions[1].id, "Id of action not found.");
220 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
251 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
221 }
252 }
222−
223− function test_automatic_scroll_on_keyboard_shown() {
224− waitForRendering(appPreview);
225− var appReviews = findChild(appPreview, "appReviews");
226− appReviews.visible = true;
227−
228− var leftFlickable = findChild(appPreview, "leftFlickable");
229− leftFlickable.contentY = leftFlickable.contentHeight;
230− var reviewField = findChild(appReviews, "reviewField");
231− appPreview.keyboardSize = 400;
232− appReviews.editing(reviewField);
233− var newFlickPos = leftFlickable.contentY;
234− var keyboardY = shell.height - appPreview.keyboardSize;
235− verify(newFlickPos < keyboardY);
236− }
237−
238 }
253 }
239}
254}