Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-06-08 19:40:08 +0300
committerHans Goudey <h.goudey@me.com>2022-06-08 19:40:14 +0300
commitfe4e646405eb3a8e38617411a2f9b1b8f6b8a8cb (patch)
tree1212e0a0b62d78e972eaf95f3af53211fbf45750 /source/blender/blenlib/tests/BLI_bounds_test.cc
parenta3e7280bd896f4e3755bb0ededfd83031e2734ea (diff)
Fix: Incorrect curves and pointcloud bounding boxes
The generic bounds utility used an incorrect initial value. The value cannot be zero-initialized, because that breaks the case where all values are greater than zero.
Diffstat (limited to 'source/blender/blenlib/tests/BLI_bounds_test.cc')
-rw-r--r--source/blender/blenlib/tests/BLI_bounds_test.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_bounds_test.cc b/source/blender/blenlib/tests/BLI_bounds_test.cc
index 9c123d4705c..5aa4e710e90 100644
--- a/source/blender/blenlib/tests/BLI_bounds_test.cc
+++ b/source/blender/blenlib/tests/BLI_bounds_test.cc
@@ -33,6 +33,13 @@ TEST(bounds, MinMaxFloat)
EXPECT_EQ(result->max, 3.0f);
}
+TEST(bounds, MinGreaterThanZero)
+{
+ Array<float> data = {1.5f, 3.0f, 1.1f, 100.0f};
+ auto result = bounds::min_max(data.as_span());
+ EXPECT_GT(result->min, 1.0f);
+}
+
TEST(bounds, MinMaxRadii)
{
Array<int2> data = {int2(0, 1), int2(3, -1), int2(0, -2), int2(-1, 1)};