[gnome-maps/wip/mlundblad/maps-uri: 1/2] Rename URL module
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/maps-uri: 1/2] Rename URL module
- Date: Sun, 31 Oct 2021 22:01:30 +0000 (UTC)
commit a4adf6c1de2b32a6f20fe5b53deb268f5035bf87
Author: Marcus Lundblad <ml update uu se>
Date: Sun Oct 31 22:57:33 2021 +0100
Rename URL module
To prepare for adding functions to
parse maps: URIs rename the module
to reflect its intention for not
only HTTP URL-related functions.
src/org.gnome.Maps.src.gresource.xml.in | 2 +-
src/place.js | 6 +++---
src/{urls.js => uris.js} | 0
tests/meson.build | 2 +-
tests/{urlsTest.js => urisTest.js} | 26 +++++++++++++-------------
5 files changed, 18 insertions(+), 18 deletions(-)
---
diff --git a/src/org.gnome.Maps.src.gresource.xml.in b/src/org.gnome.Maps.src.gresource.xml.in
index c4f10655..2338a132 100644
--- a/src/org.gnome.Maps.src.gresource.xml.in
+++ b/src/org.gnome.Maps.src.gresource.xml.in
@@ -107,7 +107,7 @@
<file>turnPointMarker.js</file>
<file>userLocationMarker.js</file>
<file>utils.js</file>
- <file>urls.js</file>
+ <file>uris.js</file>
<file>wikipedia.js</file>
<file>xmldom/dom.js</file>
<file>xmldom/domparser.js</file>
diff --git a/src/place.js b/src/place.js
index 2c2a1a12..b772a46c 100644
--- a/src/place.js
+++ b/src/place.js
@@ -29,7 +29,7 @@ const GObject = imports.gi.GObject;
const Location = imports.location;
const Overpass = imports.overpass;
const PlaceIcons = imports.placeIcons;
-const URLS = imports.urls;
+const URIS = imports.uris;
const Utils = imports.utils;
// Matches coordinates string in 'Decimal Degrees' format
@@ -503,7 +503,7 @@ let overpass = null;
const Application = imports.application;
function parseHttpURL(text, callback) {
- let [type, id] = URLS.parseAsObjectURL(text);
+ let [type, id] = URIS.parseAsObjectURL(text);
if (type && id) {
let storedPlace = Application.placeStore.existsWithOsmTypeAndId(type, id);
@@ -525,7 +525,7 @@ function parseHttpURL(text, callback) {
callback(null, _("Place not found in OpenStreetMap"));
});
} else {
- let [lat, lon, zoom] = URLS.parseAsCoordinateURL(text);
+ let [lat, lon, zoom] = URIS.parseAsCoordinateURL(text);
if (lat && lon) {
if (!Place.validateCoordinates(lat, lon)) {
diff --git a/src/urls.js b/src/uris.js
similarity index 100%
rename from src/urls.js
rename to src/uris.js
diff --git a/tests/meson.build b/tests/meson.build
index e4b07369..4d3abab6 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,6 +1,6 @@
tests = ['addressTest', 'boundingBoxTest', 'colorTest', 'osmNamesTest',
'placeIconsTest', 'timeTest', 'translationsTest', 'utilsTest',
- 'urlsTest', 'wikipediaTest']
+ 'urisTest', 'wikipediaTest']
foreach test : tests
script_conf = configuration_data()
diff --git a/tests/urlsTest.js b/tests/urisTest.js
similarity index 71%
rename from tests/urlsTest.js
rename to tests/urisTest.js
index b276df98..60848ec7 100644
--- a/tests/urlsTest.js
+++ b/tests/urisTest.js
@@ -21,7 +21,7 @@
const JsUnit = imports.jsUnit;
-const URLS = imports.urls;
+const URIS = imports.uris;
const OSM_COORD_URL1 =
'https://www.openstreetmap.org/?lat=39.9882&lon=-78.2409&zoom=14&layers=B000FTF';
@@ -32,31 +32,31 @@ function main() {
}
function parseAsObjectURLTest() {
- _assertArrayEquals([], URLS.parseAsObjectURL('https://www.example.com'));
- _assertArrayEquals([], URLS.parseAsObjectURL('https://www.openstreet.org/'));
+ _assertArrayEquals([], URIS.parseAsObjectURL('https://www.example.com'));
+ _assertArrayEquals([], URIS.parseAsObjectURL('https://www.openstreet.org/'));
_assertArrayEquals(['node', 1],
- URLS.parseAsObjectURL('https://www.openstreetmap.org/node/1'));
+ URIS.parseAsObjectURL('https://www.openstreetmap.org/node/1'));
_assertArrayEquals(['way', 2],
- URLS.parseAsObjectURL('https://www.openstreetmap.org/way/2'));
+ URIS.parseAsObjectURL('https://www.openstreetmap.org/way/2'));
_assertArrayEquals(['relation', 3],
- URLS.parseAsObjectURL('https://www.openstreetmap.org/relation/3'));
+ URIS.parseAsObjectURL('https://www.openstreetmap.org/relation/3'));
_assertArrayEquals([],
- URLS.parseAsObjectURL('https://www.openstreetmap.org/foo/1'));
+ URIS.parseAsObjectURL('https://www.openstreetmap.org/foo/1'));
_assertArrayEquals(['node', 4],
- URLS.parseAsObjectURL('https://openstreetmap.org/node/4'));
+ URIS.parseAsObjectURL('https://openstreetmap.org/node/4'));
_assertArrayEquals(['node', 5],
- URLS.parseAsObjectURL('http://www.openstreetmap.org/node/5'));
+ URIS.parseAsObjectURL('http://www.openstreetmap.org/node/5'));
}
function parseAsCoordinateURLTest() {
_assertArrayEquals([],
- URLS.parseAsCoordinateURL('https://www.example.com'));
+ URIS.parseAsCoordinateURL('https://www.example.com'));
_assertArrayEquals([],
- URLS.parseAsCoordinateURL('https://www.openstreet.org/'));
+ URIS.parseAsCoordinateURL('https://www.openstreet.org/'));
_assertArrayEquals([39.9882, -78.2409, 14],
-
URLS.parseAsCoordinateURL('https://www.openstreetmap.org/?lat=39.9882&lon=-78.2409&zoom=14&layers=B000FTF'));
+
URIS.parseAsCoordinateURL('https://www.openstreetmap.org/?lat=39.9882&lon=-78.2409&zoom=14&layers=B000FTF'));
_assertArrayEquals([59.40538, 17.34894, 12],
-
URLS.parseAsCoordinateURL('https://www.openstreetmap.org/?#map=12/59.40538/17.34894'));
+
URIS.parseAsCoordinateURL('https://www.openstreetmap.org/?#map=12/59.40538/17.34894'));
}
function _assertArrayEquals(arr1, arr2) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]