Writing tests for a UI app



What is the typical approach towards writing tests for a UI app ? For
example, if I have an app using a treeview, I can easily write tests
to verify the values in the treestore that serves as the model for the
treeview. Using $model->get($path, $column) perhaps

But how do I test the events of the widget ? For example, my treeview
itself is supposed to call a call-back when a cell is clicked, and the
call-back is to be called with arguments. For example; [Code from
Gtk2::Ex::TreeMaker]

# Here is the definition of the callback functions
sub when_cell_clicked {
   # The arguments received are:
   #   The TreeMaker object itself
   #   The Gtk2::TreePath to the CELL that was clicked on
   #   The column_id of the TreeViewColumn being edited
   my ($treemaker, $clicked_path, $column_id) = @_;
   my $clicked_record = $treemaker->locate_record($clicked_path, $column_id);
   print Dumper $clicked_record;
}

I would assume that the "correct" way to test this call-back is to
trigger the event programmatically on a specified treeview cell and
then test the arguments received ?

But how do I trigger the event on a particular cell (without a user
clicking on that particular cell) ? I guess if I have a handle to the
CELL itself, I can use the $renderer->start_editing (,,,,,) call. But
I can't think of a way to get a handle to the CELL itself.

Am I on a wrong track here ?

Ofey



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]