"Fossies" - the Fresh Open Source Software Archive

Member "screentest-2.0/NEW_TESTS" (28 Jul 2007, 5163 Bytes) of package /linux/privat/old/screentest-2.0.tar.gz:

As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    2 =============================================
    4 The process of adding new modes to screentest is not very complicated.
    5 Follow these steps (let's assume you want to add a test called "circle").
    7 1. Create the new test's source file, circle_test.c. You should copy
    8 the top of the file with copyright notice and #include statements
    9 from another source file (say text_test.c), so it looks like this:
   10 [...]
   11   *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
   12   */
   14   #ifdef HAVE_CONFIG_H
   15   #  include <config.h>
   16   #endif
   18   #include <gtk/gtk.h>
   19   #include <stdio.h>
   21   #include "callbacks.h"
   22   #include "interface.h"
   23   #include "support.h"
   25 2. Add the source file name (circle_test.c) to the screentest_SOURCES
   26 variable in Makefile.am.
   28 3. In circle_test.c you have to define the (non-static!) structure
   29 	struct test_ops circle_ops
   30 Make sure the name of the structure ends in "_ops". This structure, which have
   31 four member functions, defines the basic operations of your test mode. The
   32 structure members are:
   34 	void circle_init(GtkWidget *widget);
   35 This function is called when screentest is switched to your "circle" test.
   36 The argument is GtkWidget of type DrawingArea, which covers the whole screen.
   37 This function is optional, you can set it to NULL.
   39 	void circle_draw(GtkWidget *widget, gboolean clear);
   40 This function is called when screentest decides to redraw the screen
   41 (either when mode/fgcolor/bgcolor changes, or the Expose event from
   42 the X server is received). The first argument is the same
   43 DrawingArea as above, the second one is True, when the screentest
   44 wants you to clear the window before you start drawing. This function
   45 is not optional. You must define it (after all, your test wants
   46 to draw something, doesn't it?).
   48 	void circle_cycle(GtkWidget *widget);
   49 Screentest calls this function when user presses the left mouse button.
   50 You can use it to cycle through values of some parameter (let's say,
   51 the circle diameter). You don't need to redraw the screen. The circle_draw()
   52 function will be called afterwards. This function is optional, you can
   53 set the "cycle" member of circle_ops to NULL. The widget argument
   54 is the same as above.
   56 	void circle_close(GtkWidget *widget);
   57 This function is called when screentest wants to switch to another mode
   58 (and is called before the new mode's init() function). You can use it to
   59 deallocate fonts, colors, timers or other resources you have allocated
   60 (for example in circle_init() function).  This function is optional, you can
   61 set the "cycle" member of circle_ops to NULL. The widget argument
   62 is the same as above.
   64 4. You can use the following global variables in the above functions:
   66 	GdkGC *gc, *backgc;
   67 These are two graphic contexts. The first one has the foreground color set to
   68 the current foregronund color (defafult white) and background color to the
   69 current background color (default black). The second one has its foreground
   70 color set to the current background color (default black) and the background
   71 color to the current foreground color (default white). So you can use the
   72 first to draw with the foreground color and the second to draw with the
   73 background color. You can (ab)use these contexts for your own colors,
   74 but remember to set the color back to its original value before your return
   75 from the circle_* function.
   77 	GdkColor fgcolors[COLOR_MAX];
   78 The GdkColor array with preinitialized color values (see the enum test_color
   79 in callbacks.h).
   81 	GdkColor grays[GRAYS_MAX];
   82 The GdkColor array with pixels preinitialized to the shades of gray.
   83 grays[0] is black, grays[GRAYS_MAX-1] is white. Currently the
   84 GRAYS_MAX is #defined to COLOR_MAX, but do not depend on it.
   86 5. Use glade to add the new mode to the menu (alternatively, edit
   87 screentest.glade by hand). Make sure the name of the menu item is the name of
   88 your "<test>_ops" struct without the "_ops" ending.
   90 6. Run automake, autoconf, ./configure and make.
   92 7. If you want to distribute the resulting program:
   93 Beware this program is under the GNU General Public License, so if you
   94 distribute the modified version, you have to distribute the source code
   95 of all your modifications. See the file COPYING for details.
   97 You must make the circle_test.c available, but you don't have to send it
   98 to the author of this program. However, author of this program kindly asks
   99 you to contribute any modifications. Please send your modifications
  100 to the author of screentest, Tobias Gruetzmacher <tobias@portfolio16.de>.
  101 The preferred form of the contribution is an unified diff (see the diff(1)
  102 manual page. To make a unified diff, follow these steps:
  104 - rename your directory with modified sources (for example
  105 	mv screentest-1.0 screentest-1.0-circle).
  106 - run "make distclean" in this directory.
  107 - unpack the clean sources again:
  108 	zcat screentest-1.0.tar.gz | tar xvf -
  109 - create the patch with the following command:
  110 	diff -uNr screentest-1.0 screentest-1.0-circle >screentest-circle.patch
  111 - mail the screentest-circle.patch to the author.
  113 	Thanks,
  115 - Tobias Gruetzmacher <tobias@portfolio16.de> (current maintainer)
  116 - Jan "Yenya" Kasprzak <kas@fi.muni.cz> (previous maintainer)