Skip to content

Commit 4b09b10

Browse files
committed
Add panel and store transaction tests with UI test fixture
1 parent 0ecc3ed commit 4b09b10

7 files changed

Lines changed: 2833 additions & 14 deletions

File tree

CMake/Tests.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ set(tests
3838
townerdat_test
3939
writehero_test
4040
vendor_test
41+
panel_state_test
42+
store_transaction_test
43+
visual_store_test
4144
)
4245
set(standalone_tests
4346
codec_test

Source/stores.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ StaticVector<Item, NumWitchItemsHf> WitchItems;
5555
int BoyItemLevel;
5656
Item BoyItem;
5757

58+
/** Remember currently selected text line from TextLine while displaying a dialog */
59+
int OldTextLine;
60+
/** Currently selected text line from TextLine */
61+
int CurrentTextLine;
62+
/** Remember last scroll position */
63+
int OldScrollPos;
64+
/** Scroll position */
65+
int ScrollPos;
66+
/** Remember current store while displaying a dialog */
67+
TalkID OldActiveStore;
68+
/** Temporary item used to hold the item being traded */
69+
Item TempItem;
70+
5871
namespace {
5972

6073
/** The current towner being interacted with */
@@ -65,10 +78,6 @@ bool IsTextFullSize;
6578

6679
/** Number of text lines in the current dialog */
6780
int NumTextLines;
68-
/** Remember currently selected text line from TextLine while displaying a dialog */
69-
int OldTextLine;
70-
/** Currently selected text line from TextLine */
71-
int CurrentTextLine;
7281

7382
struct STextStruct {
7483
enum Type : uint8_t {
@@ -110,10 +119,6 @@ bool RenderGold;
110119

111120
/** Does the current panel have a scrollbar */
112121
bool HasScrollbar;
113-
/** Remember last scroll position */
114-
int OldScrollPos;
115-
/** Scroll position */
116-
int ScrollPos;
117122
/** Next scroll position */
118123
int NextScrollPos;
119124
/** Previous scroll position */
@@ -123,12 +128,6 @@ int8_t CountdownScrollUp;
123128
/** Countdown for the push state of the scroll down button */
124129
int8_t CountdownScrollDown;
125130

126-
/** Remember current store while displaying a dialog */
127-
TalkID OldActiveStore;
128-
129-
/** Temporary item used to hold the item being traded */
130-
Item TempItem;
131-
132131
/** Maps from towner IDs to NPC names. */
133132
const char *const TownerNames[] = {
134133
N_("Griswold"),

Source/stores.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ extern int BoyItemLevel;
9393
/** Current item sold by Wirt */
9494
extern Item BoyItem;
9595

96+
/** Currently selected text line from TextLine */
97+
extern DVL_API_FOR_TEST int CurrentTextLine;
98+
/** Remember currently selected text line from TextLine while displaying a dialog */
99+
extern DVL_API_FOR_TEST int OldTextLine;
100+
/** Scroll position */
101+
extern DVL_API_FOR_TEST int ScrollPos;
102+
/** Remember last scroll position */
103+
extern DVL_API_FOR_TEST int OldScrollPos;
104+
/** Remember current store while displaying a dialog */
105+
extern DVL_API_FOR_TEST TalkID OldActiveStore;
106+
/** Temporary item used to hold the item being traded */
107+
extern DVL_API_FOR_TEST Item TempItem;
108+
96109
void AddStoreHoldRepair(Item *itm, int8_t i);
97110

98111
/** Clears premium items sold by Griswold and Wirt. */

0 commit comments

Comments
 (0)