Merge pull request #153 from Lorenzooone/test_rows
Add missing target boundary tests and overworld menu items boundary tests
This commit is contained in:
commit
009a974a60
|
@ -39,6 +39,7 @@ $input_c_test_files =
|
||||||
"src/c/tests/test_utils.c",
|
"src/c/tests/test_utils.c",
|
||||||
"src/c/tests/test_m2_utils.c",
|
"src/c/tests/test_m2_utils.c",
|
||||||
"src/c/tests/battle_test.c",
|
"src/c/tests/battle_test.c",
|
||||||
|
"src/c/tests/menu_test.c",
|
||||||
"src/c/tests/debug_printf/test_print.c",
|
"src/c/tests/debug_printf/test_print.c",
|
||||||
"src/c/tests/debug_printf/mgba.c",
|
"src/c/tests/debug_printf/mgba.c",
|
||||||
"src/c/tests/debug_printf/printf.c"
|
"src/c/tests/debug_printf/printf.c"
|
||||||
|
|
|
@ -37,4 +37,5 @@ byte* __attribute__((naked)) m2_malloc(int size) {}
|
||||||
void __attribute__((naked)) m2_free(int* address) {}
|
void __attribute__((naked)) m2_free(int* address) {}
|
||||||
void __attribute__((naked)) m2_title_teardown() {}
|
void __attribute__((naked)) m2_title_teardown() {}
|
||||||
void __attribute__((naked)) vblank() {}
|
void __attribute__((naked)) vblank() {}
|
||||||
|
int __attribute__((naked)) m2_set_equippables(WINDOW* window, unsigned short choice, byte* index_list) {}
|
||||||
void __attribute__((naked)) reg_ram_reset(int flag) {}
|
void __attribute__((naked)) reg_ram_reset(int flag) {}
|
|
@ -82,6 +82,14 @@ void test_target_text()
|
||||||
assert_message(text_stayed_inside(window_pointers[3]), "Target text for Enemy %d - W", j);
|
assert_message(text_stayed_inside(window_pointers[3]), "Target text for Enemy %d - W", j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printTargetOfAttack(0,-1); // To the front row
|
||||||
|
store_pixels_overworld_buffer(0x10); // This is just for visualization purposes
|
||||||
|
assert(text_stayed_inside(window_pointers[3]));
|
||||||
|
|
||||||
|
printTargetOfAttack(1,-1); // To the back row
|
||||||
|
store_pixels_overworld_buffer(0x10); // This is just for visualization purposes
|
||||||
|
assert(text_stayed_inside(window_pointers[3]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _setup()
|
static void _setup()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "main_test.h"
|
#include "main_test.h"
|
||||||
#include "battle_test.h"
|
#include "battle_test.h"
|
||||||
|
#include "menu_test.h"
|
||||||
#include "debug_printf/test_print.h"
|
#include "debug_printf/test_print.h"
|
||||||
|
|
||||||
void start_tests()
|
void start_tests()
|
||||||
|
@ -7,6 +8,7 @@ void start_tests()
|
||||||
start_session();
|
start_session();
|
||||||
|
|
||||||
start_battle_tests();
|
start_battle_tests();
|
||||||
|
start_menu_tests();
|
||||||
|
|
||||||
end_session();
|
end_session();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
#include "menu_test.h"
|
||||||
|
|
||||||
|
#define GOODS_X 0x6
|
||||||
|
#define GOODS_Y 0x1
|
||||||
|
#define GOODS_WIDTH 0x17
|
||||||
|
#define GOODS_HEIGHT 0xE
|
||||||
|
|
||||||
|
#define INNERMOST_EQUIP_X 0x12
|
||||||
|
#define INNERMOST_EQUIP_Y 0x1
|
||||||
|
#define INNERMOST_EQUIP_WIDTH 0xB
|
||||||
|
#define INNERMOST_EQUIP_HEIGHT 0xE
|
||||||
|
|
||||||
|
#define TOTAL_ITEMS 253
|
||||||
|
|
||||||
|
#define CHOICE_WEAPONS 0x3
|
||||||
|
#define CHOICE_BODY 0x4
|
||||||
|
#define CHOICE_ARMS 0x5
|
||||||
|
#define CHOICE_OTHER 0x6
|
||||||
|
|
||||||
|
void getEquippables(byte* equip_buffers);
|
||||||
|
|
||||||
|
void test_items_text()
|
||||||
|
{
|
||||||
|
byte equip_buffers[TOTAL_ITEMS];
|
||||||
|
getEquippables(equip_buffers);
|
||||||
|
m2_setupwindow((window_pointers[4]), GOODS_X, GOODS_Y, GOODS_WIDTH, GOODS_HEIGHT);
|
||||||
|
|
||||||
|
*active_window_party_member = 0;
|
||||||
|
unsigned short *current_items = (*pc_stats)[0].goods;
|
||||||
|
byte *current_equipment = (*pc_stats)[0].equipment;
|
||||||
|
current_items[0] = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < TOTAL_ITEMS; i++)
|
||||||
|
{
|
||||||
|
current_items[1] = i;
|
||||||
|
current_equipment[0] = 0;
|
||||||
|
initWindow_buffer(window_pointers[4], NULL, 0);
|
||||||
|
goods_print_items(window_pointers[4], current_items, 0);
|
||||||
|
store_pixels_overworld_buffer(0x10); // This is just for visualization purposes
|
||||||
|
assert_message(text_stayed_inside(window_pointers[4]), "Goods window: Item %d", i);
|
||||||
|
if(equip_buffers[i] != 0)
|
||||||
|
{
|
||||||
|
current_equipment[0] = 2;
|
||||||
|
initWindow_buffer(window_pointers[4], NULL, 0);
|
||||||
|
goods_print_items(window_pointers[4], current_items, 0);
|
||||||
|
store_pixels_overworld_buffer(0x10); // This is just for visualization purposes
|
||||||
|
assert_message(text_stayed_inside(window_pointers[4]), "Goods window: Item %d - Equipped", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_equip_text()
|
||||||
|
{
|
||||||
|
byte fsp_buffer[0x20];
|
||||||
|
free_strings_pointers[3] = fsp_buffer;
|
||||||
|
byte equipped_buffer[6];
|
||||||
|
byte equip_buffers[TOTAL_ITEMS];
|
||||||
|
getEquippables(equip_buffers);
|
||||||
|
equipped_buffer[4] = 1;
|
||||||
|
equipped_buffer[5] = 0xFF;
|
||||||
|
m2_setupwindow((window_pointers[4]), INNERMOST_EQUIP_X, INNERMOST_EQUIP_Y, INNERMOST_EQUIP_WIDTH, INNERMOST_EQUIP_HEIGHT);
|
||||||
|
|
||||||
|
*active_window_party_member = 0;
|
||||||
|
*((unsigned short*)0x3005224) = CHOICE_WEAPONS;
|
||||||
|
unsigned short *current_items = (*pc_stats)[0].goods;
|
||||||
|
byte *current_equipment = (*pc_stats)[0].equipment;
|
||||||
|
window_pointers[4]->cursor_x = 1;
|
||||||
|
window_pointers[4]->number_text_area = equipped_buffer;
|
||||||
|
|
||||||
|
for(int i = 0; i < TOTAL_ITEMS; i++)
|
||||||
|
{
|
||||||
|
if(equip_buffers[i] != 0)
|
||||||
|
{
|
||||||
|
current_items[0] = i;
|
||||||
|
current_equipment[0] = 1;
|
||||||
|
initWindow_buffer(window_pointers[4], NULL, 0);
|
||||||
|
equippablePrint(window_pointers[4]);
|
||||||
|
store_pixels_overworld_buffer(0x10); // This is just for visualization purposes
|
||||||
|
assert_message(text_stayed_inside(window_pointers[4]), "Equip window: Item %d - Equipped", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void getEquippables(byte* equip_buffers)
|
||||||
|
{
|
||||||
|
byte buffer[0x20];
|
||||||
|
|
||||||
|
for(int i = 0; i < TOTAL_ITEMS; i++)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < 4; j++)
|
||||||
|
{
|
||||||
|
if(j == 0 || equip_buffers[i] == 0)
|
||||||
|
{
|
||||||
|
*active_window_party_member = (short)j;
|
||||||
|
unsigned short *current_items = (*pc_stats)[j].goods;
|
||||||
|
current_items[0] = i;
|
||||||
|
int found = 0;
|
||||||
|
found += m2_set_equippables((window_pointers[4]), CHOICE_WEAPONS, buffer);
|
||||||
|
found += m2_set_equippables((window_pointers[4]), CHOICE_BODY, buffer);
|
||||||
|
found += m2_set_equippables((window_pointers[4]), CHOICE_ARMS, buffer);
|
||||||
|
found += m2_set_equippables((window_pointers[4]), CHOICE_OTHER, buffer);
|
||||||
|
equip_buffers[i] = found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _setup()
|
||||||
|
{
|
||||||
|
(window_pointers[4]) = (struct WINDOW*)0x2030948;
|
||||||
|
(*(byte*)(0x3005050)) = 0xFF;
|
||||||
|
(*(short*)(0x30023DC)) = 0; // Default delay between prints
|
||||||
|
(*(int*)(0x3005220)) = 0x2028820;
|
||||||
|
*tilemap_pointer= (unsigned short*)0x2028018;
|
||||||
|
(*(unsigned short*)(0x500001E)) = 0x7FFF; // Make it so it's easy to check what's being written
|
||||||
|
setup_overworld_buffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void start_menu_tests()
|
||||||
|
{
|
||||||
|
run_test(test_items_text);
|
||||||
|
run_test(test_equip_text);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include "test_utils.h"
|
||||||
|
#include "test_m2_utils.h"
|
||||||
|
#include "debug_printf/test_print.h"
|
||||||
|
|
||||||
|
#include "../goods.h"
|
||||||
|
#include "../equip.h"
|
||||||
|
#include "../vwf.h"
|
||||||
|
|
||||||
|
void start_menu_tests();
|
||||||
|
|
||||||
|
extern int m2_set_equippables(WINDOW* window, unsigned short choice, byte* index_list);
|
|
@ -2400,6 +2400,7 @@ disclaimer_map:
|
||||||
.definelabel m2_statuswindow_numbers,0x80C0A5C
|
.definelabel m2_statuswindow_numbers,0x80C0A5C
|
||||||
.definelabel m2_menuwindow ,0x80C1C98
|
.definelabel m2_menuwindow ,0x80C1C98
|
||||||
.definelabel m2_psiwindow ,0x80C1FBC
|
.definelabel m2_psiwindow ,0x80C1FBC
|
||||||
|
.definelabel m2_set_equippables ,0x80C51A0
|
||||||
.definelabel m2_drawwindow ,0x80C87D0
|
.definelabel m2_drawwindow ,0x80C87D0
|
||||||
.definelabel m2_print_window ,0x80C8BE4
|
.definelabel m2_print_window ,0x80C8BE4
|
||||||
.definelabel m2_print_alphabet ,0x80C8FFC
|
.definelabel m2_print_alphabet ,0x80C8FFC
|
||||||
|
|
2
test.ps1
2
test.ps1
|
@ -1,6 +1,6 @@
|
||||||
$test_rom_file = "bin/m12test.gba"
|
$test_rom_file = "bin/m12test.gba"
|
||||||
$log_file = "bin/test.log"
|
$log_file = "bin/test.log"
|
||||||
$sleep_time = 60
|
$sleep_time = 120
|
||||||
$failure_text = "FAIL"
|
$failure_text = "FAIL"
|
||||||
$end_text = "Done!"
|
$end_text = "Done!"
|
||||||
$mgba_name = "mgba-sdl"
|
$mgba_name = "mgba-sdl"
|
||||||
|
|
Loading…
Reference in New Issue