diff --git a/test/controls_haiku.c b/test/controls_haiku.c new file mode 100644 index 00000000..cfd6c8c1 --- /dev/null +++ b/test/controls_haiku.c @@ -0,0 +1,11 @@ +// 18 january 2020 +#include "test_haiku.h" + +static const uiControlOSVtable vtable = { + .Size = sizeof (uiControlOSVtable), +}; + +const uiControlOSVtable *testOSVtable(void) +{ + return &vtable; +} diff --git a/test/controls_haiku_errors.cpp b/test/controls_haiku_errors.cpp new file mode 100644 index 00000000..6a2d26fe --- /dev/null +++ b/test/controls_haiku_errors.cpp @@ -0,0 +1,17 @@ +// 18 january 2020 +#include "test_haiku.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/meson.build b/test/meson.build index 76058435..bc4d1c72 100644 --- a/test/meson.build +++ b/test/meson.build @@ -22,7 +22,10 @@ elif libui_OS == 'darwin' 'controls_darwin_errors.m', ] elif libui_OS == 'haiku' - # TODO + libui_test_sources += [ + 'controls_haiku.c', + 'controls_haiku_errors.cpp', + ] else libui_test_sources += [ 'controls_unix.c', diff --git a/test/test_haiku.h b/test/test_haiku.h new file mode 100644 index 00000000..b2b4a6c6 --- /dev/null +++ b/test/test_haiku.h @@ -0,0 +1,3 @@ +// 18 january 2020 +#define libuiOSHeader "../ui_haiku.h" +#include "test.h"