Re: running without a mainlopp for unittests



I am just not getting it to work.

Funny thing is it works in NOFORK mode, but segfaults in FORK mode.
what I do different is:
  - setting tp the GUI object
  - call gtk_show_all(window)
  - back in unittest do
    gtk_widget_destroy(window)
    while(gtk_event_pending()) gtk_main_iteration();
  - main_level is 0 all the time

I'll now try the timeout thing again...

Stefan

Tristan Van Berkom wrote:
On Thu, 03 Feb 2005 20:41:39 +0100, Stefan Kost
<kost imn htwk-leipzig de> wrote:

Hi,

I use check too ;).
Are your tests available somehwere ?


Hmmm, like I said; I dont really use them for GUI elements so my
mainloop tests dont include gtk_init()... the test bodies that use mainloops
have this kind of flow:

 - create mainloop
 - provoke something that will happen in the event queue;
   the example I was just looking at is a test for a system wide
   observer model that uses an IPC; one test is that I modify
   a subject that I'm watching (through a callback that is obscurly
   registered through a GIOChannel)
-  register an idle func to terminate the main loop
 - If my message was recieved properly in the related callback, I set
   a global variable "success" to TRUE
- call g_main_loop_run()
- fail_unless (success == TRUE, "message");

Cheers,
                                       -Tristan





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