mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Fix tests.
This commit is contained in:
parent
62c96ebad7
commit
fbcf78c894
@ -105,7 +105,8 @@
|
|||||||
orig = config.getOrig(config.testArray[i], viewport);
|
orig = config.getOrig(config.testArray[i], viewport);
|
||||||
expected = config.getExpected(orig, viewport);
|
expected = config.getExpected(orig, viewport);
|
||||||
actual = viewport[config.method](orig);
|
actual = viewport[config.method](orig);
|
||||||
propEqual(
|
var assert = config.assert || propEqual;
|
||||||
|
assert(
|
||||||
actual,
|
actual,
|
||||||
expected,
|
expected,
|
||||||
"Correctly converted coordinates " + orig
|
"Correctly converted coordinates " + orig
|
||||||
@ -118,6 +119,10 @@
|
|||||||
viewer.open(DZI_PATH);
|
viewer.open(DZI_PATH);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function assertPointsEquals(actual, expected, message) {
|
||||||
|
Util.assertPointsEquals(actual, expected, 1e-15, message);
|
||||||
|
}
|
||||||
|
|
||||||
// Tests start here.
|
// Tests start here.
|
||||||
|
|
||||||
asyncTest('getContainerSize', function() {
|
asyncTest('getContainerSize', function() {
|
||||||
@ -872,7 +877,8 @@
|
|||||||
getExpected: function(orig, viewport) {
|
getExpected: function(orig, viewport) {
|
||||||
return orig.divide(viewer.source.dimensions.x);
|
return orig.divide(viewer.source.dimensions.x);
|
||||||
},
|
},
|
||||||
method: 'imageToViewportCoordinates'
|
method: 'imageToViewportCoordinates',
|
||||||
|
assert: assertPointsEquals
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -885,7 +891,8 @@
|
|||||||
getExpected: function(orig, viewport) {
|
getExpected: function(orig, viewport) {
|
||||||
return orig.divide(ZOOM_FACTOR * viewport.getContainerSize().x);
|
return orig.divide(ZOOM_FACTOR * viewport.getContainerSize().x);
|
||||||
},
|
},
|
||||||
method: 'imageToViewportCoordinates'
|
method: 'imageToViewportCoordinates',
|
||||||
|
assert: assertPointsEquals
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
asyncTest('imageToViewportRectangle', function() {
|
asyncTest('imageToViewportRectangle', function() {
|
||||||
@ -902,7 +909,8 @@
|
|||||||
orig.height / viewer.source.dimensions.x
|
orig.height / viewer.source.dimensions.x
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
method: 'imageToViewportRectangle'
|
method: 'imageToViewportRectangle',
|
||||||
|
assert: assertPointsEquals
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user