[Qt-interest] QTestLib + GUI

Malyushytsky, Alex alex at wai.com
Tue Nov 16 21:20:37 CET 2010


>> But I didn't have access to the buttons from outside of the dialog, so myDialog->myButton1->click() won't work.

If you have access to the QObject pointer (your dialog)  you always can get a list of the child of specific class (findChildren).




-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of NoRulez
Sent: Tuesday, November 16, 2010 4:37 AM
To: Qt Interest MailingList
Subject: Re: [Qt-interest] QTestLib + GUI

But I didn't have access to the buttons from outside of the dialog, so myDialog->myButton1->click() won't work.

Am 16.11.2010 um 11:55 schrieb Konrad Rosenbaum <konrad at silmor.de>:

> On Tuesday 16 November 2010 11:18:30 NoRulez wrote:
>> Yes but Squish is too expensive for only ~10 tests.
>>
>> So, i have a dialog with 15 buttons and  a tableview. Now after a user
>> clicks on a button, the app do something and the result is written to the
>> tableview.
>>
>> I want to emulate the button click on every of these 15 buttons and check
>> if the content of the tableview/delegate is correct. Because on each
>> action, the delegate shows different widgets too.
>
> Simply use the click() method of those buttons. Ask your delegate for an
> editor widget and test its type:
>
> //click button
> myDialog->myButton1->click();
> //get widget from delegate
> QWidget *w= myDialog->myDelegate->createEditor(0, QStyleOptionViewItem(),
> myDialog->myModel->index(1,2));
> //verify type
> QVERIFY(qobject_cast<QComboBox*>(w)!=0);
> //free widget
> if(w)delete w;
>
> You can even do more tests by checking the widgets properties...
>
>
>    Konrad
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”

“Please consider our environment before printing this email.”




More information about the Qt-interest-old mailing list