Started writing tests for uiWindow.
This commit is contained in:
parent
0be1273dab
commit
2f9aaeeb62
|
@ -446,6 +446,7 @@ const char *uiWindowTitle(uiWindow *w)
|
|||
struct windowImplData *wi = (struct windowImplData *) uiControlImplData(uiControl(w));
|
||||
|
||||
if (wi->title == NULL)
|
||||
// TODO replace this with a dedicated UTF-8 empty string object
|
||||
return "";
|
||||
return wi->title;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ libui_test_sources = files([
|
|||
'controls.c',
|
||||
'initmain.c',
|
||||
'noinitwrongthread.c',
|
||||
'window.c',
|
||||
])
|
||||
libui_allcalls_headers = files([
|
||||
'allcalls.h',
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
// 24 may 2020
|
||||
#include "test.h"
|
||||
|
||||
Test(CannotMakeWindowAChild)
|
||||
{
|
||||
uiWindow *a, *b;
|
||||
void *ctx;
|
||||
|
||||
a = uiNewWindow();
|
||||
b = uiNewWindow();
|
||||
|
||||
ctx = beginCheckProgrammerError("cannot set a uiWindow as the child of another uiControl");
|
||||
uiControlSetParent(a, b);
|
||||
// TODO this should not be necessary
|
||||
uiControlSetParent(a, NULL);
|
||||
endCheckProgrammerError(ctx);
|
||||
|
||||
uiControlFree(uiControl(b));
|
||||
uiControlFree(uiControl(a));
|
||||
}
|
||||
|
||||
Test(InitialWindowTitleIsEmptyString)
|
||||
{
|
||||
uiWindow *w;
|
||||
const char *title;
|
||||
|
||||
w = uiNewWindow();
|
||||
title = uiWindowTitle(w);
|
||||
// TODO have a utf8cmp()
|
||||
if (*title != 0)
|
||||
// TODO have a diffUTF8
|
||||
TestErrorf("brand new uiWindow has wrong title:" diff("%s"),
|
||||
title, "(empty string)");
|
||||
uiControlFree(uiControl(w));
|
||||
}
|
||||
|
||||
// TODO check that SetTitle works, and also that it sanitizes
|
||||
// TODO for all the above, check that the underlying title was also set appropriately
|
Loading…
Reference in New Issue