on xenial help sign in
Fix review entry height and bring back tests.
commit387b944f9550976d4e757baaa572d1f29915c1c4 authorMichał Sawicz <michal.sawicz@canonical.com> dateThu 25 Jul 2013, 15:35 (13 years ago) parentce14f11
2 files changed+11−22
Dash/Apps/AppReviews.qml+2−13 tests/qmltests/Dash/Apps/tst_AppReviews.qml+9−9
Dash/Apps/AppReviews.qml+2−13
@@ -80,8 +80,9 @@ Column {
8080 objectName: "reviewField"
8181 placeholderText: i18n.tr("Review")
8282 width: parent.width
83− height: units.gu(4)
8483 verticalAlignment: Text.AlignVCenter
84+ autoSize: true
85+ maximumLineCount: 5
8586
8687 Behavior on height { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
8788
@@ -92,18 +93,6 @@ Column {
9293 }
9394 }
9495
95− onTextChanged: {
96− if (reviewField.text == "") {
97− root.state = "";
98− reviewField.focus = false;
99− } else if (reviewField.lineCount > 1) {
100− reviewField.height = reviewField.contentHeight;
101− }
102− if (reviewField.lineCount == 1) {
103− reviewField.height = units.gu(4);
104− }
105− }
106−
10796 InverseMouseArea {
10897 anchors.fill: parent
10998 propagateComposedEvents: true
tests/qmltests/Dash/Apps/tst_AppReviews.qml+9−9
@@ -72,29 +72,29 @@ Item {
7272 name: "AppReviews"
7373 when: windowShown
7474
75− function test_state_nothing() {
76− appReviews.state = "";
75+ function cleanup() {
76+ sendReviewSpy.clear();
7777 var reviewField = findChild(appReviews, "reviewField");
78− var sendButton = findChild(appReviews, "sendButton");
79− compare(reviewField.width, appReviews.width, "ReviewField width don't match");
80− compare(sendButton.opacity, 0, "SendButton opacity should be 0");
78+ reviewField.focus = false;
79+ reviewField.text = "";
8180 }
8281
8382 function test_send_review() {
84− sendReviewSpy.clear();
8583 var sendButton = findChild(appReviews, "sendButton");
8684 mouseClick(sendButton, 1, 1);
87− compare(sendReviewSpy.count, 1, "SendReview signal not emitted");
85+ sendReviewSpy.wait();
8886 }
8987
9088 function test_review_focus() {
91− sendReviewSpy.clear();
9289 var sendButton = findChild(appReviews, "sendButton");
9390 var reviewField = findChild(appReviews, "reviewField");
94− var animation = findChild(appReviews, "editingAnimation");
9591
9692 compare(reviewField.focus, false, "ReviewField shouldn't have focus");
9793 compare(appReviews.state, "", "State should be empty");
94+
95+ mouseClick(reviewField, reviewField.width/2, reviewField.height/2);
96+ compare(reviewField.focus, true, "Review Field should have focus");
97+ compare(appReviews.state, "editing", "State should be 'editing'");
9898 }
9999
100100 function test_comments() {