on xenial help sign in
Add a test for hiding components when rating is negative
commit3b35a59cc4e71ff748a9f7ac28286df0603df3ee authorMichal Hruby <michal.mhr@gmail.com> dateMon 19 Aug 2013, 17:55 (13 years ago) parentf9f23fb
1 file changed+16−2
tests/qmltests/Dash/Apps/tst_AppPreview.qml+16−2
tests/qmltests/Dash/Apps/tst_AppPreview.qml+16−2
@@ -35,7 +35,7 @@ Item {
3535
3636 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.";
3737 QtObject { id: screenshots; property var value: ["fake_image1.png", "fake_image2.png", "fake_image3.png"] }
38− QtObject { id: rating; property int value: 8 }
38+ QtObject { id: rating; property real value: 0.8 }
3939 QtObject { id: rated; property int value: 120 }
4040 QtObject { id: reviews; property int value: 8 }
4141 QtObject { id: progress; property string value: "source" }
@@ -51,7 +51,7 @@ Item {
5151 property string title: "Unity App"
5252 property string appIcon: "fake_image.png"
5353 property string description: "This is an Application description"
54− property real rating: rating.value / 10.0
54+ property real rating: rating.value
5555 property int numRatings: reviews.value
5656 property var execute: root.fake_call
5757 property var infoMap: {
@@ -88,6 +88,7 @@ Item {
8888 var reviewField = findChild(appPreview, "reviewField");
8989 reviewField.focus = false;
9090 reviewField.text = "";
91+ data.rating = rating.value;
9192 }
9293
9394 function test_actions() {
@@ -148,5 +149,18 @@ Item {
148149 compare(comment, comments.value[i][3], "Comment don't match");
149150 }
150151 }
152+
153+ function test_negative_rating() {
154+ data.rating = -1.0;
155+ var rated = findChild(appPreview, "reviewsLabel");
156+ verify(rated.visible == false);
157+ var commentsArea = findChild(appPreview, "commentsArea");
158+ verify(commentsArea.visible == false);
159+ var appReviews = findChild(appPreview, "appReviews");
160+ verify(appReviews.visible == false);
161+ var buttons = findChild(appPreview, "gridButtons");
162+ verify(buttons.visible == true);
163+ }
164+
151165 }
152166}