Useful macros to validate fltk GUI

From OTBWiki
Jump to: navigation, search

In order to ease the testing of the FLTK based application, we derived three new macros. This page describes how to use them and what is written between the lines.

These macros are available in otbMacro.h.

An example of how to use these macro can be found here.

Testing widgets without value

To test the button b of the view class instance view, you can use

otbTestCallback(view,b);

This macro will check if the widget member b of the view class instance view is active, and if it is it will trigger its callback method (using the do_callback() method). It then call Fl::check() to update the display.

Testing widgets with value

To test the widget b of the view class instance view by first setting its value to value, you can use

otbTestCallbackWithValue(view,b,value);

This macro acts like the otbTestCallback() macro, except it will set the value value to b before (using the value() method) before triggering the callback.

Testing menu items

To test the menu item b from the menu bar menubar of the view class instance view, you can use:

otbTestMenuItemCallback(view,menubar,b);

This macro acts like the otbTestCallback() macro, but it uses code specific to the Fl_Menu_Item class.