Talinx / jp2a

Converts jpg/png/webp images to ASCII
GNU General Public License v2.0
65 stars 9 forks source link

[PowerPC] PNG invert, PNG interlaced 16-bit test fail (Tests FAILED: 2 of 75) #15

Open barracuda156 opened 7 months ago

barracuda156 commented 7 months ago

@Talinx There was a minor fix needed for a missing fmemopen (macOS < 10.13), but otherwise it works, apparently. Two PNG-related tests fail on PowerPC – endianness not taken into account?

 TESTING JP2A BUILD

 Note that the output may vary a bit on different platforms,
 so some tests may fail.  This does not mean that jp2a is
 completely broken.
-------------------------------------------------------------

test ( 1) (width)                                       OK
test ( 2) (border, width)                               OK
test ( 3) (size)                                        OK
test ( 4) (height)                                      OK
test ( 5) (size)                                        OK
test ( 6) (size)                                        OK
test ( 7) (invert, border)                              OK
test ( 8) (width, flip, invert)                         OK
test ( 9) (width, border)                               OK
test (10) (width, verbose)                              OK
test (11) (width, outfile)                              OK
test (12) (width, clear)                                OK
test (13) (height, grayscale)                           OK
test (14) (size, invert)                                OK
test (15) (size, invert, red channel)                   OK
test (16) (size, invert, blue channel)                  OK
test (17) (size, invert, green channel)                 OK
test (18) (width, grayscale)                            OK
test (19) (invert, width, grayscale)                    OK
test (20) (invert, size, grayscale)                     OK
test (21) (size, invert, border)                        OK
test (22) (size, html)                                  OK
test (23) (size, xhtml)                                 OK
test (24) (size, color, html, flipx)                    OK
test (25) (size, color, html, flipy)                    OK
test (26) (size, color, html, flipxy)                   OK
test (27) (size, color, xhtml, flipx)                   OK
test (28) (size, color, xhtml, flipy)                   OK
test (29) (size, color, xhtml, flipxy)                  OK
test (30) (width, html, gray, dark)                     OK
test (31) (width, html, gray, light)                    OK
test (32) (color, html, dark)                           OK
test (33) (color, html, dark fill)                      OK
test (34) (color, html, light)                          OK
test (35) (color, html, grayscale)                      OK
test (36) (color, html, --grayscale)                    OK
test (37) (color, html, --grayscale, fill)              OK
test (38) (width, xhtml, gray, dark)                    OK
test (39) (width, xhtml, gray, light)                   OK
test (40) (color, xhtml, dark)                          OK
test (41) (color, xhtml, dark fill)                     OK
test (42) (color, xhtml, light)                         OK
test (43) (color, xhtml, grayscale)                     OK
test (44) (color, xhtml, --grayscale)                   OK
test (45) (color, xhtml, --grayscale, fill)             OK
test (46) (color, ANSI, fill)                           OK
test (47) (color, ANSI, fill, --grayscale)              OK
test (48) (color, 256 color palette, fill)              OK
test (49) (color, 256 color palette, fill, --grayscale) OK
test (50) (color, truecolor, fill)                      OK
test (51) (color, truecolor, fill, --grayscale)         OK
test (52) (color, html, no-bold)                        OK
test (53) (color, xhtml, no-bold)                       OK
test (54) (html-title, xhtml)                           OK
test (55) (html-title, html)                            OK
test (56) (color, html-raw)                             OK
test (57) (color, ANSI)                                 OK
test (58) (color, ANSI, grayscale)                      OK
test (59) (color, 256 color palette)                    OK
test (60) (color, 256 color palette, grayscale)         OK
test (61) (color, truecolor)                            OK
test (62) (color, truecolor, grayscale)                 OK
test (63) (standard input, width)                       OK
test (64) (standard input, width, height)               OK
test (65) (big size)                                    OK
test (66) (PNG invert)                                  FAILED
test (67) (PNG colormap standard input)                 OK
test (68) (PNG interlaced 16-bit)                       FAILED
test (69) (size, curl download)                         OK
test (70) (size, curl download)                         OK
test (71) (very long jpg)                               Environment variable TERM not set.
OK
test (72) (very long png)                               Environment variable TERM not set.
OK
test (73) (edges)                                       OK
test (74) (edges only)                                  OK
test (75) (edges only, invert)                          OK

TEST RESULTS FOR JP2A

Tests OK    : 73 of 75  ( 97%)
Tests FAILED:  2 of 75  (  2%)

Summary of failed tests:

../src/jp2a --invert --color --size=144x36 jp2a-colorful.png | diff --strip-trailing-cr --brief - jp2a-png-invert.txt
../src/jp2a --size=300x150 --color jp2a-interlaced-16-bit.png | diff --strip-trailing-cr --brief - jp2a-png-interlaced-16-bit.txt
Talinx commented 1 month ago

Thanks for reporting this issue!

I was able to find the cause: This happens because the COLORTERM environment variable is not set. It should not happen when the variable is set, e. g. try running:

COLORTERM=truecolor make test

or checkout the develop branch where this is fixed.

I'm curious about the fmemopen issue and how you fixed it. There is already a workaround for Windows, maybe the more elegant solution would be to use it for MacOS, too: https://github.com/Talinx/jp2a/blob/aa07177663549bd251f17d5e035a951455ae78e4/src/jp2a.c#L230-L250