|
| 1 | +(* |
| 2 | +## Make Tests |
| 3 | +Tests the integrity of several Make interface methods. |
| 4 | +*) |
| 5 | +{$DEFINE WL_TEST} |
| 6 | +{$I WaspLib/osrs.simba} |
| 7 | +{$ASSERTIONS ON} |
| 8 | + |
| 9 | +const |
| 10 | + PATH: String = {$MACRO DIR} + 'imgs' + PATH_SEP; |
| 11 | + MODES: TStringArray = ['fixed', 'resizable_classic', 'resizable_modern_small', 'resizable_modern_large']; |
| 12 | + FILENAME: String := PATH_SEP + PathExtractNameWithoutExt(SCRIPT_FILE); |
| 13 | +var |
| 14 | + mode: String; |
| 15 | + img: TImage; |
| 16 | +begin |
| 17 | + for mode in MODES do |
| 18 | + begin |
| 19 | + // Test 004.png - Basic Make interface with 5 items, 6 quantity buttons, 6 selected |
| 20 | + img := new TImage(PATH + mode + FILENAME + '.png'); |
| 21 | + Target.SetImage(img); |
| 22 | + WaspLibSetup(); |
| 23 | + |
| 24 | + Assert(Make.IsOpen()); |
| 25 | + Assert(Length(Make.GetItemBoxes()) = 5); |
| 26 | + |
| 27 | + Assert(Length(Make.GetQuantityBoxes()) = 6); |
| 28 | + Assert(Length(Make.FindQuantityButtons) = 6); |
| 29 | + Assert(Make.GetCurrentQuantity() = 6); |
| 30 | + Assert(Make.HasHint() = False); |
| 31 | + |
| 32 | + // Test 004-1.png - Make interface with hint tooltip showing |
| 33 | + img := new TImage(PATH + mode + FILENAME + '-1.png'); |
| 34 | + Target.SetImage(img); |
| 35 | + |
| 36 | + WaspLibSetup(); |
| 37 | + |
| 38 | + Assert(Make.IsOpen()); |
| 39 | + Assert(Make.HasHint()); |
| 40 | + Assert(Make.ReadHint().Contains('Willow longbow')); |
| 41 | + Assert(Length(Make.GetItemBoxes()) = 5); |
| 42 | + |
| 43 | + // Test 004-2.png - Different Make interface with 1 item, 3 quantity buttons |
| 44 | + img := new TImage(PATH + mode + FILENAME + '-2.png'); |
| 45 | + Target.SetImage(img); |
| 46 | + |
| 47 | + WaspLibSetup(); |
| 48 | + |
| 49 | + Assert(Make.IsOpen()); |
| 50 | + Assert(Length(Make.GetItemBoxes()) = 1); |
| 51 | + Assert(Length(Make.GetQuantityBoxes()) = 3); |
| 52 | + Assert(Length(Make.FindQuantityButtons) = 3); |
| 53 | + Assert(Make.GetCurrentQuantity() = 10); |
| 54 | + Assert(Make.HasHint() = False); |
| 55 | + end; |
| 56 | +end; |
0 commit comments