MovieTester

From Gnash Project Wiki

Jump to: navigation, search

MovieTester is a gnash class used to automate testing with arbitrary SWF inputs. It is capable of producing user events such as mouse movements and clicks, key presses "window" resizing (not yet, but shortly) and abstracts some internals by providing higher level methods to query internal state.

Contents

How to write a MovieTester based automated test runner

MovieTester based test runner can test arbitrary SWF inputs, reguardless of what tool created them.

The simples way is to copy an exising .cpp file under testsuite/misc-ming.all or testsuite/samples or testsuite/movies.all and modify it accordingly to your needs.

In general, the steps are:

  1. Create a MovieTester instance passing it the path to the SWF file.
  2. Now you are ensured the input was fully loaded and you can start checking. See MovieTester interface in the MovieTester.h header or in the doxygen output.

TIPS:

  • Define DEBUG_MOUSE_COORDINATES in gui/gui.cpp for help finding coordinates to pass to check_pixel, or MovieTester::movePointerTo
  • Take a look at existing .cpp files under misc-ming.all to learn how others are using MovieTester

Pending issues

Testing multiple renderers at once

The MovieTester class is ready to support testing multiple renderers, by setting each initialized renderer in turn and calling ::display. This will only work if the core lib *never* accesses the render handler except at ::display time.

Unfortunately, we have a problem there, which is that the core library will currently store a pointer to a renderer-created object so we can't use the same core state to test multiple renderers in a single shot. This is a form of caching (in particular for font glyphs) which I think we should redesign so that caches are exclusively managed by renderers, and in case of a forced core storage, multiple caches are allowed (for each renderer).

Another problem, exposed by latest Video tests, is that *some* of the core lib still uses the currently registered renderer to query for its capabilities (RGB/YUV format in the video case). This would not be a problem if we did this at ::display time.

References

OpenGL offscreen rendering

In current gnash implementation, OpenGL renderer is unable to render to an offscreen buffer, which prevents it from being tested using the automated testing framework we have defined interfaces for.

Quinn reports this to be impossible, while nhv supports the contrary. More soon, stay tuned ...

References