1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
{
Copyright 2008-2017 Michalis Kamburelis.
This file is part of "Castle Game Engine".
"Castle Game Engine" is free software; see the file COPYING.txt,
included in this distribution, for details about the copyright.
"Castle Game Engine" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------------------------------------------------
}
unit TestCastleGLVersion;
interface
uses fpcunit, testutils, testregistry;
type
TTestGLVersion = class(TTestCase)
published
procedure Test1;
end;
implementation
uses SysUtils, CastleGLVersion;
procedure TTestGLVersion.Test1;
var
G: TGLVersion;
begin
G := TGLVersion.Create('1.4 (2.1 Mesa 7.0.4)',
'Mesa project: www.mesa3d.org', 'Mesa GLX Indirect');
try
AssertTrue(G.VendorInfo = '(2.1 Mesa 7.0.4)');
AssertTrue(G.Vendor = 'Mesa project: www.mesa3d.org');
AssertTrue(G.Renderer = 'Mesa GLX Indirect');
AssertTrue(G.Major = 1);
AssertTrue(G.Minor = 4);
{ Test AtLeast method }
AssertTrue(G.AtLeast(0, 9));
AssertTrue(G.AtLeast(1, 0));
AssertTrue(G.AtLeast(1, 3));
AssertTrue(G.AtLeast(1, 4));
AssertTrue(not G.AtLeast(1, 5));
AssertTrue(not G.AtLeast(2, 0));
AssertTrue(not G.ReleaseExists);
AssertTrue(G.Mesa);
AssertTrue(G.VendorMajor = 7);
AssertTrue(G.VendorMinor = 0);
AssertTrue(G.VendorRelease = 4);
finally FreeAndNil(G) end;
G := TGLVersion.Create('2.1 Mesa 7.1', 'Brian Paul',
'Mesa DRI Intel(blah blah blah)');
try
AssertTrue(G.VendorInfo = 'Mesa 7.1');
AssertTrue(G.Vendor = 'Brian Paul');
AssertTrue(G.Renderer = 'Mesa DRI Intel(blah blah blah)');
AssertTrue(G.Major = 2);
AssertTrue(G.Minor = 1);
AssertTrue(not G.ReleaseExists);
AssertTrue(G.Mesa);
AssertTrue(G.VendorMajor = 7);
AssertTrue(G.VendorMinor = 1);
AssertTrue(G.VendorRelease = 0);
finally FreeAndNil(G) end;
G := TGLVersion.Create('1.2.3', 'foobar', '');
try
AssertTrue(G.VendorInfo = '');
AssertTrue(G.Vendor = 'foobar');
AssertTrue(G.Renderer = '');
AssertTrue(G.Major = 1);
AssertTrue(G.Minor = 2);
AssertTrue(G.ReleaseExists);
AssertTrue(G.Release = 3);
AssertTrue(not G.Mesa);
finally FreeAndNil(G) end;
G := TGLVersion.Create('4.2.0 NVIDIA 304.108', 'NVIDIA Corporation', 'GeForce GTS 450/PCIe/SSE2/3DNOW!');
try
AssertEquals('NVIDIA 304.108', G.VendorInfo);
AssertEquals('NVIDIA Corporation', G.Vendor);
AssertEquals('GeForce GTS 450/PCIe/SSE2/3DNOW!', G.Renderer);
AssertEquals(4, G.Major);
AssertEquals(2, G.Minor);
AssertEquals(true, G.ReleaseExists);
AssertEquals(0, G.Release);
AssertEquals(304, G.VendorMajor);
AssertEquals(108, G.VendorMinor);
AssertEquals(0, G.VendorRelease);
AssertTrue(not G.Mesa);
AssertTrue(G.VendorType = gvNvidia);
finally FreeAndNil(G) end;
end;
initialization
RegisterTest(TTestGLVersion);
end.
|