Bump version.
[ntk.git] / test / unittest_points.cxx
blobd477421ba67f02038e9c938736e4c195781c5433
1 //
2 // "$Id: unittest_points.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 the point drawing capabilities of this implementation ----------
34 class PointTest : public Fl_Box {
35 public:
36 static Fl_Widget *create() {
37 return new PointTest(TESTAREA_X, TESTAREA_Y, TESTAREA_W, TESTAREA_H);
39 PointTest(int x, int y, int w, int h) : Fl_Box(x, y, w, h) {
40 label("testing the fl_point call\n"
41 "You should see four pixels each in black, red, green and blue. "
42 "Make sure that pixels are not anti-aliased (blurred across multiple pixels)!");
43 align(FL_ALIGN_INSIDE|FL_ALIGN_BOTTOM|FL_ALIGN_LEFT|FL_ALIGN_WRAP);
44 box(FL_BORDER_BOX);
46 void draw() {
47 Fl_Box::draw();
48 int a = x()+10, b = y()+10;
49 fl_color(FL_WHITE); fl_rectf(a, b, 90, 90);
50 fl_color(FL_BLACK); fl_rect(a, b, 90, 90);
51 fl_point(a+10, b+10); fl_point(a+20, b+20);
52 fl_point(a+10, b+20); fl_point(a+20, b+10);
53 fl_color(FL_RED); a = x()+70;
54 fl_point(a+10, b+10); fl_point(a+20, b+20);
55 fl_point(a+10, b+20); fl_point(a+20, b+10);
56 fl_color(FL_GREEN); a = x()+10; b = y()+70;
57 fl_point(a+10, b+10); fl_point(a+20, b+20);
58 fl_point(a+10, b+20); fl_point(a+20, b+10);
59 fl_color(FL_BLUE); a = x()+70;
60 fl_point(a+10, b+10); fl_point(a+20, b+20);
61 fl_point(a+10, b+20); fl_point(a+20, b+10);
65 UnitTest points("drawing points", PointTest::create);
68 // End of "$Id: unittest_points.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $"