Skip to content

Commit 31a440f

Browse files
committed
tests: ads inventory test
1 parent 206911f commit 31a440f

File tree

9 files changed

+59
-29
lines changed

9 files changed

+59
-29
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,14 @@ jobs:
4949
path: ./Includes/SRLT
5050

5151
- name: Run tests
52+
shell: bash
5253
run: |
53-
# Get all .simba files in the tests folder, sorted numerically
54-
$testFiles = Get-ChildItem -Path ./Includes/SRLT/tests/*.simba | Sort-Object Name
55-
56-
# Check if any test files were found
57-
if ($testFiles.Count -eq 0) {
58-
Write-Output "::error::No .simba test files found."
59-
exit 1
60-
}
61-
62-
# Run each test file
63-
foreach ($testFile in $testFiles) {
64-
Write-Output "Running test: $($testFile.FullName)"
65-
66-
$output = .\Simba-Win32.exe --run $testFile.FullName
67-
Write-Output $output
68-
if (-not ($output -match "Successfully executed in \d+ milliseconds\.")) {
69-
Write-Output "::error::Simba-Win32.exe failed on $($testFile.Name)."
70-
exit 1
71-
}
72-
73-
$output = .\Simba-Win64.exe --run $testFile.FullName
74-
Write-Output $output
75-
if (-not ($output -match "Successfully executed in \d+ milliseconds\.")) {
76-
Write-Output "::error::Simba-Win64.exe failed on $($testFile.Name)."
77-
exit 1
78-
}
79-
}
54+
testFiles=(./Includes/SRLT/tests/*.simba)
55+
56+
for testFile in "${testFiles[@]}"; do
57+
echo "Running test: $testFile" on 32 bits
58+
./Simba-Win32.exe --run "$testFile"
59+
echo "Running test: $testFile" on 64 bits
60+
./Simba-Win64.exe --run "$testFile"
61+
done
8062

osrs/interfaces/mainscreen/bank.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ begin
121121
Self.Title.Setup(Self.Bounds);
122122

123123
Self.Tabs := TBoxArray.Create(Self.Bounds.TopLeft.Offset(47, 42), 10, 1, 35, 28, [5, 0]);
124-
Self.SlotBoxes := TBoxArray.Create(Self.Bounds.TopLeft.Offset(57, 77), 8, (Self.Bounds.Height - 135) div 35, 31, 31, [17, 5]);
124+
//Self.SlotBoxes := TBoxArray.Create(Self.Bounds.TopLeft.Offset(57, 77), 8, (Self.Bounds.Height - 135) div 35, 31, 31, [17, 5]);
125125

126126
Self.SlotsArea.X1 := Self.Bounds.X1 + 57;
127127
Self.SlotsArea.Y1 := Self.Bounds.Y1 + 77;

osrs/interfaces/setup.simba

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ begin
4646
end;
4747
{$H+}
4848

49+
50+
procedure SaveAnonymousScreenshot(const filename: String);
51+
var
52+
img: TImage;
53+
begin
54+
try
55+
img := TImage.CreateFromTarget();
56+
img.DrawColor := $FFFFFF;
57+
58+
if Chat.IsOpen() then
59+
img.DrawBoxFilled(Chat.GetDisplayNameBox());
60+
61+
if XPBar.IsOpen() and XPBar.Setup() then
62+
img.DrawBoxFilled(XPBar.Bounds);
63+
64+
img.Save(filename);
65+
finally
66+
img.Free();
67+
end;
68+
end;
69+
4970
begin
5071
Target.AddEvent(ETargetEvent.TARGET_RESIZE, @TargetResized);
5172
RSClient.IsLoggedIn();

tests/001.simba

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//gametabs and inventory tests
2+
{$I SRLT/osrs.simba}
3+
{$ASSERTIONS ON}
4+
5+
const
6+
PATH: String = {$MACRO DIR} + 'imgs' + PATH_SEP;
7+
MODES: TStringArray = ['fixed', 'resizable_classic', 'resizable_modern_small', 'resizable_modern_large'];
8+
FILENAME: String := PATH_SEP + PathExtractNameWithoutExt(SCRIPT_FILE) + '.png';
9+
var
10+
mode: String;
11+
img: TImage;
12+
begin
13+
for mode in modes do
14+
begin
15+
if not FileExists(PATH + mode + FILENAME) then continue;
16+
img := TImage.Create(PATH + mode + FILENAME);
17+
Target.SetImage(img);
18+
19+
RSClient.Mode := RSClient.DetectClientMode();
20+
SetupInterfaces();
21+
22+
Assert(Inventory.IsOpen());
23+
//Assert(Inventory.Slots.Count() = 9);
24+
25+
img.Free();
26+
end;
27+
end;

tests/imgs/fixed/001.png

184 KB
Loading
184 KB
Loading
215 KB
Loading
181 KB
Loading

utils/misc.simba

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ begin
7272
end;
7373

7474

75-
function RandomColor: TColor;
75+
function RandomColor(): TColor;
7676
var
7777
R, G, B: Byte;
7878
begin

0 commit comments

Comments
 (0)