And added (in a somewhat dirty for now way) the noinitwrongthread.c case for uiDarwinControlHandle().
This commit is contained in:
parent
de3598df80
commit
d423688def
|
@ -0,0 +1,5 @@
|
|||
// 28 may 2019
|
||||
|
||||
// This file should NOT have include guards as it is intended to be included more than once; see noinitwrongthread_darwin.m for details.
|
||||
|
||||
allcallsCase(uiDarwinControlHandle, NULL)
|
|
@ -17,8 +17,12 @@ if libui_OS == 'windows'
|
|||
elif libui_OS == 'darwin'
|
||||
libui_test_sources += files([
|
||||
'controls_darwin.m',
|
||||
'noinitwrongthread_darwin.m',
|
||||
'window_darwin.m',
|
||||
])
|
||||
libui_allcalls_headers += files([
|
||||
'allcalls_darwin.h',
|
||||
])
|
||||
elif libui_OS == 'haiku'
|
||||
libui_test_sources += files([
|
||||
'controls_haiku.c',
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include "test.h"
|
||||
#include "thread.h"
|
||||
|
||||
// TODO split the macros in this file into its own file
|
||||
|
||||
// TODO rename to FunctionsFailBeforeInit?
|
||||
#define allcallsCase(f, ...) \
|
||||
TestNoInit(CallBeforeInitIsProgrammerError_ ## f) \
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
// 28 may 2019
|
||||
#import "test_darwin.h"
|
||||
#import "thread.h"
|
||||
|
||||
// TODO rename to FunctionsFailBeforeInit?
|
||||
#define allcallsCase(f, ...) \
|
||||
TestNoInit(CallBeforeInitIsProgrammerError_ ## f) \
|
||||
{ \
|
||||
void *ctx; \
|
||||
ctx = beginCheckProgrammerError("attempt to call " #f "() before uiInit()"); \
|
||||
f(__VA_ARGS__); \
|
||||
endCheckProgrammerError(ctx); \
|
||||
}
|
||||
#include "allcalls_darwin.h"
|
||||
#undef allcallsCase
|
||||
|
||||
// TODO rename to FunctionsFailOnWrongThread?
|
||||
#define allcallsCase(f, ...) \
|
||||
static void threadTest ## f(void *data) \
|
||||
{ \
|
||||
f(__VA_ARGS__); \
|
||||
} \
|
||||
Test(CallOnWrongThreadIsProgrammerError_ ## f) \
|
||||
{ \
|
||||
threadThread *thread; \
|
||||
threadSysError err; \
|
||||
void *ctx; \
|
||||
ctx = beginCheckProgrammerError("attempt to call " #f "() on a thread other than the GUI thread"); \
|
||||
err = threadNewThread(threadTest ## f, NULL, &thread); \
|
||||
if (err != 0) \
|
||||
TestFatalf("error creating thread: " threadSysErrorFmt, threadSysErrorFmtArg(err)); \
|
||||
err = threadThreadWaitAndFree(thread); \
|
||||
if (err != 0) \
|
||||
TestFatalf("error waiting for thread to finish: " threadSysErrorFmt, threadSysErrorFmtArg(err)); \
|
||||
endCheckProgrammerError(ctx); \
|
||||
}
|
||||
#include "allcalls_darwin.h"
|
||||
#undef allcallsCase
|
Loading…
Reference in New Issue