[Qt-interest] QTestLib + GUI

NoRulez norulez at me.com
Tue Nov 16 21:00:12 CET 2010


I've it not tested, but is this or something else also possible?

class MyTestDialog : public MyDialog {
friend class MyTestClass;
...
};

Because I don't want to use the test class within the "stable" code.

-----Ursprüngliche Nachricht-----
Von: Ulf-Alexander v. Ceumern-Lindenstjerna [mailto:ceumern at vrmagic.com] 
Gesendet: Dienstag, 16. November 2010 14:43
An: NoRulez; Qt Interest MailingList
Betreff: RE: [Qt-interest] QTestLib + GUI

class MyDialog {
friend class MyTestClass; 
...
};
Should work.

Cheers, Ulf

-----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 1:37 PM
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





More information about the Qt-interest-old mailing list