diff options
author | Sebastian Geerken <devnull@localhost> | 2014-07-13 22:18:57 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-07-13 22:18:57 +0200 |
commit | 51536a3ab5ab4f26211f28f9dd3af71baa181459 (patch) | |
tree | 95bc7418df7757aa215770835c86790c7e1477f9 | |
parent | 4e9818bba3999298690a2305c3746f336d8815be (diff) |
Tests.
-rw-r--r-- | test/dw_simple_container_test.cc | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/test/dw_simple_container_test.cc b/test/dw_simple_container_test.cc index 799da49c..20697dd6 100644 --- a/test/dw_simple_container_test.cc +++ b/test/dw_simple_container_test.cc @@ -48,10 +48,6 @@ int main(int argc, char **argv) StyleAttrs styleAttrs; styleAttrs.initValues (); styleAttrs.margin.setVal (5); - styleAttrs.borderWidth.setVal (5); - styleAttrs.setBorderColor (Color::create (layout, 0x800080)); - styleAttrs.setBorderStyle (BORDER_DASHED); - styleAttrs.padding.setVal (5); FontAttrs fontAttrs; fontAttrs.name = "Bitstream Charter"; @@ -65,40 +61,48 @@ int main(int argc, char **argv) styleAttrs.color = Color::create (layout, 0x000000); styleAttrs.backgroundColor = Color::create (layout, 0xffffff); - Style *containerStyle = Style::create (&styleAttrs); - - SimpleContainer *simpleContainer = new SimpleContainer (); - simpleContainer->setStyle (containerStyle); - layout->setWidget (simpleContainer); + Style *textblockStyle1 = Style::create (&styleAttrs); + styleAttrs.backgroundColor = NULL; styleAttrs.margin.setVal (0); - styleAttrs.borderWidth.setVal (0); - styleAttrs.padding.setVal (0); - Style *widgetStyle = Style::create (&styleAttrs); + Style *textblockStyle2 = Style::create (&styleAttrs); + Style *wordStyle = Style::create (&styleAttrs); - Textblock *textblock = new Textblock (false); - textblock->setStyle (widgetStyle); - simpleContainer->setChild (textblock); + styleAttrs.borderWidth.setVal (5); + styleAttrs.setBorderColor (Color::create (layout, 0x800080)); + styleAttrs.setBorderStyle (BORDER_DASHED); + styleAttrs.padding.setVal (5); - widgetStyle->unref(); + Style *containerStyle = Style::create (&styleAttrs); - styleAttrs.margin.setVal (0); - styleAttrs.backgroundColor = NULL; + Textblock *textblock1 = new Textblock (false); + textblock1->setStyle (textblockStyle1); + layout->setWidget (textblock1); - Style *wordStyle = Style::create (&styleAttrs); + SimpleContainer *simpleContainer = new SimpleContainer (); + simpleContainer->setStyle (containerStyle); + textblock1->addWidget (simpleContainer, containerStyle); + + Textblock *textblock2 = new Textblock (false); + textblock2->setStyle (textblockStyle2); + simpleContainer->setChild (textblock2); const char *words[] = { "This", "is", "only", "a", "short", "paragraph.", NULL }; for(int j = 0; words[j]; j++) { - textblock->addText(words[j], wordStyle); - textblock->addSpace(wordStyle); + textblock2->addText(words[j], wordStyle); + textblock2->addSpace(wordStyle); } - wordStyle->unref(); + textblockStyle1->unref(); + textblockStyle2->unref(); + containerStyle->unref(); + wordStyle->unref(); - textblock->flush (); + textblock1->flush (); + textblock2->flush (); window->resizable(viewport); window->show(); |