diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2023-12-12 21:27:08 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodrigo.arias@bsc.es> | 2023-12-21 01:05:58 +0100 |
commit | 1da1260af72b20126176e2b8f73f7b7fd5952ce1 (patch) | |
tree | 0fcdb276d30814ce4075f7cc205e357b2b7c1be5 /test/dw_example.cc | |
parent | 78ad5bfe9644d1217f9d9ad0bf2fcdc388551113 (diff) |
Split tests into unit and dw (graphical)
Graphical tests for the dw (Dillo Widget) are moved to test/dw, while
unit tests are placed into test/unit.
All tests are compiled with "make check" but only the tests that can run
without intervention and without a graphic display are executed.
Diffstat (limited to 'test/dw_example.cc')
-rw-r--r-- | test/dw_example.cc | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/test/dw_example.cc b/test/dw_example.cc deleted file mode 100644 index 259650cf..00000000 --- a/test/dw_example.cc +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Dillo Widget - * - * Copyright 2005-2007 Sebastian Geerken <sgeerken@dillo.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - - -#include <FL/Fl_Window.H> -#include <FL/Fl.H> - -#include "../dw/core.hh" -#include "../dw/fltkcore.hh" -#include "../dw/fltkviewport.hh" -#include "../dw/textblock.hh" - - -int main(int argc, char **argv) -{ - dw::fltk::FltkPlatform *platform = new dw::fltk::FltkPlatform (); - dw::core::Layout *layout = new dw::core::Layout (platform); - - Fl_Window *window = new Fl_Window(200, 300, "Dw Example"); - window->box(FL_NO_BOX); - window->begin(); - - dw::fltk::FltkViewport *viewport = - new dw::fltk::FltkViewport (0, 0, 200, 300); - layout->attachView (viewport); - - dw::core::style::StyleAttrs styleAttrs; - styleAttrs.initValues (); - styleAttrs.margin.setVal (5); - - dw::core::style::FontAttrs fontAttrs; - fontAttrs.name = "Bitstream Charter"; - fontAttrs.size = 14; - fontAttrs.weight = 400; - fontAttrs.style = dw::core::style::FONT_STYLE_NORMAL; - fontAttrs.letterSpacing = 0; - fontAttrs.fontVariant = dw::core::style::FONT_VARIANT_NORMAL; - styleAttrs.font = dw::core::style::Font::create (layout, &fontAttrs); - - styleAttrs.color = - dw::core::style::Color::create (layout, 0x000000); - styleAttrs.backgroundColor = - dw::core::style::Color::create (layout, 0xffffff); - - dw::core::style::Style *widgetStyle = - dw::core::style::Style::create (&styleAttrs); - - dw::Textblock *textblock = new dw::Textblock (false); - textblock->setStyle (widgetStyle); - layout->setWidget (textblock); - - widgetStyle->unref(); - - styleAttrs.margin.setVal (0); - styleAttrs.backgroundColor = NULL; - - dw::core::style::Style *wordStyle = - dw::core::style::Style::create (&styleAttrs); - - for(int i = 1; i <= 10; i++) { - char buf[4]; - sprintf(buf, "%d.", i); - - const char *words[] = { "This", "is", "the", buf, "paragraph.", - "Here", "comes", "some", "more", "text", - "to", "demonstrate", "word", "wrapping.", - NULL }; - - for(int j = 0; words[j]; j++) { - textblock->addText(words[j], wordStyle); - textblock->addSpace(wordStyle); - } - - textblock->addParbreak(10, wordStyle); - } - - wordStyle->unref(); - - textblock->flush (); - - window->resizable(viewport); - window->show(); - int errorCode = Fl::run(); - - delete layout; - - return errorCode; -} |