tests/vector: comments: specs only
This commit is contained in:
1 parent
58b0df8b21
commit
9fe476b803
2 files changed
+7
-23
No files matched your search
+3
-10
@@ -1,8 +1,5 @@
|
||||
-- vector/tiled tests: hand-written TMX maps (CSV / base64 zlib / gzip / raw / XML tile data, flip bits, infinite
|
||||
-- chunks, hexagonal attributes, groups, image layers, every object shape, text, typed properties, embedded and
|
||||
-- external tilesets with per-tile data) against Tiled's own TMJ export and TMX re-save of them (the same TileMap from
|
||||
-- all three), a TSX tileset against Tiled's TSJ, our encoder's TMX / TMJ read back by Tiled (tools/fixtures/_ours.luau),
|
||||
-- round trips in every data encoding, errors, and the fuzz pass. Fixtures: tools/fixtures/tiled.py.
|
||||
-- vector/tiled tests: hand-written TMX maps against Tiled's own TMJ export and TMX re-save.
|
||||
-- Fixtures: tools/fixtures/tiled.py.
|
||||
local T = require("@tests/T")
|
||||
local Tiled = require("@rosetta/vector/tiled")
|
||||
local Bytes = require("@rosetta/core/Bytes")
|
||||
@@ -17,7 +14,7 @@ local function decode(s: string | buffer): (any, any)
|
||||
return Tiled.decode(Bytes.reader(b))
|
||||
end
|
||||
|
||||
-- deep comparison of decoded maps, without the fields that only say who wrote the file
|
||||
-- ignores the fields that only say who wrote the file
|
||||
local SKIP = { version = true, tiledVersion = true, encoding = true, compression = true, meta = true }
|
||||
local function same(a: any, b: any, path: string, out: { string })
|
||||
if #out > 8 then
|
||||
@@ -73,7 +70,6 @@ for _, c in Fx.cases do
|
||||
table.insert(samples, c.tmj)
|
||||
end
|
||||
|
||||
-- details of the orthogonal map
|
||||
do
|
||||
local m = maps.ortho
|
||||
t:eq(m.class, "Level", "map class")
|
||||
@@ -118,7 +114,6 @@ do
|
||||
t:eq(maps.infinite.layers[1].chunks[2].x, -16, "chunk position")
|
||||
end
|
||||
|
||||
-- the external tileset, TSX vs Tiled's TSJ
|
||||
do
|
||||
local a = decode(Fx.tsx)
|
||||
local b = decode(Fx.tsj)
|
||||
@@ -136,7 +131,6 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
-- round trips through every flavour and data encoding
|
||||
for name, m in maps do
|
||||
for _, o in { { format = "tmx" }, { format = "tmx", encoding = "base64" }, { format = "tmx", encoding = "base64", compression = "zlib" }, { format = "tmx", encoding = "base64", compression = "gzip" }, { format = "tmx", encoding = "xml" }, { format = "tmj" }, { format = "tmj", encoding = "base64", compression = "zlib" }, { format = "json", indent = 0 } } do
|
||||
local out, err = Tiled.encode(m, o :: any)
|
||||
@@ -161,7 +155,6 @@ for _, c in Ours.checks do
|
||||
t:check(c.ok, c.label)
|
||||
end
|
||||
|
||||
-- errors
|
||||
do
|
||||
local zstd = string.gsub(Fx.cases[1].tmx, "compression=\"zlib\"", "compression=\"zstd\"")
|
||||
local _, e = decode(zstd)
|
||||
|
||||
Reference in new issue
Block a user