From 2a314271a6761d2dad12545f684c159df65b76b5 Mon Sep 17 00:00:00 2001 From: EmilyV99 Date: Thu, 17 Aug 2023 04:51:04 -0400 Subject: [PATCH] test: hopefully fix quick-assign zq tests --- src/new_subscr.cpp | 11 +++++++++++ src/zq/zquest.cpp | 2 ++ tests/test_zquest.py | 1 - 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/new_subscr.cpp b/src/new_subscr.cpp index 9d65b6ea39..f0811bd433 100644 --- a/src/new_subscr.cpp +++ b/src/new_subscr.cpp @@ -18,6 +18,11 @@ #ifdef IS_PLAYER extern int32_t directItem; extern sprite_list Lwpns; + +#define ALLOW_NULL_WIDGET replay_version_check(0,19) +#else +#define ALLOW_NULL_WIDGET is_zq_replay_test +extern bool is_zq_replay_test; #endif @@ -3329,6 +3334,7 @@ SubscrWidget* SubscrWidget::fromOld(subscreen_object const& old) return new SW_SelectedText(old); case ssoITEM: { + if(!ALLOW_NULL_WIDGET) break; SubscrWidget* ret = new SubscrWidget(old); ret->w = 16; ret->h = 16; @@ -3336,6 +3342,7 @@ SubscrWidget* SubscrWidget::fromOld(subscreen_object const& old) } case ssoICON: { + if(!ALLOW_NULL_WIDGET) break; SubscrWidget* ret = new SubscrWidget(old); ret->w = 8; ret->h = 8; @@ -3441,6 +3448,10 @@ SubscrWidget* SubscrWidget::newType(byte ty) case widgSELECTEDTEXT: widg = new SW_SelectedText(); break; + case widgNULL: + if(!ALLOW_NULL_WIDGET) break; + widg = new SubscrWidget(); + break; } return widg; } diff --git a/src/zq/zquest.cpp b/src/zq/zquest.cpp index e7ec622f5c..e423ae98d8 100644 --- a/src/zq/zquest.cpp +++ b/src/zq/zquest.cpp @@ -177,6 +177,7 @@ extern CConsoleLoggerEx zscript_coloured_console; uint8_t console_is_open = 0; uint8_t __isZQuest = 1; //Shared functionscan reference this. -Z +bool is_zq_replay_test = false; #include "base/util.h" @@ -27471,6 +27472,7 @@ int32_t main(int32_t argc,char **argv) int quick_assign_arg = used_switch(argc, argv, "-quick-assign"); if (quick_assign_arg > 0) { + is_zq_replay_test = true; set_headless_mode(); int load_ret = load_quest(argv[quick_assign_arg + 1], false); diff --git a/tests/test_zquest.py b/tests/test_zquest.py index ceaded74eb..d6e930d3f3 100644 --- a/tests/test_zquest.py +++ b/tests/test_zquest.py @@ -48,7 +48,6 @@ def run_replay(self, output_dir, args): return output.returncode, ReplayTestResults(**test_results_json) def test_zquest_compile_and_quick_assign(self): - return #TEMPORARY newsubscr2 BRANCH # TODO: set this via CLI include_paths = [ str(root_dir / 'tests/scripts'),