From 4ab5be3c14f282e5ea4f843cc8721d5f57c18c83 Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 5 Mar 2015 21:47:50 +0100 Subject: [PATCH 01/77] calculate background-position without helper element --- js/editor.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/js/editor.js b/js/editor.js index 837ce20..1a384de 100644 --- a/js/editor.js +++ b/js/editor.js @@ -201,19 +201,20 @@ function Map(sizex, sizey) { map.setHtml("mapsize", map.mapsizex + "x" + map.mapsizey); - for (var i = 0; i < map.mapsizey + (map.borderSize * 2); i++) { + // saving the current col/row of a room + var importedRooms = {}; + + for (var row = 0; row < map.mapsizey + (map.borderSize * 2); row++) { var tr = document.createElement("tr"); - tr.setAttribute('id', 'row_' + i); + tr.setAttribute('id', 'row_' + row); tr.setAttribute('style', 'height: ' + map.tileSize + 'px;'); - for (var k = 0; k < map.mapsizex + (map.borderSize * 2); k++) { + for (var col = 0; col < map.mapsizex + (map.borderSize * 2); col++) { var tile = document.createElement("td"); - tile.setAttribute('id', 'col_' + i + '_' + k); + tile.setAttribute('id', 'col_' + row + '_' + col); var roomTile = map.defaultTile; - var isBorder = map.borderSize > 0 && i <= map.borderSize - 1 || k <= map.borderSize - 1 || i >= map.mapsizey + map.borderSize || k >= map.mapsizex + map.borderSize; + var isBorder = map.borderSize > 0 && row <= map.borderSize - 1 || col <= map.borderSize - 1 || row >= map.mapsizey + map.borderSize || col >= map.mapsizex + map.borderSize; var id = null; - var row = null; - var col = null; if (!isBorder) { // we don't want to listen to this events on the border @@ -231,25 +232,25 @@ function Map(sizex, sizey) { tile.onmousemove = map.hideInfoBox; } else if (mapObject && mapObject.map && mapObject.tileIds && mapObject.tiles) { // import map - var cell = mapObject.map[i - map.borderSize][k - map.borderSize]; + var cell = mapObject.map[row - map.borderSize][col- map.borderSize]; roomTile = mapObject.tiles[cell["tile"]]; - row = cell["data-pos-y"]; - col = cell["data-pos-x"]; id = !isNaN(cell["data-id"]) && mapObject.tileIds[cell["data-id"]] || null; if (id) { tile.setAttribute("data-id", id); - if (row && col) { - map.tiles[id] = map.tiles[id] || []; - map.tiles[id].push("col_" + i + "_" + k ); - tile.setAttribute("data-pos-x", col); - tile.setAttribute("data-pos-y", row); + map.tiles[id] = map.tiles[id] || []; + if (map.tiles[id].length == 0) { + // mark the start point of a new room + importedRooms[id] = { col: col, row: row } } + map.tiles[id].push("col_" + row+ "_" + col ); + tile.setAttribute("data-pos-x", col - importedRooms[id].col); + tile.setAttribute("data-pos-y", row - importedRooms[id].row); } } else if (mapObject && (!mapObject.map || !mapObject.tileIds || !mapObject.tiles)) { throw new Error("Invalid map file!"); } - map.setTile(tile, roomTile, row, col); + map.setTile(tile, roomTile); tr.appendChild(tile); } table.appendChild(tr); @@ -497,12 +498,14 @@ function Map(sizex, sizey) { return tile.style.backgroundPosition; } - this.setTile = function(tile, currentTile, row, col) { + this.setTile = function(tile, currentTile) { var roomTile = tiles[currentTile]; if (roomTile) { tile.setAttribute("class", currentTile); tile.style.backgroundSize = parseInt(map.tileSize * roomTile.sizex) + "px " + parseInt(map.tileSize * roomTile.sizey)+ "px "; - if (!isNaN(parseInt(row)) && !isNaN(parseInt(col))) { + var col = parseInt(tile.getAttribute("data-pos-x")); + var row = parseInt(tile.getAttribute("data-pos-y")); + if (!isNaN(col) && !isNaN(row)) { map.setTilePosition(tile, parseInt(-col * map.tileSize) + "px " + parseInt(-row * map.tileSize) + "px"); } } else { From c59b5601f1e2ec01f68875b3a606ad1912d2361c Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 5 Mar 2015 21:47:56 +0100 Subject: [PATCH 02/77] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5ccc9c..cfab6a5 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This map editor should make it fairly easy to create and share maps for "War for - [ ] Resizing of current Map - [ ] Rotate Mirror 1 Feature - [ ] Undo/Redo -- [ ] Get rid of the position in the mapfile on bigger rooms and calculate it instead +- [x] Get rid of the position in the mapfile on bigger rooms and calculate it instead - [ ] Name input field for files (with versioning) ### Known Issues: From 1b59ba901418195ab8bf1060a8556a688a0a88d2 Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 5 Mar 2015 22:06:18 +0100 Subject: [PATCH 03/77] update readme --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cfab6a5..7a539f6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # wfto-mapeditor This map editor should make it fairly easy to create and share maps for "War for the Overworld" +### Release 1.3 +#### New Features: + +#### Improvements: +- Get rid of the position in the mapfile on bigger rooms and calculate it instead + ### Release 1.2 #### New Features: - Drag and drop import of mapfiles @@ -33,11 +39,10 @@ This map editor should make it fairly easy to create and share maps for "War for - [ ] Resizing of current Map - [ ] Rotate Mirror 1 Feature - [ ] Undo/Redo -- [x] Get rid of the position in the mapfile on bigger rooms and calculate it instead - [ ] Name input field for files (with versioning) ### Known Issues: - Bigger rooms are not shown if the cursor is too close the border (as they are not placeable anyway) Special Thanks to: -- Marrados: for helping with the assets +- Marados: for helping with the assets From 4ef88cc287d3330d05d0ddbe0dcc8cbbc7656d31 Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 6 Mar 2015 11:43:22 +0100 Subject: [PATCH 04/77] remove position data from imported csv map data --- js/options.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/options.js b/js/options.js index fa86f20..cfbd2a5 100644 --- a/js/options.js +++ b/js/options.js @@ -455,8 +455,6 @@ function importCsv() { for (var posx = 0; posx < roomTile.sizex; posx++) { mapData.map[y + posy][x + posx]['tile'] = tileId; mapData.map[y + posy][x + posx]['data-id'] = mapData.tileIds.length - 1; - mapData.map[y + posy][x + posx]['data-pos-x'] = posx.toString(); - mapData.map[y + posy][x + posx]['data-pos-y'] = posy.toString(); } } } From 24255a56d9398835affc699ccfc6955c16b9f94f Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 6 Mar 2015 11:46:01 +0100 Subject: [PATCH 05/77] remove position data from exported map data --- js/editor.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/editor.js b/js/editor.js index 1a384de..838ac8e 100644 --- a/js/editor.js +++ b/js/editor.js @@ -475,8 +475,6 @@ function Map(sizex, sizey) { tileId = mapData.tileIds.length - 1; } col["data-id"] = tileId; - col["data-pos-x"] = tile.getAttribute("data-pos-x"); - col["data-pos-y"] = tile.getAttribute("data-pos-y"); } col["tile"] = tileTypeId; From 8c4d82d28df87fd5178b9e548af495a4a8cf7150 Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 6 Mar 2015 11:51:36 +0100 Subject: [PATCH 06/77] update map version --- js/editor.js | 2 +- js/options.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/editor.js b/js/editor.js index 838ac8e..62604cc 100644 --- a/js/editor.js +++ b/js/editor.js @@ -436,7 +436,7 @@ function Map(sizex, sizey) { this.mapToJson = function(author){ var table = document.getElementById("map"); var mapData = { - version: "1.2", + version: "1.3", author: author || "", border: map.borderSize, tiles: [], diff --git a/js/options.js b/js/options.js index cfbd2a5..590fb03 100644 --- a/js/options.js +++ b/js/options.js @@ -326,7 +326,7 @@ function importCsv() { var calcRooms = []; var usedCores = []; var mapData = { - version: "1.2", + version: "1.3", author: "", border: 1, tiles: [], From 41fe6c5d89a363bf372390a03a52f9e9b55d0d66 Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 6 Mar 2015 15:40:03 +0100 Subject: [PATCH 07/77] remove position data from mirroring --- js/editor.js | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/js/editor.js b/js/editor.js index 62604cc..949ea4e 100644 --- a/js/editor.js +++ b/js/editor.js @@ -546,11 +546,6 @@ function Map(sizex, sizey) { * Mirrors a part of the map to get a better * @param mirrorType determines how the map should be mirrored * It's the sum of the cellvalues in the option menu - * --------- - * | 1 | 2 | - * --------- - * | 3 | 4 | - * --------- */ this.mirrorMap = function(mirrorType, reverse) { var mapObject = map.mapToJson(); @@ -623,10 +618,6 @@ function Map(sizex, sizey) { map.forEachCell(x1, x2, y1, y2, function(col, row) { // clone the mapobject cell var mirrorPart = JSON.parse(JSON.stringify(mapObject.map[row][col])); - var posy = mirrorPart['data-pos-y']; - var newPosy = 0; - var posx = mirrorPart['data-pos-x']; - var newPosx = 0; var newCol = map.mapsizex - 1 - col; var newHCol = reverse ? (x2 - 1 - col) : col; var newRow = map.mapsizey - 1 - row; @@ -682,29 +673,9 @@ function Map(sizex, sizey) { } } - if (posx && posy) { - // parse it to string, otherwise the import fails - newPosx = (tiles[tileName].sizex - posx - 1).toString(); - newPosy = (tiles[tileName].sizey - posy - 1).toString(); - } - if (type == "horizontal") { - // fix tileposition - if (reverse && posx){ - mirrorPart['data-pos-x'] = newPosx; - } - if (posy) { - mirrorPart['data-pos-y'] = newPosy; - } mapObject.map[newRow][newHCol] = mirrorPart; } else { - // fix tileposition - if (reverse && posy){ - mirrorPart['data-pos-y'] = newPosy; - } - if (posx) { - mirrorPart['data-pos-x'] = newPosx; - } mapObject.map[newVRow][newCol] = mirrorPart; } }); From 70c2c159bae7b665257d686f02893a736ca29b07 Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 6 Mar 2015 15:55:27 +0100 Subject: [PATCH 08/77] fix positioning of tiles while on mouseover (displaying the room) --- js/editor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/editor.js b/js/editor.js index 949ea4e..0d30bda 100644 --- a/js/editor.js +++ b/js/editor.js @@ -519,6 +519,10 @@ function Map(sizex, sizey) { if (temp) { tile.setAttribute('data-temp', tile.getAttribute("class")); tile.setAttribute('data-temp-pos', map.getTilePosition(tile)); + + tile.setAttribute("data-pos-x", col); + tile.setAttribute("data-pos-y", row); + tile.style.opacity = "0.7"; } else { maxsize != 1 && tile.setAttribute("data-pos-x", col); From 02285758c5e37a32524cd4c1e815c6f027dd8e48 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 2 Mar 2015 15:08:47 +0100 Subject: [PATCH 09/77] add mapname input and versioning checkbox --- css/style.css | 5 +++++ index.html | 3 +++ js/editor.js | 2 ++ js/options.js | 39 +++++++++++++++++++++++++++++++++++---- js/storage.js | 16 +++++++++++++--- 5 files changed, 58 insertions(+), 7 deletions(-) diff --git a/css/style.css b/css/style.css index 32ea3c8..2f372fc 100644 --- a/css/style.css +++ b/css/style.css @@ -147,4 +147,9 @@ td:hover { text-align: center; margin-top: 20%; font-size: 45px; +} + +#versionInfo { + display: none; + margin-top: 3px; } \ No newline at end of file diff --git a/index.html b/index.html index 6373aa1..220bca9 100644 --- a/index.html +++ b/index.html @@ -47,6 +47,9 @@ Export Map +
+

Current version:

+
diff --git a/js/editor.js b/js/editor.js index 0d30bda..4f67c06 100644 --- a/js/editor.js +++ b/js/editor.js @@ -33,6 +33,7 @@ function Map(sizex, sizey) { this.tileMode = store.getItem("tileMode") || this.tileModeDefault; this.tileModes = [ /* 'lowres' not implemented ,*/ 'color', 'normal'/*, 'highres' not implemented */ ]; this.dropTimeout = 0; + this.version = "001"; this.mouseButton = { left: 0, middle: 1, @@ -187,6 +188,7 @@ function Map(sizex, sizey) { // only one map is allowed at the same time map.destroy(); map.createButtons(); + map.version = "001"; mapParent.ondrop = map.dropMap; mapParent.ondragover = map.dragOverMap; diff --git a/js/options.js b/js/options.js index 590fb03..8a54ab5 100644 --- a/js/options.js +++ b/js/options.js @@ -5,10 +5,13 @@ var fourth = document.getElementById('fourth'); var reverse = document.getElementById('reverse'); var extend = document.getElementById('extend'); + var versioning = document.getElementById('versioning'); reverse.checked = ""; extend.checked = ""; + versioning.checked = store.getItem("versioning") || false; + reverse.onchange = resetPreview; first.onmouseover = mirrorTable; @@ -179,8 +182,14 @@ function exportMap() { var author = ''; //document.getElementById("author").value; // export as base64 var data = btoa(terrain.export(author)); - var mapName = "Map.wfto"; - + var mapName = document.getElementById("mapName").value; + if (mapName.length < 1 && mapName.match(/[^A-Za-z0-9.-_ öüäÖÜÄ]/g)) { + alert("Invalid filename!"); + return; + } + mapName += versioning.checked ? "_" + terrain.version : ""; + mapName += ".wfto"; + // Use the native blob constructor var blob = new Blob([data], {type: "application/octet-stream"}); @@ -204,14 +213,25 @@ function importMap() { if (window.FileReader) { var files = document.getElementById("mapFile").files; - if (files.length == 1) { - + if (files.length == 1) { var reader = new FileReader(); reader.readAsText(files[0]); reader.onload = function(e) { // map geladen terrain.import(atob(this.result)); + + var name = files[0].name.split(".")[0]; + var nameInput = document.getElementById("mapName"); + + var version = name.split("_"); + if (version.length > 1) { + versioning.checked = true; + var newVersion = "00" + (version[1] -(-1)); + terrain.version = newVersion.substring(newVersion.length - 3); + } + + nameInput.value = version[0]; } } else { alert("Please select a valid map file"); @@ -301,6 +321,8 @@ function refreshOptions() { generalOptions.appendChild(document.createElement("br")); } general.insertBefore(generalOptions, saveOptions); + + setVersioning(document.getElementById("versioning")); } function toggleOptions(show) { @@ -469,4 +491,13 @@ function importCsv() { alert("Please select a valid map file"); } toggleOptions(false); +} + +function setVersioning(element) { + store.setItem(element.id, element.checked); + var mapVersion = document.getElementById("mapVersion"); + mapVersion.innerText = terrain.version; + + mapVersion.parentNode.style.display = element.checked ? "block" : "none"; + } \ No newline at end of file diff --git a/js/storage.js b/js/storage.js index f846570..f891bcb 100644 --- a/js/storage.js +++ b/js/storage.js @@ -28,8 +28,9 @@ function dataStorage() { }; this.getItem = function(name) { + var returnValue = null; if (this.localStorage) { - return localStorage.getItem(name); + returnValue = localStorage.getItem(name); } var nameEQ = name + "="; var ca = document.cookie.split(';'); @@ -37,10 +38,19 @@ function dataStorage() { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) { - return c.substring(nameEQ.length,c.length); + returnValue = c.substring(nameEQ.length, c.length); } } - return null; + + switch(returnValue) { + case "null": + case "undefined": + case "false": + case "true": + returnValue = JSON.parse(returnValue); + break; + } + return returnValue; }; this.removeItem = function(name) { From d388db3ce951d4e11328cfad9e84fc97c9aa0f86 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 2 Mar 2015 15:43:13 +0100 Subject: [PATCH 10/77] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a539f6..218b9a4 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ This map editor should make it fairly easy to create and share maps for "War for ### Release 1.3 #### New Features: +- Name input field for files (with versioning) #### Improvements: - Get rid of the position in the mapfile on bigger rooms and calculate it instead @@ -12,7 +13,7 @@ This map editor should make it fairly easy to create and share maps for "War for - Drag and drop import of mapfiles - Google CSV import -### Bugfixes: +#### Bugfixes: - Overall visual improvement of tiles - Add missing tiles - Replace siegeshrine asset with correct siegeshrine and add defence parts shrine @@ -39,7 +40,6 @@ This map editor should make it fairly easy to create and share maps for "War for - [ ] Resizing of current Map - [ ] Rotate Mirror 1 Feature - [ ] Undo/Redo -- [ ] Name input field for files (with versioning) ### Known Issues: - Bigger rooms are not shown if the cursor is too close the border (as they are not placeable anyway) From bcace6e851247d8b634bffd59474fd4a1179bb28 Mon Sep 17 00:00:00 2001 From: ufdada Date: Sun, 8 Mar 2015 21:05:57 +0100 Subject: [PATCH 11/77] fix vars for elements and further improvments -move mapName Input vars to init -try and catch for reading maps --- index.html | 2 +- js/options.js | 50 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 220bca9..fa570c2 100644 --- a/index.html +++ b/index.html @@ -49,7 +49,7 @@

Current version:

-
+
diff --git a/js/options.js b/js/options.js index 8a54ab5..4959aca 100644 --- a/js/options.js +++ b/js/options.js @@ -1,11 +1,12 @@ function initOptions() { - var first = document.getElementById('first'); - var second = document.getElementById('second'); - var third = document.getElementById('third'); - var fourth = document.getElementById('fourth'); - var reverse = document.getElementById('reverse'); - var extend = document.getElementById('extend'); - var versioning = document.getElementById('versioning'); + first = document.getElementById('first'); + second = document.getElementById('second'); + third = document.getElementById('third'); + fourth = document.getElementById('fourth'); + reverse = document.getElementById('reverse'); + extend = document.getElementById('extend'); + versioning = document.getElementById('versioning'); + mapNameInput = document.getElementById("mapName"); reverse.checked = ""; extend.checked = ""; @@ -182,7 +183,7 @@ function exportMap() { var author = ''; //document.getElementById("author").value; // export as base64 var data = btoa(terrain.export(author)); - var mapName = document.getElementById("mapName").value; + var mapName = mapNameInput.value; if (mapName.length < 1 && mapName.match(/[^A-Za-z0-9.-_ öüäÖÜÄ]/g)) { alert("Invalid filename!"); return; @@ -219,19 +220,23 @@ function importMap() { reader.onload = function(e) { // map geladen - terrain.import(atob(this.result)); - - var name = files[0].name.split(".")[0]; - var nameInput = document.getElementById("mapName"); - - var version = name.split("_"); - if (version.length > 1) { - versioning.checked = true; - var newVersion = "00" + (version[1] -(-1)); - terrain.version = newVersion.substring(newVersion.length - 3); + try { + terrain.import(atob(this.result)); + + var name = files[0].name.split(".")[0]; + + var version = name.split("_"); + if (version.length > 1) { + versioning.checked = true; + var newVersion = "00" + (version[1] -(-1)); + terrain.version = newVersion.substring(newVersion.length - 3); + } + + mapNameInput.value = version[0]; + } catch(e) { + alert("Please select a valid map file.\n" + e.message); + return; } - - nameInput.value = version[0]; } } else { alert("Please select a valid map file"); @@ -344,6 +349,10 @@ function importCsv() { var reader = new FileReader(); reader.readAsText(files[0]); + var mapName = files[0].name; + mapName = mapName.substr(0, mapName.lastIndexOf(".")); + mapNameInput.value = mapName; + reader.onload = function(e) { var calcRooms = []; var usedCores = []; @@ -355,6 +364,7 @@ function importCsv() { tileIds: [], map: [] } + var rows = this.result.split("\n"); if (rows.length > bordersize * bordersize) { for (var i = bordersize; i < rows.length - bordersize; i++) { From 748568a2b93c475a5517070d1b797bdd7ec960ab Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 16:25:02 +0100 Subject: [PATCH 12/77] better escape regex --- js/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/options.js b/js/options.js index 4959aca..3958fad 100644 --- a/js/options.js +++ b/js/options.js @@ -184,7 +184,7 @@ function exportMap() { // export as base64 var data = btoa(terrain.export(author)); var mapName = mapNameInput.value; - if (mapName.length < 1 && mapName.match(/[^A-Za-z0-9.-_ öüäÖÜÄ]/g)) { + if (mapName.length < 1 && mapName.match(/[^A-Za-z0-9\.\-\_\söüäÖÜÄ]/g)) { alert("Invalid filename!"); return; } From 875af36dd477de307e1e0b0516425414d44055a5 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 16:28:18 +0100 Subject: [PATCH 13/77] fix logic mistake --- js/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/options.js b/js/options.js index 3958fad..68047c0 100644 --- a/js/options.js +++ b/js/options.js @@ -184,7 +184,7 @@ function exportMap() { // export as base64 var data = btoa(terrain.export(author)); var mapName = mapNameInput.value; - if (mapName.length < 1 && mapName.match(/[^A-Za-z0-9\.\-\_\söüäÖÜÄ]/g)) { + if (mapName.length < 1 || mapName.match(/[^A-Za-z0-9\.\-\_\söüäÖÜÄ]/g)) { alert("Invalid filename!"); return; } From 992cb44d066bf3f013fe6067f1a0399a91d56142 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 16:49:17 +0100 Subject: [PATCH 14/77] check for correct filename --- js/options.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/options.js b/js/options.js index 68047c0..fc4c07b 100644 --- a/js/options.js +++ b/js/options.js @@ -1,4 +1,6 @@ -function initOptions() { +var invalidLetterRegex = /[^A-Za-z0-9\.\-\söüäÖÜÄ]/g; + +function initOptions() { first = document.getElementById('first'); second = document.getElementById('second'); third = document.getElementById('third'); @@ -184,7 +186,7 @@ function exportMap() { // export as base64 var data = btoa(terrain.export(author)); var mapName = mapNameInput.value; - if (mapName.length < 1 || mapName.match(/[^A-Za-z0-9\.\-\_\söüäÖÜÄ]/g)) { + if (mapName.length < 1 || mapName.match(invalidLetterRegex)) { alert("Invalid filename!"); return; } @@ -214,7 +216,12 @@ function importMap() { if (window.FileReader) { var files = document.getElementById("mapFile").files; - if (files.length == 1) { + if (files.length == 1) { + if (files[0].name.match(invalidLetterRegex)) { + alert("Invalid filename!"); + return; + } + var reader = new FileReader(); reader.readAsText(files[0]); @@ -346,6 +353,11 @@ function importCsv() { if (files.length == 1) { + if (files[0].name.match(invalidLetterRegex)) { + alert("Invalid filename!"); + return; + } + var reader = new FileReader(); reader.readAsText(files[0]); From 876da6c1773f4fbce7483b38227f1ca17ead6ca0 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 17:05:45 +0100 Subject: [PATCH 15/77] make version identification more stable --- js/options.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/options.js b/js/options.js index fc4c07b..2eac6bb 100644 --- a/js/options.js +++ b/js/options.js @@ -232,14 +232,17 @@ function importMap() { var name = files[0].name.split(".")[0]; - var version = name.split("_"); - if (version.length > 1) { + var versionIndex = name.lastIndexOf("_"); + var version = parseInt(name.substr(versionIndex + 1, 3)); + + if (versionIndex !== -1 && !isNaN(version)) { versioning.checked = true; - var newVersion = "00" + (version[1] -(-1)); + var newVersion = "00" + (version + 1); terrain.version = newVersion.substring(newVersion.length - 3); + name = name.substr(0, versionIndex); } - mapNameInput.value = version[0]; + mapNameInput.value = name; } catch(e) { alert("Please select a valid map file.\n" + e.message); return; From fe645ac643379dece08344d25a23daae6761f847 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 17:06:22 +0100 Subject: [PATCH 16/77] fix regex for maps with versioning --- js/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/options.js b/js/options.js index 2eac6bb..297fd53 100644 --- a/js/options.js +++ b/js/options.js @@ -1,4 +1,4 @@ -var invalidLetterRegex = /[^A-Za-z0-9\.\-\söüäÖÜÄ]/g; +var invalidLetterRegex = /[^A-Za-z0-9\.\-\_\söüäÖÜÄ]/g; function initOptions() { first = document.getElementById('first'); From abf87b39d2dbc0f19d4aa3a0a7133dbd305b575c Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 19:16:12 +0100 Subject: [PATCH 17/77] bugfix for having a dot in filename (not before the extension). Also uncheck the versioning if the imported mapfile has no versioning. --- js/options.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/options.js b/js/options.js index 297fd53..00f1550 100644 --- a/js/options.js +++ b/js/options.js @@ -229,17 +229,19 @@ function importMap() { // map geladen try { terrain.import(atob(this.result)); - - var name = files[0].name.split(".")[0]; + var filename = files[0].name; + var name = filename.substr(0, filename.lastIndexOf(".")); var versionIndex = name.lastIndexOf("_"); - var version = parseInt(name.substr(versionIndex + 1, 3)); + var version = name.substr(-3) -(-1); if (versionIndex !== -1 && !isNaN(version)) { versioning.checked = true; - var newVersion = "00" + (version + 1); - terrain.version = newVersion.substring(newVersion.length - 3); + var newVersion = "00" + version; + terrain.version = newVersion.substring(-3); name = name.substr(0, versionIndex); + } else { + versioning.checked = false; } mapNameInput.value = name; From 8e2625b642612f1c4b60f6c37aaf99e053aac2a2 Mon Sep 17 00:00:00 2001 From: ufdada Date: Sun, 8 Mar 2015 22:01:09 +0100 Subject: [PATCH 18/77] add rotate option (not functional right now) --- css/style.css | 13 +++++++++++++ index.html | 2 ++ js/options.js | 19 ++++++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/css/style.css b/css/style.css index 2f372fc..9f2cfab 100644 --- a/css/style.css +++ b/css/style.css @@ -103,6 +103,7 @@ td:hover { } #mirrorMap td { + width: 15px; padding: 5px; transition: all 0.3s; border: 1px solid black; @@ -117,6 +118,18 @@ td:hover { cursor: pointer; } +.rotate90 { + transform: rotate(90deg); +} + +.rotate180 { + transform: rotate(180deg); +} + +.rotate270 { + transform: rotate(270deg); +} + .mirrorVertical { transform: scale(1, -1); } diff --git a/index.html b/index.html index fa570c2..f85ae4a 100644 --- a/index.html +++ b/index.html @@ -68,6 +68,8 @@
+ +

diff --git a/js/options.js b/js/options.js index 00f1550..709e41d 100644 --- a/js/options.js +++ b/js/options.js @@ -11,11 +11,13 @@ function initOptions() { mapNameInput = document.getElementById("mapName"); reverse.checked = ""; + rotate.checked = ""; extend.checked = ""; versioning.checked = store.getItem("versioning") || false; reverse.onchange = resetPreview; + rotate.onchange = resetPreview; first.onmouseover = mirrorTable; second.onmouseover = mirrorTable; @@ -78,12 +80,20 @@ function mirrorPreview(type) { case 'first': first.setAttribute("class", "active"); second.innerHTML = '1'; - second.setAttribute("class", "mirrorHorizontal"); third.innerHTML = '1'; - third.setAttribute("class", "mirrorVertical"); fourth.innerHTML = '1'; - fourth.setAttribute("class", "mirrorBoth"); reverse.disabled = "disabled"; + rotate.disabled = ""; + fourth.setAttribute("class", "mirrorBoth"); + if (!rotate.checked) { + second.setAttribute("class", "mirrorHorizontal"); + third.setAttribute("class", "mirrorVertical"); + } else { + second.setAttribute("class", "rotate90"); + third.setAttribute("class", "rotate270"); + // four keeps the same + // fourth.setAttribute("class", "rotate180"); + } if (terrain.mapsizex * 2 > terrain.maxsize || terrain.mapsizey * 2 > terrain.maxsize) { extend.disabled = "disabled"; } @@ -91,6 +101,7 @@ function mirrorPreview(type) { case 'second': first.setAttribute("class", "active"); second.setAttribute("class", "active"); + rotate.disabled = "disabled"; if (store.localStorage) { third.innerHTML = '1'; fourth.innerHTML = '2'; @@ -121,6 +132,7 @@ function mirrorPreview(type) { default: first.setAttribute("class", "active"); third.setAttribute("class", "active"); + rotate.disabled = "disabled"; if (reverse.checked) { second.innerHTML = '3'; second.setAttribute("class", "mirrorBoth"); @@ -150,6 +162,7 @@ function resetPreview(){ function resetMirror() { reverse.disabled = ""; extend.disabled = ""; + rotate.disabled = ""; first.removeAttribute("class"); second.innerHTML = '2'; From 38405003470e6b95075c9d3cf8d085cf93fbb0fc Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 20:06:46 +0100 Subject: [PATCH 19/77] refactor enabling/disabling of checkboxes --- js/options.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/js/options.js b/js/options.js index 709e41d..6c9b5ab 100644 --- a/js/options.js +++ b/js/options.js @@ -10,9 +10,7 @@ function initOptions() { versioning = document.getElementById('versioning'); mapNameInput = document.getElementById("mapName"); - reverse.checked = ""; - rotate.checked = ""; - extend.checked = ""; + resetMirror(); versioning.checked = store.getItem("versioning") || false; @@ -78,13 +76,16 @@ function mirrorTable() { function mirrorPreview(type) { switch(type) { case 'first': + extend.disabled = ""; + reverse.disabled = "disabled"; + rotate.disabled = ""; + first.setAttribute("class", "active"); second.innerHTML = '1'; third.innerHTML = '1'; fourth.innerHTML = '1'; - reverse.disabled = "disabled"; - rotate.disabled = ""; fourth.setAttribute("class", "mirrorBoth"); + if (!rotate.checked) { second.setAttribute("class", "mirrorHorizontal"); third.setAttribute("class", "mirrorVertical"); @@ -99,9 +100,13 @@ function mirrorPreview(type) { } break; case 'second': + extend.disabled = ""; + reverse.disabled = ""; + rotate.disabled = "disabled"; + first.setAttribute("class", "active"); second.setAttribute("class", "active"); - rotate.disabled = "disabled"; + if (store.localStorage) { third.innerHTML = '1'; fourth.innerHTML = '2'; @@ -130,9 +135,13 @@ function mirrorPreview(type) { break; case 'third': default: + extend.disabled = ""; + reverse.disabled = ""; + rotate.disabled = "disabled"; + first.setAttribute("class", "active"); third.setAttribute("class", "active"); - rotate.disabled = "disabled"; + if (reverse.checked) { second.innerHTML = '3'; second.setAttribute("class", "mirrorBoth"); @@ -160,9 +169,12 @@ function resetPreview(){ } function resetMirror() { - reverse.disabled = ""; extend.disabled = ""; + reverse.disabled = ""; rotate.disabled = ""; + extend.disabled = "disabled"; + reverse.disabled = "disabled"; + rotate.disabled = "disabled"; first.removeAttribute("class"); second.innerHTML = '2'; From 6ff449cf4e86dfb66ff81983dfc07faf458eca84 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 9 Mar 2015 22:32:50 +0100 Subject: [PATCH 20/77] Check for correct mapsize (otherwise it wouldn't make sense to rotate it) --- js/options.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/options.js b/js/options.js index 6c9b5ab..edd4f9d 100644 --- a/js/options.js +++ b/js/options.js @@ -14,6 +14,7 @@ function initOptions() { versioning.checked = store.getItem("versioning") || false; + extend.onchange = resetPreview; reverse.onchange = resetPreview; rotate.onchange = resetPreview; @@ -95,6 +96,10 @@ function mirrorPreview(type) { // four keeps the same // fourth.setAttribute("class", "rotate180"); } + // both sides need to have the same size to work properly + if (extend.checked && terrain.mapsizex != terrain.mapsizey || !extend.checked && (terrain.mapsizex / 2 % 1 != 0 || terrain.mapsizex / 2 != terrain.mapsizey / 2)) { + rotate.disabled = "disabled"; + } if (terrain.mapsizex * 2 > terrain.maxsize || terrain.mapsizey * 2 > terrain.maxsize) { extend.disabled = "disabled"; } From b0778eec127a893fa48c638b6679c35fc315e75c Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 10 Mar 2015 12:42:56 +0100 Subject: [PATCH 21/77] Make rotation option functional --- js/editor.js | 48 ++++++++++++++++++++++++++++++++++++++---------- js/options.js | 4 +++- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/js/editor.js b/js/editor.js index 4f67c06..5becbca 100644 --- a/js/editor.js +++ b/js/editor.js @@ -553,7 +553,7 @@ function Map(sizex, sizey) { * @param mirrorType determines how the map should be mirrored * It's the sum of the cellvalues in the option menu */ - this.mirrorMap = function(mirrorType, reverse) { + this.mirrorMap = function(mirrorType, reverse, rotate) { var mapObject = map.mapToJson(); var cols = mapObject.map[0].length; var rows = mapObject.map.length; @@ -561,16 +561,16 @@ function Map(sizex, sizey) { switch(mirrorType) { case 'first': // mirror 1 & 3 to 2 & 4 - map.mirrorPart(mapObject, 0, parseInt(cols / 2), 0, parseInt(rows), "vertical", reverse); + map.mirrorPart(mapObject, cols, rows, rotate ? "rotate" : "vertical", reverse); // mirror 1 & 2 to 3 & 4 - map.mirrorPart(mapObject, 0, parseInt(cols), 0, parseInt(rows / 2), "horizontal", reverse); + map.mirrorPart(mapObject, cols, rows, "horizontal", rotate ? true : false); break; case 'second': // 1 & 2 to 3 & 4 - map.mirrorPart(mapObject, 0, parseInt(cols), 0, parseInt(rows / 2), "horizontal", reverse); + map.mirrorPart(mapObject, cols, rows, "horizontal", reverse); break; case 'third': // 1 & 3 to 2 & 4 default: - map.mirrorPart(mapObject, 0, parseInt(cols / 2), 0, parseInt(rows), "vertical", reverse); + map.mirrorPart(mapObject, cols, rows, "vertical", reverse); break; } @@ -578,12 +578,32 @@ function Map(sizex, sizey) { map.import(str); } - this.mirrorPart = function(mapObject, x1, x2, y1, y2, type, reverse) { + this.mirrorPart = function(mapObject, cols, rows, type, reverse) { var uncompleteRooms = {}; var copiedRooms = {}; var players = [1, 2, 3, 4]; var playerSearch = /_p[1-8]/g; var mirrorPlayer = {}; + switch (type) { + case "vertical": + var x1 = 0; + var x2 = parseInt(cols / 2); + var y1 = 0; + var y2 = parseInt(rows); + break; + case "horizontal": + var x1 = 0; + var x2 = parseInt(cols); + var y1 = 0; + var y2 = parseInt(rows / 2); + break; + case "rotate": + var x1 = 0; + var x2 = parseInt(cols / 2); + var y1 = 0; + var y2 = parseInt(rows / 2); + break; + } // find uncomplete rooms (going through the mirror part) map.forEachCell(x1, x2, y1, y2, function(col, row) { @@ -628,6 +648,8 @@ function Map(sizex, sizey) { var newHCol = reverse ? (x2 - 1 - col) : col; var newRow = map.mapsizey - 1 - row; var newVRow = reverse ? (y2 - 1 - row) : row; + var newRCol = y2 * 2 - 1 - row; + var newRRow = col; var tileIdHor = mapObject.tileIds[mapObject.map[newRow][newHCol]["data-id"]]; var tileIdVert = mapObject.tileIds[mapObject.map[newVRow][newCol]["data-id"]]; var tileIdMir = mapObject.tileIds[mirrorPart["data-id"]]; @@ -679,10 +701,16 @@ function Map(sizex, sizey) { } } - if (type == "horizontal") { - mapObject.map[newRow][newHCol] = mirrorPart; - } else { - mapObject.map[newVRow][newCol] = mirrorPart; + switch(type) { + case "vertical": + mapObject.map[newVRow][newCol] = mirrorPart; + break; + case "horizontal": + mapObject.map[newRow][newHCol] = mirrorPart; + break; + case "rotate": + mapObject.map[newRRow][newRCol] = mirrorPart; + break; } }); } diff --git a/js/options.js b/js/options.js index edd4f9d..7208501 100644 --- a/js/options.js +++ b/js/options.js @@ -59,7 +59,9 @@ function mirrorMap() { } } if (ok) { - terrain.mirrorMap(active, !reverse.disabled ? reverse.checked : false); + var rev = !reverse.disabled ? reverse.checked : false; + var rot = !rotate.disabled ? rotate.checked : false; + terrain.mirrorMap(active, rev, rot); toggleOptions(false); } } From c7960d4ef7fe8da35d39d3c7513c975aa64688cc Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 10 Mar 2015 13:12:13 +0100 Subject: [PATCH 22/77] fix breaking rooms if these are on the mirror line --- js/editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/editor.js b/js/editor.js index 5becbca..600c0a7 100644 --- a/js/editor.js +++ b/js/editor.js @@ -561,7 +561,7 @@ function Map(sizex, sizey) { switch(mirrorType) { case 'first': // mirror 1 & 3 to 2 & 4 - map.mirrorPart(mapObject, cols, rows, rotate ? "rotate" : "vertical", reverse); + map.mirrorPart(mapObject, cols, rows, rotate ? "rotate" : "vertical"); // mirror 1 & 2 to 3 & 4 map.mirrorPart(mapObject, cols, rows, "horizontal", rotate ? true : false); break; @@ -652,6 +652,7 @@ function Map(sizex, sizey) { var newRRow = col; var tileIdHor = mapObject.tileIds[mapObject.map[newRow][newHCol]["data-id"]]; var tileIdVert = mapObject.tileIds[mapObject.map[newVRow][newCol]["data-id"]]; + var tileIdRot = mapObject.tileIds[mapObject.map[newRRow][newRCol]["data-id"]]; var tileIdMir = mapObject.tileIds[mirrorPart["data-id"]]; var tileName = mapObject.tiles[mirrorPart['tile']] || ""; @@ -661,6 +662,9 @@ function Map(sizex, sizey) { } else if (type == "vertical" && tileIdVert && tileIdVert in uncompleteRooms){ // the same as above in vertical mirror return; + } else if (type == "rotate" && tileIdRot && tileIdRot in uncompleteRooms){ + // the same as above in rotation + return; } else if (tileIdMir && tileIdMir in uncompleteRooms) { // see above return; From 9592d0e4d66d40de54a2f874c7a1912726b36983 Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 10 Mar 2015 15:31:15 +0100 Subject: [PATCH 23/77] fix rotate breaking not extended mirror options --- js/editor.js | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/js/editor.js b/js/editor.js index 600c0a7..68f29da 100644 --- a/js/editor.js +++ b/js/editor.js @@ -644,25 +644,35 @@ function Map(sizex, sizey) { map.forEachCell(x1, x2, y1, y2, function(col, row) { // clone the mapobject cell var mirrorPart = JSON.parse(JSON.stringify(mapObject.map[row][col])); - var newCol = map.mapsizex - 1 - col; - var newHCol = reverse ? (x2 - 1 - col) : col; - var newRow = map.mapsizey - 1 - row; - var newVRow = reverse ? (y2 - 1 - row) : row; - var newRCol = y2 * 2 - 1 - row; - var newRRow = col; - var tileIdHor = mapObject.tileIds[mapObject.map[newRow][newHCol]["data-id"]]; - var tileIdVert = mapObject.tileIds[mapObject.map[newVRow][newCol]["data-id"]]; - var tileIdRot = mapObject.tileIds[mapObject.map[newRRow][newRCol]["data-id"]]; + + switch (type) { + case "vertical": + var newCol = map.mapsizex - 1 - col; + var newVRow = reverse ? (y2 - 1 - row) : row; + var tileIdVert = mapObject.tileIds[mapObject.map[newVRow][newCol]["data-id"]]; + break; + case "horizontal": + var newHCol = reverse ? (x2 - 1 - col) : col; + var newRow = map.mapsizey - 1 - row; + var tileIdHor = mapObject.tileIds[mapObject.map[newRow][newHCol]["data-id"]]; + break; + case "rotate": + var newRCol = y2 * 2 - 1 - row; + var newRRow = col; + var tileIdRot = mapObject.tileIds[mapObject.map[newRRow][newRCol]["data-id"]]; + break; + } + var tileIdMir = mapObject.tileIds[mirrorPart["data-id"]]; var tileName = mapObject.tiles[mirrorPart['tile']] || ""; - if (type == "horizontal" && tileIdHor && tileIdHor in uncompleteRooms) { + if (tileIdHor && tileIdHor in uncompleteRooms) { // an uncomplete room should not get mirrored, we keep the tiles return; - } else if (type == "vertical" && tileIdVert && tileIdVert in uncompleteRooms){ + } else if (tileIdVert && tileIdVert in uncompleteRooms){ // the same as above in vertical mirror return; - } else if (type == "rotate" && tileIdRot && tileIdRot in uncompleteRooms){ + } else if (tileIdRot && tileIdRot in uncompleteRooms){ // the same as above in rotation return; } else if (tileIdMir && tileIdMir in uncompleteRooms) { From f627f4a0a0360e4bbd14357abbb233f52a5dddec Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 10 Mar 2015 22:18:57 +0100 Subject: [PATCH 24/77] adding a first prototype of dalek tests --- .gitignore | 1 + index.html | 2 +- js/editor.js | 1 + package.json | 9 +++++ tests/convert.js | 37 ++++++++++++++++++ tests/maps/defaultMap.js | 73 ++++++++++++++++++++++++++++++++++++ tests/options/mirror1.js | 81 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 package.json create mode 100644 tests/convert.js create mode 100644 tests/maps/defaultMap.js create mode 100644 tests/options/mirror1.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/index.html b/index.html index f85ae4a..8292909 100644 --- a/index.html +++ b/index.html @@ -76,7 +76,7 @@
- +
diff --git a/js/editor.js b/js/editor.js index 68f29da..bd354c9 100644 --- a/js/editor.js +++ b/js/editor.js @@ -213,6 +213,7 @@ function Map(sizex, sizey) { for (var col = 0; col < map.mapsizex + (map.borderSize * 2); col++) { var tile = document.createElement("td"); + tile.innerHTML = " "; tile.setAttribute('id', 'col_' + row + '_' + col); var roomTile = map.defaultTile; var isBorder = map.borderSize > 0 && row <= map.borderSize - 1 || col <= map.borderSize - 1 || row >= map.mapsizey + map.borderSize || col >= map.mapsizex + map.borderSize; diff --git a/package.json b/package.json new file mode 100644 index 0000000..6ca5b7d --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "wfto-mapeditor", + "description": "A html based map editor for 'War for the Overworld'", + "version": "0.12.0", + "devDependencies": { + "dalek-browser-chrome": "0.0.11", + "dalekjs": "0.0.9" + } +} diff --git a/tests/convert.js b/tests/convert.js new file mode 100644 index 0000000..cf7917b --- /dev/null +++ b/tests/convert.js @@ -0,0 +1,37 @@ +function convertTests() { + var testnameRegex = /]+>([^<]+)+.*/; + var testRegex = /([^<]+)<\/td>([^<]+)<\/td>([^<]+)?<\/td><\/tr>/g; + + content = content.replace(/[\r\n\t]/g, ""); + + var testName = content.match(testnameRegex)[1]; + rc = testName + "\r\n"; + while (tests = testRegex.exec(content)){ + var cmd = tests[1]; + var selector = tests[2]; + var val = tests[3]; + + // correct selector + selector = selector + .replace(/id=/g, "#") + .replace(/css=/g, "") + .replace(/>/g, ">") + .replace(/</g, "<"); + params = val ? selector + "', '" + val : selector; + + // correct cmd + cmd = cmd + .replace(/waitForElementPresent/g, "waitForElement") + .replace(/assertConfirmation/g, "assert.dialogText") + .replace(/assertConfirmation/g, "assert.dialogText") + .replace(/waitForNotVisible/g, 'waitFor(function () { return document.getElementById("' + selector.substr(1) + '").style.display == none;}, [], 10000) //') + .replace(/assertEval/g, 'assert.ok("' + selector + ' == ' + val + '", "' + selector + ' == ' + val + '") //'); + + command = "." + cmd + "('" + params + "')"; + rc += command + "\r\n"; + } + + return rc; +} + +convertTests(); diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js new file mode 100644 index 0000000..2f21684 --- /dev/null +++ b/tests/maps/defaultMap.js @@ -0,0 +1,73 @@ +module.exports = { + 'Draw test map': function (test) { + test + .open("index.html") + .waitForElement('#core_p1') + .click('#core_p1') + .click('#col_3_3') + .click('#claimed_earth_p1') + .click('#col_6_1') + .click('#col_6_2') + .click('#col_6_3') + .click('#col_6_4') + .click('#col_6_5') + .click('#col_6_6') + .click('#col_5_6') + .click('#col_4_6') + .click('#col_3_6') + .click('#col_2_6') + .click('#col_1_6') + .click('#impenetrable') + .click('#col_5_14') + .click('#col_4_14') + .click('#col_3_14') + .click('#col_2_14') + .click('#goldshrine') + .click('#col_11_3') + .click('#archiveshrine') + .click('#col_3_11') + .click('#siegeshrine') + .click('#col_5_17') + .click('#manashrine') + .click('#col_17_5') + .click('#gold') + .click('#col_2_17') + .click('#col_2_18') + .click('#col_2_19') + .click('#col_10_9') + .click('#col_9_9') + .click('#col_9_10') + .click('#col_8_10') + .click('#col_7_11') + .click('#brimstone') + .click('#col_7_6') + .click('#col_7_7') + .click('#col_7_8') + .click('#col_7_9') + .click('#col_7_10') + .click('#col_11_8') + .click('#lava') + .click('#col_14_5') + .click('#col_14_6') + .click('#col_15_6') + .click('#sacred_earth') + .click('#col_11_6') + .click('#col_11_7') + .click('#col_10_7') + .click('#col_10_6') + .click('#water') + .click('#col_8_2') + .click('#col_8_3') + .click('#dirt') + .click('#col_14_10') + .click('#col_14_11') + .click('#col_14_12') + .click('#col_14_13') + .click('#col_14_14') + .click('#col_14_15') + .click('#col_15_15') + .click('#col_16_15') + .screenshot("test.png") + .done(); + } +}; \ No newline at end of file diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js new file mode 100644 index 0000000..42e6fa7 --- /dev/null +++ b/tests/options/mirror1.js @@ -0,0 +1,81 @@ +module.exports = { + 'Draw test map': function (test) { + test + .open("index.html") + .waitForElement('#core_p1') + .click('#core_p1') + .click('#col_3_3') + .click('#claimed_earth_p1') + .click('#col_6_1') + .click('#col_6_2') + .click('#col_6_3') + .click('#col_6_4') + .click('#col_6_5') + .click('#col_6_6') + .click('#col_5_6') + .click('#col_4_6') + .click('#col_3_6') + .click('#col_2_6') + .click('#col_1_6') + .click('#impenetrable') + .click('#col_5_14') + .click('#col_4_14') + .click('#col_3_14') + .click('#col_2_14') + .click('#goldshrine') + .click('#col_11_3') + .click('#archiveshrine') + .click('#col_3_11') + .click('#siegeshrine') + .click('#col_5_17') + .click('#manashrine') + .click('#col_17_5') + .click('#gold') + .click('#col_2_17') + .click('#col_2_18') + .click('#col_2_19') + .click('#col_10_9') + .click('#col_9_9') + .click('#col_9_10') + .click('#col_8_10') + .click('#col_7_11') + .click('#brimstone') + .click('#col_7_6') + .click('#col_7_7') + .click('#col_7_8') + .click('#col_7_9') + .click('#col_7_10') + .click('#col_11_8') + .click('#lava') + .click('#col_14_5') + .click('#col_14_6') + .click('#col_15_6') + .click('#sacred_earth') + .click('#col_11_6') + .click('#col_11_7') + .click('#col_10_7') + .click('#col_10_6') + .click('#water') + .click('#col_8_2') + .click('#col_8_3') + .click('#dirt') + .click('#col_14_10') + .click('#col_14_11') + .click('#col_14_12') + .click('#col_14_13') + .click('#col_14_14') + .click('#col_14_15') + .click('#col_15_15') + .click('#col_16_15') + .screenshot("test.jpg") + .done(); + }, + 'Mirror 1': function (test) { + test + .click('#optionButton') + .click('#first') + .click('#mirrorButton') + .screenshot("test1.jpg") + .done(); + } +}; \ No newline at end of file From ef84cb816496d2b36435c843dfb0fbbf7238c3c6 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 11 Mar 2015 16:58:20 +0100 Subject: [PATCH 25/77] improve tests --- tests/maps/defaultMap.js | 15 ++++--- tests/options/mirror1.js | 87 +++++---------------------------------- tests/suite/defaultMap.js | 13 ++++++ 3 files changed, 33 insertions(+), 82 deletions(-) create mode 100644 tests/suite/defaultMap.js diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index 2f21684..4273702 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,8 +1,6 @@ module.exports = { - 'Draw test map': function (test) { - test - .open("index.html") - .waitForElement('#core_p1') + 'drawDefaultMap': function (test, external) { + test.waitForElement('#core_p1') .click('#core_p1') .click('#col_3_3') .click('#claimed_earth_p1') @@ -67,7 +65,12 @@ module.exports = { .click('#col_14_15') .click('#col_15_15') .click('#col_16_15') - .screenshot("test.png") - .done(); + .screenshot("./tests/images/:browser/defaultMap.png"); + + if (external) { + return test; + } else { + test.done(); + } } }; \ No newline at end of file diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index 42e6fa7..eeb0201 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -1,81 +1,16 @@ +'use strict'; + module.exports = { - 'Draw test map': function (test) { - test - .open("index.html") - .waitForElement('#core_p1') - .click('#core_p1') - .click('#col_3_3') - .click('#claimed_earth_p1') - .click('#col_6_1') - .click('#col_6_2') - .click('#col_6_3') - .click('#col_6_4') - .click('#col_6_5') - .click('#col_6_6') - .click('#col_5_6') - .click('#col_4_6') - .click('#col_3_6') - .click('#col_2_6') - .click('#col_1_6') - .click('#impenetrable') - .click('#col_5_14') - .click('#col_4_14') - .click('#col_3_14') - .click('#col_2_14') - .click('#goldshrine') - .click('#col_11_3') - .click('#archiveshrine') - .click('#col_3_11') - .click('#siegeshrine') - .click('#col_5_17') - .click('#manashrine') - .click('#col_17_5') - .click('#gold') - .click('#col_2_17') - .click('#col_2_18') - .click('#col_2_19') - .click('#col_10_9') - .click('#col_9_9') - .click('#col_9_10') - .click('#col_8_10') - .click('#col_7_11') - .click('#brimstone') - .click('#col_7_6') - .click('#col_7_7') - .click('#col_7_8') - .click('#col_7_9') - .click('#col_7_10') - .click('#col_11_8') - .click('#lava') - .click('#col_14_5') - .click('#col_14_6') - .click('#col_15_6') - .click('#sacred_earth') - .click('#col_11_6') - .click('#col_11_7') - .click('#col_10_7') - .click('#col_10_6') - .click('#water') - .click('#col_8_2') - .click('#col_8_3') - .click('#dirt') - .click('#col_14_10') - .click('#col_14_11') - .click('#col_14_12') - .click('#col_14_13') - .click('#col_14_14') - .click('#col_14_15') - .click('#col_15_15') - .click('#col_16_15') - .screenshot("test.jpg") - .done(); - }, - 'Mirror 1': function (test) { - test - .click('#optionButton') + 'mirror': function (test, external) { + test.click('#optionButton') .click('#first') .click('#mirrorButton') - .screenshot("test1.jpg") - .done(); + .screenshot("./tests/images/:browser/mirror1.png"); + + if (external) { + return test; + } else { + test.done(); + } } }; \ No newline at end of file diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js new file mode 100644 index 0000000..9504cb9 --- /dev/null +++ b/tests/suite/defaultMap.js @@ -0,0 +1,13 @@ +'use strict'; + +var map = require('../maps/defaultMap'); +var mirror1 = require('../options/mirror1'); + +module.exports = { + "Mirroring": function(test) { + test.open("index.html"); + map.drawDefaultMap(test, true); + mirror1.mirror(test, true); + test.done(); + } +} \ No newline at end of file From c0672537cd78209e9dfd465af9d243485fa1e41c Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 11 Mar 2015 17:15:53 +0100 Subject: [PATCH 26/77] remove chrome webdriver, as it doesn't like relative path --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 6ca5b7d..aca9454 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "description": "A html based map editor for 'War for the Overworld'", "version": "0.12.0", "devDependencies": { - "dalek-browser-chrome": "0.0.11", "dalekjs": "0.0.9" } } From e8d115ea38fd4c5258c2bdb2f2d46d4d700f1a7e Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 16 Mar 2015 21:31:27 +0100 Subject: [PATCH 27/77] make converter more reliable --- tests/convert.html | 12 ++++++++++++ tests/convert.js | 35 ++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 tests/convert.html diff --git a/tests/convert.html b/tests/convert.html new file mode 100644 index 0000000..1cf821b --- /dev/null +++ b/tests/convert.html @@ -0,0 +1,12 @@ + + + + + + +
+Quellcode +
+ + \ No newline at end of file diff --git a/tests/convert.js b/tests/convert.js index cf7917b..150f6a5 100644 --- a/tests/convert.js +++ b/tests/convert.js @@ -1,11 +1,33 @@ -function convertTests() { +function convert() { + var files = document.getElementById("files"); + if (files.files.length > 0) { + var file = files.files[0]; + + var reader = new FileReader(); + reader.readAsText(file); + reader.onload = function(){ + var text = convertTests(this.result); + var output = document.getElementById("output"); + var pre = document.createElement("pre"); + + pre.innerHTML= text; + output.appendChild(pre); + } + } +} + +function convertTests(content) { var testnameRegex = /]+>([^<]+)+.*/; var testRegex = /([^<]+)<\/td>([^<]+)<\/td>([^<]+)?<\/td><\/tr>/g; content = content.replace(/[\r\n\t]/g, ""); var testName = content.match(testnameRegex)[1]; - rc = testName + "\r\n"; + var header = "module.exports = {\r\n\t'" + testName + "': function (test, external) {\r\n\r\n\t\tif (!external) { test.open('index.html'); }\r\n\r\n\t\ttest\r\n"; + var footer = "\t\tif (external) {\r\n\t\t\treturn test;\r\n\t\t} else {\r\n\t\t\ttest.done();\r\n\t\t}\r\n\t}\r\n};"; + + var rc = header; + while (tests = testRegex.exec(content)){ var cmd = tests[1]; var selector = tests[2]; @@ -16,7 +38,8 @@ function convertTests() { .replace(/id=/g, "#") .replace(/css=/g, "") .replace(/>/g, ">") - .replace(/</g, "<"); + .replace(/</g, "<") + .replace(/"/g, "\""); params = val ? selector + "', '" + val : selector; // correct cmd @@ -27,11 +50,9 @@ function convertTests() { .replace(/waitForNotVisible/g, 'waitFor(function () { return document.getElementById("' + selector.substr(1) + '").style.display == none;}, [], 10000) //') .replace(/assertEval/g, 'assert.ok("' + selector + ' == ' + val + '", "' + selector + ' == ' + val + '") //'); - command = "." + cmd + "('" + params + "')"; + command = "\t\t." + cmd + "('" + params + "')"; rc += command + "\r\n"; } - return rc; + return rc + "\r\n" + footer; } - -convertTests(); From f3832c916cc70144e90c7296170f0003523c5898 Mon Sep 17 00:00:00 2001 From: ufdada Date: Mon, 16 Mar 2015 21:32:37 +0100 Subject: [PATCH 28/77] add test for new map --- tests/options/new_map.js | 20 ++++++++++++++++++++ tests/suite/defaultMap.js | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 tests/options/new_map.js diff --git a/tests/options/new_map.js b/tests/options/new_map.js new file mode 100644 index 0000000..7a09892 --- /dev/null +++ b/tests/options/new_map.js @@ -0,0 +1,20 @@ +module.exports = { + 'new': function (test, external, width, height) { + var width = width || '40'; + var height = height || '40'; + + if (!external) { test.open("index.html"); } + + test + .click('#optionButton') + .type('#width', width) + .type('#height', height) + .click('input[type="submit"]') + + if (external) { + return test; + } else { + test.done(); + } + } +}; \ No newline at end of file diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 9504cb9..01be66f 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -2,10 +2,12 @@ var map = require('../maps/defaultMap'); var mirror1 = require('../options/mirror1'); +var new_map = require('../options/new_map'); module.exports = { "Mirroring": function(test) { test.open("index.html"); + new_map.new(test, true); map.drawDefaultMap(test, true); mirror1.mirror(test, true); test.done(); From 9b14e7c6be266717738edd2ddf3250e6821bf3c5 Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 17 Mar 2015 21:31:45 +0100 Subject: [PATCH 29/77] update for continues integration --- .jshintrc | 36 ++++++++++ .travis.yml | 8 +++ Gruntfile.js | 42 +++++++++++ css/style.css | 2 + index.html | 10 +-- js/editor.js | 143 ++++++++++++++++++-------------------- js/options.js | 63 +++++++++-------- js/storage.js | 20 +++--- js/tiles.js | 4 +- package.json | 28 +++++++- tests/convert.html | 3 +- tests/convert.js | 13 ++-- tests/maps/defaultMap.js | 3 +- tests/options/mirror1.js | 2 - tests/options/new_map.js | 10 ++- tests/suite/defaultMap.js | 6 +- 16 files changed, 254 insertions(+), 139 deletions(-) create mode 100644 .jshintrc create mode 100644 .travis.yml create mode 100644 Gruntfile.js diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..058dc8d --- /dev/null +++ b/.jshintrc @@ -0,0 +1,36 @@ +{ + "asi": false, + "browser": true, + "curly": true, + "debug": false, + "devel": true, + "eqeqeq": false, + "es3": true, + "evil": true, + "expr": true, + "proto": true, + "regexdash": true, + "strict": false, + "scripturl": true, + "sub": true, + "trailing": true, + "undef": true, + "loopfunc": true, + "-W065": true, + "-W020": true, + + "predef" : [ + "exports", + "phantom", + "require", + "window", + "module", + "terrain", + "JSON", + "tiles", + "dataStorage", + "initOptions", + "Map", + "store" + ] +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8788c97 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - 0.11 +before_script: + - npm install -g grunt-cli +cache: + directories: + - node_modules \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..c9d00b1 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,42 @@ +module.exports = function (grunt) { + "use strict"; + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + jshint: { + all: [ + "js/**/*.js", + "tests/**/*.js", + "*.json" + ], + options: { + jshintrc: '.jshintrc' + } + }, + lint5: { + dirPath: "", + templates: [ + "index.html", + "./tests/convert.html" + ], + ignoreList: [ + '\.wfto', + '\.csv' + ] + }, + dalek: { + dist: { + src: ['./tests/options/new_map.js'] + } + } + }); + + grunt.loadNpmTasks('grunt-lint5'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-dalek'); + + grunt.registerTask('test', ['validate', 'dalek']); + grunt.registerTask('validate', ['jshint', 'lint5']); + + grunt.registerTask('default', ['test']); +}; \ No newline at end of file diff --git a/css/style.css b/css/style.css index 9f2cfab..18a8903 100644 --- a/css/style.css +++ b/css/style.css @@ -99,6 +99,8 @@ td:hover { } #mirrorMap { + border-spacing: 1; + border-collapse: separate; display: inline-block; } diff --git a/index.html b/index.html index 8292909..7f8b96b 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@
- +

Size:

@@ -34,12 +34,12 @@
Import Map - +
Import Google CSV -
+

@@ -50,7 +50,7 @@

Current version:


- +
General Options @@ -59,7 +59,7 @@
Mirror Map - +
diff --git a/js/editor.js b/js/editor.js index bd354c9..524de5e 100644 --- a/js/editor.js +++ b/js/editor.js @@ -9,7 +9,7 @@ terrain.generateTileCss(); terrain.init(); }); -} +}; function Map(sizex, sizey) { var map = this; @@ -50,7 +50,7 @@ function Map(sizex, sizey) { option: "tileSize", postSave: "setTileSize" } - } + }; var mapParent = document.getElementsByTagName('body')[0]; var dropMessage = document.getElementById("dropMessage"); @@ -64,7 +64,7 @@ function Map(sizex, sizey) { map[postSave](match[2]); } } - } + }; // TODO: Implement to save dom operations this.setTileMode = function(tileMode) { @@ -75,7 +75,7 @@ function Map(sizex, sizey) { store.setItem("tileMode", tileMode); map.tileMode = tileMode; //map.generateTileCss(); - } + }; // TODO: Implement to save dom operations this.setTileSize = function(tileSize) { @@ -86,7 +86,7 @@ function Map(sizex, sizey) { store.setItem("tileSize", tileSize); map.tileSize = tileSize; // TODO: implement instant change of tilesize - } + }; this.resetToDefault = function() { for (var item in map.options) { @@ -94,7 +94,7 @@ function Map(sizex, sizey) { map[option] = map[option + "Default"]; } terrain.generateTileCss(); - } + }; this.generateTileCss = function() { var style = document.getElementById('tileCss') || document.createElement('style'); @@ -107,17 +107,17 @@ function Map(sizex, sizey) { var css = ''; switch (map.tileMode) { case "color": - var css = ' { background-color: ' + tiles[item].color + '; }\n'; + css = ' { background-color: ' + tiles[item].color + '; }\n'; break; default: - var css = ' { background-image: url("img/' + map.assetDir + "/" + map.tileMode + "/" + item + '.png"); }\n'; + css = ' { background-image: url("img/' + map.assetDir + "/" + map.tileMode + "/" + item + '.png"); }\n'; break; } style.innerHTML += '/* ' + posx + ' x ' + posy + ' */\n'; style.innerHTML += '.' + item + css; } document.getElementsByTagName('head')[0].appendChild(style); - } + }; this.preloadTiles = function(callback) { var images = Object.keys(tiles); @@ -149,14 +149,14 @@ function Map(sizex, sizey) { for (var i=0; i< images.length; i++){ image[i] = new Image(); image[i].src = "img/" + map.assetDir + "/" + map.tileMode + "/" + images[i] + '.png'; - image[i].onload=function(){ + image[i].onload = function(){ imageLoaded(); - } - image[i].onerror=function(){ + }; + image[i].onerror = function(){ imageLoaded(); - } + }; } - } + }; this.createButtons = function() { var toolBox = document.getElementById("toolBox"); @@ -172,7 +172,7 @@ function Map(sizex, sizey) { button.id = item; button.onclick = function () { map.setCurrentTile(this.id); - } + }; //button.value = item; button.type = "button"; button.setAttribute("class", item + " tileButton"); @@ -182,7 +182,7 @@ function Map(sizex, sizey) { } toolBox.insertBefore(buttons, info); toolBox.style.display = "block"; - } + }; this.init = function(mapObject) { // only one map is allowed at the same time @@ -231,7 +231,7 @@ function Map(sizex, sizey) { if (isBorder) { // generate border - var roomTile = map.borderTile; + roomTile = map.borderTile; tile.onmousemove = map.hideInfoBox; } else if (mapObject && mapObject.map && mapObject.tileIds && mapObject.tiles) { // import map @@ -241,9 +241,9 @@ function Map(sizex, sizey) { if (id) { tile.setAttribute("data-id", id); map.tiles[id] = map.tiles[id] || []; - if (map.tiles[id].length == 0) { + if (map.tiles[id].length === 0) { // mark the start point of a new room - importedRooms[id] = { col: col, row: row } + importedRooms[id] = { col: col, row: row }; } map.tiles[id].push("col_" + row+ "_" + col ); tile.setAttribute("data-pos-x", col - importedRooms[id].col); @@ -259,7 +259,7 @@ function Map(sizex, sizey) { table.appendChild(tr); } mapParent.appendChild(table); - } + }; this.destroy = function() { map.tiles = {}; @@ -274,9 +274,9 @@ function Map(sizex, sizey) { } else { return false; } - } + }; - this.import = function(mapString) { + this.importData = function(mapString) { var mapObject = JSON.parse(mapString); if (!mapObject || !mapObject.map) { throw new Error("Not a valid Map!"); @@ -291,13 +291,13 @@ function Map(sizex, sizey) { } else { throw new Error("Not a valid Map!"); } - } + }; - this.export = function(author) { + this.exportData = function(author) { var json = map.mapToJson(author); var str = JSON.stringify(json); return str; - } + }; this.enableDrag = function(evt) { if (evt.button == map.mouseButton.left) { @@ -305,11 +305,11 @@ function Map(sizex, sizey) { map.insertTile(this, false, false); } return false; - } + }; this.disableDrag = function() { map.dragEnabled = false; - } + }; this.setRoomOnDrag = function(evt) { var infoBox = document.getElementById("infoBox"); @@ -340,15 +340,15 @@ function Map(sizex, sizey) { infoBox.style.display = "block"; map.setHtml("tile", this.getAttribute("data-temp") || this.className); - } + }; this.hideInfoBox = function() { map.hideElement("infoBox"); - } + }; this.resetRoom = function() { map.insertTile(this, false, true); - } + }; this.displayRoom = function(evt) { map.insertTile(this, true, false); @@ -363,7 +363,7 @@ function Map(sizex, sizey) { if (map.dragEnabled && roomTile.sizex * roomTile.sizey == 1) { map.insertTile(this, false, false); } - } + }; this.setRoom = function(evt) { // helper for selenium @@ -371,7 +371,7 @@ function Map(sizex, sizey) { if (evt.button == map.mouseButton.left) { map.insertTile(this, false, false); } - } + }; this.destroyRoom = function(id) { if (!id) { @@ -386,8 +386,7 @@ function Map(sizex, sizey) { tile.removeAttribute('data-pos-x'); tile.removeAttribute('data-pos-y'); } - - } + }; this.insertTile = function(tile, temp, reset) { var roomTile = tiles[map.currentTile]; @@ -403,7 +402,7 @@ function Map(sizex, sizey) { for (var i = 0; i < roomTile.sizey; i++) { for (var k = 0; k < roomTile.sizex; k++) { - var tile = document.getElementById("col_" + (startNoY + i) + "_" + (startNoX + k)); + tile = document.getElementById("col_" + (startNoY + i) + "_" + (startNoX + k)); if (!reset) { // Only add the roomTile if really set @@ -427,14 +426,14 @@ function Map(sizex, sizey) { roomTileTiles.length > 0 ? map.tiles[id] = roomTileTiles : ""; } } - } + }; this.resetTile = function(tile) { tile.hasAttribute('data-temp') && map.setTile(tile, tile.getAttribute('data-temp')); tile.hasAttribute('data-temp-pos') && map.setTilePosition(tile, tile.getAttribute('data-temp-pos')); tile.removeAttribute('data-temp'); tile.removeAttribute('data-temp-pos'); - } + }; this.mapToJson = function(author){ var table = document.getElementById("map"); @@ -445,7 +444,7 @@ function Map(sizex, sizey) { tiles: [], tileIds: [], map: [] - } + }; for (var i = map.borderSize; i < map.mapsizey + map.borderSize; i++) { @@ -488,16 +487,16 @@ function Map(sizex, sizey) { mapData.map.push(colData); } - return mapData; - } + return mapData; + }; this.setTilePosition = function(tile, pos) { tile.style.backgroundPosition = pos; - } + }; this.getTilePosition = function(tile) { return tile.style.backgroundPosition; - } + }; this.setTile = function(tile, currentTile) { var roomTile = tiles[currentTile]; @@ -512,7 +511,7 @@ function Map(sizex, sizey) { } else { console.error("No tile found for "+ currentTile); } - } + }; this.generateRoom = function(tile, row, col, temp) { var roomTile = tiles[map.currentTile]; @@ -533,21 +532,21 @@ function Map(sizex, sizey) { tile.style.opacity = "1"; } map.setTile(tile, map.currentTile, row, col); - } + }; this.setCurrentTile = function(roomTile) { // helper for selenium // console.log("\n\t\n\t\n\t\n"); map.currentTile = roomTile; - } + }; this.setHtml = function(id, html) { document.getElementById(id).innerHTML = html; - } + }; this.hideElement = function(id) { document.getElementById(id).style.display = "none"; - } + }; /** * Mirrors a part of the map to get a better @@ -570,14 +569,15 @@ function Map(sizex, sizey) { map.mirrorPart(mapObject, cols, rows, "horizontal", reverse); break; case 'third': // 1 & 3 to 2 & 4 + /* falls through */ default: map.mirrorPart(mapObject, cols, rows, "vertical", reverse); break; } var str = JSON.stringify(mapObject); - map.import(str); - } + map.importData(str); + }; this.mirrorPart = function(mapObject, cols, rows, type, reverse) { var uncompleteRooms = {}; @@ -585,24 +585,19 @@ function Map(sizex, sizey) { var players = [1, 2, 3, 4]; var playerSearch = /_p[1-8]/g; var mirrorPlayer = {}; + var x1 = 0, x2 = 0, y1 = 0, y2 = 0; switch (type) { case "vertical": - var x1 = 0; - var x2 = parseInt(cols / 2); - var y1 = 0; - var y2 = parseInt(rows); + x2 = parseInt(cols / 2); + y2 = parseInt(rows); break; case "horizontal": - var x1 = 0; - var x2 = parseInt(cols); - var y1 = 0; - var y2 = parseInt(rows / 2); + x2 = parseInt(cols); + y2 = parseInt(rows / 2); break; case "rotate": - var x1 = 0; - var x2 = parseInt(cols / 2); - var y1 = 0; - var y2 = parseInt(rows / 2); + x2 = parseInt(cols / 2); + y2 = parseInt(rows / 2); break; } @@ -704,7 +699,7 @@ function Map(sizex, sizey) { players.splice(0, 1); } if (player) { - var tileName = tileName.replace(playerSearch, "_p" + player); + tileName = tileName.replace(playerSearch, "_p" + player); var tileId = mapObject.tiles.indexOf(tileName); if (tileId == -1) { mapObject.tiles.push(tileName); @@ -728,7 +723,7 @@ function Map(sizex, sizey) { break; } }); - } + }; this.forEachCell = function(x1, x2, y1, y2, callback) { for (var row = y1; row < y2; row++){ @@ -736,22 +731,22 @@ function Map(sizex, sizey) { callback.call(this, col, row); } } - } + }; this.cancelDrop = function() { dropMessage.style.display = "none"; clearTimeout(map.dropTimeout); - } + }; this.dragOverMap = function(evt) { evt.stopPropagation(); evt.preventDefault(); clearTimeout(map.dropTimeout); - map.dropTimeout = setTimeout(function(){ map.cancelDrop() }, 200); + map.dropTimeout = setTimeout(function(){ map.cancelDrop(); }, 200); dropMessage.style.display = "block"; - } + }; this.dropMap = function(evt) { dropMessage.style.display = "none"; @@ -761,17 +756,17 @@ function Map(sizex, sizey) { var dt = evt.dataTransfer; var files = dt.files; - if(files && files.length != 0) { + if(files && files.length !== 0) { var reader = new FileReader(); reader.readAsText(files[0]); - reader.onload = function(e) { + reader.onload = function(evt) { try { - map.import(atob(this.result)); - } catch(e) { - alert("Could not load map.\n\n" + e.message); + map.importData(atob(this.result)); + } catch(exception) { + alert("Could not load map.\n\n" + exception.message); } - } + }; } - } + }; } \ No newline at end of file diff --git a/js/options.js b/js/options.js index 7208501..4f75125 100644 --- a/js/options.js +++ b/js/options.js @@ -1,14 +1,17 @@ var invalidLetterRegex = /[^A-Za-z0-9\.\-\_\söüäÖÜÄ]/g; +var first = null, second = null, third = null, fourth = null, reverse = null, extend = null, versioning = null, mapNameInput = null, rotate = null, active = ""; + function initOptions() { - first = document.getElementById('first'); - second = document.getElementById('second'); - third = document.getElementById('third'); - fourth = document.getElementById('fourth'); - reverse = document.getElementById('reverse'); - extend = document.getElementById('extend'); - versioning = document.getElementById('versioning'); + first = document.getElementById('first'), + second = document.getElementById('second'), + third = document.getElementById('third'), + fourth = document.getElementById('fourth'), + reverse = document.getElementById('reverse'), + extend = document.getElementById('extend'), + versioning = document.getElementById('versioning'), mapNameInput = document.getElementById("mapName"); + rotate = document.getElementById("rotate"); resetMirror(); @@ -32,8 +35,6 @@ function initOptions() { second.onclick = setActive; third.onclick = setActive; fourth.onclick = setActive; - - active = ""; } function mirrorMap() { @@ -53,6 +54,7 @@ function mirrorMap() { terrain.mapsizey *= 2; break; case 'third': + /* falls through */ default: terrain.mapsizex *= 2; break; @@ -99,7 +101,7 @@ function mirrorPreview(type) { // fourth.setAttribute("class", "rotate180"); } // both sides need to have the same size to work properly - if (extend.checked && terrain.mapsizex != terrain.mapsizey || !extend.checked && (terrain.mapsizex / 2 % 1 != 0 || terrain.mapsizex / 2 != terrain.mapsizey / 2)) { + if (extend.checked && terrain.mapsizex !== terrain.mapsizey || !extend.checked && (terrain.mapsizex / 2 % 1 !== 0 || terrain.mapsizex / 2 !== terrain.mapsizey / 2)) { rotate.disabled = "disabled"; } if (terrain.mapsizex * 2 > terrain.maxsize || terrain.mapsizey * 2 > terrain.maxsize) { @@ -141,6 +143,7 @@ function mirrorPreview(type) { } break; case 'third': + /* falls through */ default: extend.disabled = ""; reverse.disabled = ""; @@ -216,7 +219,7 @@ function exportMap() { // Maybe later var author = ''; //document.getElementById("author").value; // export as base64 - var data = btoa(terrain.export(author)); + var data = btoa(terrain.exportData(author)); var mapName = mapNameInput.value; if (mapName.length < 1 || mapName.match(invalidLetterRegex)) { alert("Invalid filename!"); @@ -248,7 +251,7 @@ function importMap() { if (window.FileReader) { var files = document.getElementById("mapFile").files; - if (files.length == 1) { + if (files.length === 1) { if (files[0].name.match(invalidLetterRegex)) { alert("Invalid filename!"); return; @@ -257,10 +260,10 @@ function importMap() { var reader = new FileReader(); reader.readAsText(files[0]); - reader.onload = function(e) { + reader.onload = function(evt) { // map geladen try { - terrain.import(atob(this.result)); + terrain.importData(atob(this.result)); var filename = files[0].name; var name = filename.substr(0, filename.lastIndexOf(".")); @@ -281,7 +284,7 @@ function importMap() { alert("Please select a valid map file.\n" + e.message); return; } - } + }; } else { alert("Please select a valid map file"); return; @@ -295,7 +298,7 @@ function importMap() { function saveOptions() { // save terrain temporary - var map = terrain.export(); + var map = terrain.exportData(); for (var item in terrain.options) { var element = document.getElementById(item); switch(element.nodeName.toLowerCase()) { @@ -313,7 +316,7 @@ function saveOptions() { } // apply possible changes terrain.generateTileCss(); - terrain.import(map); + terrain.importData(map); toggleOptions(false); } @@ -325,9 +328,9 @@ function resetOptions() { // execute post action terrain[terrain.options[item].postSave](option); }*/ - var map = terrain.export(); + var map = terrain.exportData(); terrain.resetToDefault(); - terrain.import(map); + terrain.importData(map); toggleOptions(false); } @@ -388,7 +391,7 @@ function importCsv() { var files = document.getElementById("csv").files; var bordersize = parseInt(document.getElementById("csvborder").value) || 3; - if (files.length == 1) { + if (files.length === 1) { if (files[0].name.match(invalidLetterRegex)) { alert("Invalid filename!"); @@ -412,12 +415,12 @@ function importCsv() { tiles: [], tileIds: [], map: [] - } + }; var rows = this.result.split("\n"); if (rows.length > bordersize * bordersize) { for (var i = bordersize; i < rows.length - bordersize; i++) { - var rowData = [] + var rowData = []; var cells = rows[i].split(","); for (var j = bordersize; j < cells.length - bordersize; j++) { @@ -495,7 +498,7 @@ function importCsv() { } var tileTypeId = mapData.tiles.indexOf(tileName); - if (tileTypeId == -1) { + if (tileTypeId === -1) { // save tilename only once and make a reference mapData.tiles.push(tileName); tileTypeId = mapData.tiles.length - 1; @@ -510,23 +513,23 @@ function importCsv() { var y = calcRooms[k][0]; var x = calcRooms[k][1]; var tileId = mapData.map[y][x]['tile']; - var tileName = mapData.tiles[tileId]; + var tile = mapData.tiles[tileId]; // There is no tile left or above it, so lets create a new room if (isNaN(parseInt(mapData.map[y][x]['data-id']))) { // new room var id = new Date().getTime() - parseInt(Math.random() * 3000000).toString(); mapData.tileIds.push(id); - var roomTile = tiles[tileName]; + var roomTile = tiles[tile]; var coreTile = ''; - var match = tileName.match(/core_p([1-8])/); + var match = tile.match(/core_p([1-8])/); if (match) { var player = parseInt(match[1]); if (usedCores.indexOf(player) != -1 && player < 5) { player = usedCores.length + 1; - tileName = tileName.replace(/_p([1-8])/, "_p" + player) - mapData.tiles.push(tileName); + tile = tile.replace(/_p([1-8])/, "_p" + player); + mapData.tiles.push(tile); tileId = mapData.tiles.length - 1; } usedCores.push(player); @@ -540,12 +543,12 @@ function importCsv() { } } } - terrain.import(JSON.stringify(mapData)); + terrain.importData(JSON.stringify(mapData)); } else { alert("Please select a valid map file"); return; } - } + }; } else { alert("Please select a valid map file"); } diff --git a/js/storage.js b/js/storage.js index f891bcb..04249b3 100644 --- a/js/storage.js +++ b/js/storage.js @@ -1,7 +1,7 @@ function dataStorage() { this.hasStorageSupport = function() { try { - if (!'localStorage' in window || typeof window['localStorage'] == "undefined") { + if (!('localStorage' in window) || typeof window['localStorage'] == "undefined") { return false; } else { return true; @@ -9,7 +9,7 @@ function dataStorage() { } catch (e) { return false; } - } + }; this.localStorage = this.hasStorageSupport(); this.setItem = function(name,value,days) { @@ -17,12 +17,12 @@ function dataStorage() { localStorage.setItem(name, value); return; } + var expires = ""; + if (days != -1) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); - var expires = "; expires="+date.toGMTString(); - } else { - var expires = ""; + expires = "; expires="+date.toGMTString(); } document.cookie = name+"="+value+expires+"; path=/"; }; @@ -36,8 +36,10 @@ function dataStorage() { var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) { + while (c.charAt(0)==' ') { + c = c.substring(1,c.length); + } + if (c.indexOf(nameEQ) === 0) { returnValue = c.substring(nameEQ.length, c.length); } } @@ -59,7 +61,7 @@ function dataStorage() { return; } this.setItem(name,"",-1); - } + }; this.clear = function() { if (this.localStorage) { @@ -74,5 +76,5 @@ function dataStorage() { var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; this.setItem(name,"",-1); } - } + }; } \ No newline at end of file diff --git a/js/tiles.js b/js/tiles.js index 39579f8..906900b 100644 --- a/js/tiles.js +++ b/js/tiles.js @@ -1,4 +1,4 @@ -var tiles = { +tiles = { 'core_p1': { sizex: 5, sizey: 5, @@ -177,4 +177,4 @@ var tiles = { sizey: 1, color: "black" } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/package.json b/package.json index aca9454..76ff331 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,32 @@ { "name": "wfto-mapeditor", "description": "A html based map editor for 'War for the Overworld'", - "version": "0.12.0", + "version": "1.3.0", + "keywords": [ + "wfto", + "editor", + "mapeditor" + ], + "homepage": "https://github.com/ufdada/wfto-mapeditor", + "author": { + "name": "ufdada" + }, + "scripts": { + "test": "grunt test" + }, + "repository": { + "type": "git", + "url": "https://github.com/ufdada/wfto-mapeditor.git" + }, + "bugs": { + "url": "https://github.com/ufdada/wfto-mapeditor/issues" + }, + "license": "LGPL", "devDependencies": { - "dalekjs": "0.0.9" + "dalekjs": "0.0.9", + "grunt": "0.4.5", + "grunt-contrib-jshint": "0.10.0", + "grunt-dalek": "^0.2.0", + "grunt-lint5": "0.3.1" } } diff --git a/tests/convert.html b/tests/convert.html index 1cf821b..dbe1604 100644 --- a/tests/convert.html +++ b/tests/convert.html @@ -1,5 +1,6 @@ - + +Convert Selenium IDE Test to Dalek diff --git a/tests/convert.js b/tests/convert.js index 150f6a5..8a31943 100644 --- a/tests/convert.js +++ b/tests/convert.js @@ -5,14 +5,14 @@ var reader = new FileReader(); reader.readAsText(file); - reader.onload = function(){ + reader.onload = function() { var text = convertTests(this.result); var output = document.getElementById("output"); var pre = document.createElement("pre"); pre.innerHTML= text; output.appendChild(pre); - } + }; } } @@ -27,8 +27,9 @@ function convertTests(content) { var footer = "\t\tif (external) {\r\n\t\t\treturn test;\r\n\t\t} else {\r\n\t\t\ttest.done();\r\n\t\t}\r\n\t}\r\n};"; var rc = header; - - while (tests = testRegex.exec(content)){ + var tests = null; + + while ((testRegex.exec(content)) !== null){ var cmd = tests[1]; var selector = tests[2]; var val = tests[3]; @@ -40,7 +41,7 @@ function convertTests(content) { .replace(/>/g, ">") .replace(/</g, "<") .replace(/"/g, "\""); - params = val ? selector + "', '" + val : selector; + var params = val ? selector + "', '" + val : selector; // correct cmd cmd = cmd @@ -50,7 +51,7 @@ function convertTests(content) { .replace(/waitForNotVisible/g, 'waitFor(function () { return document.getElementById("' + selector.substr(1) + '").style.display == none;}, [], 10000) //') .replace(/assertEval/g, 'assert.ok("' + selector + ' == ' + val + '", "' + selector + ' == ' + val + '") //'); - command = "\t\t." + cmd + "('" + params + "')"; + var command = "\t\t." + cmd + "('" + params + "')"; rc += command + "\r\n"; } diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index 4273702..e8242af 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,6 +1,7 @@ module.exports = { 'drawDefaultMap': function (test, external) { - test.waitForElement('#core_p1') + test + .waitForElement('#core_p1') .click('#core_p1') .click('#col_3_3') .click('#claimed_earth_p1') diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index eeb0201..91dc1a1 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -1,5 +1,3 @@ -'use strict'; - module.exports = { 'mirror': function (test, external) { test.click('#optionButton') diff --git a/tests/options/new_map.js b/tests/options/new_map.js index 7a09892..32163f7 100644 --- a/tests/options/new_map.js +++ b/tests/options/new_map.js @@ -1,7 +1,7 @@ module.exports = { - 'new': function (test, external, width, height) { - var width = width || '40'; - var height = height || '40'; + 'generate': function (test, external, width, height) { + width = width || '40'; + height = height || '40'; if (!external) { test.open("index.html"); } @@ -10,6 +10,10 @@ module.exports = { .type('#width', width) .type('#height', height) .click('input[type="submit"]') + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == width.value, "Mapwidth is " + width.value); + this.assert.ok(window.terrain.mapsizey == height.value, "Mapwidth is " + height.value); + }); if (external) { return test; diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 01be66f..39bde43 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -1,5 +1,3 @@ -'use strict'; - var map = require('../maps/defaultMap'); var mirror1 = require('../options/mirror1'); var new_map = require('../options/new_map'); @@ -7,9 +5,9 @@ var new_map = require('../options/new_map'); module.exports = { "Mirroring": function(test) { test.open("index.html"); - new_map.new(test, true); + new_map.generate(test, true); map.drawDefaultMap(test, true); mirror1.mirror(test, true); test.done(); } -} \ No newline at end of file +}; \ No newline at end of file From b3e67e7194f01f56a18e2f3ac4b4bac6b0842996 Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 17 Mar 2015 21:38:52 +0100 Subject: [PATCH 30/77] a little beautify --- js/storage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js/storage.js b/js/storage.js index 04249b3..313a15e 100644 --- a/js/storage.js +++ b/js/storage.js @@ -33,14 +33,14 @@ function dataStorage() { returnValue = localStorage.getItem(name); } var nameEQ = name + "="; - var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { - var c = ca[i]; - while (c.charAt(0)==' ') { - c = c.substring(1,c.length); + var cookies = document.cookie.split(';'); + for(var i=0;i < cookies.length;i++) { + var cookie = cookies[i]; + while (cookie.charAt(0)==' ') { + cookie = cookie.substring(1, cookie.length); } - if (c.indexOf(nameEQ) === 0) { - returnValue = c.substring(nameEQ.length, c.length); + if (cookie.indexOf(nameEQ) === 0) { + returnValue = cookie.substring(nameEQ.length, cookie.length); } } From 543305037d2b69fe4a9a7d503fa73dc570552c3d Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 12:47:59 +0100 Subject: [PATCH 31/77] add mirror1Map test --- tests/maps/mirror1Map.js | 683 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 683 insertions(+) create mode 100644 tests/maps/mirror1Map.js diff --git a/tests/maps/mirror1Map.js b/tests/maps/mirror1Map.js new file mode 100644 index 0000000..68ef56e --- /dev/null +++ b/tests/maps/mirror1Map.js @@ -0,0 +1,683 @@ +module.exports = { + /* draws a rather complex map for testing the mirror 1 feature */ + /* Team Brawl by Slichizard */ + 'drawMap': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .waitForElement('#core_p1') + .click('#impenetrable') + .click('#col_1_1') + .click('#col_1_2') + .click('#col_1_3') + .click('#col_1_4') + .click('#col_1_5') + .click('#col_1_6') + .click('#col_1_7') + .click('#col_1_8') + .click('#col_1_9') + .click('#col_1_10') + .click('#col_1_11') + .click('#col_1_12') + .click('#col_1_13') + .click('#col_1_14') + .click('#col_1_15') + .click('#col_1_16') + .click('#col_1_17') + .click('#col_1_18') + .click('#col_1_19') + .click('#col_1_20') + .click('#col_1_21') + .click('#col_1_22') + .click('#col_1_23') + .click('#col_1_24') + .click('#col_1_25') + .click('#col_1_26') + .click('#col_1_36') + .click('#col_2_1') + .click('#col_2_2') + .click('#col_2_3') + .click('#col_2_4') + .click('#col_2_5') + .click('#col_2_6') + .click('#col_2_7') + .click('#col_2_8') + .click('#col_2_9') + .click('#col_2_10') + .click('#col_2_11') + .click('#col_2_12') + .click('#col_2_13') + .click('#col_2_14') + .click('#col_2_15') + .click('#col_2_16') + .click('#col_2_17') + .click('#col_2_18') + .click('#col_2_19') + .click('#col_2_20') + .click('#col_2_21') + .click('#col_2_22') + .click('#col_2_23') + .click('#col_2_24') + .click('#col_2_25') + .click('#col_3_1') + .click('#col_3_2') + .click('#col_3_3') + .click('#col_3_4') + .click('#col_3_5') + .click('#col_3_6') + .click('#col_3_7') + .click('#col_3_8') + .click('#col_3_9') + .click('#col_3_10') + .click('#col_3_11') + .click('#col_3_12') + .click('#col_3_13') + .click('#col_3_14') + .click('#col_3_15') + .click('#col_3_16') + .click('#col_3_17') + .click('#col_3_18') + .click('#col_3_19') + .click('#col_3_20') + .click('#col_3_21') + .click('#col_3_22') + .click('#col_3_23') + .click('#col_3_24') + .click('#col_4_1') + .click('#col_4_2') + .click('#col_4_3') + .click('#col_4_4') + .click('#col_4_5') + .click('#col_4_6') + .click('#col_4_7') + .click('#col_4_8') + .click('#col_4_9') + .click('#col_4_10') + .click('#col_4_11') + .click('#col_4_12') + .click('#col_4_13') + .click('#col_4_14') + .click('#col_4_15') + .click('#col_4_16') + .click('#col_4_17') + .click('#col_4_18') + .click('#col_4_19') + .click('#col_4_20') + .click('#col_4_21') + .click('#col_4_22') + .click('#col_4_23') + .click('#col_5_1') + .click('#col_5_2') + .click('#col_5_3') + .click('#col_5_4') + .click('#col_5_5') + .click('#col_5_6') + .click('#col_5_7') + .click('#col_5_8') + .click('#col_5_9') + .click('#col_5_10') + .click('#col_5_11') + .click('#col_5_12') + .click('#col_5_13') + .click('#col_5_14') + .click('#col_5_15') + .click('#col_6_1') + .click('#col_6_2') + .click('#col_6_3') + .click('#col_6_4') + .click('#col_6_5') + .click('#col_6_6') + .click('#col_6_7') + .click('#col_6_8') + .click('#col_6_9') + .click('#col_6_10') + .click('#col_6_11') + .click('#col_6_12') + .click('#col_6_13') + .click('#col_6_14') + .click('#col_7_1') + .click('#col_7_2') + .click('#col_7_3') + .click('#col_7_4') + .click('#col_7_5') + .click('#col_7_6') + .click('#col_7_7') + .click('#col_7_8') + .click('#col_7_9') + .click('#col_7_10') + .click('#col_7_11') + .click('#col_7_12') + .click('#col_8_1') + .click('#col_8_2') + .click('#col_8_3') + .click('#col_8_4') + .click('#col_8_5') + .click('#col_8_6') + .click('#col_8_7') + .click('#col_8_8') + .click('#col_8_9') + .click('#col_8_10') + .click('#col_8_11') + .click('#col_9_1') + .click('#col_9_2') + .click('#col_9_3') + .click('#col_9_4') + .click('#col_9_5') + .click('#col_9_6') + .click('#col_9_7') + .click('#col_9_8') + .click('#col_9_9') + .click('#col_9_10') + .click('#col_9_11') + .click('#col_10_1') + .click('#col_10_2') + .click('#col_10_3') + .click('#col_10_4') + .click('#col_10_5') + .click('#col_10_6') + .click('#col_10_7') + .click('#col_10_8') + .click('#col_10_9') + .click('#col_10_10') + .click('#col_10_11') + .click('#col_11_1') + .click('#col_11_2') + .click('#col_11_3') + .click('#col_11_4') + .click('#col_11_5') + .click('#col_11_6') + .click('#col_11_7') + .click('#col_11_8') + .click('#col_11_9') + .click('#col_11_10') + .click('#col_11_11') + .click('#col_12_1') + .click('#col_12_2') + .click('#col_12_3') + .click('#col_12_4') + .click('#col_12_5') + .click('#col_12_6') + .click('#col_12_7') + .click('#col_12_8') + .click('#col_12_9') + .click('#col_12_10') + .click('#col_12_11') + .click('#col_13_1') + .click('#col_13_2') + .click('#col_13_3') + .click('#col_13_4') + .click('#col_13_5') + .click('#col_13_6') + .click('#col_13_7') + .click('#col_13_8') + .click('#col_13_9') + .click('#col_13_10') + .click('#col_13_11') + .click('#col_14_1') + .click('#col_14_2') + .click('#col_14_3') + .click('#col_14_4') + .click('#col_14_5') + .click('#col_14_6') + .click('#col_14_7') + .click('#col_14_8') + .click('#col_14_9') + .click('#col_14_10') + .click('#col_15_1') + .click('#col_15_2') + .click('#col_15_3') + .click('#col_15_4') + .click('#col_15_5') + .click('#col_15_6') + .click('#col_15_7') + .click('#col_15_8') + .click('#col_15_9') + .click('#col_16_1') + .click('#col_16_2') + .click('#col_16_3') + .click('#col_16_4') + .click('#col_16_5') + .click('#col_16_6') + .click('#col_16_7') + .click('#col_17_1') + .click('#col_17_2') + .click('#col_17_3') + .click('#col_17_4') + .click('#col_17_5') + .click('#col_17_6') + .click('#col_18_1') + .click('#col_18_2') + .click('#col_18_3') + .click('#col_18_4') + .click('#col_18_5') + .click('#col_19_1') + .click('#col_19_2') + .click('#col_19_3') + .click('#col_19_4') + .click('#col_20_1') + .click('#col_20_2') + .click('#col_20_3') + .click('#col_21_1') + .click('#col_21_2') + .click('#col_22_1') + .click('#col_27_1') + .click('#col_28_1') + .click('#col_28_2') + .click('#col_29_1') + .click('#col_29_2') + .click('#col_29_3') + .click('#col_30_1') + .click('#col_30_2') + .click('#col_30_3') + .click('#col_30_4') + .click('#col_31_1') + .click('#col_31_2') + .click('#col_31_3') + .click('#col_31_4') + .click('#col_31_5') + .click('#col_32_1') + .click('#col_32_2') + .click('#col_32_3') + .click('#col_32_4') + .click('#col_32_5') + .click('#col_32_6') + .click('#col_32_7') + .click('#col_33_1') + .click('#col_33_2') + .click('#col_33_3') + .click('#col_33_4') + .click('#col_33_5') + .click('#col_33_6') + .click('#col_33_7') + .click('#col_33_8') + .click('#col_34_1') + .click('#col_34_2') + .click('#col_34_3') + .click('#col_34_4') + .click('#col_34_5') + .click('#col_34_6') + .click('#col_34_7') + .click('#col_34_8') + .click('#col_34_9') + .click('#col_34_10') + .click('#col_34_11') + .click('#col_34_12') + .click('#col_34_13') + .click('#col_34_14') + .click('#col_34_15') + .click('#col_34_16') + .click('#col_34_17') + .click('#col_34_18') + .click('#col_35_1') + .click('#col_35_2') + .click('#col_35_3') + .click('#col_35_4') + .click('#col_35_5') + .click('#col_35_6') + .click('#col_35_7') + .click('#col_35_8') + .click('#col_35_9') + .click('#col_35_10') + .click('#col_35_11') + .click('#col_35_12') + .click('#col_35_13') + .click('#col_35_14') + .click('#col_35_15') + .click('#col_35_16') + .click('#col_35_17') + .click('#col_35_18') + .click('#col_35_19') + .click('#col_36_1') + .click('#col_36_2') + .click('#col_36_3') + .click('#col_36_4') + .click('#col_36_5') + .click('#col_36_6') + .click('#col_36_7') + .click('#col_36_8') + .click('#col_36_9') + .click('#col_36_10') + .click('#col_36_11') + .click('#col_36_12') + .click('#col_36_13') + .click('#col_36_14') + .click('#col_36_15') + .click('#col_36_16') + .click('#col_36_17') + .click('#col_36_18') + .click('#col_36_19') + .click('#col_36_20') + .click('#col_36_21') + .click('#col_37_1') + .click('#col_37_2') + .click('#col_37_3') + .click('#col_37_4') + .click('#col_37_5') + .click('#col_37_6') + .click('#col_37_7') + .click('#col_37_8') + .click('#col_37_9') + .click('#col_37_10') + .click('#col_37_11') + .click('#col_37_12') + .click('#col_37_13') + .click('#col_37_14') + .click('#col_37_15') + .click('#col_37_16') + .click('#col_37_17') + .click('#col_37_18') + .click('#col_37_19') + .click('#col_37_20') + .click('#col_37_21') + .click('#col_37_22') + .click('#col_36_30') + .click('#col_36_31') + .click('#col_36_32') + .click('#col_36_33') + .click('#col_37_29') + .click('#col_37_30') + .click('#col_37_31') + .click('#col_37_32') + .click('#col_37_33') + .click('#col_37_34') + .click('#lava') + .click('#col_3_29') + .click('#col_3_30') + .click('#col_3_31') + .click('#col_3_32') + .click('#col_3_33') + .click('#col_3_34') + .click('#col_3_35') + .click('#col_4_28') + .click('#col_4_29') + .click('#col_4_35') + .click('#col_4_36') + .click('#col_5_27') + .click('#col_5_28') + .click('#col_5_36') + .click('#col_6_26') + .click('#col_6_27') + .click('#col_6_36') + .click('#col_7_35') + .click('#col_9_35') + .click('#col_10_26') + .click('#col_10_27') + .click('#col_10_36') + .click('#col_11_27') + .click('#col_11_28') + .click('#col_11_36') + .click('#col_12_28') + .click('#col_12_29') + .click('#col_12_30') + .click('#col_12_34') + .click('#col_12_35') + .click('#col_12_36') + .click('#col_31_25') + .click('#col_31_29') + .click('#col_31_31') + .click('#col_31_33') + .click('#col_31_35') + .click('#col_32_23') + .click('#col_32_24') + .click('#col_32_25') + .click('#col_32_30') + .click('#col_32_32') + .click('#col_32_34') + .click('#col_33_22') + .click('#col_33_23') + .click('#col_34_21') + .click('#col_34_22') + .click('#col_35_21') + .click('#gold') + .click('#col_6_17') + .click('#col_7_16') + .click('#col_7_17') + .click('#col_7_18') + .click('#col_7_36') + .click('#col_8_15') + .click('#col_8_16') + .click('#col_8_17') + .click('#col_8_18') + .click('#col_8_35') + .click('#col_8_36') + .click('#col_9_14') + .click('#col_9_15') + .click('#col_9_16') + .click('#col_9_17') + .click('#col_9_36') + .click('#col_10_13') + .click('#col_10_14') + .click('#col_10_15') + .click('#col_10_16') + .click('#col_10_17') + .click('#col_10_18') + .click('#col_11_13') + .click('#col_11_14') + .click('#col_11_15') + .click('#col_11_16') + .click('#col_11_17') + .click('#col_11_18') + .click('#col_12_14') + .click('#col_12_17') + .click('#col_15_30') + .click('#col_15_31') + .click('#col_16_29') + .click('#col_16_30') + .click('#col_16_31') + .click('#col_16_32') + .click('#col_17_28') + .click('#col_17_29') + .click('#col_17_30') + .click('#col_17_31') + .click('#col_17_32') + .click('#col_17_33') + .click('#col_18_29') + .click('#col_18_30') + .click('#col_18_31') + .click('#col_18_32') + .click('#col_19_30') + .click('#col_19_31') + .click('#col_17_18') + .click('#col_18_18') + .click('#col_18_19') + .click('#col_18_17') + .click('#col_19_17') + .click('#col_19_18') + .click('#col_19_16') + .click('#col_20_16') + .click('#col_20_17') + .click('#col_20_15') + .click('#col_21_15') + .click('#col_21_16') + .click('#col_21_14') + .click('#col_22_14') + .click('#col_22_15') + .click('#col_22_13') + .click('#col_23_13') + .click('#col_23_14') + .click('#col_24_13') + .click('#col_23_12') + .click('#col_37_23') + .click('#col_36_23') + .click('#col_35_23') + .click('#col_35_24') + .click('#col_35_25') + .click('#col_35_26') + .click('#col_36_27') + .click('#col_37_27') + .click('#col_34_27') + .click('#col_34_28') + .click('#col_34_29') + .click('#col_34_30') + .click('#col_34_31') + .click('#col_34_32') + .click('#col_34_33') + .click('#col_34_34') + .click('#col_34_35') + .click('#col_33_36') + .click('#col_34_36') + .click('#col_35_36') + .click('#col_36_36') + .click('#col_37_36') + .click('#brimstone') + .click('#col_30_20') + .click('#col_30_21') + .click('#col_30_22') + .click('#col_30_23') + .click('#col_30_24') + .click('#col_31_19') + .click('#col_31_20') + .click('#col_31_21') + .click('#col_31_22') + .click('#col_31_23') + .click('#col_31_24') + .click('#col_32_14') + .click('#col_32_15') + .click('#col_32_16') + .click('#col_32_17') + .click('#col_32_18') + .click('#col_32_19') + .click('#col_32_20') + .click('#col_32_21') + .click('#col_32_22') + .click('#col_33_14') + .click('#col_33_15') + .click('#col_33_16') + .click('#col_33_17') + .click('#col_33_18') + .click('#col_33_19') + .click('#col_33_20') + .click('#col_33_21') + .click('#col_34_19') + .click('#col_34_20') + .click('#col_35_20') + .click('#water') + .click('#col_31_15') + .click('#col_30_15') + .click('#col_29_15') + .click('#col_29_16') + .click('#col_28_16') + .click('#col_28_17') + .click('#col_27_17') + .click('#col_27_18') + .click('#col_26_18') + .click('#col_26_19') + .click('#col_26_20') + .click('#col_25_20') + .click('#col_25_21') + .click('#col_25_22') + .click('#col_26_22') + .click('#col_25_23') + .click('#col_25_24') + .click('#col_26_24') + .click('#col_25_25') + .click('#col_25_26') + .click('#col_26_26') + .click('#col_25_27') + .click('#col_25_28') + .click('#col_26_28') + .click('#col_25_29') + .click('#col_25_30') + .click('#col_26_30') + .click('#col_25_31') + .click('#col_25_32') + .click('#col_26_32') + .click('#col_25_33') + .click('#col_25_34') + .click('#col_26_34') + .click('#col_25_35') + .click('#col_26_35') + .click('#col_26_36') + .click('#col_27_35') + .click('#col_28_36') + .click('#col_28_35') + .click('#col_28_34') + .click('#col_29_34') + .click('#col_29_35') + .click('#col_29_33') + .click('#col_29_32') + .click('#col_28_32') + .click('#col_29_31') + .click('#col_29_30') + .click('#col_28_30') + .click('#col_29_29') + .click('#col_29_28') + .click('#col_28_28') + .click('#col_29_27') + .click('#col_29_26') + .click('#col_28_26') + .click('#col_29_25') + .click('#col_29_24') + .click('#col_28_24') + .click('#col_29_23') + .click('#col_29_22') + .click('#col_28_22') + .click('#col_29_21') + .click('#col_29_20') + .click('#col_28_20') + .click('#col_29_19') + .click('#col_30_19') + .click('#col_30_18') + .click('#col_31_18') + .click('#col_31_17') + .click('#col_31_16') + .click('#permafrost') + .click('#col_30_16') + .click('#col_30_17') + .click('#col_29_17') + .click('#col_29_18') + .click('#col_28_18') + .click('#col_28_19') + .click('#col_27_19') + .click('#col_27_20') + .click('#col_27_21') + .click('#col_26_21') + .click('#col_28_21') + .click('#col_27_22') + .click('#col_27_23') + .click('#col_26_23') + .click('#col_28_23') + .click('#col_27_24') + .click('#col_27_25') + .click('#col_26_25') + .click('#col_28_25') + .click('#col_27_26') + .click('#col_27_27') + .click('#col_26_27') + .click('#col_28_27') + .click('#col_27_28') + .click('#col_27_29') + .click('#col_26_29') + .click('#col_28_29') + .click('#col_27_30') + .click('#col_27_31') + .click('#col_26_31') + .click('#col_28_31') + .click('#col_27_32') + .click('#col_27_33') + .click('#col_26_33') + .click('#col_28_33') + .click('#col_27_34') + .click('#archiveshrine') + .click('#col_25_7') + .click('#gateway') + .click('#col_37_25') + .click('#col_8_25') + .click('#core_p1') + .click('#col_8_32') + .click('#dirt') + .click('#col_8_27') + .click('#col_8_28') + .click('#col_8_29') + .click('#col_31_27') + .click('#col_32_27') + .click('#col_33_27') + + if (external) { + return test; + } else { + test.done(); + } + } +}; \ No newline at end of file From e07d9cf26ac3d882e0f9903fd8718a9a07a83081 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 13:16:51 +0100 Subject: [PATCH 32/77] update tests and improve converting of asserts --- tests/convert.js | 2 +- tests/maps/defaultMap.js | 5 ++++- tests/maps/mirror1Map.js | 2 +- tests/options/mirror1.js | 3 +++ tests/options/new_map.js | 4 ++-- tests/suite/defaultMap.js | 11 ++++++++--- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/convert.js b/tests/convert.js index 8a31943..a109c89 100644 --- a/tests/convert.js +++ b/tests/convert.js @@ -49,7 +49,7 @@ function convertTests(content) { .replace(/assertConfirmation/g, "assert.dialogText") .replace(/assertConfirmation/g, "assert.dialogText") .replace(/waitForNotVisible/g, 'waitFor(function () { return document.getElementById("' + selector.substr(1) + '").style.display == none;}, [], 10000) //') - .replace(/assertEval/g, 'assert.ok("' + selector + ' == ' + val + '", "' + selector + ' == ' + val + '") //'); + .replace(/assertEval/g, 'assert.ok(' + selector + ' == ' + val + ', "' + selector + ' == ' + val + '") //'); var command = "\t\t." + cmd + "('" + params + "')"; rc += command + "\r\n"; diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index e8242af..4ea0dc4 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,5 +1,8 @@ module.exports = { - 'drawDefaultMap': function (test, external) { + 'drawMap': function (test, external) { + + if (!external) { test.open('index.html'); } + test .waitForElement('#core_p1') .click('#core_p1') diff --git a/tests/maps/mirror1Map.js b/tests/maps/mirror1Map.js index 68ef56e..086a80a 100644 --- a/tests/maps/mirror1Map.js +++ b/tests/maps/mirror1Map.js @@ -672,7 +672,7 @@ module.exports = { .click('#col_8_29') .click('#col_31_27') .click('#col_32_27') - .click('#col_33_27') + .click('#col_33_27'); if (external) { return test; diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index 91dc1a1..9bd981f 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -3,6 +3,9 @@ module.exports = { test.click('#optionButton') .click('#first') .click('#mirrorButton') + //.assert.dialogText('This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?') + //.accept() + //.waitFor(function () { return document.getElementById("options").style.display == none;}, [], 500) //('#options') .screenshot("./tests/images/:browser/mirror1.png"); if (external) { diff --git a/tests/options/new_map.js b/tests/options/new_map.js index 32163f7..baff290 100644 --- a/tests/options/new_map.js +++ b/tests/options/new_map.js @@ -1,7 +1,7 @@ module.exports = { 'generate': function (test, external, width, height) { - width = width || '40'; - height = height || '40'; + width = width || '20'; + height = height || '20'; if (!external) { test.open("index.html"); } diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 39bde43..0121dd3 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -5,9 +5,14 @@ var new_map = require('../options/new_map'); module.exports = { "Mirroring": function(test) { test.open("index.html"); - new_map.generate(test, true); - map.drawDefaultMap(test, true); - mirror1.mirror(test, true); + new_map.generate(test, true); + map.drawMap(test, true); + mirror1.mirror(test, true); + test.execute(function() { + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "Object.keys(window.terrain.tiles).length == " + Object.keys(window.terrain.tiles).length); + }); test.done(); } }; \ No newline at end of file From ea26e2c95cd2740532f68d46376d9617d8e6a10d Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 15:44:08 +0100 Subject: [PATCH 33/77] workarround for PhantomJS confirm/alert messages --- Gruntfile.js | 2 +- tests/options/mirror1.js | 5 +++-- tests/options/new_map.js | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index c9d00b1..49c01cb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -26,7 +26,7 @@ module.exports = function (grunt) { }, dalek: { dist: { - src: ['./tests/options/new_map.js'] + src: ['./tests/suite/defaultMap.js'] } } }); diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index 9bd981f..b5eba31 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -2,9 +2,10 @@ module.exports = { 'mirror': function (test, external) { test.click('#optionButton') .click('#first') + .assert.enabled('#rotate', 'Rotate enabled') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') .click('#mirrorButton') - //.assert.dialogText('This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?') - //.accept() //.waitFor(function () { return document.getElementById("options").style.display == none;}, [], 500) //('#options') .screenshot("./tests/images/:browser/mirror1.png"); diff --git a/tests/options/new_map.js b/tests/options/new_map.js index baff290..28f8596 100644 --- a/tests/options/new_map.js +++ b/tests/options/new_map.js @@ -6,6 +6,17 @@ module.exports = { if (!external) { test.open("index.html"); } test + .execute(function(){ + // Workarround for phantomjs, otherwise confirm/alert messages break tests + window.confirm = function(text){ + //'This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?' + return true; + }; + window.alert = function(text){ + //'This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?' + return true; + }; + }) .click('#optionButton') .type('#width', width) .type('#height', height) From 15a70799ebe1e3eed80792603b02ae9de25bf8dd Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 16:04:36 +0100 Subject: [PATCH 34/77] change notifications --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8788c97..5ae414b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,8 @@ before_script: - npm install -g grunt-cli cache: directories: - - node_modules \ No newline at end of file + - node_modules +notifications: + email: + on_success: change + on_failure: change From 0111137dca2b7fde9eb127bb652a2148be32a70c Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 17:05:04 +0100 Subject: [PATCH 35/77] bugfix for converting tests --- tests/convert.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/convert.js b/tests/convert.js index a109c89..85f1ae0 100644 --- a/tests/convert.js +++ b/tests/convert.js @@ -29,7 +29,7 @@ function convertTests(content) { var rc = header; var tests = null; - while ((testRegex.exec(content)) !== null){ + while ((tests = testRegex.exec(content)) !== null){ var cmd = tests[1]; var selector = tests[2]; var val = tests[3]; @@ -46,10 +46,11 @@ function convertTests(content) { // correct cmd cmd = cmd .replace(/waitForElementPresent/g, "waitForElement") - .replace(/assertConfirmation/g, "assert.dialogText") - .replace(/assertConfirmation/g, "assert.dialogText") + .replace(/assertConfirmation/g, "// assert.dialogText") + .replace(/assertConfirmation/g, "// assert.dialogText") .replace(/waitForNotVisible/g, 'waitFor(function () { return document.getElementById("' + selector.substr(1) + '").style.display == none;}, [], 10000) //') .replace(/assertEval/g, 'assert.ok(' + selector + ' == ' + val + ', "' + selector + ' == ' + val + '") //'); + .replace(/type/g, 'setValue'); var command = "\t\t." + cmd + "('" + params + "')"; rc += command + "\r\n"; From 22d994c3ccdabf2b17cdce7dc70b9e85017be1b6 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 17:05:23 +0100 Subject: [PATCH 36/77] add extended to mirror 1 test --- tests/options/mirror1.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index b5eba31..4f4e547 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -3,12 +3,36 @@ module.exports = { test.click('#optionButton') .click('#first') .assert.enabled('#rotate', 'Rotate enabled') + .assert.notSelected('#rotate', 'Rotate unchecked') .assert.disabled('#reverse', 'Reverse disabled') .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') .click('#mirrorButton') - //.waitFor(function () { return document.getElementById("options").style.display == none;}, [], 500) //('#options') .screenshot("./tests/images/:browser/mirror1.png"); + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorExtend': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#first') + .click('#extend') + .assert.enabled('#rotate', 'Rotate enabled') + .assert.notSelected('#rotate', 'Rotate unchecked') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend unchecked') + .click('#mirrorButton') + .click('#extend') + .screenshot("./tests/images/:browser/mirror1Extend.png"); + if (external) { return test; } else { From 48dc6c13e908b6744498a8a5f927bfe5e5e16f76 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 17:06:00 +0100 Subject: [PATCH 37/77] bugfix for new map (we want to set the whole value instead of just typing after the value) --- tests/options/new_map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/options/new_map.js b/tests/options/new_map.js index 28f8596..ef283db 100644 --- a/tests/options/new_map.js +++ b/tests/options/new_map.js @@ -18,8 +18,8 @@ module.exports = { }; }) .click('#optionButton') - .type('#width', width) - .type('#height', height) + .setValue('#width', width) + .setValue('#height', height) .click('input[type="submit"]') .execute(function(){ this.assert.ok(window.terrain.mapsizex == width.value, "Mapwidth is " + width.value); From 81e6212030b34a2fcdf40d8c36c29165da8ff229 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 17:06:21 +0100 Subject: [PATCH 38/77] add new mirror option test to suite --- tests/suite/defaultMap.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 0121dd3..1f03459 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -5,14 +5,25 @@ var new_map = require('../options/new_map'); module.exports = { "Mirroring": function(test) { test.open("index.html"); - new_map.generate(test, true); - map.drawMap(test, true); - mirror1.mirror(test, true); - test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "Object.keys(window.terrain.tiles).length == " + Object.keys(window.terrain.tiles).length); - }); + // Mirror 1 + new_map.generate(test, true); + map.drawMap(test, true); + mirror1.mirror(test, true); + test.execute(function() { + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "Object.keys(window.terrain.tiles).length == 8"); + }); + // Mirror 1 Extend + new_map.generate(test, true); + map.drawMap(test, true); + mirror1.mirrorExtend(test, true); + test.execute(function() { + this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); + this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(window.terrain.tiles).length == 20"); + }); test.done(); - } + } + }; \ No newline at end of file From df3ba9e72061bb4903fea05788f4829cb6823941 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 18:15:17 +0100 Subject: [PATCH 39/77] Fix convert (error in chaining) --- tests/convert.js | 2 +- tests/images/Readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 tests/images/Readme.txt diff --git a/tests/convert.js b/tests/convert.js index 85f1ae0..5373a75 100644 --- a/tests/convert.js +++ b/tests/convert.js @@ -49,7 +49,7 @@ function convertTests(content) { .replace(/assertConfirmation/g, "// assert.dialogText") .replace(/assertConfirmation/g, "// assert.dialogText") .replace(/waitForNotVisible/g, 'waitFor(function () { return document.getElementById("' + selector.substr(1) + '").style.display == none;}, [], 10000) //') - .replace(/assertEval/g, 'assert.ok(' + selector + ' == ' + val + ', "' + selector + ' == ' + val + '") //'); + .replace(/assertEval/g, 'assert.ok(' + selector + ' == ' + val + ', "' + selector + ' == ' + val + '") //') .replace(/type/g, 'setValue'); var command = "\t\t." + cmd + "('" + params + "')"; diff --git a/tests/images/Readme.txt b/tests/images/Readme.txt new file mode 100644 index 0000000..d7888e5 --- /dev/null +++ b/tests/images/Readme.txt @@ -0,0 +1 @@ +This is the place where the test screenshots are going \ No newline at end of file From c0cf6df35e14a686a4b5bbb841045d448544ce32 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 18:17:44 +0100 Subject: [PATCH 40/77] update gitignore to ignore test screenshots --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b512c09..f9486d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +tests/images/**/*.png \ No newline at end of file From 2131ea0439bdbda14b253cf3028caa451884b9c8 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 22:35:11 +0100 Subject: [PATCH 41/77] add mirror 2 test --- tests/options/mirror1.js | 40 +++++++++++++------ tests/options/mirror2.js | 83 +++++++++++++++++++++++++++++++++++++++ tests/suite/defaultMap.js | 75 +++++++++++++++++++++++++++++++++-- 3 files changed, 183 insertions(+), 15 deletions(-) create mode 100644 tests/options/mirror2.js diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index 4f4e547..7cf8e79 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -1,14 +1,13 @@ module.exports = { 'mirror': function (test, external) { + if (!external) { test.open('index.html'); } + test.click('#optionButton') .click('#first') - .assert.enabled('#rotate', 'Rotate enabled') - .assert.notSelected('#rotate', 'Rotate unchecked') - .assert.disabled('#reverse', 'Reverse disabled') - .assert.enabled('#extend', 'Extend enabled') - .assert.notSelected('#extend', 'Extend unchecked') + .click('#mirrorButton') - .screenshot("./tests/images/:browser/mirror1.png"); + //.screenshot("./tests/images/:browser/mirror1.png") + ; if (external) { return test; @@ -24,14 +23,31 @@ module.exports = { .click('#optionButton') .click('#first') .click('#extend') - .assert.enabled('#rotate', 'Rotate enabled') - .assert.notSelected('#rotate', 'Rotate unchecked') - .assert.disabled('#reverse', 'Reverse disabled') - .assert.enabled('#extend', 'Extend enabled') - .assert.selected('#extend', 'Extend unchecked') + .click('#mirrorButton') .click('#extend') - .screenshot("./tests/images/:browser/mirror1Extend.png"); + //.screenshot("./tests/images/:browser/mirror1Extend.png" + ; + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorRotate': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#first') + .click('#rotate') + + .click('#mirrorButton') + .click('#rotate') + //.screenshot("./tests/images/:browser/mirror1Rotate.png") + ; if (external) { return test; diff --git a/tests/options/mirror2.js b/tests/options/mirror2.js new file mode 100644 index 0000000..9f813ae --- /dev/null +++ b/tests/options/mirror2.js @@ -0,0 +1,83 @@ +module.exports = { + 'mirror': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#second') + + .click('#mirrorButton') + //.screenshot("./tests/images/:browser/mirror2.png") + ; + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorExtend': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#second') + //.assert.notSelected('#extend', 'Extend unchecked') + .click('#extend') + + .click('#mirrorButton') + .click('#extend') + //.screenshot("./tests/images/:browser/mirror2Extend.png") + ; + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorReverse': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#second') + .click('#reverse') + + .click('#mirrorButton') + .click('#reverse') + //.screenshot("./tests/images/:browser/mirror2Reverse.png") + ; + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorExtendReverse': function (test, external) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#second') + .click('#reverse') + .click('#extend') + + .click('#mirrorButton') + .click('#reverse') + .click('#extend') + //.screenshot("./tests/images/:browser/mirror2ExtendReverse.png") + ; + + if (external) { + return test; + } else { + test.done(); + } + } +}; \ No newline at end of file diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 1f03459..c79b74b 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -1,5 +1,6 @@ var map = require('../maps/defaultMap'); var mirror1 = require('../options/mirror1'); +var mirror2 = require('../options/mirror2'); var new_map = require('../options/new_map'); module.exports = { @@ -8,22 +9,90 @@ module.exports = { // Mirror 1 new_map.generate(test, true); map.drawMap(test, true); + + test.execute(function() { + this.data("mapData", window.terrain.exportData()); + }); + mirror1.mirror(test, true); + /* + + .assert.enabled('#rotate', 'Rotate enabled') + .assert.notSelected('#rotate', 'Rotate unchecked') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend unchecked') + + */ + test.execute(function() { this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "Object.keys(window.terrain.tiles).length == 8"); }); + // Mirror 1 Extend - new_map.generate(test, true); - map.drawMap(test, true); + test.execute(function() { + window.terrain.importData(this.data("mapData")); + }); mirror1.mirrorExtend(test, true); test.execute(function() { this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(window.terrain.tiles).length == 20"); }); + // Mirror 1 Rotate + test.execute(function() { + window.terrain.importData(this.data("mapData")); + }); + mirror1.mirrorRotate(test, true); + test.execute(function() { + this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); + this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(window.terrain.tiles).length == 20"); + }); + + // Mirror 2 + test.execute(function() { + window.terrain.importData(this.data("mapData")); + }); + mirror2.mirror(test, true); + test.execute(function() { + // this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + // this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + // this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + }); + // Mirror 2 Extend + test.execute(function() { + window.terrain.importData(this.data("mapData")); + }); + mirror2.mirrorExtend(test, true); + test.execute(function() { + // this.assert.ok(window.terrain.mapsizex == 20, "mapsizex == 20"); + // this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40" + window.terrain.mapsizey); + // this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); + }); + // Mirror 2 Reverse + test.execute(function() { + window.terrain.importData(this.data("mapData")); + }); + mirror2.mirrorReverse(test, true); + test.execute(function() { + // this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + // this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + // this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + }); + // Mirror 2 ExtendReverse + test.execute(function() { + window.terrain.importData(this.data("mapData")); + }); + mirror2.mirrorExtendReverse(test, true); + test.execute(function() { + // this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + // this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); + // this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); + }); test.done(); - } + } }; \ No newline at end of file From 74b953748c31bad311e8a6fd6b12894a986db436 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 18 Mar 2015 23:59:18 +0100 Subject: [PATCH 42/77] cache test map (reduces overall test time) --- tests/maps/cacheMap.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/maps/cacheMap.js diff --git a/tests/maps/cacheMap.js b/tests/maps/cacheMap.js new file mode 100644 index 0000000..d6b789c --- /dev/null +++ b/tests/maps/cacheMap.js @@ -0,0 +1,19 @@ +module.exports = { + 'save': function (test, external) { + test.execute(function() { + this.data("mapData", window.terrain.exportData()); + }); + return test; + }, + 'load': function (test, external) { + test.execute(function() { + // reset these checkoxes, since dalek doesn't do that (wether with a second click nor through a reload) + window.extend.checked = ""; + window.reverse.checked = ""; + window.rotate.checked = ""; + // reimport the map + window.terrain.importData(this.data("mapData")); + }); + return test; + } +}; \ No newline at end of file From 3506b8995ea4505d484c4fc8f6e96b25b3e44db6 Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 00:00:09 +0100 Subject: [PATCH 43/77] fix assertions and make taking screenshots switching easier --- tests/maps/defaultMap.js | 6 +-- tests/options/mirror1.js | 41 +++++++++++------- tests/options/mirror2.js | 32 ++++++-------- tests/suite/defaultMap.js | 88 +++++++++++++++++++++------------------ 4 files changed, 90 insertions(+), 77 deletions(-) diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index 4ea0dc4..daae439 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,5 +1,5 @@ module.exports = { - 'drawMap': function (test, external) { + 'drawMap': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -68,8 +68,8 @@ module.exports = { .click('#col_14_14') .click('#col_14_15') .click('#col_15_15') - .click('#col_16_15') - .screenshot("./tests/images/:browser/defaultMap.png"); + .click('#col_16_15'); + makeShot && test.screenshot("./tests/images/:browser/defaultMap.png"); if (external) { return test; diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index 7cf8e79..b93d797 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -1,13 +1,12 @@ module.exports = { - 'mirror': function (test, external) { + 'mirror': function (test, external, makeShot) { if (!external) { test.open('index.html'); } test.click('#optionButton') .click('#first') - .click('#mirrorButton') - //.screenshot("./tests/images/:browser/mirror1.png") - ; + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror1.png"); if (external) { return test; @@ -15,7 +14,7 @@ module.exports = { test.done(); } }, - 'mirrorExtend': function (test, external) { + 'mirrorExtend': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -23,11 +22,8 @@ module.exports = { .click('#optionButton') .click('#first') .click('#extend') - - .click('#mirrorButton') - .click('#extend') - //.screenshot("./tests/images/:browser/mirror1Extend.png" - ; + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror1Extend.png"); if (external) { return test; @@ -35,7 +31,7 @@ module.exports = { test.done(); } }, - 'mirrorRotate': function (test, external) { + 'mirrorRotate': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -44,10 +40,27 @@ module.exports = { .click('#first') .click('#rotate') - .click('#mirrorButton') + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror1Rotate.png"); + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorExtendRotate': function (test, external, makeShot) { + + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#first') .click('#rotate') - //.screenshot("./tests/images/:browser/mirror1Rotate.png") - ; + .click('#extend') + + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror1ExtendRotate.png"); if (external) { return test; diff --git a/tests/options/mirror2.js b/tests/options/mirror2.js index 9f813ae..cd1b630 100644 --- a/tests/options/mirror2.js +++ b/tests/options/mirror2.js @@ -1,5 +1,5 @@ module.exports = { - 'mirror': function (test, external) { + 'mirror': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -7,9 +7,8 @@ module.exports = { .click('#optionButton') .click('#second') - .click('#mirrorButton') - //.screenshot("./tests/images/:browser/mirror2.png") - ; + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror2.png"); if (external) { return test; @@ -17,7 +16,7 @@ module.exports = { test.done(); } }, - 'mirrorExtend': function (test, external) { + 'mirrorExtend': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -27,10 +26,8 @@ module.exports = { //.assert.notSelected('#extend', 'Extend unchecked') .click('#extend') - .click('#mirrorButton') - .click('#extend') - //.screenshot("./tests/images/:browser/mirror2Extend.png") - ; + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror2Extend.png"); if (external) { return test; @@ -38,7 +35,7 @@ module.exports = { test.done(); } }, - 'mirrorReverse': function (test, external) { + 'mirrorReverse': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -47,10 +44,8 @@ module.exports = { .click('#second') .click('#reverse') - .click('#mirrorButton') - .click('#reverse') - //.screenshot("./tests/images/:browser/mirror2Reverse.png") - ; + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror2Reverse.png"); if (external) { return test; @@ -58,7 +53,7 @@ module.exports = { test.done(); } }, - 'mirrorExtendReverse': function (test, external) { + 'mirrorExtendReverse': function (test, external, makeShot) { if (!external) { test.open('index.html'); } @@ -68,11 +63,8 @@ module.exports = { .click('#reverse') .click('#extend') - .click('#mirrorButton') - .click('#reverse') - .click('#extend') - //.screenshot("./tests/images/:browser/mirror2ExtendReverse.png") - ; + .click('#mirrorButton'); + makeShot && test.screenshot("./tests/images/:browser/mirror2ExtendReverse.png"); if (external) { return test; diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index c79b74b..0b28515 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -1,20 +1,22 @@ var map = require('../maps/defaultMap'); +var cache = require('../maps/cacheMap'); + var mirror1 = require('../options/mirror1'); var mirror2 = require('../options/mirror2'); + var new_map = require('../options/new_map'); +var makeShot = false; module.exports = { "Mirroring": function(test) { test.open("index.html"); // Mirror 1 new_map.generate(test, true); - map.drawMap(test, true); + map.drawMap(test, true, makeShot); - test.execute(function() { - this.data("mapData", window.terrain.exportData()); - }); + cache.save(test, true); - mirror1.mirror(test, true); + mirror1.mirror(test, true, makeShot); /* .assert.enabled('#rotate', 'Rotate enabled') @@ -32,20 +34,28 @@ module.exports = { }); // Mirror 1 Extend - test.execute(function() { - window.terrain.importData(this.data("mapData")); - }); - mirror1.mirrorExtend(test, true); + cache.load(test, true); + mirror1.mirrorExtend(test, true, makeShot); test.execute(function() { this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(window.terrain.tiles).length == 20"); }); + // Mirror 1 Rotate + cache.load(test, true); + + mirror1.mirrorRotate(test, true, makeShot); test.execute(function() { - window.terrain.importData(this.data("mapData")); + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); }); - mirror1.mirrorRotate(test, true); + + // Mirror 1 ExtendRotate + cache.load(test, true); + + mirror1.mirrorExtendRotate(test, true, makeShot); test.execute(function() { this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); @@ -53,46 +63,44 @@ module.exports = { }); // Mirror 2 + cache.load(test, true); + + mirror2.mirror(test, true, makeShot); test.execute(function() { - window.terrain.importData(this.data("mapData")); - }); - mirror2.mirror(test, true); - test.execute(function() { - // this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - // this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - // this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); }); + // Mirror 2 Extend + cache.load(test, true); + + mirror2.mirrorExtend(test, true, makeShot); test.execute(function() { - window.terrain.importData(this.data("mapData")); - }); - mirror2.mirrorExtend(test, true); - test.execute(function() { - // this.assert.ok(window.terrain.mapsizex == 20, "mapsizex == 20"); - // this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40" + window.terrain.mapsizey); - // this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); }); + // Mirror 2 Reverse + cache.load(test, true); + + mirror2.mirrorReverse(test, true, makeShot); test.execute(function() { - window.terrain.importData(this.data("mapData")); - }); - mirror2.mirrorReverse(test, true); - test.execute(function() { - // this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - // this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - // this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); }); + // Mirror 2 ExtendReverse + cache.load(test, true); + + mirror2.mirrorExtendReverse(test, true, makeShot); test.execute(function() { - window.terrain.importData(this.data("mapData")); - }); - mirror2.mirrorExtendReverse(test, true); - test.execute(function() { - // this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - // this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); - // this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); + this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); + this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); }); test.done(); } - }; \ No newline at end of file From 506c6c7d1defbaa8ab88b3ed486ba49038399532 Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 00:17:04 +0100 Subject: [PATCH 44/77] update nodejs --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5ae414b..008e50f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 0.11 + - 0.12 before_script: - npm install -g grunt-cli cache: From 803ba9bdae31bc602e304339ac3696bcbff7b6a3 Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 12:22:30 +0100 Subject: [PATCH 45/77] remove selenium tests --- tests/general/new map 20 20.html | 36 - tests/general/testmap1.html | 341 -- tests/general/testmap2.html | 3351 ----------------- tests/simple mirror/index.html | 43 - tests/simple mirror/mirror 1 extend.html | 66 - tests/simple mirror/mirror 1.html | 56 - tests/simple mirror/mirror 2 extend.html | 66 - .../mirror 2 reverse extend.html | 76 - tests/simple mirror/mirror 2 reverse.html | 66 - tests/simple mirror/mirror 2.html | 56 - tests/simple mirror/mirror 3 extend.html | 66 - .../mirror 3 reverse extend.html | 76 - tests/simple mirror/mirror 3 reverse.html | 66 - tests/simple mirror/mirror 3.html | 56 - 14 files changed, 4421 deletions(-) delete mode 100644 tests/general/new map 20 20.html delete mode 100644 tests/general/testmap1.html delete mode 100644 tests/general/testmap2.html delete mode 100644 tests/simple mirror/index.html delete mode 100644 tests/simple mirror/mirror 1 extend.html delete mode 100644 tests/simple mirror/mirror 1.html delete mode 100644 tests/simple mirror/mirror 2 extend.html delete mode 100644 tests/simple mirror/mirror 2 reverse extend.html delete mode 100644 tests/simple mirror/mirror 2 reverse.html delete mode 100644 tests/simple mirror/mirror 2.html delete mode 100644 tests/simple mirror/mirror 3 extend.html delete mode 100644 tests/simple mirror/mirror 3 reverse extend.html delete mode 100644 tests/simple mirror/mirror 3 reverse.html delete mode 100644 tests/simple mirror/mirror 3.html diff --git a/tests/general/new map 20 20.html b/tests/general/new map 20 20.html deleted file mode 100644 index e5f97c9..0000000 --- a/tests/general/new map 20 20.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - -new map - - -
12
clickid=" + roomTile + "
- - - - - - - - - - - - - - - - - - - - - - - -
new map
clickid=optionButton
typeid=width20
typeid=height20
clickcss=input[type="submit"]
- - diff --git a/tests/general/testmap1.html b/tests/general/testmap1.html deleted file mode 100644 index 9dad624..0000000 --- a/tests/general/testmap1.html +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - -Draw test map - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Draw test map
waitForElementPresentid=core_p1
clickid=core_p1
clickid=col_3_3
clickid=claimed_earth_p1
clickid=col_6_1
clickid=col_6_2
clickid=col_6_3
clickid=col_6_4
clickid=col_6_5
clickid=col_6_6
clickid=col_5_6
clickid=col_4_6
clickid=col_3_6
clickid=col_2_6
clickid=col_1_6
clickid=impenetrable
clickid=col_5_14
clickid=col_4_14
clickid=col_3_14
clickid=col_2_14
clickid=goldshrine
clickid=col_11_3
clickid=archiveshrine
clickid=col_3_11
clickid=siegeshrine
clickid=col_5_17
clickid=manashrine
clickid=col_17_5
clickid=gold
clickid=col_2_17
clickid=col_2_18
clickid=col_2_19
clickid=col_10_9
clickid=col_9_9
clickid=col_9_10
clickid=col_8_10
clickid=col_7_11
clickid=brimstone
clickid=col_7_6
clickid=col_7_7
clickid=col_7_8
clickid=col_7_9
clickid=col_7_10
clickid=col_11_8
clickid=lava
clickid=col_14_5
clickid=col_14_6
clickid=col_15_6
clickid=sacred_earth
clickid=col_11_6
clickid=col_11_7
clickid=col_10_7
clickid=col_10_6
clickid=water
clickid=col_8_2
clickid=col_8_3
clickid=dirt
clickid=col_14_10
clickid=col_14_11
clickid=col_14_12
clickid=col_14_13
clickid=col_14_14
clickid=col_14_15
clickid=col_15_15
clickid=col_16_15
- - diff --git a/tests/general/testmap2.html b/tests/general/testmap2.html deleted file mode 100644 index 0e68e95..0000000 --- a/tests/general/testmap2.html +++ /dev/null @@ -1,3351 +0,0 @@ - - - - - - -Draw test map - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Draw test map
waitForElementPresentid=core_p1
clickid=impenetrable
clickid=col_1_1
clickid=col_1_2
clickid=col_1_3
clickid=col_1_4
clickid=col_1_5
clickid=col_1_6
clickid=col_1_7
clickid=col_1_8
clickid=col_1_9
clickid=col_1_10
clickid=col_1_11
clickid=col_1_12
clickid=col_1_13
clickid=col_1_14
clickid=col_1_15
clickid=col_1_16
clickid=col_1_17
clickid=col_1_18
clickid=col_1_19
clickid=col_1_20
clickid=col_1_21
clickid=col_1_22
clickid=col_1_23
clickid=col_1_24
clickid=col_1_25
clickid=col_1_26
clickid=col_1_36
clickid=col_2_1
clickid=col_2_2
clickid=col_2_3
clickid=col_2_4
clickid=col_2_5
clickid=col_2_6
clickid=col_2_7
clickid=col_2_8
clickid=col_2_9
clickid=col_2_10
clickid=col_2_11
clickid=col_2_12
clickid=col_2_13
clickid=col_2_14
clickid=col_2_15
clickid=col_2_16
clickid=col_2_17
clickid=col_2_18
clickid=col_2_19
clickid=col_2_20
clickid=col_2_21
clickid=col_2_22
clickid=col_2_23
clickid=col_2_24
clickid=col_2_25
clickid=col_3_1
clickid=col_3_2
clickid=col_3_3
clickid=col_3_4
clickid=col_3_5
clickid=col_3_6
clickid=col_3_7
clickid=col_3_8
clickid=col_3_9
clickid=col_3_10
clickid=col_3_11
clickid=col_3_12
clickid=col_3_13
clickid=col_3_14
clickid=col_3_15
clickid=col_3_16
clickid=col_3_17
clickid=col_3_18
clickid=col_3_19
clickid=col_3_20
clickid=col_3_21
clickid=col_3_22
clickid=col_3_23
clickid=col_3_24
clickid=col_4_1
clickid=col_4_2
clickid=col_4_3
clickid=col_4_4
clickid=col_4_5
clickid=col_4_6
clickid=col_4_7
clickid=col_4_8
clickid=col_4_9
clickid=col_4_10
clickid=col_4_11
clickid=col_4_12
clickid=col_4_13
clickid=col_4_14
clickid=col_4_15
clickid=col_4_16
clickid=col_4_17
clickid=col_4_18
clickid=col_4_19
clickid=col_4_20
clickid=col_4_21
clickid=col_4_22
clickid=col_4_23
clickid=col_5_1
clickid=col_5_2
clickid=col_5_3
clickid=col_5_4
clickid=col_5_5
clickid=col_5_6
clickid=col_5_7
clickid=col_5_8
clickid=col_5_9
clickid=col_5_10
clickid=col_5_11
clickid=col_5_12
clickid=col_5_13
clickid=col_5_14
clickid=col_5_15
clickid=col_6_1
clickid=col_6_2
clickid=col_6_3
clickid=col_6_4
clickid=col_6_5
clickid=col_6_6
clickid=col_6_7
clickid=col_6_8
clickid=col_6_9
clickid=col_6_10
clickid=col_6_11
clickid=col_6_12
clickid=col_6_13
clickid=col_6_14
clickid=col_7_1
clickid=col_7_2
clickid=col_7_3
clickid=col_7_4
clickid=col_7_5
clickid=col_7_6
clickid=col_7_7
clickid=col_7_8
clickid=col_7_9
clickid=col_7_10
clickid=col_7_11
clickid=col_7_12
clickid=col_8_1
clickid=col_8_2
clickid=col_8_3
clickid=col_8_4
clickid=col_8_5
clickid=col_8_6
clickid=col_8_7
clickid=col_8_8
clickid=col_8_9
clickid=col_8_10
clickid=col_8_11
clickid=col_9_1
clickid=col_9_2
clickid=col_9_3
clickid=col_9_4
clickid=col_9_5
clickid=col_9_6
clickid=col_9_7
clickid=col_9_8
clickid=col_9_9
clickid=col_9_10
clickid=col_9_11
clickid=col_10_1
clickid=col_10_2
clickid=col_10_3
clickid=col_10_4
clickid=col_10_5
clickid=col_10_6
clickid=col_10_7
clickid=col_10_8
clickid=col_10_9
clickid=col_10_10
clickid=col_10_11
clickid=col_11_1
clickid=col_11_2
clickid=col_11_3
clickid=col_11_4
clickid=col_11_5
clickid=col_11_6
clickid=col_11_7
clickid=col_11_8
clickid=col_11_9
clickid=col_11_10
clickid=col_11_11
clickid=col_12_1
clickid=col_12_2
clickid=col_12_3
clickid=col_12_4
clickid=col_12_5
clickid=col_12_6
clickid=col_12_7
clickid=col_12_8
clickid=col_12_9
clickid=col_12_10
clickid=col_12_11
clickid=col_13_1
clickid=col_13_2
clickid=col_13_3
clickid=col_13_4
clickid=col_13_5
clickid=col_13_6
clickid=col_13_7
clickid=col_13_8
clickid=col_13_9
clickid=col_13_10
clickid=col_13_11
clickid=col_14_1
clickid=col_14_2
clickid=col_14_3
clickid=col_14_4
clickid=col_14_5
clickid=col_14_6
clickid=col_14_7
clickid=col_14_8
clickid=col_14_9
clickid=col_14_10
clickid=col_15_1
clickid=col_15_2
clickid=col_15_3
clickid=col_15_4
clickid=col_15_5
clickid=col_15_6
clickid=col_15_7
clickid=col_15_8
clickid=col_15_9
clickid=col_16_1
clickid=col_16_2
clickid=col_16_3
clickid=col_16_4
clickid=col_16_5
clickid=col_16_6
clickid=col_16_7
clickid=col_17_1
clickid=col_17_2
clickid=col_17_3
clickid=col_17_4
clickid=col_17_5
clickid=col_17_6
clickid=col_18_1
clickid=col_18_2
clickid=col_18_3
clickid=col_18_4
clickid=col_18_5
clickid=col_19_1
clickid=col_19_2
clickid=col_19_3
clickid=col_19_4
clickid=col_20_1
clickid=col_20_2
clickid=col_20_3
clickid=col_21_1
clickid=col_21_2
clickid=col_22_1
clickid=col_27_1
clickid=col_28_1
clickid=col_28_2
clickid=col_29_1
clickid=col_29_2
clickid=col_29_3
clickid=col_30_1
clickid=col_30_2
clickid=col_30_3
clickid=col_30_4
clickid=col_31_1
clickid=col_31_2
clickid=col_31_3
clickid=col_31_4
clickid=col_31_5
clickid=col_32_1
clickid=col_32_2
clickid=col_32_3
clickid=col_32_4
clickid=col_32_5
clickid=col_32_6
clickid=col_32_7
clickid=col_33_1
clickid=col_33_2
clickid=col_33_3
clickid=col_33_4
clickid=col_33_5
clickid=col_33_6
clickid=col_33_7
clickid=col_33_8
clickid=col_34_1
clickid=col_34_2
clickid=col_34_3
clickid=col_34_4
clickid=col_34_5
clickid=col_34_6
clickid=col_34_7
clickid=col_34_8
clickid=col_34_9
clickid=col_34_10
clickid=col_34_11
clickid=col_34_12
clickid=col_34_13
clickid=col_34_14
clickid=col_34_15
clickid=col_34_16
clickid=col_34_17
clickid=col_34_18
clickid=col_35_1
clickid=col_35_2
clickid=col_35_3
clickid=col_35_4
clickid=col_35_5
clickid=col_35_6
clickid=col_35_7
clickid=col_35_8
clickid=col_35_9
clickid=col_35_10
clickid=col_35_11
clickid=col_35_12
clickid=col_35_13
clickid=col_35_14
clickid=col_35_15
clickid=col_35_16
clickid=col_35_17
clickid=col_35_18
clickid=col_35_19
clickid=col_36_1
clickid=col_36_2
clickid=col_36_3
clickid=col_36_4
clickid=col_36_5
clickid=col_36_6
clickid=col_36_7
clickid=col_36_8
clickid=col_36_9
clickid=col_36_10
clickid=col_36_11
clickid=col_36_12
clickid=col_36_13
clickid=col_36_14
clickid=col_36_15
clickid=col_36_16
clickid=col_36_17
clickid=col_36_18
clickid=col_36_19
clickid=col_36_20
clickid=col_36_21
clickid=col_37_1
clickid=col_37_2
clickid=col_37_3
clickid=col_37_4
clickid=col_37_5
clickid=col_37_6
clickid=col_37_7
clickid=col_37_8
clickid=col_37_9
clickid=col_37_10
clickid=col_37_11
clickid=col_37_12
clickid=col_37_13
clickid=col_37_14
clickid=col_37_15
clickid=col_37_16
clickid=col_37_17
clickid=col_37_18
clickid=col_37_19
clickid=col_37_20
clickid=col_37_21
clickid=col_37_22
clickid=col_36_30
clickid=col_36_31
clickid=col_36_32
clickid=col_36_33
clickid=col_37_29
clickid=col_37_30
clickid=col_37_31
clickid=col_37_32
clickid=col_37_33
clickid=col_37_34
clickid=lava
clickid=col_3_29
clickid=col_3_30
clickid=col_3_31
clickid=col_3_32
clickid=col_3_33
clickid=col_3_34
clickid=col_3_35
clickid=col_4_28
clickid=col_4_29
clickid=col_4_35
clickid=col_4_36
clickid=col_5_27
clickid=col_5_28
clickid=col_5_36
clickid=col_6_26
clickid=col_6_27
clickid=col_6_36
clickid=col_7_35
clickid=col_9_35
clickid=col_10_26
clickid=col_10_27
clickid=col_10_36
clickid=col_11_27
clickid=col_11_28
clickid=col_11_36
clickid=col_12_28
clickid=col_12_29
clickid=col_12_30
clickid=col_12_34
clickid=col_12_35
clickid=col_12_36
clickid=col_31_25
clickid=col_31_29
clickid=col_31_31
clickid=col_31_33
clickid=col_31_35
clickid=col_32_23
clickid=col_32_24
clickid=col_32_25
clickid=col_32_30
clickid=col_32_32
clickid=col_32_34
clickid=col_33_22
clickid=col_33_23
clickid=col_34_21
clickid=col_34_22
clickid=col_35_21
clickid=gold
clickid=col_6_17
clickid=col_7_16
clickid=col_7_17
clickid=col_7_18
clickid=col_7_36
clickid=col_8_15
clickid=col_8_16
clickid=col_8_17
clickid=col_8_18
clickid=col_8_35
clickid=col_8_36
clickid=col_9_14
clickid=col_9_15
clickid=col_9_16
clickid=col_9_17
clickid=col_9_36
clickid=col_10_13
clickid=col_10_14
clickid=col_10_15
clickid=col_10_16
clickid=col_10_17
clickid=col_10_18
clickid=col_11_13
clickid=col_11_14
clickid=col_11_15
clickid=col_11_16
clickid=col_11_17
clickid=col_11_18
clickid=col_12_14
clickid=col_12_17
clickid=col_15_30
clickid=col_15_31
clickid=col_16_29
clickid=col_16_30
clickid=col_16_31
clickid=col_16_32
clickid=col_17_28
clickid=col_17_29
clickid=col_17_30
clickid=col_17_31
clickid=col_17_32
clickid=col_17_33
clickid=col_18_29
clickid=col_18_30
clickid=col_18_31
clickid=col_18_32
clickid=col_19_30
clickid=col_19_31
clickid=col_17_18
clickid=col_18_18
clickid=col_18_19
clickid=col_18_17
clickid=col_19_17
clickid=col_19_18
clickid=col_19_16
clickid=col_20_16
clickid=col_20_17
clickid=col_20_15
clickid=col_21_15
clickid=col_21_16
clickid=col_21_14
clickid=col_22_14
clickid=col_22_15
clickid=col_22_13
clickid=col_23_13
clickid=col_23_14
clickid=col_24_13
clickid=col_23_12
clickid=col_37_23
clickid=col_36_23
clickid=col_35_23
clickid=col_35_24
clickid=col_35_25
clickid=col_35_26
clickid=col_36_27
clickid=col_37_27
clickid=col_34_27
clickid=col_34_28
clickid=col_34_29
clickid=col_34_30
clickid=col_34_31
clickid=col_34_32
clickid=col_34_33
clickid=col_34_34
clickid=col_34_35
clickid=col_33_36
clickid=col_34_36
clickid=col_35_36
clickid=col_36_36
clickid=col_37_36
clickid=brimstone
clickid=col_30_20
clickid=col_30_21
clickid=col_30_22
clickid=col_30_23
clickid=col_30_24
clickid=col_31_19
clickid=col_31_20
clickid=col_31_21
clickid=col_31_22
clickid=col_31_23
clickid=col_31_24
clickid=col_32_14
clickid=col_32_15
clickid=col_32_16
clickid=col_32_17
clickid=col_32_18
clickid=col_32_19
clickid=col_32_20
clickid=col_32_21
clickid=col_32_22
clickid=col_33_14
clickid=col_33_15
clickid=col_33_16
clickid=col_33_17
clickid=col_33_18
clickid=col_33_19
clickid=col_33_20
clickid=col_33_21
clickid=col_34_19
clickid=col_34_20
clickid=col_35_20
clickid=water
clickid=col_31_15
clickid=col_30_15
clickid=col_29_15
clickid=col_29_16
clickid=col_28_16
clickid=col_28_17
clickid=col_27_17
clickid=col_27_18
clickid=col_26_18
clickid=col_26_19
clickid=col_26_20
clickid=col_25_20
clickid=col_25_21
clickid=col_25_22
clickid=col_26_22
clickid=col_25_23
clickid=col_25_24
clickid=col_26_24
clickid=col_25_25
clickid=col_25_26
clickid=col_26_26
clickid=col_25_27
clickid=col_25_28
clickid=col_26_28
clickid=col_25_29
clickid=col_25_30
clickid=col_26_30
clickid=col_25_31
clickid=col_25_32
clickid=col_26_32
clickid=col_25_33
clickid=col_25_34
clickid=col_26_34
clickid=col_25_35
clickid=col_26_35
clickid=col_26_36
clickid=col_27_35
clickid=col_28_36
clickid=col_28_35
clickid=col_28_34
clickid=col_29_34
clickid=col_29_35
clickid=col_29_33
clickid=col_29_32
clickid=col_28_32
clickid=col_29_31
clickid=col_29_30
clickid=col_28_30
clickid=col_29_29
clickid=col_29_28
clickid=col_28_28
clickid=col_29_27
clickid=col_29_26
clickid=col_28_26
clickid=col_29_25
clickid=col_29_24
clickid=col_28_24
clickid=col_29_23
clickid=col_29_22
clickid=col_28_22
clickid=col_29_21
clickid=col_29_20
clickid=col_28_20
clickid=col_29_19
clickid=col_30_19
clickid=col_30_18
clickid=col_31_18
clickid=col_31_17
clickid=col_31_16
clickid=permafrost
clickid=col_30_16
clickid=col_30_17
clickid=col_29_17
clickid=col_29_18
clickid=col_28_18
clickid=col_28_19
clickid=col_27_19
clickid=col_27_20
clickid=col_27_21
clickid=col_26_21
clickid=col_28_21
clickid=col_27_22
clickid=col_27_23
clickid=col_26_23
clickid=col_28_23
clickid=col_27_24
clickid=col_27_25
clickid=col_26_25
clickid=col_28_25
clickid=col_27_26
clickid=col_27_27
clickid=col_26_27
clickid=col_28_27
clickid=col_27_28
clickid=col_27_29
clickid=col_26_29
clickid=col_28_29
clickid=col_27_30
clickid=col_27_31
clickid=col_26_31
clickid=col_28_31
clickid=col_27_32
clickid=col_27_33
clickid=col_26_33
clickid=col_28_33
clickid=col_27_34
clickid=archiveshrine
clickid=col_25_7
clickid=gateway
clickid=col_37_25
clickid=col_8_25
clickid=core_p1
clickid=col_8_32
clickid=dirt
clickid=col_8_27
clickid=col_8_28
clickid=col_8_29
clickid=col_31_27
clickid=col_32_27
clickid=col_33_27
- - diff --git a/tests/simple mirror/index.html b/tests/simple mirror/index.html deleted file mode 100644 index bc90514..0000000 --- a/tests/simple mirror/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - Test Suite - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Test Suite
new map 20 20
testmap1
mirror 1
new map 20 20
testmap1
mirror 1 extend
new map 20 20
testmap1
mirror 2
new map 20 20
testmap1
mirror 2 extend
new map 20 20
testmap1
mirror 2 reverse
new map 20 20
testmap1
mirror 2 reverse extend
new map 20 20
testmap1
mirror 3
new map 20 20
testmap1
mirror 3 extend
new map 20 20
testmap1
mirror 3 reverse
new map 20 20
testmap1
mirror 3 reverse extend
- - diff --git a/tests/simple mirror/mirror 1 extend.html b/tests/simple mirror/mirror 1 extend.html deleted file mode 100644 index 7ebb630..0000000 --- a/tests/simple mirror/mirror 1 extend.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=first
clickid=extend
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex40
assertEvalwindow.terrain.mapsizey40
assertEvalObject.keys(window.terrain.tiles).length20
clickid=extend
- - diff --git a/tests/simple mirror/mirror 1.html b/tests/simple mirror/mirror 1.html deleted file mode 100644 index 1ccab69..0000000 --- a/tests/simple mirror/mirror 1.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - -Mirror 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1
clickid=optionButton
clickid=first
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length8
- - diff --git a/tests/simple mirror/mirror 2 extend.html b/tests/simple mirror/mirror 2 extend.html deleted file mode 100644 index fd0a8cb..0000000 --- a/tests/simple mirror/mirror 2 extend.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=second
clickid=extend
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey40
assertEvalObject.keys(window.terrain.tiles).length10
clickid=extend
- - diff --git a/tests/simple mirror/mirror 2 reverse extend.html b/tests/simple mirror/mirror 2 reverse extend.html deleted file mode 100644 index a1de17b..0000000 --- a/tests/simple mirror/mirror 2 reverse extend.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=second
clickid=reverse
clickid=extend
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey40
assertEvalObject.keys(window.terrain.tiles).length10
clickid=reverse
clickid=extend
- - diff --git a/tests/simple mirror/mirror 2 reverse.html b/tests/simple mirror/mirror 2 reverse.html deleted file mode 100644 index 002da34..0000000 --- a/tests/simple mirror/mirror 2 reverse.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=second
clickid=reverse
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
clickid=reverse
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length7
- - diff --git a/tests/simple mirror/mirror 2.html b/tests/simple mirror/mirror 2.html deleted file mode 100644 index dca5b9d..0000000 --- a/tests/simple mirror/mirror 2.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - -Mirror 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 2
clickid=optionButton
clickid=second
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length7
- - diff --git a/tests/simple mirror/mirror 3 extend.html b/tests/simple mirror/mirror 3 extend.html deleted file mode 100644 index 785c40b..0000000 --- a/tests/simple mirror/mirror 3 extend.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=third
clickid=extend
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex40
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length10
clickid=extend
- - diff --git a/tests/simple mirror/mirror 3 reverse extend.html b/tests/simple mirror/mirror 3 reverse extend.html deleted file mode 100644 index 403d7dc..0000000 --- a/tests/simple mirror/mirror 3 reverse extend.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=third
clickid=reverse
clickid=extend
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex40
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length10
clickid=reverse
clickid=extend
- - diff --git a/tests/simple mirror/mirror 3 reverse.html b/tests/simple mirror/mirror 3 reverse.html deleted file mode 100644 index 0ff7e49..0000000 --- a/tests/simple mirror/mirror 3 reverse.html +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - -Mirror 1 extend - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 1 extend
clickid=optionButton
clickid=third
clickid=reverse
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
clickid=reverse
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length7
- - diff --git a/tests/simple mirror/mirror 3.html b/tests/simple mirror/mirror 3.html deleted file mode 100644 index 8106450..0000000 --- a/tests/simple mirror/mirror 3.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - -Mirror 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mirror 2
clickid=optionButton
clickid=third
clickcss=#mirrorButton > button
assertConfirmationThis recalculates the whole map and may remove some of your changes. Are you sure you want to continue?
waitForNotVisibleid=options
assertEvalwindow.terrain.mapsizex20
assertEvalwindow.terrain.mapsizey20
assertEvalObject.keys(window.terrain.tiles).length7
- - From b67e8146295c6e5adfe2136529a3786946781aa2 Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 12:28:57 +0100 Subject: [PATCH 46/77] add mirror 3 test --- tests/options/mirror3.js | 118 ++++++++++++++++++++++++++++++++++++++ tests/suite/defaultMap.js | 97 ++++++++++++++++++------------- 2 files changed, 174 insertions(+), 41 deletions(-) create mode 100644 tests/options/mirror3.js diff --git a/tests/options/mirror3.js b/tests/options/mirror3.js new file mode 100644 index 0000000..a7221d5 --- /dev/null +++ b/tests/options/mirror3.js @@ -0,0 +1,118 @@ +module.exports = { + 'mirror': function (test, external, makeShot) { + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#third') + + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.notSelected('#reverse', 'Reverse unchecked') + .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror3.png"); + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorExtend': function (test, external, makeShot) { + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#third') + .click('#extend') + + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.notSelected('#reverse', 'Reverse unchecked') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend checked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror3Extend.png"); + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorReverse': function (test, external, makeShot) { + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#third') + .click('#reverse') + + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.selected('#reverse', 'Reverse checked') + .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror3Reverse.png"); + + if (external) { + return test; + } else { + test.done(); + } + }, + 'mirrorExtendReverse': function (test, external, makeShot) { + if (!external) { test.open('index.html'); } + + test + .click('#optionButton') + .click('#third') + .click('#reverse') + .click('#extend') + + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.selected('#reverse', 'Reverse checked') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend checked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror3ExtendReverse.png"); + + if (external) { + return test; + } else { + test.done(); + } + } +}; diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 0b28515..b9713b0 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -3,6 +3,7 @@ var cache = require('../maps/cacheMap'); var mirror1 = require('../options/mirror1'); var mirror2 = require('../options/mirror2'); +var mirror3 = require('../options/mirror3'); var new_map = require('../options/new_map'); var makeShot = false; @@ -10,96 +11,110 @@ var makeShot = false; module.exports = { "Mirroring": function(test) { test.open("index.html"); + test.execute(function() { + this.data('mapsize', 20); + }); + // Mirror 1 new_map.generate(test, true); map.drawMap(test, true, makeShot); - cache.save(test, true); - mirror1.mirror(test, true, makeShot); - /* - - .assert.enabled('#rotate', 'Rotate enabled') - .assert.notSelected('#rotate', 'Rotate unchecked') - .assert.disabled('#reverse', 'Reverse disabled') - .assert.enabled('#extend', 'Extend enabled') - .assert.selected('#extend', 'Extend unchecked') - - */ test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "Object.keys(window.terrain.tiles).length == 8"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "Object.keys(tiles).length == 8"); }); + // test.assert.evaluate(function() { + // return Object.keys(window.terrain.tiles).length; + // }, 8, "tiles length is 8"); + // Mirror 1 Extend cache.load(test, true); mirror1.mirrorExtend(test, true, makeShot); + test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); - this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(window.terrain.tiles).length == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(tiles).length == 20"); }); // Mirror 1 Rotate cache.load(test, true); - mirror1.mirrorRotate(test, true, makeShot); + test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(tiles).length == 7"); }); // Mirror 1 ExtendRotate cache.load(test, true); - mirror1.mirrorExtendRotate(test, true, makeShot); + test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 40, "window.terrain.mapsizex == 40"); - this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(window.terrain.tiles).length == 20"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 20, "Object.keys(tiles).length == 20"); }); // Mirror 2 cache.load(test, true); - mirror2.mirror(test, true, makeShot); + test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(tiles).length == 7"); }); // Mirror 2 Extend cache.load(test, true); - mirror2.mirrorExtend(test, true, makeShot); + test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(tiles).length == 10"); }); // Mirror 2 Reverse cache.load(test, true); - mirror2.mirrorReverse(test, true, makeShot); + test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 20, "window.terrain.mapsizey == 20"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(window.terrain.tiles).length == 7"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(tiles).length == 7"); }); // Mirror 2 ExtendReverse cache.load(test, true); - mirror2.mirrorExtendReverse(test, true, makeShot); + + test.execute(function() { + this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(tiles).length == 10"); + }); + + // Mirror 3 + cache.load(test, true); + + mirror3.mirror(test, true, makeShot); + test.execute(function() { + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(tiles).length == 7"); + }); + + // Mirror 3 Extend + cache.load(test, true); + + mirror3.mirrorExtend(test, true, makeShot); + test.execute(function() { + this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(tiles).length == 10"); + }); + + // Mirror 3 Reverse + cache.load(test, true); + + mirror3.mirrorReverse(test, true, makeShot); + test.execute(function() { + this.assert.ok(Object.keys(window.terrain.tiles).length == 7, "Object.keys(tiles).length == 7"); + }); + + // Mirror 3 ExtendReverse + cache.load(test, true); + + mirror3.mirrorExtendReverse(test, true, makeShot); test.execute(function() { - this.assert.ok(window.terrain.mapsizex == 20, "window.terrain.mapsizex == 20"); - this.assert.ok(window.terrain.mapsizey == 40, "window.terrain.mapsizey == 40"); - this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(window.terrain.tiles).length == 10"); + this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(tiles).length == 10"); }); test.done(); } From 514f9465db016fcdefae38c79ecf46577cf7a1ff Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 12:29:55 +0100 Subject: [PATCH 47/77] add test messages and some asserts --- tests/maps/cacheMap.js | 2 ++ tests/maps/defaultMap.js | 2 +- tests/maps/mirror1Map.js | 2 +- tests/options/mirror1.js | 71 +++++++++++++++++++++++++++++++++------ tests/options/mirror2.js | 72 +++++++++++++++++++++++++++++++++------- tests/options/mirror3.js | 4 +++ 6 files changed, 128 insertions(+), 25 deletions(-) diff --git a/tests/maps/cacheMap.js b/tests/maps/cacheMap.js index d6b789c..f10059e 100644 --- a/tests/maps/cacheMap.js +++ b/tests/maps/cacheMap.js @@ -1,11 +1,13 @@ module.exports = { 'save': function (test, external) { + console.log(">> Save mapdata"); test.execute(function() { this.data("mapData", window.terrain.exportData()); }); return test; }, 'load': function (test, external) { + console.log(">> Load mapdata"); test.execute(function() { // reset these checkoxes, since dalek doesn't do that (wether with a second click nor through a reload) window.extend.checked = ""; diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index daae439..6f42b19 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,6 +1,6 @@ module.exports = { 'drawMap': function (test, external, makeShot) { - + console.log(">> Draw default map"); if (!external) { test.open('index.html'); } test diff --git a/tests/maps/mirror1Map.js b/tests/maps/mirror1Map.js index 086a80a..5c83c59 100644 --- a/tests/maps/mirror1Map.js +++ b/tests/maps/mirror1Map.js @@ -2,7 +2,7 @@ module.exports = { /* draws a rather complex map for testing the mirror 1 feature */ /* Team Brawl by Slichizard */ 'drawMap': function (test, external) { - + console.log(">> Draw team brawl"); if (!external) { test.open('index.html'); } test diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index b93d797..b4514db 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -1,12 +1,25 @@ module.exports = { 'mirror': function (test, external, makeShot) { + console.log('mirror1 mirror'); if (!external) { test.open('index.html'); } test.click('#optionButton') .click('#first') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror1.png"); + .click('#mirrorButton') + + .assert.enabled('#rotate', 'Rotate enabled') + .assert.notSelected('#rotate', 'Rotate unchecked') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror1.png"); if (external) { return test; @@ -15,15 +28,27 @@ module.exports = { } }, 'mirrorExtend': function (test, external, makeShot) { - + console.log('mirror1 mirrorExtend'); if (!external) { test.open('index.html'); } test .click('#optionButton') .click('#first') .click('#extend') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror1Extend.png"); + .click('#mirrorButton') + + .assert.enabled('#rotate', 'Rotate enabled') + .assert.notSelected('#rotate', 'Rotate unchecked') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend checked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror1Extend.png"); if (external) { return test; @@ -32,7 +57,7 @@ module.exports = { } }, 'mirrorRotate': function (test, external, makeShot) { - + console.log('mirror1 mirrorRotate'); if (!external) { test.open('index.html'); } test @@ -40,8 +65,20 @@ module.exports = { .click('#first') .click('#rotate') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror1Rotate.png"); + .click('#mirrorButton') + + .assert.enabled('#rotate', 'Rotate enabled') + .assert.selected('#rotate', 'Rotate checked') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror1Rotate.png"); if (external) { return test; @@ -50,7 +87,7 @@ module.exports = { } }, 'mirrorExtendRotate': function (test, external, makeShot) { - + console.log('mirror1 mirrorExtendRotate'); if (!external) { test.open('index.html'); } test @@ -59,8 +96,20 @@ module.exports = { .click('#rotate') .click('#extend') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror1ExtendRotate.png"); + .click('#mirrorButton') + + .assert.enabled('#rotate', 'Rotate enabled') + .assert.selected('#rotate', 'Rotate checked') + .assert.disabled('#reverse', 'Reverse disabled') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend checked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror1ExtendRotate.png"); if (external) { return test; diff --git a/tests/options/mirror2.js b/tests/options/mirror2.js index cd1b630..69972dd 100644 --- a/tests/options/mirror2.js +++ b/tests/options/mirror2.js @@ -1,14 +1,26 @@ module.exports = { 'mirror': function (test, external, makeShot) { - + console.log('mirror2 mirror'); if (!external) { test.open('index.html'); } test .click('#optionButton') .click('#second') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror2.png"); + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.notSelected('#reverse', 'Reverse unchecked') + .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror2.png"); if (external) { return test; @@ -17,7 +29,7 @@ module.exports = { } }, 'mirrorExtend': function (test, external, makeShot) { - + console.log('mirror2 mirrorExtend'); if (!external) { test.open('index.html'); } test @@ -26,8 +38,20 @@ module.exports = { //.assert.notSelected('#extend', 'Extend unchecked') .click('#extend') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror2Extend.png"); + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.notSelected('#reverse', 'Reverse unchecked') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend checked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror2Extend.png"); if (external) { return test; @@ -36,7 +60,7 @@ module.exports = { } }, 'mirrorReverse': function (test, external, makeShot) { - + console.log('mirror2 mirrorReverse'); if (!external) { test.open('index.html'); } test @@ -44,8 +68,20 @@ module.exports = { .click('#second') .click('#reverse') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror2Reverse.png"); + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.selected('#reverse', 'Reverse checked') + .assert.enabled('#extend', 'Extend enabled') + .assert.notSelected('#extend', 'Extend unchecked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror2Reverse.png"); if (external) { return test; @@ -54,7 +90,7 @@ module.exports = { } }, 'mirrorExtendReverse': function (test, external, makeShot) { - + console.log('mirror2 mirrorExtendReverse'); if (!external) { test.open('index.html'); } test @@ -63,8 +99,20 @@ module.exports = { .click('#reverse') .click('#extend') - .click('#mirrorButton'); - makeShot && test.screenshot("./tests/images/:browser/mirror2ExtendReverse.png"); + .click('#mirrorButton') + + .assert.disabled('#rotate', 'Rotate disabled') + .assert.enabled('#reverse', 'Reverse enabled') + .assert.selected('#reverse', 'Reverse checked') + .assert.enabled('#extend', 'Extend enabled') + .assert.selected('#extend', 'Extend checked') + + .execute(function(){ + this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + }); + + makeShot && test.screenshot("./tests/images/:browser/mirror2ExtendReverse.png"); if (external) { return test; diff --git a/tests/options/mirror3.js b/tests/options/mirror3.js index a7221d5..739ee5e 100644 --- a/tests/options/mirror3.js +++ b/tests/options/mirror3.js @@ -1,5 +1,6 @@ module.exports = { 'mirror': function (test, external, makeShot) { + console.log('mirror3 mirror'); if (!external) { test.open('index.html'); } test @@ -28,6 +29,7 @@ module.exports = { } }, 'mirrorExtend': function (test, external, makeShot) { + console.log('mirror3 mirrorExtend'); if (!external) { test.open('index.html'); } test @@ -57,6 +59,7 @@ module.exports = { } }, 'mirrorReverse': function (test, external, makeShot) { + console.log('mirror3 mirrorReverse'); if (!external) { test.open('index.html'); } test @@ -86,6 +89,7 @@ module.exports = { } }, 'mirrorExtendReverse': function (test, external, makeShot) { + console.log('mirror3 mirrorExtendReverse'); if (!external) { test.open('index.html'); } test From cd59d9e7864966a5fcfdc0b18acadebeaa21587e Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 13:08:39 +0100 Subject: [PATCH 48/77] make tests a little more colorful --- tests/maps/cacheMap.js | 4 ++-- tests/maps/defaultMap.js | 2 +- tests/maps/mirror1Map.js | 2 +- tests/options/new_map.js | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/maps/cacheMap.js b/tests/maps/cacheMap.js index f10059e..0decebd 100644 --- a/tests/maps/cacheMap.js +++ b/tests/maps/cacheMap.js @@ -1,13 +1,13 @@ module.exports = { 'save': function (test, external) { - console.log(">> Save mapdata"); + console.log(">> Save mapdata".purple()); test.execute(function() { this.data("mapData", window.terrain.exportData()); }); return test; }, 'load': function (test, external) { - console.log(">> Load mapdata"); + console.log(">> Load mapdata".purple()); test.execute(function() { // reset these checkoxes, since dalek doesn't do that (wether with a second click nor through a reload) window.extend.checked = ""; diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index 6f42b19..cccd89f 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,6 +1,6 @@ module.exports = { 'drawMap': function (test, external, makeShot) { - console.log(">> Draw default map"); + console.log(">> Draw default map".purple()); if (!external) { test.open('index.html'); } test diff --git a/tests/maps/mirror1Map.js b/tests/maps/mirror1Map.js index 5c83c59..f67b009 100644 --- a/tests/maps/mirror1Map.js +++ b/tests/maps/mirror1Map.js @@ -2,7 +2,7 @@ module.exports = { /* draws a rather complex map for testing the mirror 1 feature */ /* Team Brawl by Slichizard */ 'drawMap': function (test, external) { - console.log(">> Draw team brawl"); + console.log(">> Draw team brawl".purple()); if (!external) { test.open('index.html'); } test diff --git a/tests/options/new_map.js b/tests/options/new_map.js index ef283db..5dfecaf 100644 --- a/tests/options/new_map.js +++ b/tests/options/new_map.js @@ -1,5 +1,9 @@ module.exports = { 'generate': function (test, external, width, height) { + String.prototype.purple = function() { + return "\033[35m" + this + "\033[0m"; + }; + width = width || '20'; height = height || '20'; From 2cf08e87f544d86c7e10b620fb7cf77c30c6624c Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 15:52:41 +0100 Subject: [PATCH 49/77] fix map export --- index.html | 1 + js/options.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 7f8b96b..5722281 100644 --- a/index.html +++ b/index.html @@ -51,6 +51,7 @@

Current version:


+
General Options diff --git a/js/options.js b/js/options.js index 4f75125..eae6626 100644 --- a/js/options.js +++ b/js/options.js @@ -220,6 +220,7 @@ function exportMap() { var author = ''; //document.getElementById("author").value; // export as base64 var data = btoa(terrain.exportData(author)); + var mapName = mapNameInput.value; if (mapName.length < 1 || mapName.match(invalidLetterRegex)) { alert("Invalid filename!"); @@ -241,9 +242,11 @@ function exportMap() { var href = window.URL.createObjectURL(blob); var exportButton = document.getElementById("export"); - exportButton.setAttribute("download", mapName); - exportButton.setAttribute("href", href); - exportButton.setAttribute("target", "_blank"); + var exportLink = document.getElementById("exportLink"); + exportLink.setAttribute("download", mapName); + exportLink.setAttribute("href", href); + exportLink.setAttribute("target", "_blank"); + exportLink.click(); toggleOptions(false); } From b16947a4bdc0c31e970c3631d0d995546eb997ee Mon Sep 17 00:00:00 2001 From: ufdada Date: Thu, 19 Mar 2015 15:52:53 +0100 Subject: [PATCH 50/77] add test for importing map --- tests/files/Testfile1.wfto | 1 + tests/options/exchange_map.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 tests/files/Testfile1.wfto create mode 100644 tests/options/exchange_map.js diff --git a/tests/files/Testfile1.wfto b/tests/files/Testfile1.wfto new file mode 100644 index 0000000..6163d18 --- /dev/null +++ b/tests/files/Testfile1.wfto @@ -0,0 +1 @@ +eyJ2ZXJzaW9uIjoiMS4zIiwiYXV0aG9yIjoiIiwiYm9yZGVyIjoxLCJ0aWxlcyI6WyJjb3JlX3A0IiwiY2xhaW1lZF9lYXJ0aF9wNCIsImVhcnRoIiwiZ29sZCIsImNsYWltZWRfZWFydGhfcDEiLCJjb3JlX3AxIiwiYnJpbXN0b25lIiwiZ29sZHNocmluZSIsIndhdGVyIiwic2FjcmVkX2VhcnRoIiwiY2xhaW1lZF9lYXJ0aF9wMyIsImNsYWltZWRfZWFydGhfcDIiLCJjb3JlX3AzIiwiY29yZV9wMiJdLCJ0aWxlSWRzIjpbIjE0MjY3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b/tests/options/exchange_map.js new file mode 100644 index 0000000..fcb47ce --- /dev/null +++ b/tests/options/exchange_map.js @@ -0,0 +1,19 @@ +module.exports = { + 'importMap1': function (test, external) { + + if (!external) { test.open("index.html"); } + + test + .click('#optionButton') + .setValue('#mapFile', ".\\tests\\files\\Testfile1.wfto") + .click('#import') + .assert.val('#mapName', 'Testfile1', 'Map name is Testfile1') + .screenshot("./tests/images/:browser/Testfile1_import.png"); + + if (external) { + return test; + } else { + test.done(); + } + } +}; \ No newline at end of file From 274a3b5d63d31a02354827cf7f6a1c3ddd7db1bd Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 20 Mar 2015 13:03:40 +0100 Subject: [PATCH 51/77] additional testing and cleanup - implement csv import - clean import - add csv import file - rename import file - stub export file (currently not possible due to phantom errors) --- index.html | 2 +- tests/files/Testimport.csv | 80 +++++++++++++++++++ .../files/{Testfile1.wfto => Testimport.wfto} | 0 tests/options/exchange_map.js | 67 ++++++++++++++-- tests/options/mirror1.js | 8 +- tests/options/mirror2.js | 8 +- tests/options/mirror3.js | 8 +- tests/suite/defaultMap.js | 10 ++- 8 files changed, 164 insertions(+), 19 deletions(-) create mode 100644 tests/files/Testimport.csv rename tests/files/{Testfile1.wfto => Testimport.wfto} (100%) diff --git a/index.html b/index.html index 5722281..00b02f0 100644 --- a/index.html +++ b/index.html @@ -41,7 +41,7 @@ Import Google CSV

- +
Export Map diff --git a/tests/files/Testimport.csv b/tests/files/Testimport.csv new file mode 100644 index 0000000..46186da --- /dev/null +++ b/tests/files/Testimport.csv @@ -0,0 +1,80 @@ +im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im +,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im +di,ch,ch,ch,ch,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,ch,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,im +ch,ch,ch,ch,im,im,im,im,im,im,la,la,la,la,la,,,,,,la,la,la,im,im,im,im,im,im,im,im,im,im,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,im,im,im,im,im,im,,,,im,im,im,,,,im,im,im,,,,im,im,im,ch,im +la,ch,ch,im,im,im,im,im,go,go,la,la,la,la,la,,,,,,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,im,im,im,go,go,,,,im,,go,go,go,,im,,,,go,go,im,im,ch,im +wa,ch,im,im,im,go,go,go,go,la,la,la,la,la,la,br,,,,,di,la,la,la,la,la,la,go,,la,la,la,la,,,,,,,di,di,di,di,di,di,di,di,di,di,di,di,di,,,la,la,la,la,,go,,,,,,,,,,,,,,,,go,,im,ch,im +pf,ch,im,im,im,go,la,la,la,la,la,la,la,la,br,br,la,im,im,la,di,la,la,la,la,la,la,la,go,la,la,la,la,,,,,,la,la,la,la,im,im,im,la,la,la,la,la,la,la,la,,,la,la,la,,,,,,,,,,,,,,,,,,,,im,ch,im +br,ch,im,im,im,go,la,la,la,la,la,la,la,br,br,la,im,im,im,im,,la,la,la,la,la,la,la,,la,la,la,la,,,,,,la,la,im,im,im,ch,im,im,im,la,la,la,la,la,la,la,,la,la,la,,,,,,,,,,,,,,,,,,,,im,ch,im +se,ch,im,im,go,go,la,la,sh,sh,sh,la,la,br,la,im,im,ch,ch,im,di,la,la,la,la,la,la,la,la,la,la,la,la,,,,,,la,im,im,ch,ch,ch,ch,im,la,la,la,la,la,la,la,di,di,la,la,la,im,,,,,,im,,,,,,im,,,,,,im,im,ch,im +go,ch,im,im,go,la,la,la,sh,sh,sh,br,br,br,la,im,ch,ch,ch,im,di,la,la,,,,la,la,la,la,la,la,la,,,,,,la,im,ch,ch,ch,ch,im,la,,,,,,,,di,la,la,la,la,im,im,,,,im,im,im,,,,im,im,im,,,,im,im,im,ch,im +sa,ch,im,la,la,la,la,la,sh,sh,sh,la,la,la,im,im,ch,ch,im,im,di,di,di,,,,la,la,la,la,la,la,la,,la,la,la,,im,im,ch,ch,ch,ch,im,la,br,la,la,la,la,,la,di,di,la,la,la,im,,,,,,im,co,co,co,co,co,im,,,,,,im,im,ch,im +co,ch,im,la,la,la,la,la,la,br,la,la,la,im,im,ch,ch,ch,im,la,la,la,la,,,,,,,,la,,,,la,la,la,,im,ch,ch,ch,ch,ch,im,la,br,la,la,la,la,,la,la,,la,la,la,,,,,,,,co,co,co,co,co,,,ga,ga,ga,,,im,ch,im +sh,ch,im,la,la,la,la,la,la,br,la,la,la,la,im,im,ch,im,im,la,la,la,la,la,la,la,la,la,la,la,la,la,,,la,la,,,im,im,ch,ch,ch,im,im,la,br,la,la,la,la,,la,la,,la,im,la,,,,,,,,co,co,co,co,co,,,ga,ga,ga,,,im,ch,im +ga,ch,im,la,la,la,la,br,br,br,la,im,la,la,la,im,im,im,la,la,la,la,,la,la,la,la,la,la,la,la,di,di,la,la,la,,la,la,im,ch,ch,im,im,la,la,br,la,la,go,go,go,la,la,,la,la,la,,,,,,,,co,co,co,co,co,,,ga,ga,ga,,,im,ch,im +nb,ch,im,la,la,la,br,br,la,la,im,im,im,la,la,la,im,la,la,la,la,,go,la,la,la,la,la,la,la,la,di,la,la,la,la,la,la,la,im,im,im,im,la,la,la,br,la,la,go,go,go,la,la,,la,la,la,go,,,,,,im,co,co,co,co,co,im,,,,,,im,im,ch,im +im,ch,im,,,br,br,la,im,im,im,ch,im,im,la,la,la,la,la,la,la,go,la,la,la,la,di,di,la,la,la,di,di,la,la,la,la,la,la,im,ch,im,la,la,la,la,br,la,la,go,go,go,la,la,,,,go,go,go,,,,im,im,im,,,,im,im,im,,,,im,im,im,ch,im +im,ch,im,,,,la,im,im,ch,ch,ch,ch,im,im,la,la,la,la,la,la,la,la,la,la,la,di,la,la,la,la,la,,,la,la,di,la,la,im,ch,im,br,br,br,br,br,la,la,la,la,,la,la,la,la,la,la,go,la,la,la,la,la,la,la,la,la,la,la,la,la,la,im,im,im,im,im,ch,im +im,ch,im,,,,im,im,ch,ch,ch,ch,im,im,la,la,la,la,la,la,la,la,la,la,,,,,,la,la,la,la,,la,la,di,di,la,im,im,im,br,sh,sh,sh,br,la,la,la,la,,la,la,la,im,la,la,,la,la,la,la,la,la,la,la,la,la,la,im,im,im,im,im,im,im,im,ch,im +im,ch,im,,,,im,im,ch,ch,im,im,im,la,la,la,la,la,go,la,la,la,la,la,,go,,go,,la,la,la,go,go,go,la,la,di,la,im,im,la,br,sh,sh,sh,br,la,la,la,la,,la,la,la,la,la,la,,la,la,la,la,la,br,br,br,br,br,la,im,im,im,,,im,im,im,ch,im +im,ch,im,,,,la,im,im,im,im,la,la,la,la,la,la,la,la,go,la,la,la,la,,,,,,la,la,la,go,go,go,la,la,,la,la,la,la,br,sh,sh,sh,br,la,la,la,la,,,,,,,,,,,,,,br,go,go,go,br,im,im,,,,go,,,im,ch,im +im,ch,im,la,la,di,di,,di,di,di,la,la,la,la,la,la,la,la,la,,,la,la,,go,,go,,la,la,la,go,go,go,la,la,,,,br,br,br,br,br,br,br,br,br,br,br,,la,la,la,la,la,la,la,la,la,la,la,la,br,go,go,go,br,la,la,,,go,,go,,im,ch,im +im,ch,im,la,la,la,la,la,la,la,di,la,la,la,,go,la,la,la,la,,la,la,la,,,,,,la,la,la,la,la,la,la,la,la,la,la,la,la,br,la,la,la,la,la,la,la,la,,la,im,im,im,im,la,la,la,im,la,la,la,br,go,go,go,br,la,,,go,,,,la,im,ch,im +im,ch,im,la,la,la,la,la,la,la,di,la,la,,go,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,br,la,la,la,la,la,la,la,la,,la,im,ch,ch,im,im,im,im,im,la,la,la,br,br,br,br,br,la,la,,,,go,,la,im,ch,im +im,ch,im,im,la,la,la,la,la,,,,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,br,br,br,br,br,im,im,im,im,br,im,go,go,la,la,la,la,,,la,im,im,ch,ch,ch,ch,ch,im,im,la,la,la,,la,la,la,la,la,,,,,go,la,im,ch,im +im,ch,ch,im,la,la,la,la,la,,,,la,la,la,la,la,,,,,,la,la,la,la,la,la,la,la,la,la,br,br,im,im,im,im,im,ch,im,ch,br,ch,im,im,go,go,la,la,,la,la,la,im,im,im,ch,ch,im,im,la,la,la,la,,la,la,la,la,la,la,go,,la,la,la,im,ch,im +im,ch,ch,im,la,la,la,la,la,,,,la,la,la,la,la,,go,,go,,la,la,la,di,di,di,di,di,br,br,br,im,im,ch,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,go,go,la,,di,la,la,la,la,im,im,im,la,la,la,la,la,la,,la,la,la,la,la,la,la,la,la,la,la,im,ch,im +im,ch,ch,im,la,la,la,la,la,la,la,,la,la,la,di,di,,,,,,la,la,la,di,go,go,go,di,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,go,la,la,di,la,di,di,di,di,,,,,,,,,,la,la,la,la,la,la,la,la,la,la,im,im,ch,im +im,ch,ch,im,la,go,la,la,la,la,la,,la,la,la,di,la,,go,,go,,la,la,la,di,go,go,go,di,la,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,la,la,di,la,di,la,la,la,,go,,la,la,la,la,la,la,la,,,,,,la,la,la,im,im,ch,ch,im +im,ch,ch,im,la,,go,,la,la,la,,la,la,la,la,la,,,,,,la,la,la,di,go,go,go,di,la,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,la,la,,,,,,,,,,di,la,la,la,la,la,la,,,,,,la,im,im,im,ch,ch,ch,im +im,ch,ch,im,la,la,la,la,la,la,la,,la,la,la,la,la,la,la,la,la,la,la,la,la,di,di,di,di,di,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,la,la,,,,la,la,la,la,la,la,di,di,la,la,la,la,la,,,,,,la,im,ch,ch,ch,ch,ch,im +im,ch,ch,im,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,br,la,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,ch,ch,im,im,im,la,la,la,,,,la,la,la,la,la,la,la,di,di,la,la,la,la,,,,,,la,im,ch,ch,ch,ch,ch,im +im,ch,ch,im,la,la,la,la,la,la,la,,la,di,di,di,la,la,la,la,la,la,la,la,la,br,la,im,im,im,ch,ch,ch,ch,ch,ch,ch,im,im,im,go,go,im,im,im,im,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,di,di,di,la,la,,,,,,la,im,ch,ch,ch,ch,ch,im +im,ch,im,im,la,la,la,la,la,la,la,,,di,la,di,,la,go,go,go,la,la,la,br,br,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,la,la,la,la,la,la,la,la,la,la,la,la,la,la,,la,la,la,la,im,im,im,im,la,la,la,la,la,la,la,la,,la,la,la,im,ch,ch,ch,ch,ch,im +im,ch,im,la,la,,,,,,,,,la,la,la,,,go,go,go,la,la,br,br,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,la,la,la,la,di,di,di,di,di,la,la,la,im,im,la,,la,la,im,im,im,ch,ch,im,im,la,la,la,la,la,la,la,,la,la,im,im,ch,ch,ch,ch,ch,im +im,ch,im,la,la,,,,,,la,la,la,la,la,la,la,la,go,go,go,la,la,br,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,go,go,la,la,la,di,la,la,la,,,,la,la,la,la,,la,la,la,im,im,ch,ch,ch,ch,im,la,la,go,go,la,la,,la,la,im,ch,ch,ch,ch,ch,ch,im +im,ch,im,la,la,,,,,,la,la,la,la,la,la,la,la,la,la,la,la,la,br,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,,,,la,,,,la,la,la,la,la,,,,,,,la,la,la,la,im,im,ch,ch,im,im,la,go,go,la,la,la,,,la,im,ch,ch,ch,ch,ch,ch,im +im,ch,im,la,la,,,,,,la,la,,,la,la,di,di,la,la,la,la,la,br,im,im,ch,ch,ch,ch,ch,ch,im,im,go,,,di,la,br,la,la,la,la,la,la,la,la,la,la,la,la,di,di,la,la,la,la,im,im,im,im,la,la,la,la,la,la,la,la,,la,im,im,ch,ch,im,im,ch,im +im,ch,im,la,la,,,,,,,,,la,la,la,la,di,di,,,la,la,br,im,ch,ch,ch,ch,ch,ch,im,im,la,go,,di,di,la,br,la,la,la,la,la,la,go,la,la,la,la,la,la,di,di,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,,la,la,im,im,im,im,im,ch,im +im,ch,im,la,la,,la,la,la,la,im,im,im,la,la,la,la,la,la,la,,la,la,im,im,ch,ch,ch,ch,ch,ch,im,la,la,la,la,la,la,la,br,br,br,la,la,,,,la,la,la,la,la,la,la,di,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,,la,la,la,la,im,la,im,ch,im +im,ch,im,la,la,di,la,la,im,im,im,ch,im,im,im,im,im,im,im,la,,la,la,im,ch,ch,ch,ch,ch,ch,im,im,la,la,la,,br,br,br,go,go,br,la,go,go,,,im,im,im,la,la,la,la,di,di,di,la,la,la,,,la,la,la,la,la,la,la,,,la,la,la,la,la,la,im,ch,im +im,ch,im,la,la,di,la,im,im,ch,ch,ch,ch,ch,im,ch,ch,im,im,la,br,la,la,im,im,ch,ch,ch,ch,ch,im,go,la,la,la,,la,la,br,go,go,br,la,la,,,go,im,ch,im,im,la,la,la,la,la,la,la,la,la,la,,,la,la,,,,,,la,la,la,la,la,la,la,im,ch,im +im,ch,im,la,la,di,la,im,ch,ch,ch,ch,ch,ch,im,im,im,im,la,la,br,la,la,im,ch,ch,ch,ch,ch,ch,im,go,la,di,di,,la,la,br,br,br,br,la,la,,im,im,ch,ch,ch,im,di,la,im,la,la,la,la,la,la,la,la,,,,,go,,la,la,la,la,la,la,la,la,la,im,ch,im +im,ch,im,la,la,di,im,im,ch,ch,ch,ch,ch,im,im,la,br,br,br,br,br,br,br,br,br,ch,ch,ch,ch,ch,ch,im,la,di,la,la,la,la,la,la,la,la,la,la,la,im,ch,ch,ch,im,im,di,la,la,la,la,la,la,la,la,la,la,la,di,la,,,,la,la,la,la,la,la,la,la,la,im,ch,im +im,ch,im,la,la,di,im,ch,ch,ch,ch,ch,im,im,la,la,br,sh,sh,sh,br,la,la,im,ch,ch,ch,ch,ch,ch,ch,im,la,di,la,la,la,la,la,go,la,la,la,la,la,im,im,ch,im,im,la,di,di,la,la,,,la,la,la,la,la,la,di,la,la,la,la,la,la,go,go,la,la,la,la,la,im,ch,im +im,ch,im,la,la,di,im,im,ch,im,im,im,im,la,la,la,br,sh,sh,sh,br,la,la,go,im,ch,ch,ch,ch,ch,ch,im,la,di,la,la,la,la,,go,,,la,la,la,la,im,im,im,la,la,la,la,la,la,la,go,go,,la,la,la,la,di,la,la,la,la,la,go,go,la,la,la,la,la,br,im,ch,im +im,ch,im,la,la,di,la,im,im,la,la,la,la,la,la,la,br,sh,sh,sh,br,la,la,go,im,im,ch,ch,ch,ch,im,im,la,di,,la,la,la,,,,im,im,im,la,im,im,la,la,la,im,la,la,la,la,la,la,la,la,la,la,la,di,di,la,la,la,la,la,la,la,la,la,,,,br,im,ch,im +im,ch,im,la,la,di,la,im,la,,br,br,br,br,br,br,br,br,br,br,br,la,la,la,go,im,im,ch,ch,ch,im,la,la,la,,la,la,go,,,go,im,ch,im,im,im,la,la,la,la,im,la,la,la,la,la,la,la,la,la,la,la,di,la,la,la,la,la,la,la,la,la,la,,,,br,im,ch,im +im,ch,im,la,la,di,la,la,la,,la,la,la,la,la,la,la,la,la,la,br,la,la,la,go,go,im,im,ch,im,im,la,la,la,,,la,la,la,im,im,ch,ch,ch,im,la,la,br,br,br,la,la,la,,,la,la,la,la,la,la,la,la,la,la,go,la,la,la,,la,la,la,,,,br,im,ch,im +im,ch,im,la,la,di,la,la,la,,la,la,la,la,la,la,la,la,la,la,br,la,la,la,la,go,go,im,im,im,la,la,la,la,la,,la,la,la,im,ch,ch,ch,im,im,la,la,br,go,br,la,la,la,,la,la,la,la,la,la,la,la,la,la,la,la,la,la,,la,la,la,la,la,la,br,br,im,ch,im +im,ch,im,la,la,di,la,la,la,,la,la,la,go,go,go,la,la,la,la,br,la,la,la,la,la,la,la,la,la,la,la,la,im,la,,la,la,la,im,im,ch,im,im,la,la,im,br,br,br,la,la,la,im,la,la,la,la,la,la,la,la,la,la,la,go,la,la,la,,la,la,la,la,la,br,im,im,ch,im +im,ch,im,la,la,di,la,la,la,di,di,la,la,go,go,go,la,la,la,la,br,la,la,,,,la,la,la,la,la,la,la,im,la,,la,la,la,la,im,im,im,la,la,la,im,la,la,la,la,la,im,im,la,la,la,,,,,,la,la,la,la,la,la,la,la,la,la,la,la,br,br,im,im,ch,im +im,ch,im,la,la,di,la,la,la,la,di,,,go,go,go,,,,,,,,,la,di,di,di,,,,la,la,la,la,,la,la,la,la,la,di,di,di,la,la,la,la,la,la,la,im,im,im,im,la,la,,ga,ga,ga,,la,la,la,la,la,la,la,la,la,la,la,br,br,im,im,im,ch,im +im,ch,im,la,la,,la,la,la,di,di,la,la,la,la,la,la,la,la,,la,la,la,la,la,la,la,la,,,,la,,,,,,la,la,la,la,la,la,di,la,la,la,la,la,la,im,im,im,im,im,go,go,,ga,ga,ga,,la,la,la,im,im,la,la,la,la,br,br,br,im,im,im,im,ch,im +im,ch,im,la,la,,,la,la,,la,la,la,la,la,la,la,la,la,,la,im,im,im,la,la,di,di,,,,la,la,la,la,la,di,di,la,la,la,im,la,la,la,la,la,,,im,im,im,im,im,im,im,go,go,ga,ga,ga,,la,la,la,im,im,im,la,la,la,br,im,im,im,im,im,im,ch,im +im,ch,im,im,la,la,,,,,,,,,,,la,la,la,,la,im,ch,im,im,la,di,la,,la,la,la,la,la,la,la,la,di,di,di,la,la,la,la,la,la,la,,la,la,im,im,im,im,im,im,im,go,go,,,,la,la,im,im,im,im,im,im,im,br,im,im,im,im,im,im,ch,im +im,ch,ch,im,la,la,la,la,la,la,la,la,la,la,la,,la,im,la,,la,im,ch,ch,im,la,di,la,,la,la,la,la,im,la,la,la,la,la,di,la,la,la,go,la,la,la,la,la,la,la,go,im,im,im,im,im,im,go,go,la,la,la,la,im,im,im,im,im,im,im,br,im,im,im,im,im,ch,ch,im +im,ch,ch,im,im,la,la,la,la,la,la,la,im,la,la,,la,la,la,,la,im,im,ch,im,im,di,la,,la,la,la,la,im,im,la,la,la,la,di,la,la,la,,go,la,la,la,la,la,la,go,go,im,im,im,im,im,im,go,go,im,im,im,im,ch,ch,ch,ch,ch,ch,br,ch,im,im,im,ch,ch,ch,im +im,ch,im,im,im,la,la,la,la,la,la,la,la,la,la,go,la,la,la,,la,la,im,ch,ch,im,,,,la,la,la,im,im,im,im,la,la,la,la,la,la,la,la,go,la,la,la,la,,,,go,go,im,im,im,im,im,im,im,im,im,im,im,ch,im,ch,ch,ch,ch,br,ch,im,im,im,ch,ch,ch,im +im,ch,im,im,im,,,,im,im,im,,,,go,go,go,,,,la,la,im,ch,ch,im,,go,,la,la,la,im,ch,ch,im,im,la,la,la,la,la,la,la,,la,la,la,la,,ga,ga,ga,go,go,im,im,im,im,im,im,im,im,im,ch,ch,im,ch,ch,ch,ch,ch,ch,ch,im,im,ch,ch,ch,im +im,ch,im,im,go,go,,,,im,,,,,,go,la,la,la,,la,la,im,ch,im,la,,,,la,la,la,im,ch,ch,ch,im,la,la,la,la,la,la,la,la,la,la,la,la,,ga,ga,ga,,go,go,im,im,im,ch,ch,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,ch,ch,im +im,ch,im,,go,,,,,,,,,,,,la,la,la,,la,im,im,im,im,la,,la,di,di,la,la,im,im,ch,ch,im,la,la,,la,la,la,la,la,la,la,la,la,,ga,ga,ga,,la,go,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,ch,im +im,ch,im,,,,,,,,,,,,,,la,la,la,,la,la,la,im,la,la,,la,la,di,di,la,la,im,ch,im,im,la,la,,,la,la,la,la,la,la,la,la,,,,,,la,im,im,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,ch,im +im,ch,im,,,,,,,,,,,,,,la,la,la,,la,la,la,la,la,la,,la,la,la,di,di,la,la,im,im,la,la,la,la,,,la,la,la,di,di,la,la,la,la,la,la,la,la,im,im,im,im,im,ch,ch,ch,ch,ch,im,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,ch,im +im,ch,im,im,,,,,,im,,,,,,im,la,la,la,,la,la,la,la,la,la,,la,la,la,la,di,la,la,la,la,la,la,la,la,la,,di,di,di,di,la,la,la,la,la,la,la,la,la,im,im,im,im,ch,ch,ch,ch,ch,im,im,im,ch,ch,im,im,ch,ch,im,im,im,im,im,ch,im +im,ch,im,im,im,,,,im,im,im,,,,im,im,la,la,br,br,br,br,br,la,la,la,,la,la,la,la,di,la,la,la,go,la,la,la,la,la,,la,la,la,la,la,la,la,la,la,la,la,la,im,im,im,im,ch,ch,ch,ch,ch,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,ch,ch,im +im,ch,im,im,,,,,,im,co,co,co,co,co,im,la,la,br,go,go,go,br,,,,,la,la,la,la,la,la,la,go,go,la,la,la,la,,,,la,la,la,la,la,la,la,la,la,im,im,im,im,ch,ch,ch,ch,ch,ch,im,im,im,im,im,im,ch,ch,ch,ch,ch,ch,ch,im,im,ch,ch,im +im,ch,im,,go,,,,,,co,co,co,co,co,,la,la,br,go,go,go,br,la,la,la,la,la,la,la,la,la,la,la,go,la,la,la,la,la,,go,,la,la,la,la,go,la,go,la,la,im,im,im,im,ch,im,im,ch,ch,ch,ch,im,ch,im,im,ch,ch,ch,ch,im,ch,ch,ch,im,im,ch,ch,im +im,ch,im,,go,,,,,,co,co,co,co,co,,la,la,br,go,go,go,br,la,la,la,la,,,,,,la,la,la,la,la,la,la,la,,,,la,la,la,la,la,la,la,la,la,la,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,ch,ch,im +im,ch,im,,go,,,,,,co,co,co,co,co,,la,la,br,br,br,br,br,la,la,la,la,,,,,,la,la,la,la,la,la,la,la,,la,la,la,la,la,la,la,la,la,la,la,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,ch,ch,im +im,ch,im,im,,,,,,im,co,co,co,co,co,im,la,la,la,im,la,la,la,la,la,la,la,,,,,,,,,,la,la,la,,,la,la,la,go,la,la,la,,la,la,la,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,ch,ch,ch,im +im,ch,im,im,im,,,,im,im,im,,,,im,im,la,im,im,im,la,,la,la,la,la,la,,,,,,la,la,la,,,,,,la,la,la,go,go,la,la,,la,,la,la,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,ch,ch,ch,im +im,ch,im,im,,,,,,im,,,,,,im,la,im,im,,,,,,la,la,la,,,,,,la,la,la,la,la,la,la,la,la,la,la,go,la,la,la,la,la,la,la,la,br,br,br,br,br,br,ch,ch,ch,ch,ch,ch,ch,ch,im,ch,ch,ch,ch,ch,ch,ch,im,im,im,ch,ch,im +im,ch,im,,,,,,,,,ga,ga,ga,,,la,im,im,,,go,,,go,la,la,la,la,la,la,la,la,im,im,im,im,la,la,la,la,la,la,la,la,la,la,la,la,la,la,la,br,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,ch,im +im,ch,im,,,,,,,,,ga,ga,ga,,,im,im,,,go,,,,,la,la,la,im,im,im,im,im,im,ch,ch,im,im,la,la,la,la,la,la,la,,,,la,la,la,br,br,im,im,im,im,im,ch,ch,im,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,im,ch,im +im,ch,im,,go,,,,,,,ga,ga,ga,,,im,im,,go,,,go,,la,la,la,la,im,ch,ch,ch,ch,ch,ch,ch,ch,im,la,la,la,la,la,la,la,,,,la,la,br,br,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,ch,im,im,im,im,im,im,im,im,im,im,im,ch,im +im,ch,im,im,go,go,,,,im,,,,,,im,im,im,im,,go,,,go,la,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,la,la,la,la,la,la,,,,br,br,br,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,ch,im +im,ch,im,im,im,,,,im,im,im,,,,im,im,im,im,im,,,la,la,la,la,la,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,la,la,la,la,la,br,br,br,br,br,br,im,im,im,im,im,im,im,ch,ch,ch,im,im,im,im,im,im,im,im,im,im,ch,ch,im,im,im,im,im,ch,ch,ch,im +im,ch,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,ch,ch,ch,ch,ch,im,im,im,im,ch,ch,ch,ch,ch,ch,ch,ch,im,im,im,ch,ch,ch,ch,im +im,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,ch,im,im +im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im,im \ No newline at end of file diff --git a/tests/files/Testfile1.wfto b/tests/files/Testimport.wfto similarity index 100% rename from tests/files/Testfile1.wfto rename to tests/files/Testimport.wfto diff --git a/tests/options/exchange_map.js b/tests/options/exchange_map.js index fcb47ce..7820ef1 100644 --- a/tests/options/exchange_map.js +++ b/tests/options/exchange_map.js @@ -1,19 +1,76 @@ +var fs = require('fs'); +var dir = ".\\tests\\files\\"; + module.exports = { - 'importMap1': function (test, external) { - + 'importMap': function (test, external, makeShot, mapname) { if (!external) { test.open("index.html"); } + mapname = mapname || "Testimport"; + console.log("exchange - Import map: " + mapname); + test .click('#optionButton') - .setValue('#mapFile', ".\\tests\\files\\Testfile1.wfto") + .setValue('#mapFile', dir + mapname + ".wfto") .click('#import') - .assert.val('#mapName', 'Testfile1', 'Map name is Testfile1') - .screenshot("./tests/images/:browser/Testfile1_import.png"); + .assert.val('#mapName', mapname, 'Map name is ' + mapname) + .assert.notVisible("#options"); + + makeShot && test.screenshot("./tests/images/:browser/" + mapname + "_import.png"); + + if (external) { + return test; + } else { + test.done(); + } + }, + 'importCSVMap': function (test, external, makeShot, mapname, width, height, border) { + + if (!external) { test.open("index.html"); } + + mapname = mapname || "Testimport"; + width = width || 40; + height = height || 40; + border = border || 1; + + console.log("exchange - Import CSV map: " + mapname); + + test + .click('#optionButton') + .setValue('#csv', dir + mapname + ".csv") + .setValue('#csvborder', '"' + border + '"') + .click('#importcsv') + .assert.val('#mapName', mapname, 'Map name is ' + mapname) + // TODO Evaluate map size + .assert.notVisible("#options"); + + makeShot && test.screenshot("./tests/images/:browser/" + mapname + "_csvimport.png"); if (external) { return test; } else { test.done(); } + }, + 'exportMap': function (test, external, mapname) { + + if (!external) { test.open("index.html"); } + // TODO: Implement test for exporting map (maybe phantomjs 2.0) + test.done(); + /* + mapname = mapname || "Testimport"; + + test + .click('#optionButton') + .setValue('#mapFile', dir + mapname + ".wfto") + .click('#import') + .click('#optionButton') + .click('#export'); + + if (external) { + return test; + } else { + test.done(); + } + */ } }; \ No newline at end of file diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index b4514db..cf6f4e6 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -1,6 +1,6 @@ module.exports = { 'mirror': function (test, external, makeShot) { - console.log('mirror1 mirror'); + console.log('mirror1 - mirror'); if (!external) { test.open('index.html'); } test.click('#optionButton') @@ -28,7 +28,7 @@ module.exports = { } }, 'mirrorExtend': function (test, external, makeShot) { - console.log('mirror1 mirrorExtend'); + console.log('mirror1 - mirrorExtend'); if (!external) { test.open('index.html'); } test @@ -57,7 +57,7 @@ module.exports = { } }, 'mirrorRotate': function (test, external, makeShot) { - console.log('mirror1 mirrorRotate'); + console.log('mirror1 - mirrorRotate'); if (!external) { test.open('index.html'); } test @@ -87,7 +87,7 @@ module.exports = { } }, 'mirrorExtendRotate': function (test, external, makeShot) { - console.log('mirror1 mirrorExtendRotate'); + console.log('mirror1 - mirrorExtendRotate'); if (!external) { test.open('index.html'); } test diff --git a/tests/options/mirror2.js b/tests/options/mirror2.js index 69972dd..0c1eafd 100644 --- a/tests/options/mirror2.js +++ b/tests/options/mirror2.js @@ -1,6 +1,6 @@ module.exports = { 'mirror': function (test, external, makeShot) { - console.log('mirror2 mirror'); + console.log('mirror2 - mirror'); if (!external) { test.open('index.html'); } test @@ -29,7 +29,7 @@ module.exports = { } }, 'mirrorExtend': function (test, external, makeShot) { - console.log('mirror2 mirrorExtend'); + console.log('mirror2 - mirrorExtend'); if (!external) { test.open('index.html'); } test @@ -60,7 +60,7 @@ module.exports = { } }, 'mirrorReverse': function (test, external, makeShot) { - console.log('mirror2 mirrorReverse'); + console.log('mirror2 - mirrorReverse'); if (!external) { test.open('index.html'); } test @@ -90,7 +90,7 @@ module.exports = { } }, 'mirrorExtendReverse': function (test, external, makeShot) { - console.log('mirror2 mirrorExtendReverse'); + console.log('mirror2 - mirrorExtendReverse'); if (!external) { test.open('index.html'); } test diff --git a/tests/options/mirror3.js b/tests/options/mirror3.js index 739ee5e..f6a6f15 100644 --- a/tests/options/mirror3.js +++ b/tests/options/mirror3.js @@ -1,6 +1,6 @@ module.exports = { 'mirror': function (test, external, makeShot) { - console.log('mirror3 mirror'); + console.log('mirror3 - mirror'); if (!external) { test.open('index.html'); } test @@ -29,7 +29,7 @@ module.exports = { } }, 'mirrorExtend': function (test, external, makeShot) { - console.log('mirror3 mirrorExtend'); + console.log('mirror3 - mirrorExtend'); if (!external) { test.open('index.html'); } test @@ -59,7 +59,7 @@ module.exports = { } }, 'mirrorReverse': function (test, external, makeShot) { - console.log('mirror3 mirrorReverse'); + console.log('mirror3 - mirrorReverse'); if (!external) { test.open('index.html'); } test @@ -89,7 +89,7 @@ module.exports = { } }, 'mirrorExtendReverse': function (test, external, makeShot) { - console.log('mirror3 mirrorExtendReverse'); + console.log('mirror3 - mirrorExtendReverse'); if (!external) { test.open('index.html'); } test diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index b9713b0..5d81c5d 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -4,8 +4,10 @@ var cache = require('../maps/cacheMap'); var mirror1 = require('../options/mirror1'); var mirror2 = require('../options/mirror2'); var mirror3 = require('../options/mirror3'); +var exchange = require('../options/exchange_map'); var new_map = require('../options/new_map'); +// Make screenshots var makeShot = false; module.exports = { @@ -117,5 +119,11 @@ module.exports = { this.assert.ok(Object.keys(window.terrain.tiles).length == 10, "Object.keys(tiles).length == 10"); }); test.done(); - } + }, + "Import": function(test) { + test.open("index.html"); + exchange.importMap(test, true, makeShot); + exchange.importCSVMap(test, true, makeShot); + test.done(); + } }; \ No newline at end of file From c1d217034ba216847172114d33be58f702c0de67 Mon Sep 17 00:00:00 2001 From: ufdada Date: Fri, 20 Mar 2015 14:35:58 +0100 Subject: [PATCH 52/77] travis doesn't like relative path in file upload, so we give it an absolute path --- .jshintrc | 1 + tests/options/exchange_map.js | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.jshintrc b/.jshintrc index 058dc8d..96d7238 100644 --- a/.jshintrc +++ b/.jshintrc @@ -31,6 +31,7 @@ "dataStorage", "initOptions", "Map", + "__dirname", "store" ] } \ No newline at end of file diff --git a/tests/options/exchange_map.js b/tests/options/exchange_map.js index 7820ef1..11773fc 100644 --- a/tests/options/exchange_map.js +++ b/tests/options/exchange_map.js @@ -1,19 +1,22 @@ var fs = require('fs'); -var dir = ".\\tests\\files\\"; +var path = require('path'); +var dir = path.resolve(__dirname, "../../tests/files/"); module.exports = { 'importMap': function (test, external, makeShot, mapname) { if (!external) { test.open("index.html"); } mapname = mapname || "Testimport"; + console.log("exchange - Import map: " + mapname); + var mapfile = path.resolve(dir, mapname + ".wfto"); test - .click('#optionButton') - .setValue('#mapFile', dir + mapname + ".wfto") - .click('#import') - .assert.val('#mapName', mapname, 'Map name is ' + mapname) - .assert.notVisible("#options"); + .click('#optionButton') + .setValue('#mapFile', mapfile) + .click('#import') + .assert.val('#mapName', mapname, 'Map name is ' + mapname) + .assert.notVisible("#options"); makeShot && test.screenshot("./tests/images/:browser/" + mapname + "_import.png"); @@ -33,15 +36,16 @@ module.exports = { border = border || 1; console.log("exchange - Import CSV map: " + mapname); + var mapfile = path.resolve(dir, mapname + ".csv"); test - .click('#optionButton') - .setValue('#csv', dir + mapname + ".csv") - .setValue('#csvborder', '"' + border + '"') - .click('#importcsv') - .assert.val('#mapName', mapname, 'Map name is ' + mapname) - // TODO Evaluate map size - .assert.notVisible("#options"); + .click('#optionButton') + .setValue('#csv', mapfile) + .setValue('#csvborder', '"' + border + '"') + .click('#importcsv') + .assert.val('#mapName', mapname, 'Map name is ' + mapname) + // TODO Evaluate map size + .assert.notVisible("#options"); makeShot && test.screenshot("./tests/images/:browser/" + mapname + "_csvimport.png"); From 0932b8cfac8c84072bb67adf3acd1ecbb68a668a Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 24 Mar 2015 17:27:18 +0100 Subject: [PATCH 53/77] assert the correct map sizes --- tests/options/exchange_map.js | 8 ++++++++ tests/options/mirror1.js | 16 ++++++++-------- tests/options/mirror2.js | 16 ++++++++-------- tests/options/mirror3.js | 16 ++++++++-------- tests/suite/defaultMap.js | 3 ++- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/tests/options/exchange_map.js b/tests/options/exchange_map.js index 11773fc..1fc9b94 100644 --- a/tests/options/exchange_map.js +++ b/tests/options/exchange_map.js @@ -15,6 +15,10 @@ module.exports = { .click('#optionButton') .setValue('#mapFile', mapfile) .click('#import') + .execute(function(){ + this.data('mapsizex', window.terrain.mapsizex); + this.data('mapsizey', window.terrain.mapsizey); + }) .assert.val('#mapName', mapname, 'Map name is ' + mapname) .assert.notVisible("#options"); @@ -43,6 +47,10 @@ module.exports = { .setValue('#csv', mapfile) .setValue('#csvborder', '"' + border + '"') .click('#importcsv') + .execute(function(){ + this.data('mapsizex', window.terrain.mapsizex); + this.data('mapsizey', window.terrain.mapsizey); + }) .assert.val('#mapName', mapname, 'Map name is ' + mapname) // TODO Evaluate map size .assert.notVisible("#options"); diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index cf6f4e6..1dd6642 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -15,8 +15,8 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror1.png"); @@ -44,8 +44,8 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); makeShot && test.screenshot("./tests/images/:browser/mirror1Extend.png"); @@ -74,8 +74,8 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror1Rotate.png"); @@ -105,8 +105,8 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); makeShot && test.screenshot("./tests/images/:browser/mirror1ExtendRotate.png"); diff --git a/tests/options/mirror2.js b/tests/options/mirror2.js index 0c1eafd..defe9aa 100644 --- a/tests/options/mirror2.js +++ b/tests/options/mirror2.js @@ -16,8 +16,8 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror2.png"); @@ -47,8 +47,8 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); makeShot && test.screenshot("./tests/images/:browser/mirror2Extend.png"); @@ -77,8 +77,8 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror2Reverse.png"); @@ -108,8 +108,8 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize') * 2, "mapsizey == " + this.data('mapsize') * 2); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); makeShot && test.screenshot("./tests/images/:browser/mirror2ExtendReverse.png"); diff --git a/tests/options/mirror3.js b/tests/options/mirror3.js index f6a6f15..a65329d 100644 --- a/tests/options/mirror3.js +++ b/tests/options/mirror3.js @@ -16,8 +16,8 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror3.png"); @@ -46,8 +46,8 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror3Extend.png"); @@ -76,8 +76,8 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize'), "mapsizex == " + this.data('mapsize')); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror3Reverse.png"); @@ -107,8 +107,8 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ - this.assert.ok(window.terrain.mapsizex == this.data('mapsize') * 2, "mapsizex == " + this.data('mapsize') * 2); - this.assert.ok(window.terrain.mapsizey == this.data('mapsize'), "mapsizey == " + this.data('mapsize')); + this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); + this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); makeShot && test.screenshot("./tests/images/:browser/mirror3ExtendReverse.png"); diff --git a/tests/suite/defaultMap.js b/tests/suite/defaultMap.js index 5d81c5d..8896a43 100644 --- a/tests/suite/defaultMap.js +++ b/tests/suite/defaultMap.js @@ -14,7 +14,8 @@ module.exports = { "Mirroring": function(test) { test.open("index.html"); test.execute(function() { - this.data('mapsize', 20); + this.data('mapsizex', window.terrain.mapsizex); + this.data('mapsizey', window.terrain.mapsizey); }); // Mirror 1 From 57f6ceae8676333a23bc6faf0f62ac241959e7bc Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 24 Mar 2015 20:12:02 +0100 Subject: [PATCH 54/77] refactor helperfunctions for easier integration --- js/editor.js | 15 ++++++++++++++- tests/helper.js | 3 +++ tests/maps/cacheMap.js | 2 ++ tests/maps/defaultMap.js | 2 ++ tests/maps/mirror1Map.js | 2 ++ tests/options/exchange_map.js | 3 +++ tests/options/new_map.js | 17 +---------------- 7 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 tests/helper.js diff --git a/js/editor.js b/js/editor.js index 524de5e..ec6c715 100644 --- a/js/editor.js +++ b/js/editor.js @@ -1,4 +1,17 @@ -window.onload = function(){ +// phantom js workarround +if (window.navigator.userAgent.indexOf("PhantomJS") != -1) { + // Workarround for phantomjs, otherwise confirm/alert messages break tests + window.confirm = function(text){ + //'This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?' + return true; + }; + window.alert = function(text){ + //'This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?' + return true; + }; +} + +window.onload = function(){ // localStorage wrapper store = new dataStorage(); diff --git a/tests/helper.js b/tests/helper.js new file mode 100644 index 0000000..9261ed0 --- /dev/null +++ b/tests/helper.js @@ -0,0 +1,3 @@ +String.prototype.purple = function() { + return "\033[35m" + this + "\033[0m"; +}; \ No newline at end of file diff --git a/tests/maps/cacheMap.js b/tests/maps/cacheMap.js index 0decebd..3203e30 100644 --- a/tests/maps/cacheMap.js +++ b/tests/maps/cacheMap.js @@ -1,3 +1,5 @@ +var helper = require('../helper'); + module.exports = { 'save': function (test, external) { console.log(">> Save mapdata".purple()); diff --git a/tests/maps/defaultMap.js b/tests/maps/defaultMap.js index cccd89f..3b08e02 100644 --- a/tests/maps/defaultMap.js +++ b/tests/maps/defaultMap.js @@ -1,3 +1,5 @@ +var helper = require('../helper'); + module.exports = { 'drawMap': function (test, external, makeShot) { console.log(">> Draw default map".purple()); diff --git a/tests/maps/mirror1Map.js b/tests/maps/mirror1Map.js index f67b009..6d58ec9 100644 --- a/tests/maps/mirror1Map.js +++ b/tests/maps/mirror1Map.js @@ -1,3 +1,5 @@ +var helper = require('../helper'); + module.exports = { /* draws a rather complex map for testing the mirror 1 feature */ /* Team Brawl by Slichizard */ diff --git a/tests/options/exchange_map.js b/tests/options/exchange_map.js index 1fc9b94..736fc3c 100644 --- a/tests/options/exchange_map.js +++ b/tests/options/exchange_map.js @@ -1,6 +1,7 @@ var fs = require('fs'); var path = require('path'); var dir = path.resolve(__dirname, "../../tests/files/"); +var helper = require('../helper'); module.exports = { 'importMap': function (test, external, makeShot, mapname) { @@ -15,6 +16,7 @@ module.exports = { .click('#optionButton') .setValue('#mapFile', mapfile) .click('#import') + .wait(100) .execute(function(){ this.data('mapsizex', window.terrain.mapsizex); this.data('mapsizey', window.terrain.mapsizey); @@ -47,6 +49,7 @@ module.exports = { .setValue('#csv', mapfile) .setValue('#csvborder', '"' + border + '"') .click('#importcsv') + .wait(100) .execute(function(){ this.data('mapsizex', window.terrain.mapsizex); this.data('mapsizey', window.terrain.mapsizey); diff --git a/tests/options/new_map.js b/tests/options/new_map.js index 5dfecaf..ec62112 100644 --- a/tests/options/new_map.js +++ b/tests/options/new_map.js @@ -1,26 +1,11 @@ module.exports = { - 'generate': function (test, external, width, height) { - String.prototype.purple = function() { - return "\033[35m" + this + "\033[0m"; - }; - + 'generate': function (test, external, width, height) { width = width || '20'; height = height || '20'; if (!external) { test.open("index.html"); } test - .execute(function(){ - // Workarround for phantomjs, otherwise confirm/alert messages break tests - window.confirm = function(text){ - //'This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?' - return true; - }; - window.alert = function(text){ - //'This recalculates the whole map and may remove some of your changes. Are you sure you want to continue?' - return true; - }; - }) .click('#optionButton') .setValue('#width', width) .setValue('#height', height) From d4877f90767d6ccc09a97b8cba6be7755c80c81c Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 24 Mar 2015 20:12:22 +0100 Subject: [PATCH 55/77] add some more assert --- tests/options/mirror1.js | 7 ++++++- tests/options/mirror2.js | 4 ++++ tests/options/mirror3.js | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/options/mirror1.js b/tests/options/mirror1.js index 1dd6642..80866c4 100644 --- a/tests/options/mirror1.js +++ b/tests/options/mirror1.js @@ -3,7 +3,8 @@ module.exports = { console.log('mirror1 - mirror'); if (!external) { test.open('index.html'); } - test.click('#optionButton') + test + .click('#optionButton') .click('#first') .click('#mirrorButton') @@ -15,6 +16,7 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ + this.assert.ok(window.active == "first", "window.active should be 'first', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -44,6 +46,7 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ + this.assert.ok(window.active == "first", "window.active should be 'first', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); @@ -74,6 +77,7 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ + this.assert.ok(window.active == "first", "window.active should be 'first', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -105,6 +109,7 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ + this.assert.ok(window.active == "first", "window.active should be 'first', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); diff --git a/tests/options/mirror2.js b/tests/options/mirror2.js index defe9aa..ffd0ab9 100644 --- a/tests/options/mirror2.js +++ b/tests/options/mirror2.js @@ -16,6 +16,7 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ + this.assert.ok(window.active == "second", "window.active should be 'second', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -47,6 +48,7 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ + this.assert.ok(window.active == "second", "window.active should be 'second', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); @@ -77,6 +79,7 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ + this.assert.ok(window.active == "second", "window.active should be 'second', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -108,6 +111,7 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ + this.assert.ok(window.active == "second", "window.active should be 'second', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey') * 2, "mapsizey == " + this.data('mapsizey') * 2); }); diff --git a/tests/options/mirror3.js b/tests/options/mirror3.js index a65329d..18a9691 100644 --- a/tests/options/mirror3.js +++ b/tests/options/mirror3.js @@ -16,6 +16,7 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ + this.assert.ok(window.active == "third", "window.active should be 'third', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -46,6 +47,7 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ + this.assert.ok(window.active == "third", "window.active should be 'third', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -76,6 +78,7 @@ module.exports = { .assert.notSelected('#extend', 'Extend unchecked') .execute(function(){ + this.assert.ok(window.active == "third", "window.active should be 'third', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex'), "mapsizex == " + this.data('mapsizex')); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); @@ -107,6 +110,7 @@ module.exports = { .assert.selected('#extend', 'Extend checked') .execute(function(){ + this.assert.ok(window.active == "third", "window.active should be 'third', was " + window.active); this.assert.ok(window.terrain.mapsizex == this.data('mapsizex') * 2, "mapsizex == " + this.data('mapsizex') * 2); this.assert.ok(window.terrain.mapsizey == this.data('mapsizey'), "mapsizey == " + this.data('mapsizey')); }); From a5a0010a90277b4a820042250b0135a446f5fc22 Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 24 Mar 2015 20:12:43 +0100 Subject: [PATCH 56/77] add ticket test --- tests/files/ticket1.wfto | 1 + tests/suite/tickets.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/files/ticket1.wfto create mode 100644 tests/suite/tickets.js diff --git a/tests/files/ticket1.wfto b/tests/files/ticket1.wfto new file mode 100644 index 0000000..8d92ccb --- /dev/null +++ b/tests/files/ticket1.wfto @@ -0,0 +1 @@ +eyJ2ZXJzaW9uIjoiMS4yIiwiYXV0aG9yIjoiIiwiYm9yZGVyIjoxLCJ0aWxlcyI6WyJlYXJ0aCIsImdhdGV3YXkiXSwidGlsZUlkcyI6WyIxNDI3MTM5NDUzMDQ5IiwiMTQyNzEzOTQ1NzE2OSIsIjE0MjcxMzk0NTA4NTIiLCIxNDI3MTM5NDQzODY5IiwiMTQyNzEzOTQ0MjU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fV0sW3sidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfV0sW3sidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfSx7InRpbGUiOjB9LHsidGlsZSI6MH0seyJ0aWxlIjowfV1dfQ== \ No newline at end of file diff --git a/tests/suite/tickets.js b/tests/suite/tickets.js new file mode 100644 index 0000000..9b49d0e --- /dev/null +++ b/tests/suite/tickets.js @@ -0,0 +1,24 @@ +var map = require('../maps/defaultMap'); +var cache = require('../maps/cacheMap'); + +var mirror1 = require('../options/mirror1'); +var mirror2 = require('../options/mirror2'); +var mirror3 = require('../options/mirror3'); +var exchange = require('../options/exchange_map'); + +var new_map = require('../options/new_map'); +// Make screenshots +var makeShot = false; + +module.exports = { + "Ticket 1 - Overwrite Rooms": function(test) { + test.open("index.html"); + exchange.importMap(test, true, makeShot, "ticket1"); + mirror3.mirror(test, true, makeShot); + test.execute(function() { + this.assert.ok(window.navigator.userAgent, window.navigator.userAgent); + this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "tiles should be 8, was " + Object.keys(window.terrain.tiles).length); + }); + test.done(); + } +}; \ No newline at end of file From a2fe345cb7b9a161ee77b84c9fa7c5e042e912ab Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 24 Mar 2015 21:12:37 +0100 Subject: [PATCH 57/77] check for uncomplete rooms --- js/editor.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/js/editor.js b/js/editor.js index ec6c715..dc967b2 100644 --- a/js/editor.js +++ b/js/editor.js @@ -272,6 +272,8 @@ function Map(sizex, sizey) { table.appendChild(tr); } mapParent.appendChild(table); + + map.checkObsoleteRooms(); }; this.destroy = function() { @@ -782,4 +784,19 @@ function Map(sizex, sizey) { }; } }; + + this.checkObsoleteRooms = function() { + var tileIds = map.tiles; + for (var tileId in tileIds) { + var firstId = tileIds[tileId][0]; + var tile = document.getElementById(firstId); + var tileName = tile.getAttribute("class"); + var size = tiles[tileName].sizex * tiles[tileName].sizey; + + if (tileIds[tileId].length < size) { + // room isn't complete, destroy it! + map.destroyRoom(tileId); + } + } + }; } \ No newline at end of file From 7e3fcd87dd0254e772302cbd619889bfe16e64e7 Mon Sep 17 00:00:00 2001 From: ufdada Date: Tue, 24 Mar 2015 21:12:59 +0100 Subject: [PATCH 58/77] oops remove debug assert --- tests/suite/tickets.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/suite/tickets.js b/tests/suite/tickets.js index 9b49d0e..b7e59fd 100644 --- a/tests/suite/tickets.js +++ b/tests/suite/tickets.js @@ -16,7 +16,6 @@ module.exports = { exchange.importMap(test, true, makeShot, "ticket1"); mirror3.mirror(test, true, makeShot); test.execute(function() { - this.assert.ok(window.navigator.userAgent, window.navigator.userAgent); this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "tiles should be 8, was " + Object.keys(window.terrain.tiles).length); }); test.done(); From 6c09c2c8095585f157993b377a6efa8f3da844c8 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:06:07 +0100 Subject: [PATCH 59/77] implement ticket test in general testing. Fixes #12 --- Gruntfile.js | 5 ++++- tests/files/{ticket1.wfto => Ticket_12.wfto} | 0 tests/suite/tickets.js | 9 +++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) rename tests/files/{ticket1.wfto => Ticket_12.wfto} (100%) diff --git a/Gruntfile.js b/Gruntfile.js index 49c01cb..91ebba3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -26,7 +26,10 @@ module.exports = function (grunt) { }, dalek: { dist: { - src: ['./tests/suite/defaultMap.js'] + src: [ + './tests/suite/defaultMap.js', + './tests/suite/tickets.js' + ] } } }); diff --git a/tests/files/ticket1.wfto b/tests/files/Ticket_12.wfto similarity index 100% rename from tests/files/ticket1.wfto rename to tests/files/Ticket_12.wfto diff --git a/tests/suite/tickets.js b/tests/suite/tickets.js index b7e59fd..51da7cb 100644 --- a/tests/suite/tickets.js +++ b/tests/suite/tickets.js @@ -7,13 +7,18 @@ var mirror3 = require('../options/mirror3'); var exchange = require('../options/exchange_map'); var new_map = require('../options/new_map'); + +var helper = require('../helper'); // Make screenshots var makeShot = false; module.exports = { - "Ticket 1 - Overwrite Rooms": function(test) { + "Ticket #12 - Overwrite Rooms": function(test) { + console.log(">> Test ticket #12".purple()); + + // TODO: find out why enabling this makes the grunt test fail test.open("index.html"); - exchange.importMap(test, true, makeShot, "ticket1"); + exchange.importMap(test, true, makeShot, "Ticket_12"); mirror3.mirror(test, true, makeShot); test.execute(function() { this.assert.ok(Object.keys(window.terrain.tiles).length == 8, "tiles should be 8, was " + Object.keys(window.terrain.tiles).length); From c7b93bf6ab7cc96672e21a20894a9d160b12853a Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:08:52 +0100 Subject: [PATCH 60/77] quick fix --- tests/suite/tickets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/suite/tickets.js b/tests/suite/tickets.js index 51da7cb..92862e1 100644 --- a/tests/suite/tickets.js +++ b/tests/suite/tickets.js @@ -17,7 +17,7 @@ module.exports = { console.log(">> Test ticket #12".purple()); // TODO: find out why enabling this makes the grunt test fail - test.open("index.html"); + //test.open("index.html"); exchange.importMap(test, true, makeShot, "Ticket_12"); mirror3.mirror(test, true, makeShot); test.execute(function() { From 9655a77a2de4b71bdcc169248d7b85e97fb3deae Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:20:13 +0100 Subject: [PATCH 61/77] Update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 218b9a4..37f65eb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # wfto-mapeditor This map editor should make it fairly easy to create and share maps for "War for the Overworld" +![Travis](https://api.travis-ci.org/ufdada/wfto-mapeditor.svg) ### Release 1.3 #### New Features: From 3fc1dfe90a5c2a7f8cd2db1f70624702a975e277 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:30:52 +0100 Subject: [PATCH 62/77] Update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37f65eb..f257ffa 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,10 @@ This map editor should make it fairly easy to create and share maps for "War for ### Release 1.3 #### New Features: - Name input field for files (with versioning) +- Rotate Mirror 1 Feature #### Improvements: -- Get rid of the position in the mapfile on bigger rooms and calculate it instead +- Get rid of the position in the mapfile on bigger rooms and calculate it instead (saves filesize) ### Release 1.2 #### New Features: @@ -39,7 +40,6 @@ This map editor should make it fairly easy to create and share maps for "War for ### Upcoming Features/Bugfixes: - [ ] Resizing of current Map -- [ ] Rotate Mirror 1 Feature - [ ] Undo/Redo ### Known Issues: From 5ac3adaf444ad6d6ab14834da1a68e73e91a6862 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:38:50 +0100 Subject: [PATCH 63/77] even it shouldn't happen, rooms can theoretically be larger than in the defintion, remove them also --- js/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/editor.js b/js/editor.js index dc967b2..68b8635 100644 --- a/js/editor.js +++ b/js/editor.js @@ -793,7 +793,7 @@ function Map(sizex, sizey) { var tileName = tile.getAttribute("class"); var size = tiles[tileName].sizex * tiles[tileName].sizey; - if (tileIds[tileId].length < size) { + if (tileIds[tileId].length != size) { // room isn't complete, destroy it! map.destroyRoom(tileId); } From e8ebe12bddf2ab718db60b4a5860b130a18e837c Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:38:58 +0100 Subject: [PATCH 64/77] Update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f257ffa..8861ba2 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This map editor should make it fairly easy to create and share maps for "War for #### Improvements: - Get rid of the position in the mapfile on bigger rooms and calculate it instead (saves filesize) +- Map gets cleaned from uncompleted rooms ### Release 1.2 #### New Features: From 0cc53e621a3e4a9dc7a22749ea75812f04abcf71 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 10:41:30 +0100 Subject: [PATCH 65/77] update readme (link build status) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8861ba2..ee0566e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # wfto-mapeditor This map editor should make it fairly easy to create and share maps for "War for the Overworld" -![Travis](https://api.travis-ci.org/ufdada/wfto-mapeditor.svg) +[![Build Status](https://travis-ci.org/ufdada/wfto-mapeditor.svg)](https://travis-ci.org/ufdada/wfto-mapeditor) ### Release 1.3 #### New Features: From 749b6848c7abec966f4694e5ed6a46ecd3ccf729 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 13:53:21 +0100 Subject: [PATCH 66/77] add cli for changing the map size dynamicly --- js/editor.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/js/editor.js b/js/editor.js index 68b8635..3654d8c 100644 --- a/js/editor.js +++ b/js/editor.js @@ -64,6 +64,10 @@ function Map(sizex, sizey) { postSave: "setTileSize" } }; + this.operation = { + before: ["shift", "unshift"], + after: ["pop", "push"] + }; var mapParent = document.getElementsByTagName('body')[0]; var dropMessage = document.getElementById("dropMessage"); @@ -799,4 +803,44 @@ function Map(sizex, sizey) { } } }; + + this.changeColumn = function(mapData, position, add) { + var mapArray = mapData.map; + var operation = map.operation[position][add ? 1 : 0]; + + for (var i = 0; i < mapArray.length; i++) { + mapArray[i][operation]({ tile: 0 }); + } + } + + this.changeLine = function(mapData, position, add) { + var mapArray = mapData.map; + var operation = map.operation[position][add ? 1 : 0]; + + var cols = []; + for (var i = 0; i < mapArray[0].length; i++) { + cols.push({ tile: 0 }); + } + mapArray[operation](cols); + } + + this.changeMap = function(dir, add) { + var mapData = map.mapToJson(); + var position = "after"; + + switch(dir) { + case 'top': + position = "before"; + case 'bottom': + map.changeLine(mapData, position, add); + break; + case 'left': + position = "before"; + case 'right': + map.changeColumn(mapData, position, add); + break; + } + + map.importData(JSON.stringify(mapData)); + } } \ No newline at end of file From e455eed31baadf73712fcb1456ec4fbc2f4b025c Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 14:01:03 +0100 Subject: [PATCH 67/77] fix linting errors --- js/editor.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/editor.js b/js/editor.js index 3654d8c..656f10c 100644 --- a/js/editor.js +++ b/js/editor.js @@ -811,7 +811,7 @@ function Map(sizex, sizey) { for (var i = 0; i < mapArray.length; i++) { mapArray[i][operation]({ tile: 0 }); } - } + }; this.changeLine = function(mapData, position, add) { var mapArray = mapData.map; @@ -822,7 +822,7 @@ function Map(sizex, sizey) { cols.push({ tile: 0 }); } mapArray[operation](cols); - } + }; this.changeMap = function(dir, add) { var mapData = map.mapToJson(); @@ -831,16 +831,18 @@ function Map(sizex, sizey) { switch(dir) { case 'top': position = "before"; + /* falls through */ case 'bottom': map.changeLine(mapData, position, add); break; case 'left': position = "before"; + /* falls through */ case 'right': map.changeColumn(mapData, position, add); break; } map.importData(JSON.stringify(mapData)); - } + }; } \ No newline at end of file From 6dd8304ed188335db07af3346b3f66cee8f3d009 Mon Sep 17 00:00:00 2001 From: ufdada Date: Wed, 25 Mar 2015 16:17:13 +0100 Subject: [PATCH 68/77] add gui --- css/style.css | 19 +++++++++++++++++++ index.html | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/css/style.css b/css/style.css index 18a8903..6ce3092 100644 --- a/css/style.css +++ b/css/style.css @@ -9,6 +9,10 @@ html, body { font-size: 12px; } +a { + text-decoration: none; +} + p{ margin: 0; } @@ -167,4 +171,19 @@ td:hover { #versionInfo { display: none; margin-top: 3px; +} + +.plus { + color: green; + font-weight: bold; +} + +.minus { + color: red; + font-weight: bold; +} + +#resizeTable td { + border: 1px solid #ccc; + font-size: 18px; } \ No newline at end of file diff --git a/index.html b/index.html index 00b02f0..65c17ca 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,25 @@

Size:

+ + + + + + + + + + + + + + + + +
+ -
+ -+ -
+ -
+