Skip to content

Commit

Permalink
Minor test improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
captainurist committed Oct 15, 2023
1 parent 9d3df0b commit ba6000b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/Bin/GameTest/GameTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,10 +1468,12 @@ GAME_TEST(Issues, Issue1020) {
}

GAME_TEST(Issues, Issue1034) {
// Crash when casting telekinesis outdoors
// Crash when casting telekinesis outdoors.
auto houseTape = tapes.house();
auto statusTape = tapes.statusBar();
test.playTraceFromTestData("issue_1034.mm7", "issue_1034.json");
// check we have entered into the shop
EXPECT_EQ(window_SpeakInHouse->houseId(), HOUSE_WEAPON_SHOP_EMERALD_ISLAND);
EXPECT_TRUE(statusTape.contains("Select Target")); // Telekinesis message.
EXPECT_EQ(houseTape, tape(HOUSE_INVALID, HOUSE_WEAPON_SHOP_EMERALD_ISLAND)); // We have entered into the shop.
}

GAME_TEST(Issues, Issue1036) {
Expand Down
6 changes: 6 additions & 0 deletions test/Testing/Game/CommonTapeRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,9 @@ TestTape<int> CommonTapeRecorder::mapItemCount(ItemId itemId) {
}));
});
}

TestTape<HouseId> CommonTapeRecorder::house() {
return custom([] {
return window_SpeakInHouse ? window_SpeakInHouse->houseId() : HOUSE_INVALID;
});
}
3 changes: 3 additions & 0 deletions test/Testing/Game/CommonTapeRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Engine/Time.h"
#include "GUI/GUIEnums.h"
#include "GUI/GUIDialogues.h"
#include "GUI/UI/UIHouseEnums.h"

#include "Library/Config/ConfigEntry.h"

Expand Down Expand Up @@ -73,6 +74,8 @@ class CommonTapeRecorder {

TestTape<int> mapItemCount(ItemId itemId);

TestTape<HouseId> house();

private:
TestController *_controller = nullptr;
};

0 comments on commit ba6000b

Please sign in to comment.