2019-04-28 12:12:40 -05:00
|
|
|
// 28 april 2019
|
2019-06-01 08:27:17 -05:00
|
|
|
#include <errno.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-04-28 12:12:40 -05:00
|
|
|
#include "../ui.h"
|
2019-06-10 22:09:35 -05:00
|
|
|
#ifdef libuiOSHeader
|
|
|
|
#include libuiOSHeader
|
|
|
|
#endif
|
2019-05-26 14:41:22 -05:00
|
|
|
#include "../common/testhooks.h"
|
2019-05-04 15:53:54 -05:00
|
|
|
#include "lib/testing.h"
|
2019-06-01 08:27:17 -05:00
|
|
|
#include "lib/thread.h"
|
2019-05-04 15:53:54 -05:00
|
|
|
#include "lib/timer.h"
|
2019-04-28 12:12:40 -05:00
|
|
|
|
2019-06-02 00:59:08 -05:00
|
|
|
#define diff(fmt) "\ngot " fmt "\nwant " fmt
|
2019-05-04 20:13:47 -05:00
|
|
|
|
2019-04-28 12:12:40 -05:00
|
|
|
// main.c
|
2019-05-03 09:32:31 -05:00
|
|
|
extern void timeoutMain(void *data);
|
2019-05-03 01:02:20 -05:00
|
|
|
#define timeout_uiMain(t, d) { \
|
|
|
|
timerSysError err; \
|
2019-05-30 21:09:45 -05:00
|
|
|
bool timedOut; \
|
2019-05-03 01:02:20 -05:00
|
|
|
err = timerRunWithTimeout(d, timeoutMain, NULL, &timedOut); \
|
|
|
|
if (err != 0) \
|
|
|
|
testingTErrorf(t, "error running uiMain() in timeout: " timerSysErrorFmt, timerSysErrorFmtArg(err)); \
|
|
|
|
if (timedOut) { \
|
|
|
|
char timeoutstr[timerDurationStringLen]; \
|
|
|
|
timerDurationString(d, timeoutstr); \
|
|
|
|
testingTErrorf(t, "uiMain() timed out (%s)", timeoutstr); \
|
|
|
|
} \
|
|
|
|
}
|
2019-06-13 09:39:40 -05:00
|
|
|
extern void deferFree(testingT *t, void *data);
|
|
|
|
extern void deferEventFree(testingT *t, void *data);
|
2019-05-10 20:16:29 -05:00
|
|
|
|
|
|
|
// init.c
|
|
|
|
extern testingSet *beforeTests;
|
2019-06-09 21:45:44 -05:00
|
|
|
|
|
|
|
// errors.c
|
|
|
|
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)
|
2019-06-10 22:09:35 -05:00
|
|
|
|
|
|
|
// controls.c
|
2019-06-13 09:31:17 -05:00
|
|
|
extern uiControlVtable *allocVtableFull(testingT *t, const char *file, long line);
|
|
|
|
#define allocVtable(t) allocVtableFull(t, __FILE__, __LINE__)
|
2019-06-10 22:09:35 -05:00
|
|
|
extern uiControlOSVtable *allocOSVtableFull(testingT *t, const char *file, long line);
|
|
|
|
#define allocOSVtable(t) allocOSVtableFull(t, __FILE__, __LINE__)
|