ntk-chtheme: Add new color scheme. Save/restore selection color.
[ntk.git] / test / unittest_viewport.cxx
blob285c92d386f72c03d817df51f0bd96a3020d2fa0
1 //
2 // "$Id: unittest_viewport.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $"
3 //
4 // Unit tests for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 #include <FL/Fl_Box.H>
29 #include <FL/fl_draw.H>
32 //------- test viewport clipping ----------
34 class ViewportTest : public Fl_Box {
35 public:
36 static Fl_Widget *create() {
37 return new ViewportTest(TESTAREA_X, TESTAREA_Y, TESTAREA_W, TESTAREA_H);
39 ViewportTest(int x, int y, int w, int h) : Fl_Box(x, y, w, h) {
40 label("Testing Viewport Alignment\n\n"
41 "Only green lines should be visible.\n"
42 "If red lines are visible in the corners of this window,\n"
43 "your viewport alignment and clipping is off.\n"
44 "If there is a space between the green lines and the window border,\n"
45 "the viewport is off, but some clipping may be working.\n"
46 "Also, your window size may be off to begin with.");
47 align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER|FL_ALIGN_WRAP);
48 box(FL_BORDER_BOX);
50 void show() {
51 Fl_Box::show();
52 mainwin->testAlignment(1);
54 void hide() {
55 Fl_Box::hide();
56 mainwin->testAlignment(0);
60 UnitTest viewport("viewport test", ViewportTest::create);
63 // End of "$Id: unittest_viewport.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $