Fixing tests properly, as suggested by @sbrunner

This commit is contained in:
ahocevar
2012-12-20 16:30:58 +01:00
parent f5d7f794c9
commit fc64b2c5f8

View File

@@ -315,7 +315,7 @@
for (var i=0; i<expectedResolutions.length; ++i) {
got = layer.resolutions[i];
exp = expectedResolutions[i];
if (got.toFixed(3) !== exp.toFixed(3)) {
if (got.toFixed(10) !== exp.toFixed(10)) {
t.fail(id + ": bad resolutions - index " + i + " got " + got + " but expected " + exp);
same = false;
break;
@@ -325,11 +325,11 @@
t.ok(true, id + ": correct resolutions");
}
t.eq(
layer.maxResolution.toFixed(3), expectedMaxResolution.toFixed(3),
layer.maxResolution, expectedMaxResolution,
id + ": maxResolution set"
);
t.eq(
layer.minResolution.toFixed(3), expectedMinResolution.toFixed(3),
layer.minResolution, expectedMinResolution,
id + ": minResolution set"
);
@@ -400,13 +400,13 @@
[0.0012699126752168362, 0.0006349563376084181, 0.00031747816880420905], 0.00031747816880420905, 0.0012699126752168362
], [
"1.18", null, {scales: [400000, 200000, 100000], units: "m"},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
"1.19", null, {minScale: 400000, numZoomLevels: 3, units: "m"},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
"1.20", null, {maxScale: 100000, numZoomLevels: 3, units: "m"},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
"1.21", null, {numZoomLevels: 2}, // maxResolution calculated based on the projection's maxExtent here
[1.40625, 0.703125], 0.703125, 1.40625
@@ -519,7 +519,7 @@
[0.0012699126752168362, 0.0006349563376084181, 0.00031747816880420905], 0.00031747816880420905, 0.0012699126752168362
], [
"2.5.4", {units: "m"}, {scales: [400000, 200000, 100000]},
[141.11103491115225, 70.55551745557612, 35.27775872778806], 35.27775872778806, 141.11103491115225
[141.11139333389778, 70.55569666694889, 35.277848333474445], 35.277848333474445, 141.11139333389778
], [
/*
* Batch 2.6: minScale set in the layer options