on xenial help sign in
test and code improved, remove comments and add visible=false, also use bottomMargin instead of increasing contentHeight
ab88cc4Diego Sarmentero
Dash/Apps/AppPreview.qml+9−7
@@ -186,15 +186,17 @@ DashPreview {
186
186
187 ListItem.ThinDivider { }
187 ListItem.ThinDivider { }
188
188
189− // TODO: This should be added when the feature for reviews/comments is complete.
190−// AppReviews {
191−// objectName: "appReviews"
192−// anchors { left: parent.left; right: parent.right }
193
189
190+ AppReviews {
191+ objectName: "appReviews"
192+ // TODO: This should make this visible when the feature for reviews/comments is complete.
193+ visible: false
194+ anchors { left: parent.left; right: parent.right }
195+
194−// model: root.previewData.infoMap["comments"] ? root.previewData.infoMap["comments"].value : undefined
196+ model: root.previewData.infoMap["comments"] ? root.previewData.infoMap["comments"].value : undefined
195
197
196−// onSendReview: root.sendUserReview(review);
198+ onSendReview: root.sendUserReview(review);
197−// }
199+ }
198 }
200 }
199 }
201 }
200}
202}
Dash/DashPreview.qml+2−1
@@ -133,7 +133,8 @@ Rectangle {
133 anchors.top: parent.top
133 anchors.top: parent.top
134 anchors.bottom: parent.bottom
134 anchors.bottom: parent.bottom
135 width: root.narrowMode ? contentRow.width : contentRow.width * root.previewWidthRatio
135 width: root.narrowMode ? contentRow.width : contentRow.width * root.previewWidthRatio
136− contentHeight: leftColumn.height + root.keyboardSize
136+ contentHeight: leftColumn.height
137+ anchors.bottomMargin: root.keyboardSize
137 clip: true
138 clip: true
138
139
139 Column {
140 Column {
tests/qmltests/Dash/Apps/tst_AppPreview.qml+49−50
@@ -85,10 +85,9 @@ Item {
85 function cleanup() {
85 function cleanup() {
86 root.calls = new Array();
86 root.calls = new Array();
87 sendPreviewSpy.clear();
87 sendPreviewSpy.clear();
88− // TODO: This should be added when the feature for reviews/comments is complete.
89−// var reviewField = findChild(appPreview, "reviewField");
88+ var reviewField = findChild(appPreview, "reviewField");
90−// reviewField.focus = false;
89+ reviewField.focus = false;
91−// reviewField.text = "";
90+ reviewField.text = "";
92 data.rating = rating.value;
91 data.rating = rating.value;
93 }
92 }
94
93
@@ -117,52 +116,52 @@ Item {
117 compare(rated.text, "8 reviews", "Reviews don't match");
116 compare(rated.text, "8 reviews", "Reviews don't match");
118 }
117 }
119
118
120− // TODO: This should be added when the feature for reviews/comments is complete.
121−// function test_send_review() {
119+ function test_send_review() {
122−// var appReviews = findChild(appPreview, "appReviews");
120+ var appReviews = findChild(appPreview, "appReviews");
123−// appReviews.sendReview("review");
121+ appReviews.sendReview("review");
124−// sendPreviewSpy.wait();
122+ sendPreviewSpy.wait();
125−// }
123+ }
126−
124+
127−// function test_review_focus() {
125+ function test_review_focus() {
126+ skip();
128−// var appReviews = findChild(appPreview, "appReviews");
127+ var appReviews = findChild(appPreview, "appReviews");
129−// var sendButton = findChild(appReviews, "sendButton");
128+ var sendButton = findChild(appReviews, "sendButton");
130−// var reviewField = findChild(appReviews, "reviewField");
129+ var reviewField = findChild(appReviews, "reviewField");
131−
130+
132−// compare(reviewField.focus, false, "ReviewField shouldn't have focus");
131+ compare(reviewField.focus, false, "ReviewField shouldn't have focus");
133−// compare(appReviews.state, "", "State should be empty");
132+ compare(appReviews.state, "", "State should be empty");
134−
133+
135−// mouseClick(reviewField, reviewField.width/2, reviewField.height/2);
134+ mouseClick(reviewField, reviewField.width/2, reviewField.height/2);
136−// compare(reviewField.focus, true, "Review Field should have focus");
135+ compare(reviewField.focus, true, "Review Field should have focus");
137−// compare(appReviews.state, "editing", "State should be 'editing'");
136+ compare(appReviews.state, "editing", "State should be 'editing'");
138−// }
137+ }
139−
138+
140−// function test_comments() {
139+ function test_comments() {
141−// var commentsArea = findChild(appPreview, "commentsArea");
140+ var commentsArea = findChild(appPreview, "commentsArea");
142−// compare(commentsArea.count, 3);
141+ compare(commentsArea.count, 3);
143−// for(var i = 0; i < 3; i++) {
142+ for(var i = 0; i < 3; i++) {
144−// var username = commentsArea.itemAt(i).children[0].children[0].text
143+ var username = commentsArea.itemAt(i).children[0].children[0].text
145−// var rate = commentsArea.itemAt(i).children[0].children[1].children[0].rating
144+ var rate = commentsArea.itemAt(i).children[0].children[1].children[0].rating
146−// var date = commentsArea.itemAt(i).children[0].children[1].children[1].text
145+ var date = commentsArea.itemAt(i).children[0].children[1].children[1].text
147−// var comment = commentsArea.itemAt(i).children[1].text
146+ var comment = commentsArea.itemAt(i).children[1].text
148−// compare(username, comments.value[i][0], "Username don't match");
147+ compare(username, comments.value[i][0], "Username don't match");
149−// compare(rate, comments.value[i][1], "Rating don't match");
148+ compare(rate, comments.value[i][1], "Rating don't match");
150−// compare(date, comments.value[i][2], "Date don't match");
149+ compare(date, comments.value[i][2], "Date don't match");
151−// compare(comment, comments.value[i][3], "Comment don't match");
150+ compare(comment, comments.value[i][3], "Comment don't match");
152−// }
151+ }
153−// }
152+ }
154−
153+
155−// function test_negative_rating() {
154+ function test_negative_rating() {
156−// data.rating = -1.0;
155+ data.rating = -1.0;
157−// var rated = findChild(appPreview, "reviewsLabel");
156+ var rated = findChild(appPreview, "reviewsLabel");
158−// verify(rated.visible == false);
157+ verify(rated.visible == false);
159−// var commentsArea = findChild(appPreview, "commentsArea");
158+ var commentsArea = findChild(appPreview, "commentsArea");
160−// verify(commentsArea.visible == false);
159+ verify(commentsArea.visible == false);
161−// var appReviews = findChild(appPreview, "appReviews");
160+ var appReviews = findChild(appPreview, "appReviews");
162−// verify(appReviews.visible == false);
161+ verify(appReviews.visible == false);
163−// var buttons = findChild(appPreview, "gridButtons");
162+ var buttons = findChild(appPreview, "gridButtons");
164−// verify(buttons.visible == true);
163+ verify(buttons.visible == true);
165−// }
164+ }
166
165
167 }
166 }
168}
167}
tests/qmltests/Dash/tst_DashPreview.qml+2−4
@@ -154,13 +154,11 @@ Item {
154
154
155 function test_keyboard_present() {
155 function test_keyboard_present() {
156 var flick = findChild(preview, "leftFlickable");
156 var flick = findChild(preview, "leftFlickable");
157− var column = findChild(preview, "leftColumn");
158
157
159− compare(flick.contentHeight, column.height, "Column and Flickable area don't match");
158+ compare(flick.anchors.bottomMargin, 0, "Bottom margin should be 0");
160− var defaultValue = flick.contentHeight;
161 // Simulate that the keyboard is visible
159 // Simulate that the keyboard is visible
162 preview.keyboardSize = 500;
160 preview.keyboardSize = 500;
163− compare(flick.contentHeight, defaultValue + 500, "Flickable wasn't expanded on keyboard shown");
161+ compare(flick.anchors.bottomMargin, 500, "Bottom margin should be 500");
164 }
162 }
165 }
163 }
166}
164}