From 517791f04ef4b941d71eeb07f8d2f22afbf1f866 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 16 Jun 2019 20:34:56 -0400 Subject: [PATCH] Started writing the macOS control errors file. We have a meson problem now... it's not respecting cpp_std for Objective-C++. --- test/controls_darwin_errors.mm | 17 +++++++++++++++++ test/controls_errors.cpp | 2 +- test/meson.build | 3 +++ test/test.h | 3 +++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/controls_darwin_errors.mm diff --git a/test/controls_darwin_errors.mm b/test/controls_darwin_errors.mm new file mode 100644 index 00000000..da95adbb --- /dev/null +++ b/test/controls_darwin_errors.mm @@ -0,0 +1,17 @@ +// 16 june 2019 +#import "test_darwin.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 }, +}; diff --git a/test/controls_errors.cpp b/test/controls_errors.cpp index a7764879..6dbae8e0 100644 --- a/test/controls_errors.cpp +++ b/test/controls_errors.cpp @@ -215,6 +215,6 @@ static const struct checkErrorCase casesAfterOSVtable[] = { testingTest(ControlErrors) { checkProgrammerErrors(t, casesBeforeOSVtable); - // OS vtable sizes are tested per-OS + checkProgrammerErrors(t, controlOSVtableCases); checkProgrammerErrors(t, casesAfterOSVtable); } diff --git a/test/meson.build b/test/meson.build index 5b5e2fa9..4412881b 100644 --- a/test/meson.build +++ b/test/meson.build @@ -16,8 +16,11 @@ if libui_OS == 'windows' 'controls_windows.c', ] elif libui_OS == 'darwin' + add_languages('objcpp', + required: true) libui_test_sources += [ 'controls_darwin.m', + 'controls_darwin_errors.mm', ] else libui_test_sources += [ diff --git a/test/test.h b/test/test.h index 43426463..eb4b8d0c 100644 --- a/test/test.h +++ b/test/test.h @@ -57,6 +57,9 @@ extern size_t testImplDataSize(void); extern uint32_t testControlType; extern uint32_t testControlType2; +// controls_errors.cpp +extern const struct checkErrorCase controlOSVtableCases[]; + #ifdef __cplusplus } #endif