stefanhaustein / TerminalImageViewer

Small C++ program to display images in a (modern) terminal using RGB ANSI codes and unicode block graphics characters
Other
1.56k stars 111 forks source link

Enable continuous integration on Pull Requests #136

Closed penguin359 closed 7 months ago

penguin359 commented 8 months ago

How can we test this? Step-by-step instructions, please.

  1. Commit and push any change to master or
  2. Create a new pull request from the same or another repository
  3. Look under the Actions tab and see an automatic build and test of the software

What happened before?

No continuous integration was set up requiring manual validation that the code does indeed compile and work.

What should happen with this fix?

On any commit to master or pull request, a CI test will be started and report pass/fail in the body of the PR.

Anything else we should know about this patch?

Hopefully this is the start of more PRs and maybe a CI Badge could be added to the README with the latest status.

stefanhaustein commented 7 months ago

Would it make sense to use some kind of color test image here -- perhaps similar to the one that used to be shown on TV after the program had ended?

aaronliu0130 commented 7 months ago

Hmm... I'm not sure if there's any comparable image that Ubuntu ships, and I'm not sure about including the image in the repo and increasing its size.

penguin359 commented 7 months ago

I picked the current image by running a find command in my first run and selecting a generic image that was likely to always be present. The Debian logo seemed like a good fit, but we could also pick any image that is from a valid which could be apt-get installed so there might be backgrounds or other more colorful images. As for testing it, I had considered saving the output and doing a simple diff against it. That would work if the current output was stable for a given input, but a bit fragile if there were improvements to produce an even better rendering. The better option would probably be to introduce a simple parser for the output that still requires the same image size which can be stable, and then just compares each pixels to a reference 2-d array of values and makes sure they are equal within some tolerance.

aaronliu0130 commented 7 months ago

I've added a ton of unversioned paths to my fork of the actions. You can view the results at https://github.com/aaronliu0130/TerminalImageViewer/actions/runs/7662799618/job/20884623837, under the "Test" dropdown. Obviously, these are thumbs and not the full version, and GitHub's been kind enough to mess up random lines be deleting random characters in front. Which do you think are good? My candidates are the MSEdge logo, CMakeSetup.png, file.png, cat_1.jpg, icon.png, watermark.png, the good ol' debian logo, pstree32.xpm, apache_pb.png, pngtest.png, and maybe display-im6.q16.xpm .