Closed ttytm closed 2 months ago
With a fix the asserts in the added test can be enabled
I will look into that tomorrow, Thank you for the report @ttytm.
I can't reproduce the issue.
Ubuntu 22.04.3 LTS
Mozilla Firefox 126.0
my_function_integer 4: 12345.678900
Probably we may need the full logs to know what's going on. Also, the browser or WV you are using.
Happens in chrome and Firefox for me.
I see it doesn't reproduces in CI (asserts for floats are currently commented out, values are only printed):
JS passed:
await webui.assert_float(1.0, 2.3, 3.45);
backed prints:
num1: 1.000000, num2: 2.300000, num3: 3.450000
ref. Test Static step in: webui-dev/webui/actions/runs/9541169685/job/26293993613
Looks correct on the ubuntu runner.
The get_string call doesn't look right:
[User] webui_get_float_at([3])
[User] webui_get_string_at([3])
The example is unchanged ofc.
[Core] _webui_process(2) -> Argument 0: 3 bytes
[Core] _webui_process(2) -> Argument 1: 3 bytes
[Core] _webui_process(2) -> Argument 2: 3 bytes
[Core] _webui_process(2) -> Argument 3: 10 bytes
[Core] _webui_process(2) -> Expected and received 23 bytes of data.
Looks correct, the UI (bridge) sent all data. Can you please try:
assert(num3 == 3.45f);
[Core] _webui_process(2) -> Argument 0: 3 bytes [Core] _webui_process(2) -> Argument 1: 3 bytes [Core] _webui_process(2) -> Argument 2: 3 bytes [Core] _webui_process(2) -> Argument 3: 10 bytes [Core] _webui_process(2) -> Expected and received 23 bytes of data.
Looks correct, the UI (bridge) sent all data. Can you please try:
assert(num3 == 3.45f);
I'm receiving a 00 decimal so in the test its 3.00 and the assert does not work.
As the logs show, my_function_integer 4: 12345,000000
when 12345.6789
was passed.
Yes, I want to make sure that the actual value is .0
, I want to be sure the issue is not with the print format.
Yep the check failed, tested with atof/strtod/sscanf.
The conversion works correctly when setlocale(LC_NUMERIC, "C");
is set.
Then the assert works with the fully specified number:
assert(num3 == 3.450000); // true (requires setlocal on the tested machine)
assert(num3 == 3.45f); // false
I tried to reproduce the issue, but I can't, it always works fine for me. I manually test it in:
Please re-open if the issue still exists.
Bug Description
https://github.com/webui-dev/webui/blob/9518b9e8442c9cbd275110c4e7871d0fe9f934b7/examples/C/call_c_from_js/main.c#L35
prints:
Expected Behavior
Reproduction Steps
The
call_c_from_js
example can be used as reproductionError Logs
No response
Possible Solution
No response
Version
2.5.0-beta
Environment Details (OS name, version, etc.)