test(bar): add unit tests (#2845)

* test(bar) Add test for docummented default attributes

* test(bar) Update test for docummented default attributes

* test(bar): Indicator width tracks value

* test(bar) Calculate bar indicator width based on its style

Take padding, max value and bar value into consideraion

* test(bar) Indicator area gets smaller when increasing padding in LV_PART_MAIN style

* test(bar) Start value changes only when in range mode

* docs(bar): Add missing MODE to symbols

* test(bar) Start value should be smaller than current value

* test(bar): Test current value truncation to max and min value

* bar: Check bar mode in lv_bar_set_start_value

bar start_value can be changed only when bar is in LV_BAR_MODE_RANGE mode.
Return early when it's not.

* test(bar): Fix width calculation test

* bar: Initialize indic_area in constructor

* test(bar): Refactor indicator coordinate update test

* test(bar): Indicator negative value in symmetrical mode

* test(bar): Fix base direction

* test(bar): Indicator coord test for RTL base dir
This commit is contained in:
Carlos Diaz
2022-01-22 09:17:13 -06:00
committed by GitHub
parent 1f9d3892a3
commit 0b68840cd9
3 changed files with 264 additions and 3 deletions

View File

@@ -29,8 +29,8 @@ The new value in `lv_bar_set_value` can be set with or without an animation depe
### Modes
The bar can be one of the following modes:
- `LV_BAR_MODE_NORMAL` A normal bar as described above
- `LV_BAR_SYMMETRICAL` Draw the indicator from the zero value to current value. Requires a negative minimum range and positive maximum range.
- `LV_BAR_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value always has to be smaller than the end value.
- `LV_BAR_MODE_SYMMETRICAL` Draw the indicator from the zero value to current value. Requires a negative minimum range and positive maximum range.
- `LV_BAR_MODE_RANGE` Allows setting the start value too by `lv_bar_set_start_value(bar, new_value, LV_ANIM_ON/OFF)`. The start value always has to be smaller than the end value.
## Events
- `LV_EVENT_DRAW_PART_BEGIN` and `LV_EVENT_DRAW_PART_END` are sent for the following parts: