def test_inserting_display_data_channel_updates_display_layer_data_indexes( self): document_model = DocumentModel.DocumentModel() with contextlib.closing(document_model): data_item1 = DataItem.DataItem(numpy.zeros((8, ), numpy.uint32)) document_model.append_data_item(data_item1) data_item2 = DataItem.DataItem(numpy.zeros((8, ), numpy.uint32)) document_model.append_data_item(data_item2) data_item3 = DataItem.DataItem(numpy.zeros((8, ), numpy.uint32)) document_model.append_data_item(data_item3) display_item = document_model.get_display_item_for_data_item( data_item1) display_item.append_display_data_channel_for_data_item(data_item2) display_item._set_display_layer_property(0, "ref", "A") display_item._set_display_layer_property(1, "ref", "B") self.assertEqual(2, len(display_item.display_data_channels)) self.assertEqual( 0, display_item.get_display_layer_property(0, "data_index")) self.assertEqual( 1, display_item.get_display_layer_property(1, "data_index")) display_item.insert_display_data_channel( 1, DisplayItem.DisplayDataChannel(data_item=data_item3)) self.assertEqual(3, len(display_item.display_data_channels)) self.assertEqual( 0, display_item.get_display_layer_property(0, "data_index")) self.assertEqual( 2, display_item.get_display_layer_property(1, "data_index")) self.assertEqual("A", display_item.get_display_layer_property(0, "ref")) self.assertEqual("B", display_item.get_display_layer_property(1, "ref"))
def test_inserting_display_data_channel_updates_display_layer_data_indexes( self): with TestContext.create_memory_context() as test_context: document_model = test_context.create_document_model() data_item1 = DataItem.DataItem(numpy.zeros((8, ), numpy.uint32)) document_model.append_data_item(data_item1) data_item2 = DataItem.DataItem(numpy.zeros((8, ), numpy.uint32)) document_model.append_data_item(data_item2) data_item3 = DataItem.DataItem(numpy.zeros((8, ), numpy.uint32)) document_model.append_data_item(data_item3) display_item = document_model.get_display_item_for_data_item( data_item1) display_item.append_display_data_channel_for_data_item(data_item2) display_item._set_display_layer_property(0, "ref", "A") display_item._set_display_layer_property(1, "ref", "B") self.assertEqual(2, len(display_item.display_data_channels)) self.assertEqual( display_item.display_data_channels[0], display_item.get_display_layer_display_data_channel(0)) self.assertEqual( display_item.display_data_channels[1], display_item.get_display_layer_display_data_channel(1)) display_item.insert_display_data_channel( 1, DisplayItem.DisplayDataChannel(data_item=data_item3)) self.assertEqual(3, len(display_item.display_data_channels)) self.assertEqual( display_item.display_data_channels[0], display_item.get_display_layer_display_data_channel(0)) self.assertEqual( display_item.display_data_channels[2], display_item.get_display_layer_display_data_channel(1)) self.assertEqual("A", display_item.get_display_layer_property(0, "ref")) self.assertEqual("B", display_item.get_display_layer_property(1, "ref"))
def test_cursor_over_1d_composite_image(self): with TestContext.create_memory_context() as test_context: document_model = test_context.create_document_model() data_item = DataItem.DataItem(numpy.zeros((32,))) data_item2 = DataItem.DataItem(numpy.zeros((32,))) document_model.append_data_item(data_item) document_model.append_data_item(data_item2, False) display_item = document_model.get_display_item_for_data_item(data_item) display_item.display_type = "line_plot" display_item.append_display_data_channel(DisplayItem.DisplayDataChannel(data_item=data_item2)) display_item.calibration_style_id = "pixels-top-left" p, v = display_item.get_value_and_position_text(display_item.display_data_channel, (25, )) self.assertEqual(p, "25") self.assertEqual(v, "")
def test_display_item_with_multiple_display_data_channels_has_sensible_properties( self): document_model = DocumentModel.DocumentModel() with contextlib.closing(document_model): data_item = DataItem.DataItem(numpy.zeros((8, 8), numpy.uint32)) data_item2 = DataItem.DataItem(numpy.zeros((8, 8), numpy.uint32)) document_model.append_data_item(data_item) document_model.append_data_item(data_item2, False) display_item = document_model.get_display_item_for_data_item( data_item) display_item.append_display_data_channel( DisplayItem.DisplayDataChannel(data_item=data_item2)) self.assertIsNotNone(display_item.size_and_data_format_as_string) self.assertIsNotNone(display_item.date_for_sorting) self.assertIsNotNone(display_item.date_for_sorting_local_as_string) self.assertIsNotNone(display_item.status_str) self.assertIsNotNone(display_item.used_display_type)
def test_display_item_with_multiple_display_data_channels_has_sensible_properties( self): with TestContext.create_memory_context() as test_context: document_model = test_context.create_document_model() data_item = DataItem.DataItem(numpy.zeros((8, 8), numpy.uint32)) data_item2 = DataItem.DataItem(numpy.zeros((8, 8), numpy.uint32)) document_model.append_data_item(data_item) document_model.append_data_item(data_item2, False) display_item = document_model.get_display_item_for_data_item( data_item) display_item.append_display_data_channel( DisplayItem.DisplayDataChannel(data_item=data_item2)) self.assertIsNotNone(display_item.size_and_data_format_as_string) self.assertIsNotNone(display_item.date_for_sorting) self.assertIsNotNone(display_item.date_for_sorting_local_as_string) self.assertIsNotNone(display_item.status_str) self.assertIsNotNone(display_item.project_str) self.assertIsNotNone(display_item.used_display_type)