Debian Codegraph @

tests/code/testcases/testcastletiledmap.pas

raw
1 // -*- compile-command: "./test_single_testcase.sh TTestCastleTiledMap" -*-
2 {
3 Copyright 2021-2023 Michalis Kamburelis.
4
5 This file is part of "Castle Game Engine".
6
7 "Castle Game Engine" is free software; see the file COPYING.txt,
8 included in this distribution, for details about the copyright.
9
10 "Castle Game Engine" is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 ----------------------------------------------------------------------------
15 }
16
17 { Test CastleTiledMap unit. }
18 unit TestCastleTiledMap;
19
20 interface
21
22 uses
23 Classes, SysUtils, CastleTester;
24
25 type
26 TTestCastleTiledMap = class(TCastleTestCase)
27 published
28 procedure TestLoadingUi;
29 procedure TestLoadingTransform;
30 procedure TestLoadingRenderingWithoutAtlas;
31 end;
32
33 implementation
34
35 uses CastleTiledMap;
36
37 const
38 TestMaps: array [0..12] of String = (
39 'castle-data:/tiled-maps/desert.tmx',
40 'castle-data:/tiled-maps/desert_with_objects.tmx',
41 'castle-data:/tiled-maps/hexagonal-mini.tmx',
42 'castle-data:/tiled-maps/isometric_grass_and_water.tmx',
43 'castle-data:/tiled-maps/orthogonal-outside.tmx',
44 'castle-data:/tiled-maps/perspective_walls.tmx',
45 'castle-data:/tiled-maps/sewers.tmx',
46 // See https://github.com/castle-engine/castle-engine/pull/438
47 'castle-data:/tiled-maps/desert_with_empty_objects_layer.tmx',
48 'castle-data:/tiled-maps2/map-hexagonal.tmx',
49 'castle-data:/tiled-maps2/map-isometric-staggered.tmx',
50 'castle-data:/tiled-maps2/map-isometric-test-non-square.tmx',
51 'castle-data:/tiled-maps2/map-isometric.tmx',
52 'castle-data:/tiled-maps2/map-orthogonal.tmx'
53 );
54
55 procedure TTestCastleTiledMap.TestLoadingUi;
56 var
57 Map: TCastleTiledMapControl;
58 MapUrl: String;
59 begin
60 Map := TCastleTiledMapControl.Create(nil);
61 try
62 for MapUrl in TestMaps do
63 Map.Url := MapUrl;
64 finally FreeAndNil(Map) end;
65 end;
66
67 procedure TTestCastleTiledMap.TestLoadingTransform;
68 var
69 Map: TCastleTiledMap;
70 MapUrl: String;
71 begin
72 Map := TCastleTiledMap.Create(nil);
73 try
74 for MapUrl in TestMaps do
75 Map.Url := MapUrl;
76 finally FreeAndNil(Map) end;
77 end;
78
79 procedure TTestCastleTiledMap.TestLoadingRenderingWithoutAtlas;
80 var
81 Map: TCastleTiledMap;
82 begin
83 Map := TCastleTiledMap.Create(nil);
84 try
85 Map.Url := 'castle-data:/tiled-map-no-atlas/test.tmx';
86 finally FreeAndNil(Map) end;
87 end;
88
89 initialization
90 RegisterTest(TTestCastleTiledMap);
91 end.