def test_change_slide(self): """ Test the change_slide method. """ # GIVEN: A ServiceItem with two frames content. service_item = ServiceItem(None) service = read_service_from_file('serviceitem_image_3.osj') with patch('os.path.exists'): service_item.set_from_service(service[0]) # WHEN: Added to the preview widget and switched to the second frame. self.preview_widget.replace_service_item(service_item, 1, 0) self.preview_widget.change_slide(1) # THEN: The current_slide_number should reflect the change. self.assertEqual(self.preview_widget.current_slide_number(), 1, 'The current slide number should be 1.')
def test_replace_service_item(self): """ Test item counts and current number with a service item. """ # GIVEN: A ServiceItem with two frames. service_item = ServiceItem(None) service = read_service_from_file('serviceitem_image_3.osj') with patch('os.path.exists'): service_item.set_from_service(service[0]) # WHEN: Added to the preview widget. self.preview_widget.replace_service_item(service_item, 1, 1) # THEN: The slide count and number should fit. self.assertEqual(self.preview_widget.slide_count(), 2, 'The slide count should be 2.') self.assertEqual(self.preview_widget.current_slide_number(), 1, 'The current slide number should be 1.')
def test_change_slide(self): """ Test the change_slide method. """ # GIVEN: A ServiceItem with two frames content. service_item = ServiceItem(None) service = read_service_from_file('serviceitem_image_3.osj') with patch('os.path.exists'): service_item.set_from_service(service[0]) # WHEN: Added to the preview widget and switched to the second frame. self.preview_widget.replace_service_item(service_item, 1, 0) self.preview_widget.change_slide(1) # THEN: The current_slide_number should reflect the change. assert self.preview_widget.current_slide_number( ) == 1, 'The current slide number should be 1.'
def test_replace_service_item(self): """ Test item counts and current number with a service item. """ # GIVEN: A ServiceItem with two frames. service_item = ServiceItem(None) service = read_service_from_file('serviceitem_image_3.osj') with patch('os.path.exists'): service_item.set_from_service(service[0]) # WHEN: Added to the preview widget. self.preview_widget.replace_service_item(service_item, 1, 1) # THEN: The slide count and number should fit. assert self.preview_widget.slide_count( ) == 2, 'The slide count should be 2.' assert self.preview_widget.current_slide_number( ) == 1, 'The current slide number should be 1.'