mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 12:01:15 -04:00
Uncomment the unit test on geolocation that currently fails + some minor changes
This commit is contained in:
parent
33794f7aeb
commit
0334d5e3a6
@ -325,11 +325,11 @@ define(function(require) {
|
|||||||
localArchive.getTitlesInCoords(rectFranceGermany, 10, callbackTitlesNearbyFound);
|
localArchive.getTitlesInCoords(rectFranceGermany, 10, callbackTitlesNearbyFound);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
asyncTest("check articles found nearby London", function() {
|
asyncTest("check articles found nearby London", function() {
|
||||||
expect(2);
|
expect(3);
|
||||||
var callbackTitlesNearbyLondonFound = function(titleList) {
|
var callbackTitlesNearbyLondonFound = function(titleList) {
|
||||||
ok(titleList !== null, "Some titles should be found");
|
ok(titleList !== null, "Some titles should be found");
|
||||||
|
ok(titleList.length > 0, "At least one title should be found");
|
||||||
var titleLondon = null;
|
var titleLondon = null;
|
||||||
for (var i=0; i<titleList.length; i++) {
|
for (var i=0; i<titleList.length; i++) {
|
||||||
var title = titleList[i];
|
var title = titleList[i];
|
||||||
@ -342,15 +342,14 @@ define(function(require) {
|
|||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
var pointLondon = new geometry.point(51, 0);
|
var pointLondon = new geometry.point(51, 0);
|
||||||
var maxDistance = 100;
|
var maxDistance = 1;
|
||||||
var rectLondon = new geometry.rect(
|
var rectLondon = new geometry.rect(
|
||||||
pointLondon.x - maxDistance,
|
pointLondon.x - maxDistance,
|
||||||
pointLondon.y - maxDistance,
|
pointLondon.y - maxDistance,
|
||||||
maxDistance * 2,
|
maxDistance * 2,
|
||||||
maxDistance * 2);
|
maxDistance * 2);
|
||||||
localArchive.getTitlesInCoords(rectLondon, 30, callbackTitlesNearbyLondonFound);
|
localArchive.getTitlesInCoords(rectLondon, 100, callbackTitlesNearbyLondonFound);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
module("evopedia_random_title");
|
module("evopedia_random_title");
|
||||||
asyncTest("check that a random title is found", function() {
|
asyncTest("check that a random title is found", function() {
|
||||||
|
@ -674,14 +674,7 @@ define(function(require) {
|
|||||||
else {
|
else {
|
||||||
// Search is over : now let's convert the title positions into Title instances
|
// Search is over : now let's convert the title positions into Title instances
|
||||||
if (titlePositionsFound && titlePositionsFound.length > 0) {
|
if (titlePositionsFound && titlePositionsFound.length > 0) {
|
||||||
// TODO find out why there are duplicates, and why the maxTitles is not respected
|
LocalArchive.readTitlesFromTitleCoordsInTitleFile(localArchive, titlePositionsFound, 0, new Array(), callbackFunction);
|
||||||
// The statement below removes duplicates and limits its size
|
|
||||||
// (not correctly because based on indexes of the original array, instead of target array)
|
|
||||||
// This should be removed when the cause is found
|
|
||||||
var filteredTitlePositions = titlePositionsFound.filter(function (e, i, arr) {
|
|
||||||
return arr.lastIndexOf(e) === i && i<=maxTitles;
|
|
||||||
});
|
|
||||||
LocalArchive.readTitlesFromTitleCoordsInTitleFile(localArchive, filteredTitlePositions, 0, new Array(), callbackFunction);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
callbackFunction(titlePositionsFound);
|
callbackFunction(titlePositionsFound);
|
||||||
@ -789,8 +782,6 @@ define(function(require) {
|
|||||||
if (targetRect.intersect(rectNE)) {
|
if (targetRect.intersect(rectNE)) {
|
||||||
LocalArchive.getTitlesInCoordsInt(localArchive, coordinateFileIndex, pos3, targetRect, rectNE, maxTitles, titlePositionsFound, callbackFunction, callbackGetTitlesInCoordsInt);
|
LocalArchive.getTitlesInCoordsInt(localArchive, coordinateFileIndex, pos3, targetRect, rectNE, maxTitles, titlePositionsFound, callbackFunction, callbackGetTitlesInCoordsInt);
|
||||||
}
|
}
|
||||||
// TODO : it seems possible that targetRect does not intersect any of the 4 rectangles
|
|
||||||
// Is it normal? In this case, the callback is never called
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is a leaf node : let's see if its articles are in the
|
// This is a leaf node : let's see if its articles are in the
|
||||||
|
@ -447,7 +447,7 @@ define(function(require) {
|
|||||||
// Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
|
// Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
|
||||||
// If width < 0 the function swaps the left and right corners,
|
// If width < 0 the function swaps the left and right corners,
|
||||||
// and it swaps the top and bottom corners if height < 0
|
// and it swaps the top and bottom corners if height < 0
|
||||||
// like in http://harmattan-dev.nokia.com/docs/library/html/qt4/qrectf.html#normalized
|
// like in http://qt-project.org/doc/qt-4.8/qrectf.html#normalized
|
||||||
normalized: function() {
|
normalized: function() {
|
||||||
var newx = this.x;
|
var newx = this.x;
|
||||||
var newy = this.y;
|
var newy = this.y;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user