IMON GRAPHIC!
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 31s
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 47s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 1m9s
Release j3270 / Build & Publish Release (push) Successful in 42s
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 31s
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 47s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 1m9s
Release j3270 / Build & Publish Release (push) Successful in 42s
This commit is contained in:
@@ -285,6 +285,79 @@ public class GocaDecoderTest {
|
||||
assertTrue(plane.hasContent(), "Expected plane to have content after image decoding");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImonGddmImageRendering() throws Exception {
|
||||
GraphicsPlane plane = new GraphicsPlane(1040, 1118);
|
||||
plane.setCharDimensions(13, 26);
|
||||
plane.setScreenDimensions(80, 43);
|
||||
GocaDecoder decoder = new GocaDecoder(plane);
|
||||
|
||||
assertEquals(1040, plane.getTotalWidth());
|
||||
assertEquals(1118, plane.getTotalHeight());
|
||||
assertEquals(520, plane.getXMax());
|
||||
assertEquals(558, plane.getYMax());
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// GSCP: Set Current Position (377, 494)
|
||||
out.write(GocaConstants.G_GSCP);
|
||||
out.write(0x04);
|
||||
out.write(0x01); out.write(0x79); // X = 377
|
||||
out.write(0x01); out.write(0xEE); // Y = 494
|
||||
|
||||
// GSCOL: Color 1 = Blue
|
||||
out.write(GocaConstants.G_GSCOL);
|
||||
out.write(0x01);
|
||||
|
||||
// G_GBIMGC (0x91): Begin Image Current Position: len=6, flags=0, w=80, h=80
|
||||
out.write(GocaConstants.G_GBIMGC);
|
||||
out.write(0x06);
|
||||
out.write(0x00); out.write(0x00); // flags/format
|
||||
out.write(0x00); out.write(0x50); // w = 80
|
||||
out.write(0x00); out.write(0x50); // h = 80
|
||||
|
||||
// G_GIMD (0x92): 10 bytes scanline
|
||||
out.write(GocaConstants.G_GIMD);
|
||||
out.write(0x0A);
|
||||
out.write(new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0xFF });
|
||||
|
||||
// G_GEIMG (0x93): End Image with 2-byte operand (02 00 00 as sent by IMON)
|
||||
out.write(GocaConstants.G_GEIMG);
|
||||
out.write(0x02);
|
||||
out.write(0x00); out.write(0x00);
|
||||
|
||||
// Subsequent order to verify stream synchronization: GSCOL Color 2 = Red
|
||||
out.write(GocaConstants.G_GSCOL);
|
||||
out.write(0x02);
|
||||
|
||||
// G_GBIMGC (0x91): Second image tile
|
||||
out.write(GocaConstants.G_GBIMGC);
|
||||
out.write(0x06);
|
||||
out.write(0x00); out.write(0x00);
|
||||
out.write(0x00); out.write(0x50);
|
||||
out.write(0x00); out.write(0x50);
|
||||
|
||||
out.write(GocaConstants.G_GIMD);
|
||||
out.write(0x0A);
|
||||
out.write(new byte[] { (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA, (byte)0xAA });
|
||||
|
||||
out.write(GocaConstants.G_GEIMG);
|
||||
out.write(0x02);
|
||||
out.write(0x00); out.write(0x00);
|
||||
|
||||
byte[] stream = out.toByteArray();
|
||||
decoder.decodeStream(stream, 0, stream.length);
|
||||
|
||||
assertTrue(plane.hasContent(), "Expected plane to have content after IMON GOCA decoding");
|
||||
int mappedX = plane.mapX(377);
|
||||
int mappedY = plane.mapY(494);
|
||||
assertEquals(897, mappedX);
|
||||
assertEquals(64, mappedY);
|
||||
|
||||
int[] rgb = plane.getRgbBuffer();
|
||||
int pixelAtImg = rgb[mappedY * 1040 + mappedX];
|
||||
assertNotEquals(0, pixelAtImg, "Pixel at image location should be rendered");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDirectObjectControlSf24() {
|
||||
haus.nightmare.lib3270j.screen.ScreenBuffer sb = new haus.nightmare.lib3270j.screen.ScreenBuffer(
|
||||
|
||||
Reference in New Issue
Block a user