1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

388 Commits

Author SHA1 Message Date
Gabor Kiss-Vamosi
a76bb70a79 feat(arc): add lv_arc_align_obj_to_angle and lv_arc_rotate_obj_to_angle 2022-04-27 14:24:45 +02:00
Gabor Kiss-Vamosi
318146a2c2 feat(draw): support transforming widgets and improfe sw transform
For details see: https://docs.lvgl.io/master/overview/style.html
2022-04-26 10:45:12 +02:00
Gabor Kiss-Vamosi
17f5e0accb fix(slider): fix left knob in ranged mode
fixes: #3285
2022-04-20 11:19:26 +02:00
Gabor Kiss-Vamosi
9997fb00aa feat(dropdown): add lv_dropdown_get_option_index 2022-04-19 11:25:29 +02:00
guoweilkd
9137840582
fix(canvas):image cache may expire after set canvas's buff (#3267) 2022-04-11 13:35:28 +02:00
Gabor Kiss-Vamosi
127d8e82e3 fix(textarea): fix max length handling 2022-03-24 18:48:25 +01:00
Carlos Diaz
2b6cc3bc9c
ci(slider): add unit test (#3198)
* slider: Refactor LV_SLIDER_KNOB_COORD and draw_knob

The `hor` parameter of this macro was always true, ending up always using the
left side of the ternary operator, with this refactor we eliminate the `hor`
parameter and remove the ternary operator it was used for.

This macro is only used in the `draw_knob` event handler, so it helps with its
initial cleanup.

* test(slider): Test documented default properties

* test(slider): Tests for LV_EVENT_KEY with valid and invalid keys

* feat(slider): Add helper to know if slider is horizontal

* chore(slider): Cleanup LV_EVENT_PRESSING handler

Reduce scope of variables where possible and use LV_CLAMP

* chore(slider): Cleanup draw_knob

* test(slider): Add tests for LV_EVENT_RELEASED

* test(slider): Add note about left_knob_focus

* test(slider): Initial test for hit test

* test(slider): Add tests for different slider modes

* chore(slider): cleanup draw_knob

* chore(slider): Cleanup position_knob

* test(slider): Move group configuration to setUp

* test(slider): Refactor tests with feedback

* add test_ranged_mode_adjust_with_encoder

* code formatting

* tests(slider): Remove direct usages of left_knob_focus

* test(slider): Remove unused variable

* Revert "test(slider): Refactor tests with feedback"

This reverts commit b274f829ecd83c894569b6f0535c7edebce5cbc9.

* test(slider): Add missing variable

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2022-03-23 13:05:30 +01:00
Gabor Kiss-Vamosi
306fa19682 fix(table): invalidate only the changed cell
fixes: https://forum.lvgl.io/t/refresh-cells-that-changed/8454
2022-03-18 15:16:06 +01:00
ckielstra
f79e2838cb
chore(doc): spelling (#3172)
* Spelling: 'an unicode' -> 'a unicode'

* fix(changelog) spelling

* Remove double spaces

* Spelling
2022-03-16 10:19:19 +01:00
Gabor Kiss-Vamosi
18f2d78728 fix(roller): fix unexpected jump in infinite mode
fixes #3132
2022-03-01 18:40:39 +01:00
Carlos Diaz
406386dc3f
test(line): add unit tests for line widget (#3104)
* test(line): Test y invert field

* test(line): Validate documented default values

* test(line): Assert line is not clickable after construction

* test(line): Test line size calculation

* chore(line): Refactor LV_EVENT_GET_SELF_SIZE handling

Return early when no point_array is set or point_num is 0

* chore(line): Cleanup LV_EVENT_DRAW_MAIN handling

Reduce scope of point variables

* test(line): Clean screen on tearDown

* test(line): Add initial test for extra draw size calculation

* test(line): Fix extra draw size test
2022-02-25 19:58:43 +01:00
Andres O. Vela
340d45cfa9
feat(label): added animation style property to apply it to circular scrolling animation of label widget (#3128)
* feat(label): added animation style property to apply it to circular scrolling animation of label widget

Added an animation style property to be used as animation template for different use cases in different widgets.
This commit implements using this property to set the start and repeat delay of the circular scrolling animation of the label widget.

Closes #3097

* fix(label): changed animation style property's var_type to `const lv_anim_t *`

* example(label): added example showing how to customize circular scrolling animation

* chore(label): ran code-format.py and added missing function prototype to lv_example_widgets.h
2022-02-25 11:54:27 +01:00
Carlos Diaz
e25fa427d1
test(table): replicate issue when reducing table cells (#3121)
* test(table): Replicate issue when reducing table cells

See #3120 for report

* test(table): Cell reduction test without use after free

Set the row count to 1 to be able to have a passing test, now we can track
down the real bug, which is triggered when having more than 1 row in the table.

* test(table): Add failing test for cell reduction

This test currently triggers the use after free bug

* chore(table): No-op when new and current row and columns counts are equal

* chore(table): Clean up lv_table_set_col_cnt

* chore(table): Add comments to get_row_height

* chore(table): Minor format cleanup and comment of cell_data layout

* fix ASAN arror

* minor fixes

* chore(table): Restore comments to get_row_height

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2022-02-24 19:14:33 +01:00
Alexandre Abadie
774403b3cf
fix(script): in lv_conf_internal fix some widget dependencies when using Kconfig (#3119)
* widgets: make dependencies internal handling consistent when using Kconfig

* scripts/lv_conf_internal_gen.py: fix issue with widget with dependencies

* scripts/lv_conf_internal_gen.py: allow to call it from other directory
2022-02-22 19:45:33 +01:00
Carlos Diaz
ab727d3181
test(textarea): add unit test (#3074)
* test(textarea): Password mode

* test(textarea): label style with one line enabled

* test(textarea): Cursor click pos

* chore(textarea): Move auto hide to helper

* test(textarea): Placeholder text

* test(textarea): Default properties values

* test(textarea): Remove assert from one line test

* tests(textarea): Remove unused variables

* feat/textarea: Add and use is_valid_but_non_printable_char

* chore/textarea: General cleanup

* test(textarea): Accepted chars

* Update src/widgets/lv_textarea.c

* test(textarea): Assert text is empty after widget creation

* test(textarea): Update test for label style with one line enabled

* test(textarea): Add default text helper and use it

* test(textarea): Ignore line break chars in one line mode

* textarea: Check for line break chars sooner when adding char

* textarea: Start refactor of insert_handler

* textarea: Add comments to insert_handler

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2022-02-17 18:12:59 +01:00
Carlos Diaz
cfd6d43672
test(table): add unit tests (#3040)
* test(table): Happy path test for set_cell_value

* table: Abstract char configuration on set_cell_value

Abstract bytes to allocate calculation and txt copying

* table: Add missing &

* table: Update helper names

* test(table): Add test for column increasing when setting a formatted cell value

* table: Increase table columns when needed

* test(table): Fix test_table_should_grow_columns_automatically_when_setting_formatted_cell_value

* table: Fix code formatting

* test(table): Add test for cell ctrl

* table: Refactor draw_main low hanging fruits

* lv_table: Initial refactor of get_row_height

Mostly early breaks on loops and reducing variable scope where possible

* lv_table: Initial refactor of refr_size

Adding const wherever is possible

* lv_table: Further cleanup get_row_height

* lv_table: Cleanup loop in draw_main

* lv_table: Fix -Werror=shadow compilation error

* test(table): Tests for cell ctrl clearance

* lv_table: Rename index to idx

* lv_table: Use helper to know if cell is empty

* test(table): Comment assumptions to column grow test

* test(table): Row height with multi line cell value

* test(table): Wrap on long texts and increase row height

* add rendering test

* fix warnings

* fix out of bounds indexig

* fix rendering test

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2022-02-17 13:52:46 +01:00
Mariotaku
70c2b57abe
fix(canvas): force canvas to use sw draw (#3045)
* force canvas to use sw draw

* added userdata to lv_draw_sdl_drv_param_t

* fixing build test

* Update src/draw/sdl/lv_draw_sdl.h

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2022-01-25 13:24:34 +01:00
Gabor Kiss-Vamosi
5ec532dfd5 fix(sw): make knob size calculation more intuitive 2022-01-24 16:21:43 +01:00
Carlos Diaz
0b68840cd9
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
2022-01-22 16:17:13 +01:00
Gabor Kiss-Vamosi
345f6882c9 fix(arc): fix knob invalidation 2022-01-19 14:02:11 +01:00
Gabor Kiss-Vamosi
0921dfc8cd fix(switch): make knob height calculation similar to slider
That is use the switch's full height without padding as default knob height
2022-01-18 11:25:23 +01:00
ckielstra
febafd1cc7
chore: many trivial spelling and layout fixes (#3008)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2022-01-17 08:10:23 -05:00
Gabor Kiss-Vamosi
8d52de14b3 fix(table, chart): fix memory leaks
fixes #2967
2022-01-15 20:43:17 +01:00
Gabor Kiss-Vamosi
7c8adba839 chore: fix warning 2022-01-15 20:02:02 +01:00
Gabor Kiss-Vamosi
5709528550 fix(roller): clip overflowing text 2022-01-15 13:56:39 +01:00
Gabor Kiss-Vamosi
0a5a07278e chore(slider): fix warning 2022-01-08 13:57:58 +01:00
Gabor Kiss-Vamosi
9d3fb41896 feat(slider): consider ext_click_area on the knob with LV_OBJ_FLAG_ADV_HITTEST 2022-01-08 13:48:35 +01:00
guoweilkd
ee3aa07a83
feat(obj): subdivide LV_OBJ_FLAG_SCROLL_CHAIN into ...CHAIN_HOR and ...CHAIN_VER (#2961)
* feat(obj scroll):subdivide LV_OBJ_FLAG_SCROLL_CHAIN into ...CHAIN_HOR and ...CHAIN_VER

* feat(roller):open the horizontal scroll chain

* chore(docs):improve the description of scroll chain
2022-01-05 13:44:05 +01:00
Gabor Kiss-Vamosi
364ca3ca17 fix(bar, slider): fix shadow drawing on short indicators
The issue is related to the case when the indicator is short but the main part (bg) clips it with a larger radius.
In this case this indicaotr might have a strange shape, like
 _
/ |
| |
\_|

We can't draw a shadow like this, so the indicator has to be et least a square,
to be sure it's not clipped to an ugly shape.

The previous code considered the bg radius to decide whether to draw shadow on short indicators or not.
However if the indicator's radius should be considered, becuse if its area at least a square
we can already draw shadows.
2022-01-04 10:49:07 +01:00
Malte Langermann
9ca4f56c0e
fix(canvas): off by one error in size check in lv_canvas_copy_buf (#2950) 2022-01-03 12:41:04 +01:00
Gabor Kiss-Vamosi
2392f585bb fix(btnmatrix): fix crash if an empty btnmatrix is pressed 2021-12-22 21:18:07 +01:00
Gabor Kiss-Vamosi
4d61f38020 fix(label): dot not add dots if the label height > 1 font line height
fixes: #2907
2021-12-22 17:55:47 +01:00
xennex22
935caa64e4
fix: fix parameter order in function prototypes (#2929)
* Fixed inconsistent header for find_track_end()

* Fixed inconsistent header for lv_tileview_add_tile()

* Made ptr const in lv_tlsf_free()

* Made ptr const in lv_tlsf_free()

* Corrected lv_bar_set_value() calls

* Corrected use of bool for lv_anim_enable_t

* Fixed uninitialised variable for performance monitor

* Undo fix
2021-12-21 20:09:49 +01:00
Gabor Kiss-Vamosi
db53ea925c arch(draw): allow replacing the draw engine
BREAKING CHANGE: the API of lv_draw_... function have been changed
2021-12-21 15:54:22 +01:00
guoweilkd
8315eb1ca4
feat(txt): add used_width parameter to _lv_txt_get_next_line() (#2898) 2021-12-21 10:37:02 +01:00
Paul
28d06b0354
fix(dropdown): in lv_dropdpwn_get_selected_str handle if there are no options (#2925)
* fix lv_dropdown_get_selected_str

* fix lv_dropdown_get_selected_str

* fix lv_dropdown_get_selected_str
2021-12-20 15:57:03 +01:00
Gabor Kiss-Vamosi
fa9340c45f fix(roller): snap on press lost
fixes #2916
2021-12-20 15:09:32 +01:00
Gabor Kiss-Vamosi
cb7fc2bb59 fix(dropdown) be sure the list is the top object on the screen
fixes #2893
2021-12-13 20:26:24 +01:00
Gabor Kiss-Vamosi
d47cd1d7fe fix(btnmatrix): keep the selected button even on release
fixes: #2858
2021-12-07 15:38:11 +01:00
Carlos Diaz
559c2cdc9e
test(switch): add initial unit test (#2794)
* test(switch): Add test file and state at creation test

* test(switch): Event handler called only once per click

* test(switch): Add test state change when event bubbling is enabled

* test(switch): Cleanup event bubbling test

* tests(switch): Update memory test and add basic animation test

* test(switch) Add helper to click on switch

* test(switch) Add basic test for knob size calculation

* misc(switch) Replace switch knob rounding error magic number with define

* test(switch) Improve animation test

Properly wait for 50ms after clicking on the switch using lv_test_indev_wait and also assert on switch state after the first and second clicks

* test(switch) cleanup

* misc(switch) Cleanup

* switch: Expose _LV_SWITCH_KNOB_EXT_AREA_CORRECTION value

So we can use it when testing extra draw size
2021-12-07 13:49:26 +01:00
ckielstra
91fc579ee7
docs fix spelling, parameter descriptions, comments, etc (#2865) 2021-12-02 08:44:05 -05:00
Gabor Kiss-Vamosi
d5ede0ebc6 fix(img) fix invalidation issue on transformations
fixes #2853
2021-11-30 20:35:12 +01:00
Mariotaku
6791522588
fix(checkbox) remove unnecessary events (#2829)
* Fixed LV_EVENT_VALUE_CHANGED event in lv_checkbox

* Update CHANGELOG.md

* Removed LV_EVENT_PRESSED/RELEASED related event

* Update docs/CHANGELOG.md

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2021-11-23 16:36:44 +01:00
Gabor Kiss-Vamosi
9d3134b66e feat(dropdown): keep the list on open/close for simpler styling
So far it was deleted on close, now it's just hidden/unhidden
2021-11-23 13:45:46 +01:00
Xiang Xiao
3a0069adf8
chore(format): run code-format.sh (#2822)
* fix(format): run code-format.sh

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>

* fix(astyle): add the 3rd party source file to exclude list

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-22 13:32:48 +01:00
Xiang Xiao
58d9645a5c
chore: replace (void)xxx with LV_UNUSED(xxx) (#2779)
and remove the redundant inclusion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-09 13:48:02 +01:00
Kevin Thibedeau
53a3e17f76
fix(proto) Remove redundant prototype declarations (#2771) 2021-11-07 16:03:31 +08:00
Gabor Kiss-Vamosi
580e05a0e1 fix(label) update lv_label_get_letter_pos to work with LV_BASE_DIR_AUTO too
related to #2712
2021-10-29 10:52:01 +02:00
Gabor Kiss-Vamosi
6df51225c2 fix(label) consider base dir lv_label_get_letter_pos in special cases
related to https://github.com/lvgl/lvgl/issues/2712#issuecomment-953463193
2021-10-28 19:48:13 +02:00
Xiang Xiao
91cf82d081
fix: mark unused variable with LV_UNUSED(xxx) instead of (void)xxx (#2734)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-10-27 10:00:06 +02:00