Debian Codegraph @

tests/code/testcases/testcastlerenderoptions.pas

raw
1 // -*- compile-command: "./test_single_testcase.sh TTestCastleRenderOptions" -*-
2 {
3 Copyright 2023-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 for CastleRenderOptions unit. }
18 unit TestCastleRenderOptions;
19
20 interface
21
22 uses
23 Classes, SysUtils,
24 CastleTester;
25
26 type
27 TTestCastleRenderOptions = class(TCastleTestCase)
28 published
29 procedure TestEquals;
30 end;
31
32 implementation
33
34 uses CastleRenderOptions;
35
36 procedure TTestCastleRenderOptions.TestEquals;
37 var
38 R1, R2: TCastleRenderOptions;
39 begin
40 R1 := nil;
41 R2 := nil;
42 try
43 R1 := TCastleRenderOptions.Create(nil);
44 R2 := TCastleRenderOptions.Create(nil);
45
46 AssertTrue(R1.Equals(R2));
47 AssertTrue(R2.Equals(R2));
48 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
49 AssertTrue(R2.Equals(R1)); // has to be always true, obviously
50
51 R1.Blending := false;
52
53 AssertFalse(R1.Equals(R2));
54 AssertFalse(R2.Equals(R1));
55 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
56 AssertTrue(R2.Equals(R2)); // has to be always true, obviously
57
58 R2.Blending := false;
59
60 AssertTrue(R1.Equals(R2));
61 AssertTrue(R2.Equals(R2));
62 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
63 AssertTrue(R2.Equals(R1)); // has to be always true, obviously
64
65 R2.Blending := true;
66
67 AssertFalse(R1.Equals(R2));
68 AssertFalse(R2.Equals(R1));
69 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
70 AssertTrue(R2.Equals(R2)); // has to be always true, obviously
71
72 R1.Blending := true;
73
74 AssertTrue(R1.Equals(R2));
75 AssertTrue(R2.Equals(R2));
76 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
77 AssertTrue(R2.Equals(R1)); // has to be always true, obviously
78
79 R1.InternalColorChannels := R1.InternalColorChannels - [3];
80
81 AssertFalse(R1.Equals(R2));
82 AssertFalse(R2.Equals(R1));
83 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
84 AssertTrue(R2.Equals(R2)); // has to be always true, obviously
85
86 R1.InternalColorChannels := R1.InternalColorChannels + [3];
87
88 AssertTrue(R1.Equals(R2));
89 AssertTrue(R2.Equals(R2));
90 AssertTrue(R1.Equals(R1)); // has to be always true, obviously
91 AssertTrue(R2.Equals(R1)); // has to be always true, obviously
92 finally
93 FreeAndNil(R1);
94 FreeAndNil(R2);
95 end;
96 end;
97
98 initialization
99 RegisterTest(TTestCastleRenderOptions);
100 end.