From 9d6f22c8847ed8f56d71d91d8509e4103e0373fa Mon Sep 17 00:00:00 2001 From: Toastical Date: Sat, 1 Feb 2025 03:38:03 +0200 Subject: [PATCH 1/2] activate_self wrapper for puppet and NOT check for any_chatlog --- code/tests/_game_test.dm | 2 ++ code/tests/_game_test_puppeteer.dm | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/code/tests/_game_test.dm b/code/tests/_game_test.dm index a7853c1d277b..24a5d2a32e9c 100644 --- a/code/tests/_game_test.dm +++ b/code/tests/_game_test.dm @@ -19,6 +19,8 @@ GLOBAL_LIST_EMPTY(game_test_chats) #define TEST_ASSERT_ANY_CHATLOG(puppet, text) if(!puppet.any_chatlog_has_text(text)) { return Fail("Expected `[text]` in any chatlog but got [jointext(puppet.get_chatlogs(), "\n")]", __FILE__, __LINE__) } +#define TEST_ASSERT_NOT_CHATLOG(puppet, text) if(puppet.any_chatlog_has_text(text)) { return Fail("Didn't expect `[text]` in any chatlog but got [jointext(puppet.get_chatlogs(), "\n")]", __FILE__, __LINE__) } + /// Asserts that the two parameters passed are equal, fails otherwise /// Optionally allows an additional message in the case of a failure #define TEST_ASSERT_EQUAL(a, b, message) do { \ diff --git a/code/tests/_game_test_puppeteer.dm b/code/tests/_game_test_puppeteer.dm index 525b3c7991dd..eaae62e70c24 100644 --- a/code/tests/_game_test_puppeteer.dm +++ b/code/tests/_game_test_puppeteer.dm @@ -48,6 +48,16 @@ origin_test.Fail("could not spawn obj [obj_type] near [src]") +/datum/test_puppeteer/proc/use_item_in_hand() + var/obj/item/item = puppet.get_active_hand() + if(!item) + origin_test.Fail("could not find obj in [puppet] active hand", __FILE__, __LINE__) + return + + item.activate_self(puppet) + puppet.next_click = world.time + puppet.next_move = world.time + /datum/test_puppeteer/proc/click_on(target, params) var/datum/test_puppeteer/puppet_target = target if(istype(puppet_target)) From 1d142c9646ffb22d1a02ed9bfa6329dde7626c6f Mon Sep 17 00:00:00 2001 From: Toastical Date: Sat, 1 Feb 2025 05:42:07 +0200 Subject: [PATCH 2/2] fixed helper proc --- code/tests/_game_test_puppeteer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/tests/_game_test_puppeteer.dm b/code/tests/_game_test_puppeteer.dm index eaae62e70c24..9074310ee69f 100644 --- a/code/tests/_game_test_puppeteer.dm +++ b/code/tests/_game_test_puppeteer.dm @@ -51,12 +51,12 @@ /datum/test_puppeteer/proc/use_item_in_hand() var/obj/item/item = puppet.get_active_hand() if(!item) - origin_test.Fail("could not find obj in [puppet] active hand", __FILE__, __LINE__) return item.activate_self(puppet) puppet.next_click = world.time puppet.next_move = world.time + return TRUE /datum/test_puppeteer/proc/click_on(target, params) var/datum/test_puppeteer/puppet_target = target