From 35548b912aa1bcb7f57b4654f6c5d45b3d0dd8c9 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 29 Apr 2015 14:10:00 -0400 Subject: [PATCH] Finished the Page 1 test by implementing the show/hide/enable/disable control tests. --- test/page1.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/page1.c b/test/page1.c index 69b59251..a688083a 100644 --- a/test/page1.c +++ b/test/page1.c @@ -42,6 +42,16 @@ static void showSpaced(uiButton *b, void *data) uiEntrySetText(entry, s); } +#define SHED(method, Method) \ + static void method ## Control(uiButton *b, void *data) \ + { \ + uiControl ## Method(uiControl(data)); \ + } +SHED(show, Show) +SHED(hide, Hide) +SHED(enable, Enable) +SHED(disable, Disable) + uiBox *makePage1(uiWindow *w) { uiBox *page1; @@ -112,23 +122,31 @@ uiBox *makePage1(uiWindow *w) setButton = uiNewButton("Button"); uiBoxAppend(testBox, uiControl(setButton), 1); getButton = uiNewButton("Show"); + uiButtonOnClicked(getButton, showControl, setButton); uiBoxAppend(testBox, uiControl(getButton), 0); getButton = uiNewButton("Hide"); + uiButtonOnClicked(getButton, hideControl, setButton); uiBoxAppend(testBox, uiControl(getButton), 0); getButton = uiNewButton("Enable"); + uiButtonOnClicked(getButton, enableControl, setButton); uiBoxAppend(testBox, uiControl(getButton), 0); getButton = uiNewButton("Disable"); + uiButtonOnClicked(getButton, disableControl, setButton); uiBoxAppend(testBox, uiControl(getButton), 0); uiBoxAppend(page1, uiControl(testBox), 0); hbox = newHorizontalBox(); getButton = uiNewButton("Show Box"); + uiButtonOnClicked(getButton, showControl, testBox); uiBoxAppend(hbox, uiControl(getButton), 1); getButton = uiNewButton("Hide Box"); + uiButtonOnClicked(getButton, hideControl, testBox); uiBoxAppend(hbox, uiControl(getButton), 1); getButton = uiNewButton("Enable Box"); + uiButtonOnClicked(getButton, enableControl, testBox); uiBoxAppend(hbox, uiControl(getButton), 1); getButton = uiNewButton("Disable Box"); + uiButtonOnClicked(getButton, disableControl, testBox); uiBoxAppend(hbox, uiControl(getButton), 1); uiBoxAppend(page1, uiControl(hbox), 0);