Skip to content

Commit 6c122f5

Browse files
committed
Fixes for unity build
1 parent 2dabc52 commit 6c122f5

File tree

6 files changed

+37
-30
lines changed

6 files changed

+37
-30
lines changed

tests/yup_graphics/yup_ColorGradient.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828

2929
using namespace yup;
3030

31-
namespace
32-
{
33-
static constexpr float tol = 1e-5f;
34-
} // namespace
35-
3631
TEST (ColorGradientTests, Default_Constructor)
3732
{
3833
ColorGradient gradient;
@@ -74,6 +69,8 @@ TEST (ColorGradientTests, Two_Color_Linear_Constructor)
7469

7570
TEST (ColorGradientTests, Two_Color_Radial_Constructor)
7671
{
72+
static constexpr float tol = 1e-5f;
73+
7774
Color green (0xff00ff00);
7875
Color yellow (0xffffff00);
7976
ColorGradient gradient (green, 50.0f, 60.0f, yellow, 80.0f, 90.0f, ColorGradient::Radial);
@@ -128,6 +125,8 @@ TEST (ColorGradientTests, Multi_Stop_Constructor)
128125

129126
TEST (ColorGradientTests, Multi_Stop_Radial_Constructor)
130127
{
128+
static constexpr float tol = 1e-5f;
129+
131130
std::vector<ColorGradient::ColorStop> stops;
132131
stops.emplace_back (Color (0xffff0000), 10.0f, 20.0f, 0.0f);
133132
stops.emplace_back (Color (0xff0000ff), 40.0f, 50.0f, 1.0f);
@@ -529,6 +528,8 @@ TEST (ColorGradientTests, Constructor_Default_Type_Parameter)
529528

530529
TEST (ColorGradientTests, Constructor_Explicit_Type_Parameter)
531530
{
531+
static constexpr float tol = 1e-5f;
532+
532533
Color startColor (0xff00ff00); // Green
533534
Color endColor (0xffff00ff); // Magenta
534535

@@ -558,6 +559,8 @@ TEST (ColorGradientTests, Constructor_Explicit_Type_Parameter)
558559

559560
TEST (ColorGradientTests, AddColorStop_With_Delta_Only)
560561
{
562+
static constexpr float tol = 1e-5f;
563+
561564
ColorGradient gradient;
562565

563566
// Add first stop to establish baseline

tests/yup_graphics/yup_Line.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525

2626
using namespace yup;
2727

28-
namespace
29-
{
30-
static constexpr float tol = 1e-5f;
31-
} // namespace
32-
3328
TEST (LineTests, DefaultConstructor)
3429
{
3530
Line<float> l;
@@ -146,6 +141,8 @@ TEST (LineTests, KeepOnlyStartAndEnd)
146141

147142
TEST (LineTests, RotateAtPoint)
148143
{
144+
static constexpr float tol = 1e-5f;
145+
149146
Line<float> l (2.0f, 0.0f, 4.0f, 0.0f);
150147
auto rl = l.rotateAtPoint (Point<float> (2.0f, 0.0f), MathConstants<float>::halfPi);
151148
EXPECT_NEAR (rl.getStartX(), 2.0f, tol);
@@ -299,6 +296,8 @@ TEST (LineTests, TypeConversionEdgeCases)
299296

300297
TEST (LineTests, RotationEdgeCases)
301298
{
299+
static constexpr float tol = 1e-5f;
300+
302301
// Test rotation with different angles
303302
Line<float> l (0.0f, 0.0f, 2.0f, 0.0f);
304303

tests/yup_graphics/yup_Path.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ using namespace yup;
3131

3232
namespace
3333
{
34-
static constexpr float tol = 1e-4f;
35-
36-
void expectPointNear (const Point<float>& a, const Point<float>& b, float tolerance = tol)
34+
void expectPointNear (const Point<float>& a, const Point<float>& b, float tolerance = 1e-4f)
3735
{
3836
EXPECT_NEAR (a.getX(), b.getX(), tolerance);
3937
EXPECT_NEAR (a.getY(), b.getY(), tolerance);
4038
}
4139

42-
void expectRectNear (const Rectangle<float>& a, const Rectangle<float>& b, float tolerance = tol)
40+
void expectRectNear (const Rectangle<float>& a, const Rectangle<float>& b, float tolerance = 1e-4f)
4341
{
4442
EXPECT_NEAR (a.getX(), b.getX(), tolerance);
4543
EXPECT_NEAR (a.getY(), b.getY(), tolerance);
@@ -222,6 +220,8 @@ TEST (PathTests, TransformAndTransformed)
222220

223221
TEST (PathTests, ScaleToFit)
224222
{
223+
static constexpr float tol = 1e-4f;
224+
225225
Path p;
226226
p.addRectangle (10, 10, 20, 20);
227227
p.scaleToFit (0, 0, 100, 50, false);
@@ -541,6 +541,8 @@ TEST (PathTests, AppendPathPractical)
541541

542542
TEST (PathTests, ScaleToFitPractical)
543543
{
544+
static constexpr float tol = 1e-4f;
545+
544546
Path p;
545547
p.addRectangle (10, 10, 20, 20);
546548
p.scaleToFit (0, 0, 100, 50, false);

tests/yup_graphics/yup_Point.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727

2828
using namespace yup;
2929

30-
namespace
31-
{
32-
static constexpr float tol = 1e-5f;
33-
} // namespace
34-
3530
TEST (PointTests, Default_Constructor)
3631
{
3732
Point<float> p;
@@ -120,6 +115,8 @@ TEST (PointTests, Magnitude)
120115

121116
TEST (PointTests, Circumference_Points)
122117
{
118+
static constexpr float tol = 1e-5f;
119+
123120
Point<float> center (1.0f, 1.0f);
124121
float radius = 2.0f;
125122
float angle = 0.0f; // 0 degrees
@@ -160,6 +157,8 @@ TEST (PointTests, Scaling)
160157

161158
TEST (PointTests, Rotation)
162159
{
160+
static constexpr float tol = 1e-5f;
161+
163162
float angle = MathConstants<float>::halfPi; // 90 degrees
164163

165164
{
@@ -473,6 +472,8 @@ TEST (PointTests, ApproximatelyEqualTo)
473472

474473
TEST (PointTests, EllipticalCircumference)
475474
{
475+
static constexpr float tol = 1e-5f;
476+
476477
Point<float> center (1.0f, 1.0f);
477478
float radiusX = 2.0f;
478479
float radiusY = 3.0f;
@@ -614,6 +615,8 @@ TEST (PointTests, Normalize_Zero)
614615

615616
TEST (PointTests, Transform_DifferentTypes)
616617
{
618+
static constexpr float tol = 1e-5f;
619+
617620
Point<float> p (1.0f, 2.0f);
618621

619622
// Test with translation
@@ -637,6 +640,8 @@ TEST (PointTests, Transform_DifferentTypes)
637640

638641
TEST (PointTests, Circumference_NegativeRadii)
639642
{
643+
static constexpr float tol = 1e-5f;
644+
640645
Point<float> center (1.0f, 1.0f);
641646
float radius = -2.0f; // Negative radius
642647

@@ -733,6 +738,8 @@ TEST (PointTests, VectorOperations_EdgeCases)
733738

734739
TEST (PointTests, NormalizationEdgeCases)
735740
{
741+
static constexpr float tol = 1e-5f;
742+
736743
// Test already normalized vector
737744
Point<float> normalized (0.6f, 0.8f); // magnitude = 1.0
738745
EXPECT_TRUE (normalized.isNormalized());
@@ -807,6 +814,8 @@ TEST (PointTests, LerpAndMidpoint_EdgeCases)
807814

808815
TEST (PointTests, RotationWithOrigin)
809816
{
817+
static constexpr float tol = 1e-5f;
818+
810819
Point<float> p (1.0f, 0.0f);
811820

812821
// Test rotation around origin
@@ -827,6 +836,8 @@ TEST (PointTests, RotationWithOrigin)
827836

828837
TEST (PointTests, AngleTo_EdgeCases)
829838
{
839+
static constexpr float tol = 1e-5f;
840+
830841
Point<float> origin (0.0f, 0.0f);
831842
Point<float> right (1.0f, 0.0f);
832843
Point<float> up (0.0f, 1.0f);

tests/yup_graphics/yup_Rectangle.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525

2626
using namespace yup;
2727

28-
namespace
29-
{
30-
static constexpr float tol = 1e-5f;
31-
} // namespace
32-
3328
TEST (RectangleTests, Default_Constructor)
3429
{
3530
Rectangle<float> r;
@@ -643,6 +638,8 @@ TEST (RectangleTests, Centered_Rectangle_With_Size_Edge_Cases)
643638

644639
TEST (RectangleTests, Transform)
645640
{
641+
static constexpr float tol = 1e-5f;
642+
646643
Rectangle<float> r (1.0f, 2.0f, 3.0f, 4.0f);
647644

648645
// Test translation

tests/yup_graphics/yup_RectangleList.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525

2626
using namespace yup;
2727

28-
namespace
29-
{
30-
static constexpr float tol = 1e-5f;
31-
} // namespace
32-
3328
TEST (RectangleListTests, DefaultConstructor)
3429
{
3530
RectangleList<float> list;
@@ -555,4 +550,4 @@ TEST (RectangleListTests, MergeRecursiveScenario)
555550

556551
// Should merge into fewer rectangles
557552
EXPECT_LT (list.getNumRectangles(), 3);
558-
}
553+
}

0 commit comments

Comments
 (0)