### Question:
LedSimulatorOutputWindow { private Point getWindowSize(Layout layout) { int x, y; switch (layout.getLayoutName()) { case HORIZONTAL: x = getOneMatrixXSize() * layout.getRow1Size() + layout.getRow2Size(); y = getOneMatrixYSize(); break; default: int xsize = (layout.getRow1Size() + layout.getRow2Size()) / 2; x = getOneMatrixXSize() * xsize; y = getOneMatrixYSize() * 2; break; } return new Point(x+rahmenSize,y+2*OFS+2*rahmenSize); } LedSimulatorOutputWindow(MatrixData matrixData, int ledSize, Layout layout); void calculateWindowsSize(Layout layout); int getOneMatrixXSize(); int getOneMatrixYSize(); Point getWindowSize(); int getRahmenSize(); int getLedSize(); int getLedSizeX(); int getLedSizeY(); @Override String toString(); static int OFS; }### Answer:
@Test public void testWindowSizePixelInvaders() { if (java.awt.GraphicsEnvironment.isHeadless()) { return; } MatrixData matrixData = new MatrixData(8, 8); LedSimulatorOutputWindow lsow = new LedSimulatorOutputWindow(matrixData, LED_SIZE, l); Point p = lsow.getWindowSize(); }
@Test public void testWindowSizeStripInvaders() { if (java.awt.GraphicsEnvironment.isHeadless()) { return; } MatrixData matrixData = new MatrixData(400, 8); LedSimulatorOutputWindow lsow = new LedSimulatorOutputWindow(matrixData, LED_SIZE, l); Point p = lsow.getWindowSize(); Assert.assertTrue(p.getX()>p.getY()); System.out.println(lsow); }
@Test public void testWindowSizeStripInvadersInverted() { if (java.awt.GraphicsEnvironment.isHeadless()) { return; } MatrixData matrixData = new MatrixData(8, 200); LedSimulatorOutputWindow lsow = new LedSimulatorOutputWindow(matrixData, LED_SIZE, l); Point p = lsow.getWindowSize(); Assert.assertTrue(p.getX()<p.getY()); System.out.println(lsow); }