Skip to content

wallpapers/image: add basic unit test for frontend

Fushan Wen requested to merge work/fuf/image/testfrontend into master

This adds 3 tests for the frontend, each with different fill modes and background colors.

  1. Load image with the default settings
  2. Load image with blur enabled and PreserveAspectFit fill mode
  3. Load image with Pad fill mode

This uses QQuickItem::grabImage to check the color is coorect in each test case.

Local test result:

> ./testimagefrontend 
********* Start testing of ImageFrontendTest *********
Config: Using QtTest library 5.15.7, Qt 5.15.7 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 12.2.1 20221020 [revision 0aaef83351473e8f4eb774f8f999bbe87a4866d7]), opensuse-tumbleweed 20221111
PASS   : ImageFrontendTest::initTestCase()
QWARN  : ImageFrontendTest::testLoadWallpaper(Default) Could not create scene graph context for backend 'automaticbackend' - check that plugins are installed correctly in /usr/lib64/qt5/plugins
PASS   : ImageFrontendTest::testLoadWallpaper(Default)
PASS   : ImageFrontendTest::testLoadWallpaper(Blur enabled)
PASS   : ImageFrontendTest::testLoadWallpaper(Background color)
PASS   : ImageFrontendTest::cleanupTestCase()
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted, 739ms
********* Finished testing of ImageFrontendTest *********

Merge request reports

Loading