Re: running without a mainlopp for unittests



On Thu, 03 Feb 2005 19:07:48 +0100, Stefan Kost
<kost imn htwk-leipzig de> wrote:
hi hi,

I currently fight with some highlevel unit test, that should basically start the
application and immeditely exit.
The Problem I have is that instead of calling gtk_main() I want to init
everything and then shut-down.

The test-framework stats tests with fork to capture crashing.
Before I initialize g_thread and gdk_threads. I wrap lauching the test suite in
gdk_thread_enter/leave().

When the tests run, I often get XLib errors a la
sequence lost (0x100b9 > 0xb9) in reply to 0x0!
...

To me this sounds like probelm in message passing. Should I add another
gdk_thread_enter/leave() after the fork (for each test case)?

Does anyone do unit test that test the GUI?

I use "check" to unit test things that run in a GMainLoop, I dont use it
for the GUI mostly because the vast majority of tests I have to run on
GUI elements are functional tests.

In "check" there is a mechanism that allows you to setup "init" and
"teardown" stubs (that are also unit test functions) that will be run
after the fork() and before the exit() for every "unit test" in a given
"test suite", I would think that gtk_init() would belong in one of these
"init" stubs

If your test application is "forked" (like check does) it shouln't cause any
conflicts at the xlib client-server level (contrary to if it was threaded), so
I'm quite sure you dont need to hold the gdk_threads_mutex during unit
tests.

Just my 2 cents ;-)

Cheers,
                                                      -Tristan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]