[Qt-interest] QTestLib + GUI

NoRulez norulez at me.com
Tue Nov 16 13:36:39 CET 2010


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



More information about the Qt-interest-old mailing list