@@ -0,0 +1,69 @@
1+/*
2+ * Copyright 2014 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.4
18+import QtTest 1.0
19+import Ubuntu.Components 1.3
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: "black"
28+
29+ property var shareData: {
30+ "uri": [
31+ "Text here",
32+ "text here 2",
33+ "text here 3"
34+ ],
35+ "content-type": "text"
36+ }
37+
38+ property var shareDataNoUri: {
39+ "uri": "",
40+ "content-type": "text"
41+ }
42+
43+
44+ PreviewMediaToolbar {
45+ id: previewMediaToolbar
46+ anchors { left: parent.left; bottom: parent.bottom; }
47+ shareData: root.shareData
48+ }
49+
50+ UT.UnityTestCase {
51+ name: "PreviewMediaToolbarTest"
52+ when: windowShown
53+
54+ property Item sharingWidget: findChild(previewMediaToolbar, "sharingWidget")
55+
56+ function cleanup() {
57+ previewMediaToolbar.shareData = root.shareData;
58+ }
59+
60+ function test_visible() {
61+ previewMediaToolbar.shareData = shareDataNoUri;
62+ compare(previewMediaToolbar.visible, false);
63+ compare(sharingWidget.visible, false);
64+ previewMediaToolbar.shareData = shareData;
65+ compare(previewMediaToolbar.visible, true);
66+ compare(sharingWidget.visible, true);
67+ }
68+ }
69+}