mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
add test for windowToImageCoordinates
This commit is contained in:
parent
13045e2ac4
commit
59ee91ea1a
@ -47,22 +47,24 @@
|
|||||||
viewer.open('/test/data/testpattern.dzi');
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
/* asyncTest('windowToImageCoordinates', function() {
|
asyncTest('windowToImageCoordinates', function() {
|
||||||
var openHandler = function(event) {
|
var openHandler = function(event) {
|
||||||
viewer.removeHandler('open', openHandler);
|
viewer.removeHandler('open', openHandler);
|
||||||
var viewport = viewer.viewport;
|
var viewport = viewer.viewport;
|
||||||
|
|
||||||
// do stuff here
|
var orig = new OpenSeadragon.Point(
|
||||||
var orig = ;
|
getRandom(100, 3000), getRandom(100, 3000)
|
||||||
var expected = ;
|
);
|
||||||
var actual = ;
|
// 500 is the viewer size; there's 20 px of padding (I think)
|
||||||
equal(expected, actual, "what are you testing");
|
var expected = orig.divide(500).plus( new OpenSeadragon.Point(20, 20) );
|
||||||
|
var actual = viewport.windowToViewportCoordinates(orig);
|
||||||
|
propEqual(actual, expected, "Coordinates converted correctly for " + orig);
|
||||||
|
|
||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
viewer.addHandler('open', openHandler);
|
viewer.addHandler('open', openHandler);
|
||||||
viewer.open('/test/data/testpattern.dzi');
|
viewer.open('/test/data/testpattern.dzi');
|
||||||
});*/
|
});
|
||||||
|
|
||||||
/* Need imagetoViewerElementCoordinates first to figure out this one
|
/* Need imagetoViewerElementCoordinates first to figure out this one
|
||||||
asyncTest('imageToWindowCoordinates', function() {
|
asyncTest('imageToWindowCoordinates', function() {
|
||||||
@ -91,9 +93,9 @@
|
|||||||
viewer.removeHandler('open', openHandler);
|
viewer.removeHandler('open', openHandler);
|
||||||
var viewport = viewer.viewport;
|
var viewport = viewer.viewport;
|
||||||
|
|
||||||
var orig_x = getRandom(100, 3000);
|
var orig = new OpenSeadragon.Point(
|
||||||
var orig_y = getRandom(100, 3000);
|
getRandom(100, 3000), getRandom(100, 3000)
|
||||||
var orig = new OpenSeadragon.Point(orig_x, orig_y);
|
);
|
||||||
|
|
||||||
// 500 is the viewport container size; there's 20 px of padding (I think)
|
// 500 is the viewport container size; there's 20 px of padding (I think)
|
||||||
var expected = orig.divide(500).plus( new OpenSeadragon.Point(20, 20) );
|
var expected = orig.divide(500).plus( new OpenSeadragon.Point(20, 20) );
|
||||||
@ -111,9 +113,9 @@
|
|||||||
viewer.removeHandler('open', openHandler);
|
viewer.removeHandler('open', openHandler);
|
||||||
var viewport = viewer.viewport;
|
var viewport = viewer.viewport;
|
||||||
|
|
||||||
var orig_x = getRandom(0, 1000);
|
var orig = new OpenSeadragon.Point(
|
||||||
var orig_y = getRandom(0, 1000);
|
getRandom(0, 1000), getRandom(0, 1000)
|
||||||
var orig = new OpenSeadragon.Point(orig_x, orig_y);
|
);
|
||||||
|
|
||||||
// 500 is the viewport container size; there's 20 px of padding (I think)
|
// 500 is the viewport container size; there's 20 px of padding (I think)
|
||||||
var expected = orig.minus( new OpenSeadragon.Point(20, 20) ).times(500);
|
var expected = orig.minus( new OpenSeadragon.Point(20, 20) ).times(500);
|
||||||
|
Loading…
Reference in New Issue
Block a user