| 1 |
// -*- compile-command: "./test_single_testcase.sh TTestVideos" -*- |
| 2 |
{ |
| 3 |
Copyright 2013-2021 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 CastleVideos unit. } |
| 18 |
unit TestCastleVideos; |
| 19 |
|
| 20 |
interface |
| 21 |
|
| 22 |
uses |
| 23 |
Classes, SysUtils, |
| 24 |
CastleTester, CastleVideos; |
| 25 |
|
| 26 |
type |
| 27 |
TTestVideos = class(TCastleTestCase) |
| 28 |
published |
| 29 |
procedure TestLoad; |
| 30 |
end; |
| 31 |
|
| 32 |
implementation |
| 33 |
|
| 34 |
uses CastleFilesUtils; |
| 35 |
|
| 36 |
procedure TTestVideos.TestLoad; |
| 37 |
var |
| 38 |
Video: TVideo; |
| 39 |
begin |
| 40 |
Video := TVideo.Create; |
| 41 |
try |
| 42 |
Video.LoadFromFile('castle-data:/videos/video1_@counter(4).png'); |
| 43 |
AssertTrue(Video.Count = 3); |
| 44 |
Video.LoadFromFile('castle-data:/videos/video2_@counter(4).png'); |
| 45 |
AssertTrue(Video.Count = 3); |
| 46 |
Video.LoadFromFile('castle-data:/videos/video_single.png'); |
| 47 |
AssertTrue(Video.Count = 1); |
| 48 |
|
| 49 |
try |
| 50 |
Video.LoadFromFile('castle-data:/videos/video_not_existing.png'); |
| 51 |
Fail('Should fail'); |
| 52 |
except |
| 53 |
on E: Exception do |
| 54 |
begin |
| 55 |
// Writeln(E.Message); |
| 56 |
end; |
| 57 |
end; |
| 58 |
|
| 59 |
try |
| 60 |
Video.LoadFromFile('castle-data:/videos/video_not_existing@counter(1).png'); |
| 61 |
Fail('Should fail'); |
| 62 |
except |
| 63 |
on E: Exception do |
| 64 |
begin |
| 65 |
// Writeln(E.Message); |
| 66 |
AssertTrue(Pos('cannot be loaded', E.Message) <> 0); |
| 67 |
end; |
| 68 |
end; |
| 69 |
finally FreeAndNil(Video) end; |
| 70 |
end; |
| 71 |
|
| 72 |
initialization |
| 73 |
RegisterTest(TTestVideos); |
| 74 |
end. |