GIMP now has UI tests

Hacker News by 4 min read 79x views
GIMP now has UI tests

Share Post

GIMP has a lot of intertwined menus, dialogs and tools. When we change a part of the interface, another may halt operating and sometimes, the problem can be missed until a person reports it.

To discover these problems early, a new GUI testing phase was implemented. A representative GUI test starts GIMP, clicks menus and buttons, and afterward checks the result. These tests run automatically all period we merge contributor changes.

Why we need them⁠

GIMP already has component tests. A component test checks one small part of the code, for example how GIMP says an XCF file. But our component tests were not opening a genuine window. So it coult not inform us if a dialog opens, or if a menu item did its job.

Note that GIMP already had tests of GUI code, normally interacting directly with the center code, and sometimes equal simulating input devices’ events (pointer movements, clicks, drags…). But nothing can attack interacting with the genuine interface. Furthermore specified bequest tests immediately hijacking core code arrive alongside their own problems, specified as breaking all too frequently (and not since they detected a bug), all during not being capable to detect whole categories of bugs.

UI tests inspect the program as a whole, in the identical way as you use it.

What the tests do⁠

Each test starts a genuine GIMP and does one small task. Then it says the result from GIMP. If the outcome is not correct, the test fails and tells us what went wrong.

We have 13 tests at this time. They check that:

  • GIMP starts and shows its main window.
  • The Welcome dialog opens on the accurate tab. It additionally stays hidden whenever you rotate off “Show on Start”.
  • File > New makes an depiction alongside the size you set.
  • File > Export As writes a accurate PNG file.
  • Tools > Swap Colors swaps the foreground and background colors.
  • You can category a new foreground color in the Colors dialog.
  • You can add a tier and delete a layer.
  • Undo and Redo work.
  • Zoom In changes the zoom level.
  • A click on a tool clasp in the toolbox selects that tool. The test then uses the Bucket Fill tool on the canvas.
  • A alter in Preferences is saved whenever you click OK.
  • A list action, Image > Flatten Image, does its job.

How they work⁠

The tests do not need a screen. Each test starts a small, hidden desktop, runs GIMP in it, and removes it at the end. Because of this, the tests can run on our CI servers, where no display is available.

To discover a clasp or a menu, the tests do not appearance at the pixels on the screen. They use the accessibility data that GIMP gives to tools such as display readers. This has one additional fine result: whenever we create GIMP easier to test, we additionally create it easier to use alongside a display reader, hence enhance the software accessibility.

The tests use dogtail, a Python tool for UI tests. To run GIMP on a server alongside no screen, dogtail needed a new feature. We contributed this characteristic upstream, to dogtail itself, so other projects can use it too.

At this time, the tests run lone on Linux (both X11 and Wayland) since dogtail does not assistance Windows or macOs.

Adding equal these few uncomplicated tests considerably increases confidence that the GIMP build has worked, and additionally shows the test infrastructure is operating and useful.

Credits⁠

  • Harsh Verma wrote the UI tests and the new dogtail feature.
  • Jehan reviewed the UI tests.
  • Michal Odehnal reviewed the new dogtail feature.

You can peruse the complete alter in merge petition !2909.

How you can help⁠

13 tests is a fine start, but GIMP has many additional dialogs and tools. If you want to help, you can compose a test for the part of GIMP that you use the most.

We wrote a guide that shows how to compose a new test and how to discover the cause whenever a test fails: UI tests on developer.gimp.org.

We anticipation this activity volition assistance us discover bugs before and keep GIMP operating well for everyone.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads