[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    [Kde-bindings] Qt and Multithread
From:       Stefan Champailler <champailler () octalis ! com>
Date:       2005-10-18 8:51:15
Message-ID: 200510181051.17806.champailler () octalis ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Dear all,


I'm still developping my robot for konqueror and I've stumbled on a 
fundamental issue.

I want to have a robot that can control konqueror to make GUI testing 
(and I have a good reason to do it like that, HttpUnit won't do it).

The thing I want to achieve is to have several little functions that 
allow me to write scripts like this :

# this is ruby code...
openURL(google.org")
fillForm("search","what I serach for")
submitForm("search")
assert( link_present("www.mysite.com"))

To achieve this, ruby must have the control flow. However, if I use 
Korundum and a KApplication, the control flow is passed to Qt. This 
leads to code like this, with an event handler :

case scenarioStep
    when 1
        openURL(google.org")
    when 2
        fillForm("search","what I serach for")
    ...
end
scenarioStep++

this works but it's not nice : having to write down all these "when" 
is not nice.

What I was thinking on is to have two threads. One threads running 
the QT stuff (one window with a KHTML part) and another running my 
script. This way the application loop control flow is handled 
separately of the scenario control flow.

The problem is that first, if I create a thread beside the 
KApplication.exec one, it is run only if events are thrown at the 
KApplication.exec.

Second, if I write :

a = KDE::Application.new()

Thread.new {
    a.exec 
}

it crashes miserably.

Any suggestion ?

Thank you !

Stefan

[Attachment #5 (application/pgp-signature)]

_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic