[Pkg-pascal-devel] Bug#820708: autopkgtest if cge works with current libpng version

Michalis Kamburelis michalis at castle-engine.io
Mon Dec 20 16:26:46 GMT 2021

Note that Castle Game Engine contains a number of automatic tests that load PNG images already.

In particular tests/code/testcastleimages.pas loads various PNG images, checking that the type (like RGBA) and sizes are correct. See https://github.com/castle-engine/castle-engine/blob/master/tests/code/testcastleimages.pas .

This testcase is executed as part of large application in tests/, using FpcUnit, and Debian already executes this testsuite automatically as far as I know.

The one thing we don't test there is whether we actually use LibPng, not some other PNG-reading library.

CGE by itself will automatically fallback from LibPng to FpImage (in CGE 7.0-alpha1) if LibPng is not found. This is acceptable for CGE, although on Linux practically everyone has LibPng, and we take care of distributing LibPng for other platforms too (like Windows, Android, iOs). But we still consider a "fallback on some other library to read PNG, like FpImage" useful, as A. we need such library anyway for other image formats (like JPG) and B. it will work in all possible cases (e.g. if someone packages CGE application in some weird way on Windows, and deletes "libpngXXX.dll").

In the upcoming CGE version, 7.0-alpha2, this fallback will likely change from FpImage to Vampyre Imaging Library, see our news last weekend: https://castle-engine.io/wp/2021/12/18/integration-with-vampyre-imaging-library-new-example-image_display-to-test-image-loading-speed-and-format-support/ . From the point of view of Debian, it still means we just have a fallback from LibPng -> some other PNG reader, with implementation contained within Pascal units in CGE.

To test whether CGE actually uses LibPng, just

1. add to uses clause of TestCastleImages new unit: CastleInternalPng

2. add a method like this:

procedure TTestImages.TestUsingLibPng;

This will make sure that CGE is actually using LibPng, not any fallback. If this succeeds, and other TestCastleImages methods will also succeed -> you know that CGE is using LibPng and that it works :)

So Debian can carry the patch adding TestUsingLibPng (if you want to require that CGE in Debian always uses LibPng, which is fine by me, although I don't want to require it in upstream). And everything else will be tested using ready tests in CGE, which we maintain constantly :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-pascal-devel/attachments/20211220/d24d8558/attachment.htm>

More information about the Pkg-pascal-devel mailing list