@Test public void testExportToPng() { when(canvasExport.toImageData(eq(canvasHandler), any(CanvasURLExportSettings.class))).thenReturn(PNG_DATA_URI); tested.exportToPng(canvasHandler, "file1"); final ArgumentCaptor<ImageDataUriContent> contentArgumentCaptor = ArgumentCaptor.forClass(ImageDataUriContent.class); verify(imageFileExport, times(1)).export(contentArgumentCaptor.capture(), eq("file1.png")); verify(pdfFileExport, never()).export(any(PdfDocument.class), anyString()); final ImageDataUriContent imageDataUriContent = contentArgumentCaptor.getValue(); assertEquals(PNG_DATA_URI, imageDataUriContent.getUri()); verify(clearSelectionEvent).fire(any(CanvasClearSelectionEvent.class)); }
public String exportToPng(final AbstractCanvasHandler canvasHandler) { final CanvasURLExportSettings settings = CanvasURLExportSettings.build(CanvasExport.URLDataType.PNG); clearSelection(canvasHandler); return canvasExport.toImageData(canvasHandler, settings); }
CanvasFileExport { public String exportToPng(final AbstractCanvasHandler canvasHandler) { final CanvasURLExportSettings settings = CanvasURLExportSettings.build(CanvasExport.URLDataType.PNG); clearSelection(canvasHandler); return canvasExport.toImageData(canvasHandler, settings); } }
CanvasFileExport { public String exportToPng(final AbstractCanvasHandler canvasHandler) { final CanvasURLExportSettings settings = CanvasURLExportSettings.build(CanvasExport.URLDataType.PNG); clearSelection(canvasHandler); return canvasExport.toImageData(canvasHandler, settings); } protected  CanvasFileExport(); @Inject  CanvasFileExport(final CanvasExport<AbstractCanvasHandler> canvasExport,
                            final FileExport<ImageDataUriContent> imageFileExport,
                            final FileExport<PdfDocument> pdfFileExport,
                            final FileExportsPreferences preferences,
                            final SvgFileExport svgFileExport,
                            final Event<CanvasClearSelectionEvent> clearSelectionEvent); }
CanvasFileExport { public String exportToPng(final AbstractCanvasHandler canvasHandler) { final CanvasURLExportSettings settings = CanvasURLExportSettings.build(CanvasExport.URLDataType.PNG); clearSelection(canvasHandler); return canvasExport.toImageData(canvasHandler, settings); } protected  CanvasFileExport(); @Inject  CanvasFileExport(final CanvasExport<AbstractCanvasHandler> canvasExport,
                            final FileExport<ImageDataUriContent> imageFileExport,
                            final FileExport<PdfDocument> pdfFileExport,
                            final FileExportsPreferences preferences,
                            final SvgFileExport svgFileExport,
                            final Event<CanvasClearSelectionEvent> clearSelectionEvent); void exportToSvg(final AbstractCanvasHandler canvasHandler,
                            final String fileName); String exportToSvg(final AbstractCanvasHandler canvasHandler); String exportToPng(final AbstractCanvasHandler canvasHandler); void exportToJpg(final AbstractCanvasHandler canvasHandler,
                            final String fileName); void exportToPng(final AbstractCanvasHandler canvasHandler,
                            final String fileName); void exportToPdf(final AbstractCanvasHandler canvasHandler,
                            final String fileName); }
CanvasFileExport { public String exportToPng(final AbstractCanvasHandler canvasHandler) { final CanvasURLExportSettings settings = CanvasURLExportSettings.build(CanvasExport.URLDataType.PNG); clearSelection(canvasHandler); return canvasExport.toImageData(canvasHandler, settings); } protected  CanvasFileExport(); @Inject  CanvasFileExport(final CanvasExport<AbstractCanvasHandler> canvasExport,
                            final FileExport<ImageDataUriContent> imageFileExport,
                            final FileExport<PdfDocument> pdfFileExport,
                            final FileExportsPreferences preferences,
                            final SvgFileExport svgFileExport,
                            final Event<CanvasClearSelectionEvent> clearSelectionEvent); void exportToSvg(final AbstractCanvasHandler canvasHandler,
                            final String fileName); String exportToSvg(final AbstractCanvasHandler canvasHandler); String exportToPng(final AbstractCanvasHandler canvasHandler); void exportToJpg(final AbstractCanvasHandler canvasHandler,
                            final String fileName); void exportToPng(final AbstractCanvasHandler canvasHandler,
                            final String fileName); void exportToPdf(final AbstractCanvasHandler canvasHandler,
                            final String fileName);  }