diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-09-05 08:37:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-05 08:37:16 -0400 |
commit | 7ac4c3b56e5246fceaa73e7c9c665d3c04827d6c (patch) | |
tree | e96334bd9299102ebdaf229eec9cf4c2165f8c2f /indra/llmath/tests/v4coloru_test.cpp | |
parent | 487973d3f0ee9b8583b3d977ca6a405cba5fe518 (diff) | |
parent | 6a747e1ce027700a3609f4c377179bfa29c3ce31 (diff) |
Merge pull request #2450 from secondlife/lua-merge
Merge updated 'main' branch into release/luau-scripting
Diffstat (limited to 'indra/llmath/tests/v4coloru_test.cpp')
-rw-r--r-- | indra/llmath/tests/v4coloru_test.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/indra/llmath/tests/v4coloru_test.cpp b/indra/llmath/tests/v4coloru_test.cpp index 2b6ee952a3..9d707d18c5 100644 --- a/indra/llmath/tests/v4coloru_test.cpp +++ b/indra/llmath/tests/v4coloru_test.cpp @@ -48,18 +48,18 @@ namespace tut void v4coloru_object::test<1>() { LLColor4U llcolor4u; - ensure("1:LLColor4u:Fail to initialize ", ((0 == llcolor4u.mV[VX]) && (0 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("1:LLColor4u:Fail to initialize ", ((0 == llcolor4u.mV[VRED]) && (0 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; LLColor4U llcolor4u1(r,g,b); - ensure("2:LLColor4u:Fail to initialize ", ((r == llcolor4u1.mV[VX]) && (g == llcolor4u1.mV[VY]) && (b == llcolor4u1.mV[VZ])&& (255 == llcolor4u1.mV[VW]))); + ensure("2:LLColor4u:Fail to initialize ", ((r == llcolor4u1.mV[VRED]) && (g == llcolor4u1.mV[VGREEN]) && (b == llcolor4u1.mV[VBLUE])&& (255 == llcolor4u1.mV[VALPHA]))); LLColor4U llcolor4u2(r,g,b,a); - ensure("3:LLColor4u:Fail to initialize ", ((r == llcolor4u2.mV[VX]) && (g == llcolor4u2.mV[VY]) && (b == llcolor4u2.mV[VZ])&& (a == llcolor4u2.mV[VW]))); + ensure("3:LLColor4u:Fail to initialize ", ((r == llcolor4u2.mV[VRED]) && (g == llcolor4u2.mV[VGREEN]) && (b == llcolor4u2.mV[VBLUE])&& (a == llcolor4u2.mV[VALPHA]))); const U8 vec[4] = {0x12,0xFF,0xAF,0x23}; LLColor4U llcolor4u3(vec); - ensure("4:LLColor4u:Fail to initialize ", ((vec[0] == llcolor4u3.mV[VX]) && (vec[1] == llcolor4u3.mV[VY]) && (vec[2] == llcolor4u3.mV[VZ])&& (vec[3] == llcolor4u3.mV[VW]))); + ensure("4:LLColor4u:Fail to initialize ", ((vec[0] == llcolor4u3.mV[VRED]) && (vec[1] == llcolor4u3.mV[VGREEN]) && (vec[2] == llcolor4u3.mV[VBLUE])&& (vec[3] == llcolor4u3.mV[VALPHA]))); LLSD sd = llcolor4u3.getValue(); LLColor4U llcolor4u4(sd); @@ -82,10 +82,10 @@ namespace tut U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; LLColor4U llcolor4u(r,g,b,a); llcolor4u.setToBlack(); - ensure("setToBlack:Fail to set black ", ((0 == llcolor4u.mV[VX]) && (0 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("setToBlack:Fail to set black ", ((0 == llcolor4u.mV[VRED]) && (0 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); llcolor4u.setToWhite(); - ensure("setToWhite:Fail to white ", ((255 == llcolor4u.mV[VX]) && (255 == llcolor4u.mV[VY]) && (255 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("setToWhite:Fail to white ", ((255 == llcolor4u.mV[VRED]) && (255 == llcolor4u.mV[VGREEN]) && (255 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); } template<> template<> @@ -104,11 +104,11 @@ namespace tut U8 r = 0x12, g = 0xFF, b = 0xAF, a = 0x23; LLColor4U llcolor4u; llcolor4u.setVec(r,g,b,a); - ensure("1:setVec:Fail to set the values ", ((r == llcolor4u.mV[VX]) && (g == llcolor4u.mV[VY]) && (b == llcolor4u.mV[VZ])&& (a == llcolor4u.mV[VW]))); + ensure("1:setVec:Fail to set the values ", ((r == llcolor4u.mV[VRED]) && (g == llcolor4u.mV[VGREEN]) && (b == llcolor4u.mV[VBLUE])&& (a == llcolor4u.mV[VALPHA]))); llcolor4u.setToBlack(); llcolor4u.setVec(r,g,b); - ensure("2:setVec:Fail to set the values ", ((r == llcolor4u.mV[VX]) && (g == llcolor4u.mV[VY]) && (b == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("2:setVec:Fail to set the values ", ((r == llcolor4u.mV[VRED]) && (g == llcolor4u.mV[VGREEN]) && (b == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); LLColor4U llcolor4u1; llcolor4u1.setVec(llcolor4u); @@ -117,7 +117,7 @@ namespace tut const U8 vec[4] = {0x12,0xFF,0xAF,0x23}; LLColor4U llcolor4u2; llcolor4u2.setVec(vec); - ensure("4:setVec:Fail to set the values ", ((vec[0] == llcolor4u2.mV[VX]) && (vec[1] == llcolor4u2.mV[VY]) && (vec[2] == llcolor4u2.mV[VZ])&& (vec[3] == llcolor4u2.mV[VW]))); + ensure("4:setVec:Fail to set the values ", ((vec[0] == llcolor4u2.mV[VRED]) && (vec[1] == llcolor4u2.mV[VGREEN]) && (vec[2] == llcolor4u2.mV[VBLUE])&& (vec[3] == llcolor4u2.mV[VALPHA]))); } template<> template<> @@ -126,7 +126,7 @@ namespace tut U8 alpha = 0x12; LLColor4U llcolor4u; llcolor4u.setAlpha(alpha); - ensure("setAlpha:Fail to set alpha value ", (alpha == llcolor4u.mV[VW])); + ensure("setAlpha:Fail to set alpha value ", (alpha == llcolor4u.mV[VALPHA])); } template<> template<> @@ -159,29 +159,29 @@ namespace tut llcolor4u3 = llcolor4u1 + llcolor4u2; ensure_equals( "1a.operator+:Fail to Add the values ", - llcolor4u3.mV[VX], + llcolor4u3.mV[VRED], (U8)(r1+r2)); ensure_equals( "1b.operator+:Fail to Add the values ", - llcolor4u3.mV[VY], + llcolor4u3.mV[VGREEN], (U8)(g1+g2)); ensure_equals( "1c.operator+:Fail to Add the values ", - llcolor4u3.mV[VZ], + llcolor4u3.mV[VBLUE], (U8)(b1+b2)); llcolor4u2 += llcolor4u1; ensure_equals( "2a.operator+=:Fail to Add the values ", - llcolor4u2.mV[VX], + llcolor4u2.mV[VRED], (U8)(r1+r2)); ensure_equals( "2b.operator+=:Fail to Add the values ", - llcolor4u2.mV[VY], + llcolor4u2.mV[VGREEN], (U8)(g1+g2)); ensure_equals( "2c.operator+=:Fail to Add the values ", - llcolor4u2.mV[VZ], + llcolor4u2.mV[VBLUE], (U8)(b1+b2)); } @@ -194,29 +194,29 @@ namespace tut llcolor4u3 = llcolor4u1 - llcolor4u2; ensure_equals( "1a. operator-:Fail to Add the values ", - llcolor4u3.mV[VX], + llcolor4u3.mV[VRED], (U8)(r1-r2)); ensure_equals( "1b. operator-:Fail to Add the values ", - llcolor4u3.mV[VY], + llcolor4u3.mV[VGREEN], (U8)(g1-g2)); ensure_equals( "1c. operator-:Fail to Add the values ", - llcolor4u3.mV[VZ], + llcolor4u3.mV[VBLUE], (U8)(b1-b2)); llcolor4u1 -= llcolor4u2; ensure_equals( "2a. operator-=:Fail to Add the values ", - llcolor4u1.mV[VX], + llcolor4u1.mV[VRED], (U8)(r1-r2)); ensure_equals( "2b. operator-=:Fail to Add the values ", - llcolor4u1.mV[VY], + llcolor4u1.mV[VGREEN], (U8)(g1-g2)); ensure_equals( "2c. operator-=:Fail to Add the values ", - llcolor4u1.mV[VZ], + llcolor4u1.mV[VBLUE], (U8)(b1-b2)); } @@ -229,30 +229,30 @@ namespace tut llcolor4u3 = llcolor4u1 * llcolor4u2; ensure_equals( "1a. operator*:Fail to multiply the values", - llcolor4u3.mV[VX], + llcolor4u3.mV[VRED], (U8)(r1*r2)); ensure_equals( "1b. operator*:Fail to multiply the values", - llcolor4u3.mV[VY], + llcolor4u3.mV[VGREEN], (U8)(g1*g2)); ensure_equals( "1c. operator*:Fail to multiply the values", - llcolor4u3.mV[VZ], + llcolor4u3.mV[VBLUE], (U8)(b1*b2)); U8 mulVal = 123; llcolor4u1 *= mulVal; ensure_equals( "2a. operator*=:Fail to multiply the values", - llcolor4u1.mV[VX], + llcolor4u1.mV[VRED], (U8)(r1*mulVal)); ensure_equals( "2b. operator*=:Fail to multiply the values", - llcolor4u1.mV[VY], + llcolor4u1.mV[VGREEN], (U8)(g1*mulVal)); ensure_equals( "2c. operator*=:Fail to multiply the values", - llcolor4u1.mV[VZ], + llcolor4u1.mV[VBLUE], (U8)(b1*mulVal)); } @@ -274,7 +274,7 @@ namespace tut LLColor4U llcolor4u(r,g,b,a); U8 modVal = 45; llcolor4u %= modVal; - ensure_equals("operator%=:Fail ", llcolor4u.mV[VW], (U8)(a * modVal)); + ensure_equals("operator%=:Fail ", llcolor4u.mV[VALPHA], (U8)(a * modVal)); } template<> template<> @@ -284,13 +284,13 @@ namespace tut LLColor4U llcolor4u1(r,g,b,a); std::string color("12, 23, 132, 50"); LLColor4U::parseColor4U(color, &llcolor4u1); - ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VX]) && (23 == llcolor4u1.mV[VY]) && (132 == llcolor4u1.mV[VZ])&& (50 == llcolor4u1.mV[VW]))); + ensure("parseColor4U() failed to parse the color value ", ((12 == llcolor4u1.mV[VRED]) && (23 == llcolor4u1.mV[VGREEN]) && (132 == llcolor4u1.mV[VBLUE])&& (50 == llcolor4u1.mV[VALPHA]))); color = "12, 23, 132"; - ensure("2:parseColor4U() failed to parse the color value ", (FALSE == LLColor4U::parseColor4U(color, &llcolor4u1))); + ensure("2:parseColor4U() failed to parse the color value ", (false == LLColor4U::parseColor4U(color, &llcolor4u1))); color = "12"; - ensure("2:parseColor4U() failed to parse the color value ", (FALSE == LLColor4U::parseColor4U(color, &llcolor4u1))); + ensure("2:parseColor4U() failed to parse the color value ", (false == LLColor4U::parseColor4U(color, &llcolor4u1))); } template<> template<> @@ -300,8 +300,8 @@ namespace tut LLColor4U llcolor4u(r,g,b,a),llcolor4u1; const F32 fVal = 3.f; llcolor4u1 = llcolor4u.multAll(fVal); - ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VX]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VY] - && ((U8)ll_round(b * fVal) == llcolor4u1.mV[VZ])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VW]))); + ensure("multAll:Fail to multiply ", (((U8)ll_round(r * fVal) == llcolor4u1.mV[VRED]) && (U8)ll_round(g * fVal) == llcolor4u1.mV[VGREEN] + && ((U8)ll_round(b * fVal) == llcolor4u1.mV[VBLUE])&& ((U8)ll_round(a * fVal) == llcolor4u1.mV[VALPHA]))); } template<> template<> @@ -311,13 +311,13 @@ namespace tut U8 r2 = 23, g2 = 230, b2 = 124, a2 = 255; LLColor4U llcolor4u(r1,g1,b1,a1),llcolor4u1(r2,g2,b2,a2); llcolor4u1 = llcolor4u1.addClampMax(llcolor4u); - ensure("1:addClampMax():Fail to add the value ", ((r1+r2 == llcolor4u1.mV[VX]) && (255 == llcolor4u1.mV[VY]) && (b1+b2 == llcolor4u1.mV[VZ])&& (255 == llcolor4u1.mV[VW]))); + ensure("1:addClampMax():Fail to add the value ", ((r1+r2 == llcolor4u1.mV[VRED]) && (255 == llcolor4u1.mV[VGREEN]) && (b1+b2 == llcolor4u1.mV[VBLUE])&& (255 == llcolor4u1.mV[VALPHA]))); r1 = 132, g1 = 3, b1 = 3, a1 = 2; r2 = 123, g2 = 230, b2 = 154, a2 = 25; LLColor4U llcolor4u2(r1,g1,b1,a1),llcolor4u3(r2,g2,b2,a2); llcolor4u3 = llcolor4u3.addClampMax(llcolor4u2); - ensure("2:addClampMax():Fail to add the value ", ((255 == llcolor4u3.mV[VX]) && (g1+g2 == llcolor4u3.mV[VY]) && (b1+b2 == llcolor4u3.mV[VZ])&& (a1+a2 == llcolor4u3.mV[VW]))); + ensure("2:addClampMax():Fail to add the value ", ((255 == llcolor4u3.mV[VRED]) && (g1+g2 == llcolor4u3.mV[VGREEN]) && (b1+b2 == llcolor4u3.mV[VBLUE])&& (a1+a2 == llcolor4u3.mV[VALPHA]))); } template<> template<> @@ -331,6 +331,6 @@ namespace tut F32 color_scale_factor = MAX_COLOR/r; S32 r2 = ll_round(r * color_scale_factor); S32 g2 = ll_round(g * color_scale_factor); - ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VX]) && (g2 == llcolor4u.mV[VY]) && (0 == llcolor4u.mV[VZ])&& (255 == llcolor4u.mV[VW]))); + ensure("setVecScaleClamp():Fail to add the value ", ((r2 == llcolor4u.mV[VRED]) && (g2 == llcolor4u.mV[VGREEN]) && (0 == llcolor4u.mV[VBLUE])&& (255 == llcolor4u.mV[VALPHA]))); } } |