on xenial help sign in
Merge app-preview.
commit16720bcb0fc1473df1b38aa44fbca0f2a1a75292 authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 26 Jul 2013, 16:08 (13 years ago) parent4e0fd6e
2 files changed+13−25
Dash/Apps/AppReviews.qml+2−14 tests/qmltests/Dash/Apps/tst_AppPreview.qml+11−11
Dash/Apps/AppReviews.qml+2−14
@@ -80,9 +80,9 @@ Column {
8080 objectName: "reviewField"
8181 placeholderText: i18n.tr("Review")
8282 width: parent.width
83− height: units.gu(4)
84− contentHeight: units.gu(3) * 5
8583 verticalAlignment: Text.AlignVCenter
84+ autoSize: true
85+ maximumLineCount: 5
8686
8787 Behavior on height { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
8888
@@ -93,18 +93,6 @@ Column {
9393 }
9494 }
9595
96− onTextChanged: {
97− if (reviewField.text == "") {
98− root.state = "";
99− reviewField.focus = false;
100− } else if (reviewField.lineCount > 1) {
101− reviewField.height = reviewField.contentHeight;
102− }
103− if (reviewField.lineCount == 1) {
104− reviewField.height = units.gu(4);
105− }
106− }
107−
10896 InverseMouseArea {
10997 anchors.fill: parent
11098 propagateComposedEvents: true
tests/qmltests/Dash/Apps/tst_AppPreview.qml+11−11
@@ -98,6 +98,12 @@ Item {
9898 name: "AppPreview"
9999 when: windowShown
100100
101+ function cleanup() {
102+ sendReviewSpy.clear();
103+ reviewField.focus = false;
104+ reviewField.text = "";
105+ }
106+
101107 function test_actions() {
102108 root.calls = new Array();
103109 var buttons = findChild(appPreview, "gridButtons");
@@ -124,20 +130,10 @@ Item {
124130 compare(rated.text, i18n.tr("%1 review", "%1 reviews", 8).arg(8), "Reviews don't match");
125131 }
126132
127− function test_state_nothing() {
128− var appReviews = findChild(appPreview, "appReviews");
129− appReviews.state = "";
130− var reviewField = findChild(appPreview, "reviewField");
131− var sendButton = findChild(appPreview, "sendButton");
132− compare(reviewField.width, appReviews.width, "ReviewField width don't match");
133− compare(sendButton.opacity, 0, "SendButton opacity should be 0");
134− }
135−
136133 function test_send_review() {
137− sendPreviewSpy.clear();
138134 var appReviews = findChild(appPreview, "appReviews");
139135 appReviews.sendReview("review");
140− compare(sendPreviewSpy.count, 1, "SendReview signal not emitted");
136+ sendPreviewSpy.wait();
141137 }
142138
143139 function test_review_focus() {
@@ -148,6 +144,10 @@ Item {
148144
149145 compare(reviewField.focus, false, "ReviewField shouldn't have focus");
150146 compare(appReviews.state, "", "State should be empty");
147+
148+ mouseClick(reviewField, reviewField.width/2, reviewField.height/2);
149+ compare(reviewField.focus, true, "Review Field should have focus");
150+ compare(appReviews.state, "editing", "State should be 'editing'");
151151 }
152152
153153 function test_comments() {