Пример #1
0
 def test_should_handle_on_volume_increase_activate(self):
   volumebutton = testhelper.find_child(self._controller.view, 'volumebutton')
   testhelper.assert_close(volumebutton.get_value(), 0.1)
   self._setup_callback(self._controller.view.lookup_action('volume::increase').activate)
   self._setup_callback(self._do_close_window)
   gi.repository.Gtk.main()
   testhelper.assert_close(volumebutton.get_value(), 0.3)
Пример #2
0
 def test_should_handle_on_volume_value_changed(self):
   volumebutton = testhelper.find_child(self._controller.view, 'volumebutton')
   assert(volumebutton.get_value() == 0.1)
   # just make sure we don't have an infinite loop...
   self._setup_callback(volumebutton.set_value, 0.45)
   self._setup_callback(self._do_close_window)
   gi.repository.Gtk.main()
   assert(volumebutton.get_value() == 0.45)
Пример #3
0
 def test_should_handle_on_control_seek_change_value(self):
   self._create_routine(2)
   testhelper.assert_close(self._plan.routines[-1].completed(), 0.0)
   seekscale = testhelper.find_child(self._controller.view, 'seekscale')
   self._setup_callback(seekscale.emit, 'change-value', gi.repository.Gtk.ScrollType.JUMP, 50.0)
   self._setup_callback(self._do_close_window)
   gi.repository.Gtk.main()
   testhelper.assert_close(self._plan.routines[-1].completed(), 1.0)
Пример #4
0
 def test_should_be_able_to_seek_in_a_routine_that_is_in_progress(self):
   l = testhelper.Listener()
   self._controller.model.runner.connect('event', l.call)
   d = 100
   self._create_routine(d)
   seekscale = testhelper.find_child(self._controller.view, 'seekscale')
   self._setup_callback(self._controller.view.lookup_action('control::startstop').activate)
   self._setup_callback(seekscale.emit, 'change-value', gi.repository.Gtk.ScrollType.JUMP, 33.0)
   self._setup_callback(self._do_close_window)
   gi.repository.Gtk.main()
   assert(0 < l.elapsed(beeps.helpers.event.RoutineStarted, beeps.helpers.event.IntervalProgressed) < d)
   testhelper.assert_close(self._plan.runner.routine.progress(), 0.33)
Пример #5
0
 def test_should_handle_on_routine_row_activated(self):
   self._create_routine(4)
   self._create_routine(6)
   self._plan.load_routine(self._plan.routines[-1])
   assert(self._plan.runner.routine == self._plan.routines[-1])
   routinetreeview = testhelper.find_child(self._controller.view, 'routinetreeview')
   p = gi.repository.Gtk.TreePath(0)
   s = routinetreeview.get_selection()
   self._setup_callback(s.select_path, p)
   self._setup_callback(routinetreeview.row_activated, p, routinetreeview.get_column(0))
   self._setup_callback(self._do_close_window)
   gi.repository.Gtk.main()
   assert(self._plan.runner.routine == self._plan.routines[-2])
Пример #6
0
 def test_on_volume_value_changed(self):
   button = testhelper.find_child(self._view, 'volumebutton')
   button.emit('value-changed', 0.2)
   assert(self._controller.called() == 1)
Пример #7
0
 def test_on_routine_row_activated(self):
   treeview = testhelper.find_child(self._view, 'routinetreeview')
   treeview.emit('row-activated', None, None)
   assert(self._controller.called() == 1)
Пример #8
0
 def test_on_routine_popup_menu(self):
   treeview = testhelper.find_child(self._view, 'routinetreeview')
   treeview.emit('popup-menu')
   assert(self._controller.called() == 1)
Пример #9
0
 def test_on_routine_changed(self):
   treeviewselection = testhelper.find_child(self._view, 'routinetreeview').get_selection()
   treeviewselection.emit('changed')
   assert(self._controller.called() == 1)
Пример #10
0
 def test_on_routine_button_press_event(self):
   treeview = testhelper.find_child(self._view, 'routinetreeview')
   treeview.emit('button-press-event', gi.repository.Gdk.Event())
   assert(self._controller.called() == 1)
Пример #11
0
 def test_on_control_seek_change_value(self):
   scale = testhelper.find_child(self._view, 'seekscale')
   scale.emit('change-value', gi.repository.Gtk.ScrollType.STEP_RIGHT, 0.5)
   assert(self._controller.called() == 1)
Пример #12
0
 def test_should_handle_on_routine_changed(self, *args):
   self._create_routine(4)
   routinetreeview = testhelper.find_child(self._controller.view, 'routinetreeview')
   self._setup_callback(routinetreeview.get_selection().unselect_all)
   self._setup_callback(self._do_close_window)
   gi.repository.Gtk.main()
Пример #13
0
 def _do_dialog_accept(self, name):
   testhelper.find_child(self._controller.view, 'nameentry').set_text('test2')
   super()._do_dialog_accept()
Пример #14
0
 def _do_update_a_routine_name(self):
   testhelper.find_child(self._controller.view, 'nameentry').set_text('test2')
   self._controller.view.get_widget_for_response(gi.repository.Gtk.ResponseType.ACCEPT).emit('clicked')
Пример #15
0
 def test_should_delete_a_routine(self):
   self._view.show_all()
   testhelper.gtk_run_dialog(self._view, gi.repository.Gtk.ResponseType.ACCEPT, testhelper.find_child(self._view, 'okdelete').emit, 'clicked')
Пример #16
0
 def test_should_create_a_routine(self):
   entry = testhelper.find_child(self._view, 'nameentry')
   entry.set_text('test')
   self._view.show_all()
   testhelper.gtk_run_dialog(self._view, gi.repository.Gtk.ResponseType.ACCEPT, testhelper.find_child(self._view, 'okedit').emit, 'clicked')
   assert(self._controller.called() == 1)
Пример #17
0
def test_find_child():
  builder = gi.repository.Gtk.Builder()
  builder.add_from_resource(beeps.views.planview.ROUTINE_EDITOR_UI)
  view = builder.get_object('editordialog')
  assert(testhelper.find_child(view, 'nameentry') != None)
  assert(testhelper.find_child(view, 'anmeentry') == None)