diff --git a/tests/run_tests.py b/tests/run_tests.py index 87b6c68..e22e9f0 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -183,6 +183,17 @@ class PannellumTester(object): 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") + # Check multires with external tile loading + self.browser.execute_script("viewer.loadScene('multires-loader')") + time.sleep(5) + if create_ref: + self.take_screenshot("panorama", "tests/multires.png") + subprocess.call(["optipng", "-o7", "-strip", "all", "tests/multires.png"]) + else: + reference = Image.open("tests/multires.png") + comparator = self.take_screenshot("panorama") + self.equal_images(reference, comparator, "multires with external tile loading") + self.httpd.server_close() def get_browser(self, name=None): diff --git a/tests/tests.html b/tests/tests.html index e9e8f5e..0125246 100644 --- a/tests/tests.html +++ b/tests/tests.html @@ -90,7 +90,51 @@ viewer = pannellum.viewer('panorama', { "dragHandlerFunc": console.log } ] - } + }, + + "multires-loader": { + "title": "multires title", + "type": "multires", + "hfov": 85, + "multiRes": { + "basePath": "../examples/multires", + "path": "/%l/%s%x%y", + "fallbackPath": "/fallback/%s", + "extension": "png", + "tileResolution": 256, + "maxLevel": 4, + "cubeResolution": 2048, + "loader": function(node){ + var resolver; + var rejector; + var promise = {}; + + promise.then = function(callback){ + resolver = callback; + return promise; + } + + promise.catch = function(callback){ + rejector = callback; + return promise; + } + + var img = document.createElement('img'); + img.onload = function () { + if(resolver) + resolver(img); + } + img.onerror = function(err) { + if(rejector) + rejector(err); + } + + img.src = node.uri; + + return promise; + } + } + } } });