diff --git a/tests/run_tests.py b/tests/run_tests.py index cc5f035..87b6c68 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -27,6 +27,7 @@ import numpy as np from PIL import Image, ImageChops from selenium.common.exceptions import TimeoutException from selenium import webdriver +from selenium.webdriver.common.action_chains import ActionChains class PannellumServer(SimpleHTTPRequestHandler): @@ -154,7 +155,7 @@ class PannellumTester(object): reference = Image.open("tests/cube.png") comparator = self.take_screenshot("panorama") self.equal_images(reference, comparator, "cube") - + # Check hot spot self.browser.find_element_by_class_name("pnlm-scene").click() time.sleep(5) @@ -170,6 +171,18 @@ class PannellumTester(object): comparator = self.take_screenshot("panorama") self.equal_images(reference, comparator, "multires") + + #Check hotspot dragging - move from (20,20) to (0,0) + action = ActionChains(self.browser) + action.drag_and_drop( + self.browser.find_element_by_class_name('pnlm-hotspot'), + self.browser.find_element_by_class_name('pnlm-render-container') #drops in the middle of the element + ) + action.perform() + time.sleep(1) + assert self.browser.execute_script("var hs = viewer.getConfig().hotSpots[0]; return Math.abs(hs.yaw) < 0.001 && Math.abs(hs.pitch) < 0.001") + print("PASS: hot spot dragging") + self.httpd.server_close() def get_browser(self, name=None): diff --git a/tests/tests.html b/tests/tests.html index c678d2e..e9e8f5e 100644 --- a/tests/tests.html +++ b/tests/tests.html @@ -42,7 +42,8 @@ viewer = pannellum.viewer('panorama', { "pitch": -12, "yaw": 170, "type": "info", - "text": "info test" + "text": "info test", + }, { "pitch": -10, @@ -78,7 +79,17 @@ viewer = pannellum.viewer('panorama', { "tileResolution": 256, "maxLevel": 4, "cubeResolution": 2048 - } + }, + "hotSpots": [ + { + "pitch": 20, + "yaw": 20, + "type": "info", + "text": "drag test", + "draggable": true, + "dragHandlerFunc": console.log + } + ] } } });