@@ -21,7 +21,7 @@ import Unity.Test 0.1 as UT
22Rectangle {
22Rectangle {
24− width: units.gu(60)
24+ width: units.gu(80)
25 height: units.gu(80)
25 height: units.gu(80)
26 color: "lightgrey"
26 color: "lightgrey"
@@ -44,13 +44,62 @@ Rectangle {
46 UT.UnityTestCase {
46 UT.UnityTestCase {
47 name: "PreviewImageGalleryTest"
48 name: "PreviewImageGalleryTest"
48 when: windowShown
49 when: windowShown
51+ property Item slideShow: findChild(imageGallery.rootItem, "slideShow")
52+ property Item slideShowCloseButton: findChild(slideShow, "slideShowCloseButton")
53+ property Item slideShowListView: findChild(slideShow, "slideShowListView")
56+ imageGallery.widgetData = sourcesModel1;
57+ slideShow.visible = false;
50 function test_changeEmptyModel() {
60 function test_changeEmptyModel() {
51 imageGallery.widgetData = sourcesModel0;
61 imageGallery.widgetData = sourcesModel0;
52 var placeholderScreenshot = findChild(imageGallery, "placeholderScreenshot");
62 var placeholderScreenshot = findChild(imageGallery, "placeholderScreenshot");
53 compare(placeholderScreenshot.visible, true);
63 compare(placeholderScreenshot.visible, true);
66+ function test_slideShowOpenClose() {
67+ var image0 = findChild(imageGallery, "previewImage0");
68+ mouseClick(image0, image0.width / 2, image0.height / 2);
69+ tryCompare(slideShow, "visible", true);
70+ tryCompare(slideShow, "scale", 1.0);
71+ tryCompare(slideShowCloseButton, "visible", true);
72+ mouseClick(slideShowCloseButton, slideShowCloseButton.width / 2, slideShowCloseButton.height / 2);
73+ tryCompare(slideShow, "visible", false);
76+ function test_slideShowShowHideHeader() {
77+ var image0 = findChild(imageGallery, "previewImage0");
78+ mouseClick(image0, image0.width / 2, image0.height / 2);
79+ tryCompare(slideShow, "visible", true);
80+ tryCompare(slideShow, "scale", 1.0);
81+ tryCompare(slideShowCloseButton, "visible", true);
82+ mouseClick(slideShow, slideShow.width / 2, slideShow.height / 2);
83+ tryCompare(slideShowCloseButton, "visible", false);
84+ mouseClick(slideShow, slideShow.width / 2, slideShow.height / 2);
85+ tryCompare(slideShowCloseButton, "visible", true);
88+ function test_slideShowOpenCorrectImage_data() {
90+ { tag: "Image 0", index: 0 },
91+ { tag: "Image 1", index: 1 },
92+ { tag: "Image 2", index: 2 },
96+ function test_slideShowOpenCorrectImage(data) {
97+ var image = findChild(imageGallery, "previewImage" + data.index);
98+ mouseClick(image, image.width / 2, image.height / 2);
99+ tryCompare(slideShow, "visible", true);
100+ tryCompare(slideShow, "scale", 1.0);
101+ tryCompare(slideShowListView, "currentIndex", data.index);
102+ verify(image.source === slideShowListView.currentItem.source);