UnboundTerminal extends AbstractTerminal { @Override public void set(int y, int x, TerminalCellLike tcell) { Grid<TerminalCellLike> grid = getGrid(); grid.get(y, x).set(tcell); grid.get(y, x).setDirty(false); } UnboundTerminal(); static UnboundTerminal initialize(String name, int rows, int cols, String font); @Override void disableEventNotice(BlackenEventType event); @Override void disableEventNotices(); @Override void enableEventNotice(BlackenEventType event); @Override @Deprecated void enableEventNotices(EnumSet<BlackenEventType> events); @Override int getch(); @Override int getch(int millis); @Override boolean keyWaiting(); @Override EnumSet<BlackenModifier> getLockingStates(); @Override BlackenMouseEvent getmouse(); @Override String getString(int y, int x, int length); @Override BlackenWindowEvent getwindow(); @Override void set(int y, int x, TerminalCellLike tcell); @Override boolean setFullScreen(boolean state); @Override boolean getFullScreen(); @Override void setSize(TerminalScreenSize size); @Override void refresh(int y, int x); @Override void setEventNotices(EnumSet<BlackenEventType> events); @Override EnumSet<BlackenEventType> getEventNotices(); @Override BlackenImageLoader getImageLoader();  }
@Test @Covers({"public ColorPalette coerceToPalette(ColorPalette,Integer,Integer)", "public ColorPalette setPalette(ColorPalette,int,int)", "public ColorPalette setPalette(ColorPalette,AbstractTerminal$CoerceMethod,PaletteTransformer)", }) public void coerceToPalette_palette_num_num() { assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); assertNull(terminal.getPalette()); ColorPalette palette = new ColorPalette(); palette.add(0xFF000000); palette.add(0xFF808080); palette.add(0xFF800000); palette.add(0xFF008000); palette.add(0xFF000080); for (int y = 0; y < NUM_ROWS; y++) { for (int x = 0; x < NUM_COLS; x++) { terminal.set(y, x, null, palette.get(x % 5), palette.get(y % 5)); } } terminal.coerceToPalette(palette, 0, 1); for (int y = 0; y < NUM_ROWS; y++) { for (int x = 0; x < NUM_COLS; x++) { terminal.set(y, x, null, x % 5, y % 5); } } assertSame(palette, terminal.getPalette()); assertEquals(5, palette.size()); assertEquals(0xFF000000, (int)palette.get(0)); assertEquals(0xFF808080, (int)palette.get(1)); assertEquals(0xFF800000, (int)palette.get(2)); assertEquals(0xFF008000, (int)palette.get(3)); assertEquals(0xFF000080, (int)palette.get(4)); assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); }
@Test @Covers({"public ColorPalette coerceToPalette(ColorPalette,String,String)", "public ColorPalette setPalette(ColorPalette,AbstractTerminal$CoerceMethod,PaletteTransformer)", }) public void coerceToPalette_palette_name_name() { assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); assertNull(terminal.getPalette()); ColorPalette palette = new ColorPalette(); palette.add("black", 0xFF000000); palette.add("white", 0xFF808080); palette.add(0xFF800000); palette.add(0xFF008000); palette.add(0xFF000080); for (int y = 0; y < NUM_ROWS; y++) { for (int x = 0; x < NUM_COLS; x++) { terminal.set(y, x, null, palette.get(x % 5), palette.get(y % 5)); } } terminal.coerceToPalette(palette, "black", "white"); for (int y = 0; y < NUM_ROWS; y++) { for (int x = 0; x < NUM_COLS; x++) { terminal.set(y, x, null, x % 5, y % 5); } } assertSame(palette, terminal.getPalette()); assertEquals(5, palette.size()); assertEquals(0xFF000000, (int)palette.get(0)); assertEquals(0xFF808080, (int)palette.get(1)); assertEquals(0xFF800000, (int)palette.get(2)); assertEquals(0xFF008000, (int)palette.get(3)); assertEquals(0xFF000080, (int)palette.get(4)); assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); }
@Test @Covers("public void set(int,int,String,Integer,Integer,EnumSet<TerminalStyle>,EnumSet<CellWalls>)") public void set() { assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); terminal.set(0, 0, "A", 0xed123456, 0xab098765, EnumSet.of(TerminalStyle.STYLE_BOLD), EnumSet.of(CellWalls.BOTTOM)); TerminalCellLike cell = terminal.get(0, 0); assertEquals("A", cell.getSequence()); assertEquals(0xed123456, cell.getForeground()); assertEquals(0xab098765, cell.getBackground()); assertEquals(EnumSet.of(TerminalStyle.STYLE_BOLD), cell.getStyle()); assertEquals(EnumSet.of(CellWalls.BOTTOM), cell.getCellWalls()); assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); }
@Test @Covers("public void set(int,int,TerminalCellLike)") public void set_Y_X_TerminalCell() { assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); terminal.set(0, 0, new TerminalCell("A")); terminal.set(NUM_ROWS-1, 0, new TerminalCell("B")); terminal.set(0, NUM_COLS-1, new TerminalCell("C")); terminal.set(NUM_ROWS-1, NUM_COLS-1, new TerminalCell("D")); assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); verifySet(); }
@Test @Covers("public void set(int,int,String,Integer,Integer)") public void set_y_x_Sequence_fg_bg() { assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); terminal.set(0, 0, "A", null, null); terminal.set(NUM_ROWS-1, 0, "B", null, null); terminal.set(0, NUM_COLS-1, "C", null, null); terminal.set(NUM_ROWS-1, NUM_COLS-1, "D", null, null); verifySet(); assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); }
@Test @Covers("public void set(int,int,String,Integer,Integer,EnumSet<TerminalStyle>,EnumSet<CellWalls>)") public void set_y_x_Seq_fg_bg_sty_wal() { assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); terminal.set(0, 0, "A", null, null, null, null); terminal.set(NUM_ROWS-1, 0, "B", null, null, null, null); terminal.set(0, NUM_COLS-1, "C", null, null, null, null); terminal.set(NUM_ROWS-1, NUM_COLS-1, "D", null, null, null, null); verifySet(); assertEquals(-1, terminal.getCursorY()); assertEquals(-1, terminal.getCursorX()); }