Commit Graph

119 Commits

Author SHA1 Message Date
Kim Woelders 9657d6a291 test_grab: Rearrange code 2023-02-19 16:57:20 +01:00
Kim Woelders ce0ac1eeff Add imlib_save_image_fd()
#7
2023-02-15 18:31:19 +01:00
Guilherme Janczak 84314f013f
remove bad unused function
__imlib_FileCanRead() suffers from TOCTTOU issues. The file behind the
path it takes as a parameter can change while the function executes, and
also between the function's return and the caller's use of the path.

The function is also unused, so just delete it.
2023-02-04 04:17:57 +00:00
Kim Woelders 1ca706b79a test: test_save: Check that files are written and ok 2023-01-22 17:20:01 +01:00
Kim Woelders 87bd2fa58a test: test_save: Trivial changes 2023-01-22 17:19:48 +01:00
Kim Woelders 9b9abcdc1e test: Introduce image_get_crc32() 2023-01-22 17:14:52 +01:00
Kim Woelders 0f27c5e6ec test: Add some pam tests 2023-01-12 22:14:03 +01:00
Kim Woelders 8fc05e400e test: Add a few tests for obscure pnm formats 2023-01-12 22:13:54 +01:00
Kim Woelders 8416d2b244 test: test_load_2: Check frame 0/1 loading too 2022-11-15 11:49:47 +01:00
Kim Woelders d4f604230a test: test_load: Quit when loading primary image fails 2022-10-31 07:17:34 +01:00
Kim Woelders ed89effcf3 api: error_return adjustments
- Drop imlib_load_image_fde()
- Remove error_return from imlib_load_image_mem()

It is becoming somewhat messy having functions with and without error
returns, so drop error returns in API functions added since v1.9.1.
Use imlib_get_error() to get the error instead.
2022-09-30 06:08:29 +02:00
Kim Woelders 43c54e1345 Introduce imlib_get_error()
Some of the image loading functions have a version with an error_return,
and some not.
With imlib_get_error() it is now possible to fetch the load error for
any image loading function call.
2022-09-30 06:04:27 +02:00
Kim Woelders 51906190a1 image: Don't munmap external memory
When loading image from memory (imlib_load_image[_frame]_mem()) the
memory was unintentionally munmapped after loading.

This would cause trouble if loading multiple times from the same mmap'ed
memory, but not from malloced memory as the munmap would then just fail
silently.

#1
2022-09-29 13:48:46 +02:00
Kim Woelders 9f9779e698 test: Re-generate test images with recent tool/library versions
Converters and library versions used:
 convert                ImageMagick-6.9.12.64
 cjxl                   libjxl-0.7.0
 heif-enc               libheif-1.13.0
 opj2_compress          openjpeg2-2.5.0
 pnmtopnm,pamtoxvmini   netpbm-10.99.00
2022-09-28 18:19:07 +02:00
Kim Woelders 87bcf92524 Includes tweaks
- Drop unneeded errno.h includes.
- Include stdarg.h only where needed.
2022-09-28 18:19:07 +02:00
Kim Woelders af587674a4 Introduce imlib_load_image_mem()
For loading images from memory.
2022-07-10 12:51:15 +02:00
Kim Woelders cea1207efe Introduce imlib_load_image_fde()
Same as imlib_load_image_fd() but with error return.
2022-07-07 12:59:40 +02:00
Kim Woelders 90824fc2fd test: Add test_misc 2022-06-24 21:33:23 +02:00
Kim Woelders 416f847dc3 Introduce strsplit() 2022-06-23 07:36:23 +02:00
Kim Woelders ee862ac6bf test: Add some of JPEG 2000 tests 2022-04-10 12:48:25 +02:00
Kim Woelders e8b564f141 build: Tweaks
- Let test depend on src
- Run tests sequentially
2022-04-09 17:19:19 +02:00
Kim Woelders c13f4ddf65 test_save: Updates
Catch various issues related to
- loader caching
- loader lookup for saving
- deferred loading in connection with saving
2022-04-07 11:29:22 +02:00
Kim Woelders 766c9d096f test: Add basic jxl test 2022-04-02 20:18:56 +02:00
Kim Woelders ac0d69863b test_load: Check deferred loading too 2022-03-29 06:54:55 +02:00
Kim Woelders 18d0befc57 Use stdint types instead of DATA32 etc.
This should make things slightly more consistent and unambiguous, and
the stdint types are already used here and there (in loaders).

