use of com.archimatetool.model.IDiagramModelImage in project archi by archimatetool.
the class CanvasModelEditPartFactoryTests method testDiagramImageEditPart.
@Test
public void testDiagramImageEditPart() {
IDiagramModelImage image = IArchimateFactory.eINSTANCE.createDiagramModelImage();
EditPart editPart = editPartFactory.createEditPart(null, image);
assertTrue(editPart instanceof DiagramImageEditPart);
assertEquals(image, editPart.getModel());
}
use of com.archimatetool.model.IDiagramModelImage in project archi by archimatetool.
the class ArchiveManagerTests method testDispose.
@Test
public void testDispose() throws IOException {
IDiagramModelImage dmImage = IArchimateFactory.eINSTANCE.createDiagramModelImage();
dm.getChildren().add(dmImage);
archiveManager.loadImagesFromModelFile(TestSupport.TEST_MODEL_FILE_ZIPPED);
dmImage.setImagePath(archiveManager.getLoadedImagePaths().get(0));
assertEquals(2, model.eAdapters().size());
assertFalse(archiveManager.getLoadedImagePaths().isEmpty());
archiveManager.dispose();
assertEquals(1, model.eAdapters().size());
assertTrue(archiveManager.getLoadedImagePaths().isEmpty());
}
use of com.archimatetool.model.IDiagramModelImage in project archi by archimatetool.
the class ArchiveManagerTests method testEContentAdapter.
@Test
public void testEContentAdapter() throws Exception {
assertTrue(archiveManager.getImagePaths().isEmpty());
IDiagramModelImage dmImage = IArchimateFactory.eINSTANCE.createDiagramModelImage();
// Add IDiagramModelImageProvider without an image path set - should not register
dm.getChildren().add(dmImage);
assertTrue(archiveManager.getImagePaths().isEmpty());
assertTrue(archiveManager.getLoadedImagePaths().isEmpty());
dm.getChildren().remove(dmImage);
// Add IDiagramModelImageProvider with an image path set - should register
String imagePath = "/somePath/image.png";
dmImage.setImagePath(imagePath);
dm.getChildren().add(dmImage);
assertEquals(1, archiveManager.getImagePaths().size());
assertEquals(1, archiveManager.getLoadedImagePaths().size());
assertEquals(imagePath, archiveManager.getImagePaths().get(0));
// Set image path, should still only be one
String imagePath2 = "/somePath/image2.png";
dmImage.setImagePath(imagePath2);
assertEquals(1, archiveManager.getImagePaths().size());
// This should be increased
assertEquals(2, archiveManager.getLoadedImagePaths().size());
assertEquals(imagePath2, archiveManager.getImagePaths().get(0));
}
use of com.archimatetool.model.IDiagramModelImage in project archi by archimatetool.
the class ArchiveManagerTests method testHasImages.
@Test
public void testHasImages() {
assertFalse(archiveManager.hasImages());
IDiagramModelImage dmImage = IArchimateFactory.eINSTANCE.createDiagramModelImage();
dmImage.setImagePath("somePath");
dm.getChildren().add(dmImage);
assertTrue(archiveManager.hasImages());
}
use of com.archimatetool.model.IDiagramModelImage in project archi by archimatetool.
the class ArchiveManagerTests method testAddImageFromFile.
@Test
public void testAddImageFromFile() throws Exception {
IDiagramModelImage dmImage = IArchimateFactory.eINSTANCE.createDiagramModelImage();
dm.getChildren().add(dmImage);
// should be empty
assertTrue(archiveManager.getLoadedImagePaths().isEmpty());
File imgFile = new File(TestSupport.getTestDataFolder(), "/img/img1.png");
String pathName = archiveManager.addImageFromFile(imgFile);
assertNotNull(pathName);
// should still be empty
assertTrue(archiveManager.getLoadedImagePaths().isEmpty());
dmImage.setImagePath(pathName);
// This should now be increased
assertEquals(pathName, archiveManager.getLoadedImagePaths().get(0));
// This should be set
assertEquals(pathName, archiveManager.getImagePaths().get(0));
}
Aggregations