Conversation
|
Hmm, the failure in CI (linux-latest-dev) doesn't happen on my local machine. I'll just leave the PR as-is and maybe you can figure out what the issue is :) |
I checked other places where TGUI/tests/Widgets/EditBox.cpp Line 356 in 6759d47 Unlike your code, my test didn't restore the original value when it's done. So if that test runs before yours then it will fail.
Maybe |
|
"Maybe !(hi < lo) can be replaced by hi >= lo?" - I considered that but rejected it since most types implement operator< but not necessarily other operators, so this is the form that would work for most types. |
|
I'll update the PR regarding blink rate. |
|
I don't think the clamp function will ever be used on a non-numeric type that lacks a |
762b54d to
82a921d
Compare
Commit ef7de90 missed a spot.
As far as I can tell, tgui::clamp matches the behaviour and precondition requirements of std::clamp exactly, but if a user passes a value of 'hi' that is less than 'lo' then the returned result may be surprising (not undefined, just not what you'd expect). To guard against such surprises I think it is prudent to add an assert for debug builds that checks the precondition - it costs nothing for release builds but may save some users from a nasty surprise in debug builds.
This adds tests for some (not all) global TGUI functions declared/defined in Global.hpp/Global.cpp Some of these were already fully or partially covered transitively by other tests, but adding explicit tests doesn't hurt. This just makes the tests explicit and expands the coverage. Some global functions are not tested yet since I need to figure out how to do that properly, but that doesn't detract from these tests.
82a921d to
147a796
Compare
A mixed bag of stuff for you :)