Crate ribir_dev_helper

Source

Macros§

assert_layout_result_by_path
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.
painter_backend_eq_image_test
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.
test_case_name
unit_test_describe
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.
widget_image_test
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}.
widget_layout_test
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.
widget_test_suit
This macro is equivalent to writing widget_layout_test!, widget_image_test!, widget_bench! three macros at the same time.

Structs§

ImageTest

Functions§

assert_texture_eq_png
wgpu_render_commands
Render painter by wgpu backend, and return the image.