Commit Graph

131 Commits

Author SHA1 Message Date
guoweilkd
8315eb1ca4
feat(txt): add used_width parameter to _lv_txt_get_next_line() (#2898) 2021-12-21 10:37:02 +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
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
Gabor Kiss-Vamosi
918b3defd7 test(dropdown) fix to pass again 2021-11-23 14:13:24 +01:00
Gabor Kiss-Vamosi
b279f63d6b test(template) simplify _test_template.c
Originally added here 7278089040
but lost somehow
2021-11-11 17:36:12 +01:00
Gabor Kiss-Vamosi
80f0b09e34 test fix LV_USE_LOG_LEVEL -> LV_LOG_LEVEL typo
Related to #2673
2021-10-19 17:40:41 +02:00
Gabor Kiss-Vamosi
e83df6f14d test(arc): add test case for adv_hittest 2021-10-19 17:36:37 +02:00
Carlos Diaz
42989d4e9a
test(txt) initial unit tests and general code cleanup/fixes (#2623)
* test(txt): Add test for identifying empty text when trying to get next line

* test(txt): Rename next line empty string handling test

* test(txt): Add tests for _lv_txt_is_cmd

* test(txt): Add initial tests for _lv_txt_ins

* fix(txt): Check for NULL before using strlen

Passing NULL to strlen is not defined, so we should avoid it

* txt: Update docs

Remove docs from source file and add comment about pointers to NULL terminated arrays where necessary

* txt: Misc update in encoded_size

* test(txt): first tests for _lv_txt_cut

* tests: Remove -Wmissing-prototype flag from compilation

This will allow us to have cleaner test cases files.

* test(txt): Remove test (funtion) prototypes as they're no longer necessary

* Update src/misc/lv_txt.h

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

* Update src/misc/lv_txt.h

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

* Revert "tests: Remove -Wmissing-prototype flag from compilation"

This reverts commit 8b3217de8d.

* test(txt): Use pragma to disable missing-prototype warning

* test: use extended set of compile options for test cases

* Revert "test(txt): Use pragma to disable missing-prototype warning"

This reverts commit 64909e30ed.

* test(txt): Add assert to test_txt_cut_len_longer_than_string test

* test(txt): Add test for _lv_txt_encoded_next on valid ascii input

* test(txt): Add tests for _lv_txt_encoded_next with 2 byte long inputs

* test(txt): Add tests for _lv_txt_encoded_next with 3 byte long inputs

* test(txt): Add tests for _lv_txt_encoded_next with 4 byte long inputs

* cleanup(txt): Add helper macros to identify ASCII and UTF8 codes

* cleanup(txt): Add missing LV_ prefix to helper macros

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
2021-10-15 11:37:53 +02:00
Gabor Kiss-Vamosi
7a95fa9e2d test add 3rd party libs to all tests and also fix them
Fixes: #2661
2021-10-12 17:03:50 +02:00
Carlos Diaz
3b6a05e253
test add setUp and tearDown to test template (#2648) 2021-10-11 14:22:55 +02:00
Carlos Diaz
acf915b896
test(arc) add initial unit tests (#2617)
* test(arc): Add test for valid creation

* test(arc): Add test for max value truncation

* test(arc): Add test for min value truncation

* test(arc): Add test for value adjustment after updating range

* test(arc): Update test for min value truncation

* test(arc): Add test for angle updating after changing to symmetrical mode

* test(arc): Add test for angle updating after changing to symmetrical mode and value is greater than middle range

* test(arc): Use unity setUp function

* remove API comments from lv_arc.c

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2021-10-07 19:01:02 +02:00
Gabor Kiss-Vamosi
18f61c5f77
arch add small 3rd party libs to lvgl (#2569)
* move png, sjpg, bmp, gif, fs_if to extra/libs

* reorganize the examples

* update lv_conf_internal.h

* fix warnings

* add freetype

* remove unused assets

* add the new libs to build tests

* update the docs
2021-10-04 14:34:11 +02:00
Carlos Diaz
bb6829796b
test(checkbox) add initial tests (#2551)
* test(checkbox): Add initial test for checkbox

* test(checkbox): Add test_checkbox_should_have_default_text_when_created

* test(checkbox): Add test_checkbox_should_return_dinamically_allocated_text

* test(checkbox): Add initial tests for static text

Tests are failing tho

* test(arc): Rename bugfix test to arc

Also adds reference to issue in a comment

* test(checkbox): Tests for static text passes

* test(checkbox): Remove test for memory freeing when static text is refreshed

NULL isn't a valid parameter in lv_checkbox_set_text_static
2021-09-20 20:38:47 +02:00
Carlos Diaz
ab50f001a6
feat(tests): Include debug information to test builds (#2568) 2021-09-19 15:23:21 -04:00
Chris Mumford
b1bf7fd29a
test(ci) build and run tests in parallel. (#2515)
Create one GitHub workflow job for each build option build
or test execution. This allows each of the five builds to
be executed in parallel as well as making it easier to
navigate to the test output as it now resides in its own
job.

This change **does** change the command-line arguments to
the test execution script. This is required to allow the
build options name to be passed in.

New `tests/main.py` command-line help:

```
usage: main.py [-h] [--build-options BUILD_OPTIONS] [--clean]
               [--report]
               [{build,test} [{build,test} ...]]

Build and/or run LVGL tests.

positional arguments:
  {build,test}          build: compile build tests, test:
                        compile/run executable tests.

optional arguments:
  -h, --help            show this help message and exit
  --build-options BUILD_OPTIONS
                        the build option name to build or run.
                        When omitted all build configurations
                        are used.
  --clean               clean existing build artifacts before
                        operation.
  --report              generate code coverage report for
                        tests.

This program builds and optionally runs the LVGL test programs.
There are two types of LVGL tests: "build", and "test". The
build-only tests, as their name suggests, only verify that the
program successfully compiles and links (with various build
options). There are also a set of tests that execute to verify
correct LVGL library behavior.
```
2021-09-01 11:58:14 +02:00
Chris Mumford
df6cbfe866
ci(tests) run tests using ctest (#2503)
Simplifies `tests/main.py` as it no longer needs to invoke
tests individually or keep track of and report their pass/fail
status.

Also enables the ability to run tests in parallel, support timeouts,
and re-run flaky tests.

https://cmake.org/cmake/help/latest/manual/ctest.1.html
2021-08-30 08:45:33 -04:00
Chris Mumford
c11569dc5c
ci(tests) use common script to install development prereqs (#2504)
Simplified workflow and documentation, by moving the
development package prerequisites into a new build script
`scripts/install-prerequisites.sh`.

Also, moved prerequisite installation into its own CI step and
removed explicit working directory change as it is no longer
needed (`main.py` does it).
2021-08-27 18:57:46 -04:00
Chris Mumford
9c846ee493
test convert Makefile to CMake (#2495)
* Convert tests/Makefile to a cmake project file.

This change switches the building of LVGL tests to use cmake
which is more portable than make. Additionally, whenever
cmake can be used, instead of the Python script (`main.py`),
the former is preferred.

The interface to `main.py` is unchanged, and tests are built
and executated the same as before.

This closes https://github.com/lvgl/lvgl/issues/2474.

* Installing `gcovr` in GitHub workflow.

* Documented steps to install libpng-dev.

* Added missing stdout flush when running tests.

* Grammar tweak in README.

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2021-08-27 15:49:31 +02:00
Gabor Kiss-Vamosi
9fb98da8a2 test(dropdown) remove dummy test case
relaetd to https://github.com/lvgl/lvgl/issues/2337#issuecomment-905002568
2021-08-26 12:11:29 +02:00
Chris Mumford
53986b4b0e
test Refactor unit test scripts. (#2473)
* Refactor unit test scripts.

Does the following:

1. Remove as many dependencies on the operating system shell as possible.
   For example, use of shutil.rmtree(...) instead of os.system('rm -r ...').
   This brings this script a bit closer to being able to run on Windows.
2. Switch from os.system() to subprocess.check_call().
   * This is a bit more secure as check_call() directly invokes the subprocess
     without evaluation the arguments on a command-line.
   * Removes the need to evaluate the return code as check_call() does this.
   * Can directly set environment variables (e.g. env=cmd_env) instead of
     including with subprocess invocation (e.g. BIN=test.bin).
3. Minor cleanup to main.py sys.argv parsing.
4. PEP8 formatting.

* Ignore FileNotFoundError for rmtree('report').

* Back to os.system for gcovr.

* Removed unused shutil import.
2021-08-25 15:37:59 +02:00
Gabor Kiss-Vamosi
906448ef63 feat(obj) place the scrollbar to the left with RTL base dir.
Related to #2424
2021-08-19 12:51:29 +02:00
Themba Dube
ae15a1bbfe Revert "fix(tests) remove src/test_runners when cleaning"
This reverts commit 6726b0f5df.
2021-08-03 10:25:20 -04:00
Themba Dube
6726b0f5df fix(tests) remove src/test_runners when cleaning 2021-08-03 09:38:13 -04:00
Gabor Kiss-Vamosi
5b3d3dc8b3 perf(draw) reimplement rectangle drawing algorithms
No functionalty has changed only make them more readable and faster.
2021-08-02 15:45:14 +02:00
Gabor Kiss-Vamosi
637b706ddc
perf(draw) reimplement circle drawing algorithms (#2374)
* perf(draw) reimplement circle drawing algorithms

Imporve the speed of circle drawing
Add circle draw caching
Various other speed improvements

* docs describe how to use masks

* fix(draw) add missing GC root usage
2021-07-27 19:16:00 +02:00
Themba Dube
3eacc5923c ci add config for 8bpp 2021-07-15 17:12:25 -04:00
Gabor Kiss-Vamosi
88c485949f feat(event, widgets) improve the paramter of LV_EVENT_DRAW_PART_BEGIN/END
Add lv_<widget>_draw_part_type_t to widgets to precisly describe the hooked drawings.
Also add class_p element to lv_obj_draw_part_dsc_t to show what widgets lv_<widget>_draw_part_type_t needs to be used.

Related to: https://forum.lvgl.io/t/how-to-add-minor-division-lines-to-a-chart/5366/
2021-07-07 16:19:06 +02:00
Themba Dube
4fff99da1d feat(tests) upload coverage to codecov 2021-07-05 13:58:46 -04:00
Gabor Kiss-Vamosi
90438603ad fix(test) do not including anything in test files when not running tests 2021-07-01 21:14:00 +02:00
Gabor Kiss-Vamosi
36b9db38b7 fix tests 2021-06-28 11:13:34 +02:00
Gabor Kiss-Vamosi
449952e3b7 fix tests 2021-06-28 11:08:46 +02:00
Gabor Kiss-Vamosi
c38cae22fb test fix CI build error 2021-06-23 23:04:12 +02:00
Gabor Kiss-Vamosi
61cda59cbe test fix build error 2021-06-23 22:19:51 +02:00
Gabor Kiss-Vamosi
4143b804c8 test(dropdown) add tess for keypad and encoder 2021-06-23 21:51:52 +02:00
Gabor Kiss-Vamosi
e536bb6325 test add keypad and encoder emulators 2021-06-23 21:51:14 +02:00
Gabor Kiss-Vamosi
2ba810b8de tests add mosue emulator 2021-06-23 15:51:30 +02:00
Gabor Kiss-Vamosi
b765643e49 tests add README 2021-06-23 15:51:12 +02:00
Gabor Kiss-Vamosi
3672f87332 test move more source files to src folder 2021-06-23 13:23:47 +02:00
Gabor Kiss-Vamosi
b9b4ba5b26 test cleant up report folder 2021-06-18 14:15:53 +02:00
Gabor Kiss-Vamosi
e35b1d04bd test add build test again, add dropdown test, integrate gcov and gvocr 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
e9e010a846 test add move tests to test_cases and test_runners directories 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
bc5b3be61f test(font_loader) migrate the exisiting font loader test 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
28d2ad4c3a feat(test) add assert for screenshot compare 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
ea8bed34b4 chore(test) improve prints 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
7610d38bb0 fix(test) silence make 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
c12a22ee87 fix(test) add #if guard to exclude test related files from the build 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
c26bcf1cc6 feat(test) first experiement with Unity test engine 2021-06-18 14:13:41 +02:00
Gabor Kiss-Vamosi
8dd33a0041 fix warnings 2021-05-29 07:32:44 +02:00
Gabor Kiss-Vamosi
6aa27cc11b refactor(label, text area) rename functions of text_sel to text_selection 2021-05-13 15:39:06 +02:00
Gabor Kiss-Vamosi
070df61eb2 refactor(color) refactor the palette API 2021-04-23 12:46:14 +02:00