A library for parsing Tiled maps.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Set cwd to test directory

This will make it easier to open and use the test maps and tilesets in
Tiled.

+43 -21
+2 -2
test/map-base64-gzip.tmj
··· 77 77 "tilesets":[ 78 78 { 79 79 "firstgid":1, 80 - "source":"test/source_tileset.tsj" 80 + "source":"source_tileset.tsj" 81 81 }, 82 82 { 83 83 "firstgid":5, 84 - "source":"test/images_tileset.tsj" 84 + "source":"images_tileset.tsj" 85 85 }], 86 86 "tilewidth":16, 87 87 "type":"map",
+2 -2
test/map-base64-none.tmj
··· 84 84 "tilesets":[ 85 85 { 86 86 "firstgid":1, 87 - "source":"test/source_tileset.tsj" 87 + "source":"source_tileset.tsj" 88 88 }, 89 89 { 90 90 "firstgid":5, 91 - "source":"test/images_tileset.tsj" 91 + "source":"images_tileset.tsj" 92 92 }], 93 93 "tilewidth":16, 94 94 "type":"map",
+2 -2
test/map-base64-zlib.tmj
··· 76 76 "tilesets":[ 77 77 { 78 78 "firstgid":1, 79 - "source":"test/source_tileset.tsj" 79 + "source":"source_tileset.tsj" 80 80 }, 81 81 { 82 82 "firstgid":5, 83 - "source":"test/images_tileset.tsj" 83 + "source":"images_tileset.tsj" 84 84 }], 85 85 "tilewidth":16, 86 86 "type":"map",
+2 -2
test/map-base64-zstd.tmj
··· 76 76 "tilesets":[ 77 77 { 78 78 "firstgid":1, 79 - "source":"test/source_tileset.tsj" 79 + "source":"source_tileset.tsj" 80 80 }, 81 81 { 82 82 "firstgid":5, 83 - "source":"test/images_tileset.tsj" 83 + "source":"images_tileset.tsj" 84 84 }], 85 85 "tilewidth":16, 86 86 "type":"map",
+1 -1
test/map-infinite-base64-zstd.tmj
··· 105 105 "tilesets":[ 106 106 { 107 107 "firstgid":1, 108 - "source":"test/source_tileset.tsj" 108 + "source":"source_tileset.tsj" 109 109 }, 110 110 { 111 111 "columns":2,
+1 -1
test/map-infinite-csv.tmj
··· 118 118 "tilesets":[ 119 119 { 120 120 "firstgid":1, 121 - "source":"test/source_tileset.tsj" 121 + "source":"source_tileset.tsj" 122 122 }, 123 123 { 124 124 "columns":2,
+2 -2
test/map.tmj
··· 103 103 "tilesets":[ 104 104 { 105 105 "firstgid":1, 106 - "source":"test/source_tileset.tsj" 106 + "source":"source_tileset.tsj" 107 107 }, 108 108 { 109 109 "firstgid":5, 110 - "source":"test/images_tileset.tsj" 110 + "source":"images_tileset.tsj" 111 111 }], 112 112 "tilewidth":16, 113 113 "type":"map",
+17 -7
test/maps.zig
··· 1 1 test "initFromSlice" { 2 + try changeTestDir(); 3 + 2 4 const test_map = @embedFile("map.tmj"); 3 5 4 6 const allocator = std.testing.allocator; ··· 10 12 } 11 13 12 14 test "initFromFile" { 15 + try changeTestDir(); 16 + 13 17 const allocator = std.testing.allocator; 14 18 15 19 const test_maps = [_][]const u8{ 16 - "test/map.tmj", 17 - "test/map-base64-none.tmj", 18 - "test/map-base64-gzip.tmj", 19 - "test/map-base64-zlib.tmj", 20 - "test/map-base64-zstd.tmj", 20 + "map.tmj", 21 + "map-base64-none.tmj", 22 + "map-base64-gzip.tmj", 23 + "map-base64-zlib.tmj", 24 + "map-base64-zstd.tmj", 21 25 }; 22 26 23 27 for (test_maps) |test_map| { ··· 38 42 } 39 43 40 44 test "infinite maps" { 45 + try changeTestDir(); 46 + 41 47 const allocator = std.testing.allocator; 42 48 43 49 const test_maps = [_][]const u8{ 44 - "test/map-infinite-csv.tmj", 45 - "test/map-infinite-base64-zstd.tmj", 50 + "map-infinite-csv.tmj", 51 + "map-infinite-base64-zstd.tmj", 46 52 }; 47 53 48 54 for (test_maps) |test_map| { ··· 102 108 } 103 109 104 110 test "findObject" { 111 + try changeTestDir(); 112 + 105 113 const allocator = std.testing.allocator; 106 114 const test_map = @embedFile("map.tmj"); 107 115 ··· 118 126 119 127 const tmz = @import("tmz"); 120 128 const Map = tmz.Map; 129 + 130 + const changeTestDir = @import("tests.zig").changeTestDir; 121 131 122 132 const std = @import("std"); 123 133 const expectEqualDeep = std.testing.expectEqualDeep;
-1
test/test
··· 1 - ..
+9
test/tests.zig
··· 4 4 _ = @import("tilesets.zig"); 5 5 _ = @import("properties.zig"); 6 6 } 7 + 8 + pub fn changeTestDir() !void { 9 + var dir = std.fs.cwd().openDir("test", .{}) catch return; 10 + defer dir.close(); 11 + 12 + try dir.setAsCwd(); 13 + } 14 + 15 + const std = @import("std");
+1 -1
test/tileset.tsj
··· 1 1 { 2 - "source": "test/source_tileset.tsj", 2 + "source": "source_tileset.tsj", 3 3 "type":"tileset", 4 4 "version":"1.10" 5 5 }
+4
test/tilesets.zig
··· 1 1 test "initFromSlice" { 2 + try changeTestDir(); 3 + 2 4 const test_tileset = @embedFile("tileset.tsj"); 3 5 4 6 const allocator = std.testing.allocator; ··· 47 49 48 50 const tmz = @import("tmz"); 49 51 const Tileset = tmz.Tileset; 52 + 53 + const changeTestDir = @import("tests.zig").changeTestDir; 50 54 51 55 const std = @import("std"); 52 56 const expectEqual = std.testing.expectEqual;