efl/src/tests/elementary/spec
Xavi Artigas e776f5f0d7 Efl.Ui.Format revamp
This class helps widgets which contain a numerical value and must display it,
like Progressbar (units label), Spin, Spin_Button, Slider (both units and popup
labels, in legacy), Tags (when in shrunk mode) or Calendar (year_month label).

Previously this was a mix of interface and mixin: widgets had to support setting a
formatting func, and the mixin offered support for formatting strings, by setting
an internal formatting func. On top of that, the spinner widget supported "special
values", a list of values that should be shown as certain strings instead.

This has now been simplified and unified:
Widgets including this mixin can use the formatted_value_get() method which accepts
an Eina_Value and returns a string. Thats's it.
The mixin adds three properties to the widget (format_values, format_func and
format_string) which users can use to tailor formatting. The widget does not need
to know which method has been used, it just retrieves the resulting string.
This removes a lot of duplicated widget code, and adds functionality which was
missing before. For example, all widgets support passing a list of values now.

Widgets must implement the apply_formatted_value() method so they are notified
of changes in the format and they can redraw anything they need.

Tests have been added to the Elementary Spec suite for all cases.

Legacy widgets behavior has not been modified, although a few needed some code
changes.
2019-07-04 19:38:20 +02:00
..
README Efl.Ui.Format revamp 2019-07-04 19:38:20 +02:00
efl_test_clickable.c efl_ui_frame: migrate to efl.ui.clickable 2019-05-15 09:09:04 -04:00
efl_test_container.c
efl_test_content.c efl_ui: rename list empty item to list placeholder item. 2019-05-30 15:40:31 +09:00
efl_test_format.c Efl.Ui.Format revamp 2019-07-04 19:38:20 +02:00
efl_test_gfx_arrangement.c efl_pack: split algin and padding property 2019-04-26 12:06:02 +02:00
efl_test_pack.c ui.relative_layout: implement Efl.Pack 2019-05-03 11:53:54 +02:00
efl_test_pack_linear.c Revert "efl_ui_suite_spec: add a hack to have running tests again" 2019-06-20 08:10:47 +02:00
efl_ui_spec_suite.c efl_ui_spec: Support running with CK_FORK=no 2019-06-18 12:22:54 -04:00
efl_ui_spec_suite.h Efl.Ui.Format revamp 2019-07-04 19:38:20 +02:00
generator.py efl_ui_spec: Support running with CK_FORK=no 2019-06-18 12:22:54 -04:00
meson.build Efl.Ui.Format revamp 2019-07-04 19:38:20 +02:00

README

== What is this spec test suite for ? ==

The spec test suite tests code purely against interfaces. There is no specific widget code in the tests; only interface calls are tested.
This is useful for testing the same interface on different implementations.

== Test metadata ==

The test framework is driven by some metadata found at the top of every test file.
There is a C comment at the top of every test file that starts with "spec-meta-start", followed by a json snippet. For instance:
/* spec-meta-start
   {"test-interface":"Efl.Pack_Linear",
    "test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid"],
    "custom-mapping" : {
       "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS"
    }
   }
   spec-meta-end */

The "test-interface" key specifies the interface being tested.
The "test-widgets" key specifies the widgets where this interface will be tested.
"custom-mapping" is an optional key. Some interface methods might require that an object of a specific type is passed as parameter. With "custom-mapping" you can specify the types of these objects for each widget. The above example instructs the test framework to inject objects of type EFL_UI_GRID_DEFAULT_ITEM_CLASS when testing methods of the Efl.Ui.Grid widget that require an object.

== Adding a widget to a test ==

Just add your widget name to the "test-widgets" array and recompile. Next run of the spec test suite will check if your widget follows the spec of this interface.

== Adding a new test ==

To add a new test you need to create the .c file and include the metadata comment at the top.
Remember to add the new .c file to the meson.build file.