@Test public void canDetermineHeight() { PrintPayload payload = new PrintPayload(); payload.append("Line1"); payload.append("Line2"); payload.append("Line3"); payload.append("Line4"); PrintPreview printPreview = new PrintPreview(payload, getPrinterSettings()); assertThat(printPreview.determineHeight()).isEqualTo(144); }
public int determineHeight() { int height = 0; for (PrintRow row : processRowsBeforePreviewing(printPayload.getRows())) { if (row instanceof TextRow) { PrinterFont font = getFont(((TextRow) row).getPrinterFontId()); height += font.getLineHeight(); } else if (row instanceof ImageRow) { height += ((ImageRow) row).getImage().getHeight() + VERTICAL_MARGIN * 2; } } return height + VERTICAL_MARGIN * 2; }
PrintPreview { public int determineHeight() { int height = 0; for (PrintRow row : processRowsBeforePreviewing(printPayload.getRows())) { if (row instanceof TextRow) { PrinterFont font = getFont(((TextRow) row).getPrinterFontId()); height += font.getLineHeight(); } else if (row instanceof ImageRow) { height += ((ImageRow) row).getImage().getHeight() + VERTICAL_MARGIN * 2; } } return height + VERTICAL_MARGIN * 2; } }
PrintPreview { public int determineHeight() { int height = 0; for (PrintRow row : processRowsBeforePreviewing(printPayload.getRows())) { if (row instanceof TextRow) { PrinterFont font = getFont(((TextRow) row).getPrinterFontId()); height += font.getLineHeight(); } else if (row instanceof ImageRow) { height += ((ImageRow) row).getImage().getHeight() + VERTICAL_MARGIN * 2; } } return height + VERTICAL_MARGIN * 2; } PrintPreview(PrintPayload printPayload, PrinterSettings printerSettings); }
PrintPreview { public int determineHeight() { int height = 0; for (PrintRow row : processRowsBeforePreviewing(printPayload.getRows())) { if (row instanceof TextRow) { PrinterFont font = getFont(((TextRow) row).getPrinterFontId()); height += font.getLineHeight(); } else if (row instanceof ImageRow) { height += ((ImageRow) row).getImage().getHeight() + VERTICAL_MARGIN * 2; } } return height + VERTICAL_MARGIN * 2; } PrintPreview(PrintPayload printPayload, PrinterSettings printerSettings); Bitmap getBitmap(); Bitmap getScaledBitmap(Context context); byte[] getCompressedBitmap(); int determineHeight(); }
PrintPreview { public int determineHeight() { int height = 0; for (PrintRow row : processRowsBeforePreviewing(printPayload.getRows())) { if (row instanceof TextRow) { PrinterFont font = getFont(((TextRow) row).getPrinterFontId()); height += font.getLineHeight(); } else if (row instanceof ImageRow) { height += ((ImageRow) row).getImage().getHeight() + VERTICAL_MARGIN * 2; } } return height + VERTICAL_MARGIN * 2; } PrintPreview(PrintPayload printPayload, PrinterSettings printerSettings); Bitmap getBitmap(); Bitmap getScaledBitmap(Context context); byte[] getCompressedBitmap(); int determineHeight();  }