mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-22 03:52:21 -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);
|
||||
});
|
||||
|
||||
/*
|
||||
asyncTest("check articles found nearby London", function() {
|
||||
expect(2);
|
||||
expect(3);
|
||||
var callbackTitlesNearbyLondonFound = function(titleList) {
|
||||
ok(titleList !== null, "Some titles should be found");
|
||||
ok(titleList.length > 0, "At least one title should be found");
|
||||
var titleLondon = null;
|
||||
for (var i=0; i<titleList.length; i++) {
|
||||
var title = titleList[i];
|
||||
@ -342,15 +342,14 @@ define(function(require) {
|
||||
start();
|
||||
};
|
||||
var pointLondon = new geometry.point(51, 0);
|
||||
var maxDistance = 100;
|
||||
var maxDistance = 1;
|
||||
var rectLondon = new geometry.rect(
|
||||
pointLondon.x - maxDistance,
|
||||
pointLondon.y - maxDistance,
|
||||
maxDistance * 2,
|
||||
maxDistance * 2);
|
||||
localArchive.getTitlesInCoords(rectLondon, 30, callbackTitlesNearbyLondonFound);
|
||||
localArchive.getTitlesInCoords(rectLondon, 100, callbackTitlesNearbyLondonFound);
|
||||
});
|
||||
*/
|
||||
|
||||
module("evopedia_random_title");
|
||||
asyncTest("check that a random title is found", function() {
|
||||
|
@ -674,14 +674,7 @@ define(function(require) {
|
||||
else {
|
||||
// Search is over : now let's convert the title positions into Title instances
|
||||
if (titlePositionsFound && titlePositionsFound.length > 0) {
|
||||
// TODO find out why there are duplicates, and why the maxTitles is not respected
|
||||
// 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);
|
||||
LocalArchive.readTitlesFromTitleCoordsInTitleFile(localArchive, titlePositionsFound, 0, new Array(), callbackFunction);
|
||||
}
|
||||
else {
|
||||
callbackFunction(titlePositionsFound);
|
||||
@ -789,8 +782,6 @@ define(function(require) {
|
||||
if (targetRect.intersect(rectNE)) {
|
||||
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 {
|
||||
// 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.
|
||||
// If width < 0 the function swaps the left and right corners,
|
||||
// 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() {
|
||||
var newx = this.x;
|
||||
var newy = this.y;
|
||||
|
Loading…
x
Reference in New Issue
Block a user