libui: Fix clamping of input values in ui::Size
A previous change to fix a compiler warning broke the clamped-conversion of floating point input values to the int32_t values used internally. As a result, calling setWidth() or steHeight() with any floating point value resulted in a value of INT32_MIN being set, The existing Size_test unit test would have caught this issue, but it would have had to have been manually run since it was not configured to run automatically. No one noticed it was broken for a while since it is relatively new and the existing callers were not setting a floating point value. This change: 1) Fixes clamping of floating point values to work again, as verified by the existing test. 2) Helps enforce that the header remains conversion-warning free by enabling a few conversion warnings (as errors) when building the test. 3) Adds a TEST_MAPPING file, which will run Size_test as part of the presubmit runs (effectively continuously), as well as including the test in the device-test suite in the Android.bp file. 4) Adds a PrintTo() function for more clearly printing out a ui::Size value when using the Google Test framework. Bug: 149495759 Test: atest Size_test Change-Id: I8f18f20e6b5a3ea54eb383486a1f7222a1a2a544
Loading
Please register or sign in to comment