From f40b7b46d5eeedb6f5a4b1a0d7d2cf5432a1854f Mon Sep 17 00:00:00 2001 From: tznind Date: Sun, 22 Sep 2024 20:28:39 +0100 Subject: [PATCH] Fix test and make comments clearer --- UnitTests/Drawing/SixelEncoderTests.cs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/UnitTests/Drawing/SixelEncoderTests.cs b/UnitTests/Drawing/SixelEncoderTests.cs index 3c8042710..ac0b92cca 100644 --- a/UnitTests/Drawing/SixelEncoderTests.cs +++ b/UnitTests/Drawing/SixelEncoderTests.cs @@ -17,10 +17,27 @@ public class SixelEncoderTests var expected = "\u001bP" + // Start sixel sequence "0;0;0" + // Defaults for aspect ratio and grid size "q" + // Signals beginning of sixel image data - "\"1;1;3;2" + // no scaling factors (1x1) and filling 3 runes horizontally and 2 vertically + "\"1;1;12;2" + // no scaling factors (1x1) and filling 12px width with 2 'sixel' height = 12 px high + + /* + * Definition of the color palette + */ "#0;2;100;0;0" + // Red color definition in the format "#;;;;" - 2 means RGB. The values range 0 to 100 - "~~~~$-" + // First 6 rows of red pixels - "~~~~$-" + // Next 6 rows of red pixels + + /* + * Start of the Pixel data + * We draw 6 rows at once, so end up with 2 'lines' + * Both are basically the same and terminate with dollar hyphen (except last row) + * Format is: + * #0 (selects to use color palette index 0 i.e. red) + * !12 (repeat next byte 12 times i.e. the whole length of the row) + * ~ (the byte 111111 i.e. fill completely) + * $ (return to start of line) + * - (move down to next line) + */ + "#0!12~$-" + + "#0!12~$" + // Next 6 rows of red pixels + "\u001b\\"; // End sixel sequence // Arrange: Create a 12x12 bitmap filled with red @@ -44,5 +61,4 @@ public class SixelEncoderTests Assert.Equal (expected, result); } - }