From e73c3363ec8da4d17e42786ec582752ce5c4fad7 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 11 May 2020 22:30:30 -0400 Subject: [PATCH] Reintegrated the Windows control tests. We may be close to getting rid of zNEW_test! --- test/controls_windows.c | 25 +++++++++++++++++++++++++ test/meson.build | 6 +++++- {zNEW_test => test}/test_windows.h | 0 zNEW_test/controls_windows.c | 11 ----------- zNEW_test/controls_windows_errors.cpp | 17 ----------------- 5 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 test/controls_windows.c rename {zNEW_test => test}/test_windows.h (100%) delete mode 100644 zNEW_test/controls_windows.c delete mode 100644 zNEW_test/controls_windows_errors.cpp 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 }, -};