[Kde-bindings] Qt and Multithread

Stefan Champailler champailler at octalis.com
Tue Oct 18 09:00:48 UTC 2005


Sorry about this question, I just saw there's on previous post on 
this ML that deals with the very same kind of issue... There :

http://lists.kde.org/?l=kde-bindings&m=112798649226241&w=2

stF


> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20051018/94571106/attachment.sig>


More information about the Kde-bindings mailing list