Add binoculars theme, auto reformat everything
This commit is contained in:
parent
38dea806c5
commit
78d6482c88
586 changed files with 115573 additions and 111842 deletions
|
@ -111,74 +111,74 @@ export default class GeoOperationsSpec extends T {
|
|||
|
||||
const isTrue = GeoOperationsSpec.isTrue;
|
||||
const isFalse = GeoOperationsSpec.isFalse;
|
||||
|
||||
|
||||
isFalse(GeoOperations.inside(GeoOperationsSpec.inHole, GeoOperationsSpec.multiPolygon), "InHole was detected as true");
|
||||
isTrue(GeoOperations.inside(GeoOperationsSpec.inMultiPolygon, GeoOperationsSpec.multiPolygon), "InMultiPolgyon was not detected as true");
|
||||
isFalse(GeoOperations.inside(GeoOperationsSpec.outsidePolygon, GeoOperationsSpec.multiPolygon), "OutsideOfPolygon was detected as true");
|
||||
|
||||
}],
|
||||
["Intersection between a line and a polygon", () => {
|
||||
const line = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
3.779296875,
|
||||
48.777912755501845
|
||||
],
|
||||
[
|
||||
1.23046875,
|
||||
47.60616304386874
|
||||
["Intersection between a line and a polygon", () => {
|
||||
const line = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
3.779296875,
|
||||
48.777912755501845
|
||||
],
|
||||
[
|
||||
1.23046875,
|
||||
47.60616304386874
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const overlap = GeoOperations.calculateOverlap(line, [GeoOperationsSpec.polygon]);
|
||||
Assert.equal(1, overlap.length)
|
||||
}],
|
||||
["Fully enclosed", () => {
|
||||
const line = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
0.0439453125,
|
||||
47.31648293428332
|
||||
],
|
||||
[
|
||||
0.6591796875,
|
||||
46.77749276376827
|
||||
const overlap = GeoOperations.calculateOverlap(line, [GeoOperationsSpec.polygon]);
|
||||
Assert.equal(1, overlap.length)
|
||||
}],
|
||||
["Fully enclosed", () => {
|
||||
const line = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[
|
||||
0.0439453125,
|
||||
47.31648293428332
|
||||
],
|
||||
[
|
||||
0.6591796875,
|
||||
46.77749276376827
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const overlap = GeoOperations.calculateOverlap(line, [GeoOperationsSpec.polygon]);
|
||||
Assert.equal(1, overlap.length)
|
||||
}],
|
||||
["overlapWith matches points too", () => {
|
||||
const point = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
2.274169921875,
|
||||
46.76244305208004
|
||||
]
|
||||
}
|
||||
};
|
||||
const overlap = GeoOperations.calculateOverlap(line, [GeoOperationsSpec.polygon]);
|
||||
Assert.equal(1, overlap.length)
|
||||
}],
|
||||
["overlapWith matches points too", () => {
|
||||
const point = {
|
||||
"type": "Feature",
|
||||
"properties": {},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
2.274169921875,
|
||||
46.76244305208004
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
const overlap = GeoOperations.calculateOverlap(point, [GeoOperationsSpec.polygon]);
|
||||
Assert.equal(1, overlap.length)
|
||||
}]
|
||||
]
|
||||
)
|
||||
|
||||
const overlap = GeoOperations.calculateOverlap(point, [GeoOperationsSpec.polygon]);
|
||||
Assert.equal(1, overlap.length)
|
||||
}]
|
||||
]
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import {Utils} from "../Utils";
|
||||
|
||||
Utils.runningFromConsole = true;
|
||||
import {equal} from "assert";
|
||||
import T from "./TestHelper";
|
||||
import {Translation} from "../UI/i18n/Translation";
|
||||
import AllKnownLayers from "../Customizations/AllKnownLayers";
|
||||
import * as bike_repair_station from "../assets/layers/bike_repair_station/bike_repair_station.json"
|
||||
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
|
||||
|
||||
Utils.runningFromConsole = true;
|
||||
|
||||
export default class ImageAttributionSpec extends T {
|
||||
constructor() {
|
||||
super(
|
||||
|
@ -15,7 +14,7 @@ export default class ImageAttributionSpec extends T {
|
|||
[
|
||||
"Should find all the images",
|
||||
() => {
|
||||
const pumps: LayerConfig = new LayerConfig(bike_repair_station )
|
||||
const pumps: LayerConfig = new LayerConfig(bike_repair_station)
|
||||
const images = pumps.ExtractImages();
|
||||
const expectedValues = ['./assets/layers/bike_repair_station/repair_station.svg',
|
||||
'./assets/layers/bike_repair_station/repair_station_pump.svg',
|
||||
|
|
|
@ -23,7 +23,7 @@ export default class ImageSearcherSpec extends T {
|
|||
|
||||
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,25 +15,25 @@ export default class OsmConnectionSpec extends T {
|
|||
super("OsmConnectionSpec-test", [
|
||||
["login on dev",
|
||||
() => {
|
||||
const osmConn = new OsmConnection(false,false,
|
||||
const osmConn = new OsmConnection(false, false,
|
||||
new UIEventSource<string>(undefined),
|
||||
"Unit test",
|
||||
true,
|
||||
"osm-test"
|
||||
)
|
||||
|
||||
osmConn.userDetails.map((userdetails : UserDetails) => {
|
||||
if(userdetails.loggedIn){
|
||||
console.log("Logged in with the testing account. Writing some random data to test preferences")
|
||||
const data = Math.random().toString()
|
||||
osmConn.GetPreference("test").setData(data)
|
||||
|
||||
osmConn.GetPreference("https://raw.githubusercontent.com/AgusQui/MapCompleteRailway/main/railway")
|
||||
.setData(data)
|
||||
|
||||
}
|
||||
|
||||
osmConn.userDetails.map((userdetails: UserDetails) => {
|
||||
if (userdetails.loggedIn) {
|
||||
console.log("Logged in with the testing account. Writing some random data to test preferences")
|
||||
const data = Math.random().toString()
|
||||
osmConn.GetPreference("test").setData(data)
|
||||
|
||||
osmConn.GetPreference("https://raw.githubusercontent.com/AgusQui/MapCompleteRailway/main/railway")
|
||||
.setData(data)
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ScriptUtils.sleep(1000)
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ export default class OsmObjectSpec extends T {
|
|||
|
||||
timeout--;
|
||||
}
|
||||
if(!downloaded){
|
||||
if (!downloaded) {
|
||||
throw "Timeout: referencing ways not found"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ export default class TagSpec extends T {
|
|||
equal(notEmptyList.matchesProperties({"xyz": undefined}), true);
|
||||
equal(notEmptyList.matchesProperties({"xyz": "[]"}), false);
|
||||
equal(notEmptyList.matchesProperties({"xyz": "[\"abc\"]"}), true);
|
||||
|
||||
|
||||
let compare = TagUtils.Tag("key<=5")
|
||||
equal(compare.matchesProperties({"key": undefined}), false);
|
||||
equal(compare.matchesProperties({"key": "6"}), false);
|
||||
|
@ -195,7 +195,7 @@ export default class TagSpec extends T {
|
|||
console.log(overpass)
|
||||
equal(overpass[0], "[\"boundary\"=\"protected_area\"][\"protect_class\"!~\"^98$\"]")
|
||||
|
||||
const or = {
|
||||
const or = {
|
||||
or: [
|
||||
"leisure=nature_reserve",
|
||||
t
|
||||
|
@ -205,10 +205,12 @@ export default class TagSpec extends T {
|
|||
equal(2, overpassOr.length)
|
||||
equal(overpassOr[1], "[\"boundary\"=\"protected_area\"][\"protect_class\"!~\"^98$\"]")
|
||||
|
||||
const orInOr = {or:[
|
||||
"amenity=drinking_water",
|
||||
or
|
||||
]}
|
||||
const orInOr = {
|
||||
or: [
|
||||
"amenity=drinking_water",
|
||||
or
|
||||
]
|
||||
}
|
||||
const overpassOrInor = TagUtils.Tag(orInOr).asOverpass()
|
||||
equal(3, overpassOrInor.length)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Utils} from "../Utils";Utils.runningFromConsole = true;
|
||||
import {Utils} from "../Utils";
|
||||
import TagSpec from "./Tag.spec";
|
||||
import ImageAttributionSpec from "./ImageAttribution.spec";
|
||||
import GeoOperationsSpec from "./GeoOperations.spec";
|
||||
|
@ -13,6 +13,7 @@ import OsmObjectSpec from "./OsmObject.spec";
|
|||
import ScriptUtils from "../scripts/ScriptUtils";
|
||||
import UnitsSpec from "./Units.spec";
|
||||
|
||||
Utils.runningFromConsole = true;
|
||||
|
||||
|
||||
export default class TestAll {
|
||||
|
@ -45,6 +46,6 @@ const allTests = [
|
|||
|
||||
for (const test of allTests) {
|
||||
if (test.failures.length > 0) {
|
||||
throw "Some test failed: "+test.failures.join(", ")
|
||||
throw "Some test failed: " + test.failures.join(", ")
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
export default class T {
|
||||
|
||||
public readonly failures : string[] = []
|
||||
public readonly name : string;
|
||||
public readonly failures: string[] = []
|
||||
public readonly name: string;
|
||||
|
||||
constructor(testsuite: string, tests: [string, () => void][]) {
|
||||
this.name = testsuite
|
||||
|
@ -32,6 +32,7 @@ export default class T {
|
|||
throw "Expected true, but got false: " + msg
|
||||
}
|
||||
}
|
||||
|
||||
static isFalse(b: boolean, msg: string) {
|
||||
if (b) {
|
||||
throw "Expected false, but got true: " + msg
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
import T from "./TestHelper";
|
||||
import {Utils} from "../Utils";
|
||||
|
||||
Utils.runningFromConsole = true;
|
||||
import TagRenderingQuestion from "../UI/Popup/TagRenderingQuestion";
|
||||
import {UIEventSource} from "../Logic/UIEventSource";
|
||||
import * as assert from "assert";
|
||||
import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig";
|
||||
import {LayoutConfigJson} from "../Models/ThemeConfig/Json/LayoutConfigJson";
|
||||
import LayoutConfig from "../Models/ThemeConfig/LayoutConfig";
|
||||
|
||||
export default class ThemeSpec extends T{
|
||||
Utils.runningFromConsole = true;
|
||||
|
||||
export default class ThemeSpec extends T {
|
||||
constructor() {
|
||||
super("Theme tests",
|
||||
[
|
||||
["Nested overrides work", () => {
|
||||
|
||||
const themeConfigJson : LayoutConfigJson = {
|
||||
const themeConfigJson: LayoutConfigJson = {
|
||||
description: "Descr",
|
||||
icon: "",
|
||||
language: ["en"],
|
||||
|
@ -23,7 +20,7 @@ export default class ThemeSpec extends T{
|
|||
{
|
||||
builtin: "public_bookcase",
|
||||
override: {
|
||||
source:{
|
||||
source: {
|
||||
geoJson: "xyz"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ import T from "./TestHelper";
|
|||
import {Utils} from "../Utils";
|
||||
import {equal} from "assert";
|
||||
import LZString from "lz-string";
|
||||
import * as Assert from "assert";
|
||||
import * as assert from "assert";
|
||||
|
||||
export default class UtilsSpec extends T {
|
||||
private static readonly example = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue