on xenial help sign in
add publisher information to App's header. Disable rating completely (including star rating)
commit48f63b92513b82840cf29d7b32addf3d9ad39811 authorDiego Sarmentero <diego.sarmentero@gmail.com> dateTue 1 Oct 2013, 12:30 (13 years ago) parentdb80e66
4 files changed+55−32
Dash/Apps/AppPreview.qml+8−3 Dash/Generic/GenericPreview.qml−1 Dash/Previews/Header.qml+7−3 tests/qmltests/Dash/Apps/tst_AppPreview.qml+40−25
Dash/Apps/AppPreview.qml+8−3
@@ -32,7 +32,9 @@ GenericPreview {
3232 actions: root.previewData.infoMap["show_progressbar"] ? progressComponent : buttonsComponent
3333 description: descriptionComponent
3434 header: headerComponent
35− ratings: ratingsComponent
35+
36+ // TODO: Ratings are not yet complete... enable this once they work
37+ //ratings: ratingsComponent
3638
3739 Component {
3840 id: previewImagesComponent
@@ -64,8 +66,10 @@ GenericPreview {
6466 Component {
6567 id: headerComponent
6668 Header {
69+ objectName: "previewHeader"
6770 title: previewData.title
6871 icon: previewData.appIcon
72+ subtitle: root.previewData.infoMap["publisher"] ? root.previewData.infoMap["publisher"].value : ""
6973 rating: Math.round(root.previewData.rating * 10)
7074 reviews: root.previewData.numRatings
7175 rated: root.previewData.infoMap["rated"] ? root.previewData.infoMap["rated"].value : 0
@@ -157,7 +161,10 @@ GenericPreview {
157161 Component {
158162 id: ratingsComponent
159163 Column {
164+ id: columnReviewRating
165+ objectName: "columnReviewRating"
160166 visible: root.previewData.rating >= 0
167+
161168 spacing: units.gu(1)
162169 height: childrenRect.height
163170
@@ -192,8 +199,6 @@ GenericPreview {
192199 Reviews {
193200 id: appReviews
194201 objectName: "appReviews"
195− // TODO: This should make this visible when the feature for reviews/comments is complete.
196− visible: false; height: 0
197202
198203 anchors { left: parent.left; right: parent.right }
199204
Dash/Generic/GenericPreview.qml−1
@@ -29,7 +29,6 @@ DashPreview {
2929 header: headerComponent
3030 actions: actionsComponent
3131 description: descriptionComponent
32− ratings: ratingsComponent
3332
3433 Component {
3534 id: previewImagesComponent
Dash/Previews/Header.qml+7−3
@@ -31,8 +31,8 @@ Row {
3131
3232 UbuntuShape {
3333 id: imageShape
34− width: units.gu(6)
35− height: units.gu(6)
34+ width: height
35+ height: Math.max(units.gu(6), contentColumn.height)
3636 visible: image.source.toString().length > 0
3737 image: Image {
3838 id: image
@@ -43,10 +43,12 @@ Row {
4343 }
4444
4545 Column {
46+ id: contentColumn
4647 spacing: units.gu(1)
4748
4849 Label {
4950 id: titleLabel
51+ objectName: "titleLabel"
5052 fontSize: "large"
5153 color: "white"
5254 style: Text.Raised
@@ -64,15 +66,17 @@ Row {
6466 style: Text.Raised
6567 styleColor: "black"
6668 opacity: .6
69+ visible: text.length > 0
6770 }
6871
6972 Row {
70− visible: root.rating >= 0 && subtitleLabel.text.length == 0
73+ visible: root.rating >= 0
7174 spacing: units.gu(1)
7275
7376 RatingStars {
7477 id: ratingStars
7578 maximumRating: 10
79+ rating: -1
7680 }
7781
7882 Label {
tests/qmltests/Dash/Apps/tst_AppPreview.qml+40−25
@@ -42,6 +42,7 @@ Item {
4242 QtObject { id: rated; property int value: 120 }
4343 QtObject { id: reviews; property int value: 8 }
4444 QtObject { id: progress; property string value: "source" }
45+ QtObject { id: publisher; property string value: "Ubuntu Developer" }
4546 QtObject { id: comments; property var value: [
4647 ["Unity User", 4, "08/20/2013", root.commentary],
4748 ["Unity User", 8, "01/15/2013", root.commentary],
@@ -62,7 +63,8 @@ Item {
6263 property var infoMap: {
6364 "more-screenshots": screenshots,
6465 "rated": rated,
65− "comments": comments
66+ "comments": comments,
67+ "publisher": publisher
6668 }
6769 property var actions: [
6870 { "id": 123, "displayName": "action1" },
@@ -84,6 +86,7 @@ Item {
8486 "more-screenshots": screenshots,
8587 "rated": rated,
8688 "comments": comments,
89+ "publisher": publisher,
8790 "progressbar_source": progressSource
8891 }
8992 property var actions: [
@@ -112,14 +115,15 @@ Item {
112115 function cleanup() {
113116 root.calls = new Array();
114117 sendPreviewSpy.clear();
115− var reviewField = findChild(appPreview, "reviewField");
116− reviewField.focus = false;
117− reviewField.text = "";
118− data.rating = rating.value;
118+ // TODO: This doesn't work right now as Reviews are disabled
119+ //var reviewField = findChild(appPreview, "reviewField");
120+ //reviewField.focus = false;
121+ //reviewField.text = "";
122+ //data.rating = rating.value;
119123 dataProgress.infoMap["progressbar_source"].value = "service";
120− var appReviews = findChild(appPreview, "appReviews");
121− appReviews.visible = false;
122− appPreview.keyboardSize = 0;
124+ //var appReviews = findChild(appPreview, "appReviews");
125+ //appReviews.visible = false;
126+ //appPreview.keyboardSize = 0;
123127 }
124128
125129 function test_actions() {
@@ -137,6 +141,14 @@ Item {
137141 }
138142 }
139143
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+
140152 function test_rated() {
141153 var rated = findChild(appPreview, "ratedLabel");
142154 compare(rated.text, "(120)", "Rates not equal");
@@ -147,13 +159,16 @@ Item {
147159 compare(rated.text, "8 reviews", "Reviews don't match");
148160 }
149161
150− function test_send_review() {
162+ // TODO: Disabled as reviewing and commenting is currently disabled
163+/* function test_send_review() {
151164 var appReviews = findChild(appPreview, "appReviews");
152165 appReviews.sendReview("review");
153166 sendPreviewSpy.wait();
154167 }
155168
156169 function test_review_focus() {
170+ var columnReviewRating = findChild(appPreview, "columnReviewRating");
171+ columnReviewRating.visible = true;
157172 var appReviews = findChild(appPreview, "appReviews");
158173 appReviews.visible = true;
159174 var sendButton = findChild(appReviews, "sendButton");
@@ -194,6 +209,22 @@ Item {
194209 verify(buttons.visible == true);
195210 }
196211
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+*/
197228 function test_progress_show() {
198229 appPreview.previewData = dataProgress;
199230 var progress = findChild(appPreview, "progressBar");
@@ -219,21 +250,5 @@ Item {
219250 compare(root.calls[0][0], actions[1].id, "Id of action not found.");
220251 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
221252 }
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−
238253 }
239254}