瀏覽代碼

Add test for hot spot dragging.

pull/881/head
Nico Höllerich 4 年之前
父節點
當前提交
30679d9e1b
共有 2 個檔案被更改,包括 27 行新增3 行删除
  1. +14
    -1
      tests/run_tests.py
  2. +13
    -2
      tests/tests.html

+ 14
- 1
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):


+ 13
- 2
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
}
]
}
}
});


Loading…
取消
儲存