From 515b25c144c1ed07bd3ea0db9f82212c6cfc943f Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 29 Apr 2015 13:38:38 -0400 Subject: [PATCH] Started reintegrating the old Page 1 test into the new test. The UI is done. --- test/GNUmakeinc.mk | 1 + test/main.c | 19 +++------- test/page1.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++ test/test.h | 3 ++ 4 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 test/page1.c diff --git a/test/GNUmakeinc.mk b/test/GNUmakeinc.mk index e601e605..851684fa 100644 --- a/test/GNUmakeinc.mk +++ b/test/GNUmakeinc.mk @@ -3,6 +3,7 @@ testCFILES = \ test/main.c \ test/menus.c \ + test/page1.c \ test/spaced.c testHFILES = \ diff --git a/test/main.c b/test/main.c index b204fb73..16abfd51 100644 --- a/test/main.c +++ b/test/main.c @@ -21,7 +21,7 @@ int main(int argc, char *argv[]) const char *err; uiWindow *w; uiTab *tab; - uiBox *vbox; + uiBox *page1; memset(&o, 0, sizeof (uiInitOptions)); for (i = 1; i < argc; i++) @@ -45,21 +45,12 @@ int main(int argc, char *argv[]) uiWindowOnClosing(w, onClosing, NULL); tab = newTab(); - vbox = newVerticalBox(); - uiTabAppendPage(tab, "Page 1", uiControl(vbox)); - uiTabAppendPage(tab, "Page 2", uiControl(newVerticalBox())); - uiTabAppendPage(tab, "Page 3", uiControl(newVerticalBox())); - uiTabDeletePage(tab, 1); - // TODO delete the stack + + page1 = makePage1(); + uiTabAppendPage(tab, "Page 1", uiControl(page1)); + uiWindowSetChild(w, uiControl(tab)); - uiBoxAppend(vbox, uiNewButton("Button"), 0); - uiBoxAppend(vbox, uiNewCheckbox("Checkbox"), 0); - uiBoxAppend(vbox, uiNewEntry(), 0); - uiBoxAppend(vbox, uiNewLabel("Label"), 0); - - uiControlShow(uiControl(newWindow("Second Window", 320, 240, 1))); - uiControlShow(uiControl(w)); uiMain(); printf("after uiMain()\n"); diff --git a/test/page1.c b/test/page1.c new file mode 100644 index 00000000..43d36a90 --- /dev/null +++ b/test/page1.c @@ -0,0 +1,88 @@ +// 29 april 2015 +#include "test.h" + +static uiEntry *entry; +static uiCheckbox *spaced; + +uiBox *makePage1(void) +{ + uiBox *page1; + uiButton *getButton, *setButton; + uiBox *hbox; + uiBox *testBox; + uiLabel *label; + + page1 = newVerticalBox(); + + entry = uiNewEntry(); + uiBoxAppend(page1, uiControl(entry), 0); + + spaced = uiNewCheckbox("Spaced"); + label = uiNewLabel("Label"); + + hbox = newHorizontalBox(); + getButton = uiNewButton("Get Window Text"); + setButton = uiNewButton("Set Window Text"); + uiBoxAppend(hbox, uiControl(getButton), 1); + uiBoxAppend(hbox, uiControl(setButton), 1); + uiBoxAppend(page1, uiControl(hbox), 0); + + hbox = newHorizontalBox(); + getButton = uiNewButton("Get Button Text"); + setButton = uiNewButton("Set Button Text"); + uiBoxAppend(hbox, uiControl(getButton), 1); + uiBoxAppend(hbox, uiControl(setButton), 1); + uiBoxAppend(page1, uiControl(hbox), 0); + + hbox = newHorizontalBox(); + getButton = uiNewButton("Get Checkbox Text"); + setButton = uiNewButton("Set Checkbox Text"); + uiBoxAppend(hbox, uiControl(getButton), 1); + uiBoxAppend(hbox, uiControl(setButton), 1); + uiBoxAppend(page1, uiControl(hbox), 0); + + hbox = newHorizontalBox(); + getButton = uiNewButton("Get Label Text"); + setButton = uiNewButton("Set Label Text"); + uiBoxAppend(hbox, uiControl(getButton), 1); + uiBoxAppend(hbox, uiControl(setButton), 1); + uiBoxAppend(page1, uiControl(hbox), 0); + + hbox = newHorizontalBox(); + uiBoxAppend(hbox, uiControl(spaced), 1); + getButton = uiNewButton("On"); + uiBoxAppend(hbox, uiControl(getButton), 0); + getButton = uiNewButton("Off"); + uiBoxAppend(hbox, uiControl(getButton), 0); + getButton = uiNewButton("Show"); + uiBoxAppend(hbox, uiControl(getButton), 0); + uiBoxAppend(page1, uiControl(hbox), 0); + + testBox = newHorizontalBox(); + setButton = uiNewButton("Button"); + uiBoxAppend(testBox, uiControl(setButton), 1); + getButton = uiNewButton("Show"); + uiBoxAppend(testBox, uiControl(getButton), 0); + getButton = uiNewButton("Hide"); + uiBoxAppend(testBox, uiControl(getButton), 0); + getButton = uiNewButton("Enable"); + uiBoxAppend(testBox, uiControl(getButton), 0); + getButton = uiNewButton("Disable"); + uiBoxAppend(testBox, uiControl(getButton), 0); + uiBoxAppend(page1, uiControl(testBox), 0); + + hbox = newHorizontalBox(); + getButton = uiNewButton("Show Box"); + uiBoxAppend(hbox, uiControl(getButton), 1); + getButton = uiNewButton("Hide Box"); + uiBoxAppend(hbox, uiControl(getButton), 1); + getButton = uiNewButton("Enable Box"); + uiBoxAppend(hbox, uiControl(getButton), 1); + getButton = uiNewButton("Disable Box"); + uiBoxAppend(hbox, uiControl(getButton), 1); + uiBoxAppend(page1, uiControl(hbox), 0); + + uiBoxAppend(page1, uiControl(label), 0); + + return page1; +} diff --git a/test/test.h b/test/test.h index 79fd7527..d62f6743 100644 --- a/test/test.h +++ b/test/test.h @@ -18,3 +18,6 @@ extern uiTab *newTab(void); // menus.c extern void initMenus(void); + +// page1.c +extern uiBox *makePage1(void);