Fixed the build and implemented some of the missing functions I just added. Not too happy with how these tests are structured so far; I might hack on that before continuing...

This commit is contained in:
Pietro Gagliardi 2022-07-30 12:13:36 -04:00
parent 1d7c530c32
commit eb1250a32b
5 changed files with 35 additions and 4 deletions

View File

@ -264,6 +264,11 @@ uiControlOSVtable *uiprivControlOSVtable(uiControl *c)
return c->type->osVtable; return c->type->osVtable;
} }
uiControl *uiprivControlParent(uiControl *c)
{
return c->parent;
}
static uiControl testHookControlWithInvalidControlMarker = { static uiControl testHookControlWithInvalidControlMarker = {
// use something other than 0 here to make it look like accidental real data // use something other than 0 here to make it look like accidental real data
.controlID = UINT32_C(0x5A5A5A5A), .controlID = UINT32_C(0x5A5A5A5A),

View File

@ -76,6 +76,7 @@ extern void uiprivReportError(const char *prefix, const char *msg, const char *s
extern bool uiprivOSVtableValid(const char *name, const uiControlOSVtable *osVtable, const char *func); extern bool uiprivOSVtableValid(const char *name, const uiControlOSVtable *osVtable, const char *func);
extern uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable); extern uiControlOSVtable *uiprivCloneOSVtable(const uiControlOSVtable *osVtable);
extern uiControlOSVtable *uiprivControlOSVtable(uiControl *c); extern uiControlOSVtable *uiprivControlOSVtable(uiControl *c);
extern uiControl *uiprivControlParent(uiControl *c);
// utf8.c // utf8.c
extern char *uiprivSanitizeUTF8(const char *str); extern char *uiprivSanitizeUTF8(const char *str);

View File

@ -97,7 +97,7 @@ Test(GettingWindowsParentHandleOfNullControlIsProgrammerError)
{ {
void *ctx; void *ctx;
ctx = beginCheckProgrammerError("uiWindowsControlHandle(): invalid null pointer for uiControl"); ctx = beginCheckProgrammerError("uiWindowsControlParentHandle(): invalid null pointer for uiControl");
uiWindowsControlParentHandle(NULL); uiWindowsControlParentHandle(NULL);
endCheckProgrammerError(ctx); endCheckProgrammerError(ctx);
} }
@ -111,7 +111,7 @@ Test(SettingWindowsControlPosOfNullControlIsProgrammerError)
endCheckProgrammerError(ctx); endCheckProgrammerError(ctx);
} }
Test(SettingWindowsControlPosOfNullControlIsProgrammerError) Test(SettingWindowsControlPosToNullRectIsProgrammerError)
{ {
#if 0 #if 0
// TODO // TODO

View File

@ -87,7 +87,7 @@ Test(WindowsCannotSetWindowControlPos)
w = uiNewWindow(); w = uiNewWindow();
ctx = beginCheckProgrammerError("cannot set a uiWindow as the child of another uiControl"); ctx = beginCheckProgrammerError("cannot call uiWindowsControlSetControlPos() on a uiWindow");
r.left = 0; r.left = 0;
r.top = 0; r.top = 0;
r.right = 640; r.right = 640;

View File

@ -14,6 +14,7 @@ bool uiprivOSVtableValid(const char *name, const uiControlOSVtable *osVtable, co
} }
checkMethod(Handle) checkMethod(Handle)
checkMethod(ParentHandleForChild) checkMethod(ParentHandleForChild)
checkMethod(SetControlPos)
return true; return true;
} }
@ -53,9 +54,33 @@ HWND uiWindowsControlParentHandle(uiControl *c)
uiprivProgrammerErrorNullPointer("uiControl", uiprivFunc); uiprivProgrammerErrorNullPointer("uiControl", uiprivFunc);
return NULL; return NULL;
} }
parent = uiControlParent(c); parent = uiprivControlParent(c);
if (parent == NULL) if (parent == NULL)
return NULL; return NULL;
parentVtable = uiprivControlOSVtable(parent); parentVtable = uiprivControlOSVtable(parent);
return callVtable(parentVtable->ParentHandleForChild, parent, uiControlImplData(parent), c); return callVtable(parentVtable->ParentHandleForChild, parent, uiControlImplData(parent), c);
} }
HRESULT uiWindowsControlSetControlPos(uiControl *c, const RECT *r)
{
uiControlOSVtable *osVtable;
if (!uiprivCheckInitializedAndThread())
return E_FAIL;
if (c == NULL) {
uiprivProgrammerErrorNullPointer("uiControl", uiprivFunc);
return E_FAIL;
}
if (r == NULL) {
uiprivProgrammerErrorNullPointer("RECT", uiprivFunc);
return E_FAIL;
}
osVtable = uiprivControlOSVtable(c);
return callVtable(osVtable->SetControlPos, c, uiControlImplData(c), r);
}
HRESULT uiWindowsSetControlHandlePos(HWND hwnd, const RECT *r)
{
// TODO
return S_OK;
}