[Qt-interest] QTestLib + GUI

Konrad Rosenbaum konrad at silmor.de
Tue Nov 16 11:55:41 CET 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101116/35b370ae/attachment.bin 


More information about the Qt-interest-old mailing list