diff --git a/test/controls_windows.c b/test/controls_windows.c new file mode 100644 index 00000000..04302205 --- /dev/null +++ b/test/controls_windows.c @@ -0,0 +1,25 @@ +// 10 june 2019 +#include "test_windows.h" + +static const uiControlOSVtable osVtable = { + .Size = sizeof (uiControlOSVtable), +}; + +const uiControlOSVtable *testOSVtable(void) +{ + return &osVtable; +} + +Test(WrongControlOSVtableSizeIsProgrammerError) +{ + uiControlVtable vtable; + uiControlOSVtable osvt; + void *ctx; + + testControlLoadNopVtable(&vtable); + ctx = beginCheckProgrammerError("uiRegisterControlType(): wrong size 1 for uiControlOSVtable"); + memset(&osvt, 0, sizeof (uiControlOSVtable)); + osvt.Size = 1; + uiRegisterControlType("name", &vtable, &osvt, 0); + endCheckProgrammerError(ctx); +} diff --git a/test/meson.build b/test/meson.build index 28d87f94..2cee2e93 100644 --- a/test/meson.build +++ b/test/meson.build @@ -9,7 +9,11 @@ libui_test_sources = files([ libui_allcalls_headers = files([ 'allcalls.h', ]) -if libui_OS == 'darwin' +if libui_OS == 'windows' + libui_test_sources += files([ + 'controls_windows.c', + ]) +elif libui_OS == 'darwin' libui_test_sources += files([ 'controls_darwin.m', ]) diff --git a/zNEW_test/test_windows.h b/test/test_windows.h similarity index 100% rename from zNEW_test/test_windows.h rename to test/test_windows.h diff --git a/zNEW_test/controls_windows.c b/zNEW_test/controls_windows.c deleted file mode 100644 index affdb52b..00000000 --- a/zNEW_test/controls_windows.c +++ /dev/null @@ -1,11 +0,0 @@ -// 10 june 2019 -#include "test_windows.h" - -static const uiControlOSVtable vtable = { - .Size = sizeof (uiControlOSVtable), -}; - -const uiControlOSVtable *testOSVtable(void) -{ - return &vtable; -} diff --git a/zNEW_test/controls_windows_errors.cpp b/zNEW_test/controls_windows_errors.cpp deleted file mode 100644 index 56b7c3e2..00000000 --- a/zNEW_test/controls_windows_errors.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// 16 june 2019 -#include "test_windows.h" - -const struct checkErrorCase controlOSVtableCases[] = { - { - "uiRegisterControlType() with OS vtable with wrong size", - [](void) { - uiControlOSVtable vtable; - - memset(&vtable, 0, sizeof (uiControlOSVtable)); - vtable.Size = 1; - uiRegisterControlType("name", testVtable(), &vtable, 0); - }, - "uiRegisterControlType(): wrong size 1 for uiControlOSVtable", - }, - { NULL, NULL, NULL }, -};