summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2014-09-26 23:58:05 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2014-09-26 23:58:05 +0000
commiteb1af07952d3cfbe8d00037c481e30ad72160c12 (patch)
tree212c01562a5bef43f95f85926273055af632787c /test
parent5899b2cc6d024b311b89a36d810dc246fd778be4 (diff)
Add Fl_Window::wait_for_expose() and test program (STR #3124).
Also modified .gitignore, svn-properties, Makefile and CMake-Files. Todo: test/twowin.cxx and test/windowfocus.cxx need to be added to ide files (MS VC++ and Xcode). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10339 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/Makefile6
-rw-r--r--test/windowfocus.cxx58
3 files changed, 64 insertions, 2 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1ec27d35e..616e95777 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -118,9 +118,11 @@ CREATE_EXAMPLE(threads threads.cxx fltk)
CREATE_EXAMPLE(tile tile.cxx fltk)
CREATE_EXAMPLE(tiled_image tiled_image.cxx fltk)
CREATE_EXAMPLE(tree tree.fl fltk)
+CREATE_EXAMPLE(twowin twowin.cxx fltk)
CREATE_EXAMPLE(utf8 utf8.cxx fltk)
CREATE_EXAMPLE(valuators valuators.fl fltk)
CREATE_EXAMPLE(unittests unittests.cxx fltk)
+CREATE_EXAMPLE(windowfocus windowfocus.cxx fltk)
# OpenGL demos...
if(OPENGL_FOUND)
diff --git a/test/Makefile b/test/Makefile
index c972d7d18..f3214683c 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -93,7 +93,8 @@ CPPFILES =\
tree.cxx \
twowin.cxx \
valuators.cxx \
- utf8.cxx
+ utf8.cxx \
+ windowfocus.cxx
ALL = \
unittests$(EXEEXT) \
@@ -163,7 +164,8 @@ ALL = \
twowin$(EXEEXT) \
valuators$(EXEEXT) \
cairotest$(EXEEXT) \
- utf8$(EXEEXT)
+ utf8$(EXEEXT) \
+ windowfocus$(EXEEXT)
GLALL = \
diff --git a/test/windowfocus.cxx b/test/windowfocus.cxx
new file mode 100644
index 000000000..96173ee41
--- /dev/null
+++ b/test/windowfocus.cxx
@@ -0,0 +1,58 @@
+//
+// Cross-window show/focus test program for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2014 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:
+//
+// http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+#include <FL/Fl.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_Input.H>
+
+static Fl_Double_Window *win1, *win2;
+static Fl_Input *inp;
+
+static void popup(Fl_Widget *, void *) {
+
+ win2->position(win1->x() + win1->w(), win1->y());
+
+ win2->show();
+ win2->wait_for_expose();
+ inp->take_focus();
+}
+
+int main(int argc, char **argv) {
+
+ win1 = new Fl_Double_Window(300, 200);
+ win1->label("show() focus test");
+
+ Fl_Box *b = new Fl_Box(10, 10, 280, 130);
+ b->label("Type something to pop the subwindow up. "
+ "The focus should stay on the input, "
+ "and you should be able to continue typing.");
+ b->align(FL_ALIGN_WRAP | FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
+
+ inp = new Fl_Input(10, 150, 150, 25);
+ inp->when(FL_WHEN_CHANGED);
+ inp->callback(popup);
+
+ win1->end();
+
+ win2 = new Fl_Double_Window(300, 200);
+ win2->label("window2");
+ win2->end();
+
+ win1->show(argc,argv);
+
+ return Fl::run();
+}