@@ -0,0 +1,68 @@
1+/*
2+ * Copyright 2015 Canonical Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+import QtQuick 2.0
18+import QtTest 1.0
19+import Ubuntu.Components 1.1
20+import "../../../../qml/Dash/Previews"
21+import Unity.Test 0.1 as UT
22+
23+Rectangle {
24+ id: root
25+ width: units.gu(40)
26+ height: units.gu(80)
27+ color: Theme.palette.selected.background
28+
29+ property var comment: {
30+ "author": "Claire Thompson",
31+ "date": "28/04/2015 3:48pm",
32+ "comment": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
33+ "source": "../../graphics/avatars/amanda@12.png"
34+ }
35+
36+ property var commentNoImage: {
37+ "author": "Claire Thompson",
38+ "date": "28/04/2015 3:48pm",
39+ "comment": "Been quite a while since I really liked one.",
40+ "source": "null"
41+ }
42+
43+ PreviewSocialComment {
44+ id: previewCommentInput
45+ anchors.left: parent.left
46+ anchors.right: parent.right
47+ widgetData: comment
48+ widgetId: "previewSocialComment"
49+ }
50+
51+ UT.UnityTestCase {
52+ name: "PreviewSocialCommentTest"
53+ when: windowShown
54+
55+ function testAnchorsNoAvatar() {
56+ var column = findChild(previewCommentInput, "column");
57+ var avatar = findChild(previewCommentInput, "avatar");
58+
59+ compare(previewCommentInput.widgetData, comment);
60+ compare(avatar.visible, true);
61+ compare(column.anchors.left, avatar.anchors.right);
62+
63+ previewCommentInput.widgetData = commentNoImage;
64+ tryCompare(avatar, "visible", false);
65+ compare(column.anchors.left, previewCommentInput.anchors.left);
66+ }
67+ }
68+}