don't use out of range float values in the test

These doubles are sometimes used as doubles and sometimes floats,
but it doesn't make sense to use values that can't be a float as one.
Just skip those in the test combinatorics.

Change-Id: Ibfdb699cac80b260258b164f95361110eb85c152
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309483
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2020-08-11 16:44:39 -05:00 committed by Skia Commit-Bot
parent d4328567af
commit ab6f9ef34a

View File

@ -50,6 +50,12 @@ DEF_TEST(ScaleToSides, reporter) {
for (int i = 0; i < numInterestingValues; i++) {
for (int j = 0; j < numInterestingValues; j++) {
for (int k = 0; k < numInterestingValues; k++) {
// We're about to cast values i and j to float, don't bother if they won't fit.
// (Is there a more robust way to test this, like SkTFitsIn but double->float?)
if (interestingValues[i] > FLT_MAX ||
interestingValues[j] > FLT_MAX) {
continue;
}
float radius1 = (float)interestingValues[i];
float radius2 = (float)interestingValues[j];
double width = interestingValues[k];