diff options
| author | Matthias Melcher <github@matthiasm.com> | 2022-02-06 15:22:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-06 15:22:24 +0100 |
| commit | db0a1f4baeb928b54d328d5dfbd0ec37b0b58bd3 (patch) | |
| tree | ed53495f5dd435d7c23cd4267fb785e5ebca679c /test/unittests.h | |
| parent | af4954aee3483f03ff69e990e80f4e4a18e8b7f6 (diff) | |
OpenGL implementation of all `fl_` "Drawing Fast Shapes" graphics calls (#385)
* Fix build system for unites,
* Updated unittest to check OpenGL drawing.
Making sure that OpenGL drawing is exactly the same
as native drawing to make FLTK widget rendering
look the same in GL windows.
* Make OpenGL optional.
* Implemented clipping in OpenGL
* unites drawing fast shapes
* Fixed CMake
* Updating unittest.
Added tests for fl_pi and fl_arc (int)
Renamed tab to render complex shapes.
* Improved OpenGL FLTK drawing emulation.
* Fixed GTK ROUND DOWN BOX
* Fixing Makefile for unittest
* Correctly aligning OpenGL text.
* Fixed text alignment in GL windows.
Explained the "FLTK over GL " example in Cube.
* Overlapping test.
* Better GL graphics alignment.
* Drawing the focus rect.
* Adding Alpha Channel support for GL.
* Added FLTK-on-GL documentation.
Diffstat (limited to 'test/unittests.h')
| -rw-r--r-- | test/unittests.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/unittests.h b/test/unittests.h new file mode 100644 index 000000000..3b9cddd3f --- /dev/null +++ b/test/unittests.h @@ -0,0 +1,87 @@ +// +// Unit tests for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2022 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +#ifndef UNITTESTS_H +#define UNITTESTS_H 1 + +#include <FL/Fl.H> +#include <FL/Fl_Double_Window.H> + +// WINDOW/WIDGET SIZES +#define MAINWIN_W 700 // main window w() +#define MAINWIN_H 400 // main window h() +#define BROWSER_X 10 // browser x() +#define BROWSER_Y 25 // browser y() +#define BROWSER_W 150 // browser w() +#define BROWSER_H MAINWIN_H-35 // browser h() +#define TESTAREA_X (BROWSER_W + 20) // test area x() +#define TESTAREA_Y 25 // test area y() +#define TESTAREA_W (MAINWIN_W - BROWSER_W - 30) // test area w() +#define TESTAREA_H BROWSER_H // test area h() + +typedef void (*UnitTestCallback)(const char*, class Fl_Group*); + +extern class MainWindow *mainwin; +extern class Fl_Hold_Browser *browser; + +enum { + kTestAbout = 0, + kTestPoints, + kTestFastShapes, + kTestCircles, +// kTestComplexShapes, + kTestText, + kTestSymbol, + kTestImages, + kTestViewport, + kTestScrollbarsize, + kTestSchemes, + kTestSimpleTerminal +}; + +// This class helps to automatically register a new test with the unittest app. +// Please see the examples on how this is used. +class UnitTest { +public: + UnitTest(int index, const char *label, Fl_Widget* (*create)()); + ~UnitTest(); + const char *label(); + void create(); + void show(); + void hide(); + static int numTest() { return nTest; } + static UnitTest *test(int i) { return fTest[i]; } +private: + char *fLabel; + Fl_Widget *(*fCreate)(); + Fl_Widget *fWidget; + static void add(int index, UnitTest *t); + static int nTest; + static UnitTest *fTest[]; +}; + +// The main window needs an additional drawing feature in order to support +// the viewport alignment test. +class MainWindow : public Fl_Double_Window { +public: + MainWindow(int w, int h, const char *l=0L); + void drawAlignmentIndicators(); + void draw(); + void testAlignment(int v); + int fTestAlignment; +}; + +#endif |
