| 1 |
{ |
| 2 |
Copyright 2024-2024 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Test for CastleRendererInternalShader unit. } |
| 17 |
unit TestCastleRendererInternalShader; |
| 18 |
|
| 19 |
interface |
| 20 |
|
| 21 |
uses |
| 22 |
Classes, SysUtils, |
| 23 |
CastleTester; |
| 24 |
|
| 25 |
type |
| 26 |
TTestCastleRendererInternalShader = class(TCastleTestCase) |
| 27 |
published |
| 28 |
procedure TestFindPlugName; |
| 29 |
end; |
| 30 |
|
| 31 |
implementation |
| 32 |
|
| 33 |
uses CastleUtils, CastleRendererInternalShader; |
| 34 |
|
| 35 |
procedure TTestCastleRendererInternalShader.TestFindPlugName; |
| 36 |
var |
| 37 |
PlugName, DeclaredParameters: String; |
| 38 |
begin |
| 39 |
PlugName := FindPlugName(NL + |
| 40 |
'void PLUG_main_texture_apply ( inout vec4 fcol, const in vec3 unused )' + NL + |
| 41 |
'{' + NL + |
| 42 |
'}', DeclaredParameters); |
| 43 |
AssertEquals('main_texture_apply', PlugName); |
| 44 |
AssertEquals('( inout vec4 fcol, const in vec3 unused )', DeclaredParameters); |
| 45 |
|
| 46 |
PlugName := FindPlugName(NL + |
| 47 |
'void PLUG_main_texture_apply( inout vec4 fcol, const in vec3 unused )' + NL + |
| 48 |
'{' + NL + |
| 49 |
'}', DeclaredParameters); |
| 50 |
AssertEquals('main_texture_apply', PlugName); |
| 51 |
AssertEquals('( inout vec4 fcol, const in vec3 unused )', DeclaredParameters); |
| 52 |
|
| 53 |
// Make sure PLUG_xxx not followed by ( is not recognized |
| 54 |
PlugName := FindPlugName(NL + |
| 55 |
'/* void PLUG_main_texture_apply bla blah */', DeclaredParameters); |
| 56 |
AssertEquals('', PlugName); |
| 57 |
end; |
| 58 |
|
| 59 |
initialization |
| 60 |
RegisterTest(TTestCastleRendererInternalShader); |
| 61 |
end. |