From c5d6ac30b82ddd3627df5113312737699ffc1714 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 17 Apr 2015 22:08:13 -0400 Subject: [PATCH] Laid the framework for testing tab deletion. --- test.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/test.c b/test.c index b8ee4189..23a79ee1 100644 --- a/test.c +++ b/test.c @@ -69,7 +69,7 @@ static void setCheckboxText(uiButton *b, void *data) } uiWindow *w; -#define nStacks 11 +#define nStacks 13 uiStack *stacks[nStacks]; uiCheckbox *spaced; @@ -167,6 +167,23 @@ static void moveToSecond(uiButton *b, void *data) uiStackAppend(secondStack, uiControl(movingLabel), 1); } +uiStack *mainStack; +uiStack *page1stack; +uiTab *tab; + +void movePage1Out(uiButton *b, void *data) +{ + // TODO +// uiTabDeletePage(tab, 0) + uiStackAppend(mainStack, uiControl(page1stack), 1); +} + +void addPage1Back(uiButton *b, void *data) +{ + uiStackDelete(mainStack, 1); + uiTabAddPage(tab, "Page 1", uiControl(page1stack)); +} + int main(int argc, char *argv[]) { uiInitOptions o; @@ -174,7 +191,6 @@ int main(int argc, char *argv[]) const char *err; uiButton *getButton, *setButton; uiLabel *label; - uiTab *tab; int page2stack; memset(&o, 0, sizeof (uiInitOptions)); @@ -197,6 +213,7 @@ int main(int argc, char *argv[]) uiWindowOnClosing(w, onClosing, NULL); stacks[0] = uiNewVerticalStack(); + page1stack = stacks[0]; e = uiNewEntry(); uiStackAppend(stacks[0], uiControl(e), 0); @@ -300,7 +317,6 @@ int main(int argc, char *argv[]) uiStackAppend(stacks[0], uiControl(label), 0); tab = uiNewTab(); - uiWindowSetChild(w, uiControl(tab)); uiTabAddPage(tab, "Page 1", uiControl(stacks[0])); page2stack = i; @@ -326,6 +342,22 @@ int main(int argc, char *argv[]) uiStackAppend(stacks[page2stack], uiControl(stacks[i]), 0); i++; + stacks[i] = uiNewHorizontalStack(); + getButton = uiNewButton("Move Page 1 Out"); + uiButtonOnClicked(getButton, movePage1Out, NULL); + setButton = uiNewButton("Add Page 1 Back"); + uiButtonOnClicked(setButton, addPage1Back, NULL); + uiStackAppend(stacks[i], uiControl(getButton), 0); + uiStackAppend(stacks[i], uiControl(setButton), 0); + uiStackAppend(stacks[page2stack], uiControl(stacks[i]), 0); + i++; + + stacks[i] = uiNewHorizontalStack(); + mainStack = stacks[i]; + uiStackAppend(stacks[i], uiControl(tab), 1); + uiWindowSetChild(w, uiControl(mainStack)); + i++; + if (i != nStacks) { fprintf(stderr, "forgot to update nStacks (expected %d)\n", i); return 1;