I'm not aware of any systems where this change makes any difference.
If there are targets out there with 64 bit ints imlib2 might now work
there and on targets with 16 bit ints it most likely still doesn't.
2022-03-26 15:54:40 +01:00
Kim Woelders bc9867379c Deprecate imlib_load/save_image_with_error_return() 2022-03-21 10:11:02 +01:00
Kim Woelders 4bf622173c Switch to imlib_load/save_image_with_errno_return() 2022-03-21 10:09:18 +01:00
Kim Woelders bf07b104f3 Image load: Change error code on zero file size
From IMLIB_LOAD_ERROR_UNKNOWN to IMLIB_LOAD_ERROR_IMAGE_READ.

Mostly to get the same error from loading a 0 byte file as any other too
short file.
2022-03-19 17:25:54 +01:00
Kim Woelders 16cda0cc97 test: Properly include test.h in test SOURCES 2022-03-15 13:26:33 +01:00
Kim Woelders b0f3bfc907 test_grab: Enable testing depths other than 24 and 32
Also test with/without using a mask when grabbing (just a "full" one for
now to hit different grabber paths).
2022-03-07 21:46:56 +01:00
Kim Woelders f334da7959 test: Command line options tweak 2022-03-07 21:46:56 +01:00
Kim Woelders ac1d4b0520 Deal consistently with including Imlib2.h
- Always include config.h before Imlib2.h
  Needed for X_DISPLAY_MISSING.
- Always include config.h and Imlib2.h first
  Should make it more likely to spot stuff missing but required
  in Imlib2.h, like stddef.h.
  gtest.h apparently must be included before X headers though.
- Make sure we use the Imlib2.h here and not the one in /usr/include

Also ensure that the tests build when building without X.
2022-03-03 07:35:39 +01:00
Kim Woelders 79a5086b58 test: Merge common stuff 2022-02-06 13:07:47 +01:00
Kim Woelders 68171bdf7c test: Add basic heif loader check 2022-01-29 19:59:47 +01:00
Kim Woelders dde8b3fcd1 test: Add some more PNM type loading tests
Also avoid that .gz file contents depend on contained file's time stamp.
2022-01-19 19:38:32 +01:00
Kim Woelders 10f692c946 test: Add makefile to generate test images 2022-01-18 20:42:13 +01:00
Kim Woelders da2ce0d94b test: Move generated image files out of source dir
Simplifies cleaning up.
2022-01-18 20:40:59 +01:00
Kim Woelders 64c031acab test: Check __imlib_FileKey() 2022-01-17 13:06:16 +01:00
Kim Woelders a542fb6724 Add svg loader 2022-01-08 16:08:37 +01:00
Kim Woelders 503e8527c3 Add lzma loader 2021-12-28 16:08:06 +01:00
Kim Woelders cbe7408bd8 test: Add a couple of ico depth test images 2021-12-26 12:22:20 +01:00
Kim Woelders 8370777a31 Make initial context static
Avoids having to check on every API function call.
2021-12-08 19:12:29 +01:00
Kim Woelders dbdea2a4a6 test: Add context test 2021-12-06 14:30:30 +01:00
Kim Woelders 9b29249619 test: Add some scaling/rotation tests 2021-12-04 06:55:21 +01:00
Kim Woelders 074c408608 test_save: Check images with alpha too 2021-12-04 06:55:21 +01:00
Kim Woelders e0e4f883e9 test_grab: Add scale-down tests 2021-11-25 15:46:23 +01:00
Kim Woelders 00d050901d test_grab: Cleanups, cosmetics 2021-11-25 15:46:23 +01:00
Kim Woelders 6e27c1e2c3 Fix y-upscaling in imlib_create_scaled_image_from_drawable() 2021-11-25 15:45:56 +01:00
Kim Woelders 008e4e9fd4 test: Add X11 drawable grabbing test 2021-11-23 20:33:25 +01:00
Kim Woelders 0ef105d43c test: test_load improvements 2021-11-05 17:22:01 +01:00