-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arc initial unit tests #2617
arc initial unit tests #2617
Conversation
There are some refactor opportunities that could be done in @cmumford Thanks for adding coverage report, it does look very nice 😸 , I need to research how to 'visualize' the coverage info in the source files within WSL tho. |
The docs was incorrect. I've updated it to say 0..100.
Can you mention some of these opportunities? |
If you have more tests ideas please let me know. How can I trigger
Thanks, I've updated the test accordingly
It's just a cleanup on the diff --git a/src/widgets/lv_arc.c b/src/widgets/lv_arc.c
index 4df3dc015..0cc1446f0 100644
--- a/src/widgets/lv_arc.c
+++ b/src/widgets/lv_arc.c
@@ -816,26 +816,24 @@ static void value_update(lv_obj_t * obj)
/*If the value is still not set to any value do not update*/
if(arc->value == VALUE_UNSET) return;
- int16_t bg_midpoint, range_midpoint, bg_end = arc->bg_angle_end;
- if(arc->bg_angle_end < arc->bg_angle_start) bg_end = arc->bg_angle_end + 360;
+ int16_t bg_end = arc->bg_angle_end;
+ if(arc->bg_angle_end < arc->bg_angle_start) bg_end += 360;
int16_t angle;
switch(arc->type) {
- case LV_ARC_MODE_SYMMETRICAL:
- bg_midpoint = (arc->bg_angle_start + bg_end) / 2;
- range_midpoint = (int32_t)(arc->min_value + arc->max_value) / 2;
+ case LV_ARC_MODE_SYMMETRICAL: {
+ int16_t bg_midpoint = (arc->bg_angle_start + bg_end) / 2;
+ int16_t range_midpoint = (int16_t)(arc->min_value + arc->max_value) / 2;
if(arc->value < range_midpoint) {
angle = lv_map(arc->value, arc->min_value, range_midpoint, arc->bg_angle_start, bg_midpoint);
- lv_arc_set_start_angle(obj, angle);
- lv_arc_set_end_angle(obj, bg_midpoint);
+ lv_arc_set_angles(obj, angle, bg_midpoint);
}
else {
angle = lv_map(arc->value, range_midpoint, arc->max_value, bg_midpoint, bg_end);
- lv_arc_set_start_angle(obj, bg_midpoint);
- lv_arc_set_end_angle(obj, angle);
+ lv_arc_set_angles(obj, bg_midpoint, angle);
}
- break;
+ } break;
case LV_ARC_MODE_REVERSE:
angle = lv_map(arc->value, arc->min_value, arc->max_value, arc->bg_angle_start, bg_end);
lv_arc_set_angles(obj, angle, arc->bg_angle_end); |
I left that function without tests on purpose. |
…mode and value is greater than middle range
8b1cd4b
to
48f1899
Compare
API comments should be only in the headers and a lot of files are already updated but still not all. I've pushed a commit to fix it case of the arc.
The functions from |
I tried to trigger the |
Can we merge this and keep the event test for later? |
Sure, every bit of test is a treasure. 🙂 Thank you very much! |
Description of the feature or fix
What the title says, if you need me to add any special test please let me know 😸
Checkpoints