1
0
mirror of https://github.com/deadw00d/AROS.git synced 2025-10-26 21:18:42 +00:00

Add test confirming that Window_Title is not copied by Window class

This commit is contained in:
deadwood
2022-05-29 17:21:57 +02:00
parent 430661c878
commit b54fdbf126
4 changed files with 87 additions and 1 deletions

View File

@ -0,0 +1,81 @@
/*
Copyright <20> 2022, The AROS Development Team. All rights reserved.
$Id$
*/
#include <libraries/mui.h>
#include <proto/muimaster.h>
#include <proto/intuition.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <clib/alib_protos.h>
#include "../test-util.h"
#if defined(__AROS__)
#include <CUnit/CUnitCI.h>
#endif
struct Library *MUIMasterBase = NULL;
static IPTR nget(Object *obj, ULONG attr)
{
IPTR val = 0;
get(obj, attr, &val);
return val;
}
CU_SUITE_SETUP()
{
MUIMasterBase = OpenLibrary((STRPTR)MUIMASTER_NAME, 0);
if (!MUIMasterBase)
CUE_SINIT_FAILED;
return CUE_SUCCESS;
}
CU_SUITE_TEARDOWN()
{
CloseLibrary(MUIMasterBase);
return CUE_SUCCESS;
}
CU_TEST_SETUP()
{
}
CU_TEST_TEARDOWN()
{
}
static void test_window_not_copying_title()
{
TEXT wintitle[] = "TITLE";
Object *app = ApplicationObject, End;
set(app, MUIA_Application_Sleep, TRUE);
Object *win = WindowObject,
MUIA_Window_Title, wintitle,
MUIA_Window_RootObject, RectangleObject,
End,
End;
DoMethod(app, OM_ADDMEMBER, win);
set(win, MUIA_Window_Open, TRUE);
CU_ASSERT_EQUAL(wintitle, (APTR)nget(win, MUIA_Window_Title));
wintitle[0] = 'B';
CU_ASSERT_STRING_EQUAL("BITLE", (APTR)nget(win, MUIA_Window_Title));
MUI_DisposeObject(app);
}
int main(int argc, char** argv)
{
CU_CI_DEFINE_SUITE("MUIC_Window_Suite", __cu_suite_setup, __cu_suite_teardown, __cu_test_setup, __cu_test_teardown);
CUNIT_CI_TEST(test_window_not_copying_title);
return CU_CI_RUN_SUITES();
}

View File

@ -31,7 +31,8 @@ CUNITFILES := \
cunit-zune-handleevent \
cunit-zune-handleevent-2 \
cunit-zune-showhide \
cunit-zune-sleep
cunit-zune-sleep \
cunit-zune-window
USER_CFLAGS := -I $(SRCDIR)/workbench/system/Wanderer/Classes

View File

@ -81,6 +81,9 @@ static ULONG SAVEDS func(REG(a0, struct IClass *cl), \
#define CUE_SUCCESS 0
#define CUE_SINIT_FAILED 22
#define CU_ASSERT_STRING_EQUAL(expected, actual) \
CU_ASSERT(strcmp(expected, actual) == 0)
#define CU_ASSERT_EQUAL(expected, actual) \
CU_ASSERT(expected == actual)

View File

@ -48,6 +48,7 @@ If NOT WARN
Execute S/Test cunit/zune/cunit-zune-handleevent-2
Execute S/Test cunit/zune/cunit-zune-showhide
Execute S/Test cunit/zune/cunit-zune-sleep
Execute S/Test cunit/zune/cunit-zune-window
Endif