Started writing the controls Darwin-specific code and all-platforms tests for real.
This commit is contained in:
parent
89f64eb067
commit
6903bebe7d
|
@ -3,12 +3,18 @@
|
|||
|
||||
bool uiprivOSVtableValid(uiControlOSVtable *osVtable, const char *func)
|
||||
{
|
||||
// TODO
|
||||
if (vtable->Size != sizeof (uiControlOSVtable)) {
|
||||
uiprivProgrammerErrorWrongStructSize(vtable->Size, "uiControlOSVtable", func);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uiControlOSVtable *uiprivCloneOSVtable(uiControlOSVtable *osVtable)
|
||||
{
|
||||
// TODO
|
||||
return NULL;
|
||||
uiControlOSVtable *v2;
|
||||
|
||||
v2 = uiprivNew(uiControlOSVtable);
|
||||
*v2 = *osVtable;
|
||||
return v2;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
|
||||
#if 0
|
||||
|
||||
struct testOSVtable {
|
||||
void (*TestMethod)(uiControl *c, void *implData);
|
||||
};
|
||||
|
||||
struct testOSImplData {
|
||||
bool initCalled;
|
||||
bool *freeCalled;
|
||||
|
@ -28,7 +24,7 @@ static void testVtableTestMethod(uiControl *c, void *implData)
|
|||
// do nothing
|
||||
}
|
||||
|
||||
static void createTestVtables(uiControlVtable *vtable, struct testOSVtable *osVtable)
|
||||
static void createTestVtables(uiControlVtable *vtable, uiControlOSVtable **osVtable)
|
||||
{
|
||||
memset(&vtable, 0, sizeof (uiControlVtable));
|
||||
vtable.Size = sizeof (uiControlVtable);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
// 10 june 2019
|
||||
#import "test_darwin.h"
|
||||
|
||||
uiControlOSVtable *allocOSVtableFull(testingT *t, const char *file, long line)
|
||||
{
|
||||
uiControlOSVtable *v;
|
||||
|
||||
v = (uiControlOSVtable *) malloc(sizeof (uiControlOSVtable));
|
||||
if (v == NULL)
|
||||
testingTFatalfFull(t, file, line, "memory exhausted allocating uiControlOSVtable");
|
||||
memset(v, 0, sizeof (uiControlOSVtable));
|
||||
v->Size = sizeof (uiControlOSVtable);
|
||||
return v;
|
||||
}
|
|
@ -9,6 +9,20 @@ libui_test_sources = [
|
|||
'noinitwrongthread.c',
|
||||
]
|
||||
|
||||
if libui_OS == 'windows'
|
||||
libui_test_sources += [
|
||||
'controls_windows.c',
|
||||
]
|
||||
else if libui_OS == 'darwin'
|
||||
libui_test_sources += [
|
||||
'controls_darwin.m',
|
||||
]
|
||||
else
|
||||
libui_test_sources += [
|
||||
'controls_unix.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if libui_OS == 'windows'
|
||||
libui_test_sources += [
|
||||
windows.compile_resources('resources_' + libui_mode + '.rc',
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../ui.h"
|
||||
#ifdef libuiOSHeader
|
||||
#include libuiOSHeader
|
||||
#endif
|
||||
#include "../common/testhooks.h"
|
||||
#include "lib/testing.h"
|
||||
#include "lib/thread.h"
|
||||
|
@ -34,3 +37,7 @@ extern testingSet *beforeTests;
|
|||
extern void checkProgrammerErrorFull(testingT *t, const char *file, long line, const char *name, void (*f)(void *data), void *data, const char *msgWant, bool inThread);
|
||||
#define checkProgrammerError(t, name, f, data, msgWant) checkProgrammerErrorFull(t, __FILE__, __LINE__, name, f, data, msgWant, false)
|
||||
#define checkProgrammerErrorInThread(t, name, f, data, msgWant) checkProgrammerErrorFull(t, __FILE__, __LINE__, name, f, data, msgWant, true)
|
||||
|
||||
// controls.c
|
||||
extern uiControlOSVtable *allocOSVtableFull(testingT *t, const char *file, long line);
|
||||
#define allocOSVtable(t) allocOSVtableFull(t, __FILE__, __LINE__)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// 10 june 2019
|
||||
#define libuiOSHeader "../ui_darwin.h"
|
||||
#include "test.h"
|
Loading…
Reference in New Issue