Florian Ragwitz > Gtk2-1.223 > Gtk2::TestHelper

Download:
Gtk2-1.223.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  7
View/Report Bugs
Module Version: 0.02   Source   Latest Release: Gtk2-1.224

NAME ^

Gtk2::TestHelper - Code to make testing Gtk2 and friends simpler.

SYNOPSIS ^

  use Gtk2::TestHelper tests => 10;

DESCRIPTION ^

A simplistic module that brings together code that would otherwise have to be copied into each and every test. The magic happens during the importing process and therefore all options are passed to the use call. The module also use's strict, warnings, Gtk2, and Test::More so that the individual tests will not have to. The only required option is the number of tests. The module installs a key snooper that causes all keyboard input to be ignored.

OPTIONS ^

tests

The number of tests to be completed.

noinit

Do not call Gtk2->init_check, assume that it is not necessary.

nowin32

Set to true if all tests are to be skipped on the win32 platform.

at_least_version

A reference to a list that is checked with Gtk2->CHECK_VERSION.

skip_all

Simply skip all tests with the reason provided.

"EXPORTED" FUNCTIONS ^

This module also defines a few utility functions for use in tests; since we already override import and pull the dirty trick of calling use in the package main, these are defined in the package main rather than exported by Exporter.

run_main
run_main (CODEREF)
run_main BLOCK

Run a main loop, and stop when all pending events are handled. This is useful if you have a test that needs a main loop to run properly, because it allows your program to remain noninteractive. Important for a test suite.

If the optional CODEREF is supplied, it will be run right before killing the mainloop. The function is prototyped to allow two styles of invocation:

  run_main (\&some_sub);    # explicit code reference
  run_main { print "hi" };  # callback as a block
ok_idle (TEST_SUB [, TEST_NAME])

Run Test::Simple's ok() on the return value of TEST_SUB after handling pending events. Implemented with run_main and other special trickery.

is_idle (THIS_SUB, THAT [, NAME])

Like ok_idle(), but compares the return value of THIS_SUB with THAT using Test::More's is().

ginterfaces_ok (GOBJECT_OR_PACKAGE)

Verify that the GObject subclass GOBJECT_OR_PACKAGE's @ISA is set up properly with all of the GInterfaces that the type system claims it supports. Something like an isa_ok() in steroids.

delta_ok (A, B [, NAME])

Checks that the absolute difference of the numbers A and B is smaller than 1e-6.

SEE ALSO ^

perl(1), Gtk2(3pm).

AUTHORS ^

The Gtk2-Perl Team.

COPYRIGHT AND LICENSE ^

Copyright 2003-2005 by the gtk2-perl team.

LGPL, See LICENSE file for more information.

syntax highlighting: