@@ -0,0 +1,105 @@
2+ * Copyright 2013 Canonical Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+import "../../../../Dash/Apps"
20+import Unity.Test 0.1 as UT
27+ property string _username: "Unity User"
28+ property int _rating: 8
29+ property string _date: "04/20/2013"
30+ property string _comment: "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."
35+ signalName: "sendReview"
38+ function get_comments() {
39+ var c1 = new Object();
40+ c1.username = root._username;
41+ c1.rate = root._rating;
42+ c1.date = root._date;
43+ c1.comment = root._comment;
44+ var c2 = new Object();
45+ c2.username = root._username;
46+ c2.rate = root._rating;
47+ c2.date = root._date;
48+ c2.comment = root._comment;
49+ var c3 = new Object();
50+ c3.username = root._username;
51+ c3.rate = root._rating;
52+ c3.date = root._date;
53+ c3.comment = root._comment;
54+ var c4 = new Object();
55+ c4.username = root._username;
56+ c4.rate = root._rating;
57+ c4.date = root._date;
58+ c4.comment = root._comment;
60+ return [c1, c2, c3, c4];
63+ // The component under test
68+ model: get_comments()
75+ function test_state_nothing() {
76+ appReviews.state = "";
77+ var reviewField = findChild(appReviews, "reviewField");
78+ var sendButton = findChild(appReviews, "sendButton");
79+ compare(reviewField.width, appReviews.width);
80+ compare(sendButton.opacity, 0);
83+ function test_send_review() {
84+ var sendButton = findChild(appReviews, "sendButton");
85+ mouseClick(sendButton, 1, 1)
86+ compare(sendReviewSpy.count, 1, "SendReview signal not emitted");
89+ function test_comments() {
90+ var commentsArea = findChild(appReviews, "commentsArea");
91+ compare(commentsArea.count, 4);
92+ for(var i = 0; i < 4; i++) {
93+ var username = commentsArea.itemAt(i).children[0].children[0].text
94+ var rate = commentsArea.itemAt(i).children[0].children[1].children[0].rating
95+ var date = commentsArea.itemAt(i).children[0].children[1].children[1].text
96+ var comment = commentsArea.itemAt(i).children[1].text
97+ compare(username, root._username);
98+ compare(rate, root._rating);
99+ compare(date, root._date);
100+ compare(comment, root._comment);