Crate ribir_dev_helper

source ·

Macros§

  • Macro is used to check if the layout information of a widget is as expected. At first, it accepts a TestWindow that contains the widgets you want to test. Then use a pair of braces to describe the layout information of a widget, in the braces inner, you should specify the widget by an index path, then use {key} == {expression} to describe what you want to test the widget.
  • Macro help to write an example. This macro accepts a function that returns a widget as the root of the application, you can specify the window size by wnd_size = { size }. It will generate codes for you:
  • This macro generates image tests for the painter with every backend. Accept a function returning a painter. The generated test name is the function name composed a prefix(the backend name). The test will check if the backend renders the painter result to generate the same content as the image file.
  • A unit test macro to help describe the test flow. This macro provide ability to pack many unit tests, and print the result like official. Should always use official test harness first, use it only when you need execute test by self.
  • This macro accepts a function that returns a widget to generate a benchmark for the returning widget.
  • This macro generates image tests for a widget. The first parameter must be a function that returns the widget you want to test. And the macro will generate tests for the widget with every theme and painter backend. The test and image file name was formatted by {widget name} _with_{theme name}_by_{painter backend name}.
  • This macro generates a layout test for your widget. The first parameter must be a function that returns the widget you want to test, and the macro will use the function name to generate a test with a ‘_layout’ suffix. And then you can specify the window size for testing by wnd_size = { expression for window size}, if you have not specified, the window will use 1024x1024 as its default size.
  • This macro is equivalent to writing widget_layout_test!, widget_image_test!, widget_bench! three macros at the same time.

Functions§