END_TEST;
}
-int UtcDaliAnimationSetDuratioN(void)
+int UtcDaliAnimationSetDurationP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationGetDuratioN(void)
+int UtcDaliAnimationGetDurationP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationGetEndActioN(void)
+int UtcDaliAnimationGetEndActionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationSetDisconnectActioN(void)
+int UtcDaliAnimationSetDisconnectActionP(void)
{
TestApplication application;
Stage stage( Stage::GetCurrent() );
END_TEST;
}
-int UtcDaliAnimationGetDisconnectActioN(void)
+int UtcDaliAnimationGetDisconnectActionP(void)
{
TestApplication application;
Animation animation = Animation::New(1.0f);
END_TEST;
}
-int UtcDaliAnimationSetDefaultAlphaFunctioN(void)
+int UtcDaliAnimationSetDefaultAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationGetDefaultAlphaFunctioN(void)
+int UtcDaliAnimationGetDefaultAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationStopSetPositioN(void)
+int UtcDaliAnimationStopSetPositionP(void)
{
// Test that Animation::Stop & Actor::SetPosition can be used in conjunction
// i.e. to check that the animation does not interfere with the position set.
END_TEST;
}
-int UtcDaliAnimationAnimateByBooleaN(void)
+int UtcDaliAnimationAnimateByBooleanP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByBooleanAlphaFunctioN(void)
+int UtcDaliAnimationAnimateByBooleanAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByFloatAlphaFunctioN(void)
+int UtcDaliAnimationAnimateByFloatAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByIntegerAlphaFunctioN(void)
+int UtcDaliAnimationAnimateByIntegerAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByVector2AlphaFunctioN(void)
+int UtcDaliAnimationAnimateByVector2AlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByVector3AlphaFunctioN(void)
+int UtcDaliAnimationAnimateByVector3AlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByVector4AlphaFunctioN(void)
+int UtcDaliAnimationAnimateByVector4AlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByActorPositioN(void)
+int UtcDaliAnimationAnimateByActorPositionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByActorPositionAlphaFunctioN(void)
+int UtcDaliAnimationAnimateByActorPositionAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByActorOrientatioN(void)
+int UtcDaliAnimationAnimateByActorOrientationP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateByActorOrientationAlphaFunctioN(void)
+int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToBooleaN(void)
+int UtcDaliAnimationAnimateToBooleanP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToBooleanAlphaFunctioN(void)
+int UtcDaliAnimationAnimateToBooleanAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToFloatAlphaFunctioN(void)
+int UtcDaliAnimationAnimateToFloatAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToIntegerAlphaFunctioN(void)
+int UtcDaliAnimationAnimateToIntegerAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToVector2AlphaFunctioN(void)
+int UtcDaliAnimationAnimateToVector2AlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToVector3AlphaFunctioN(void)
+int UtcDaliAnimationAnimateToVector3AlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToVector4AlphaFunctioN(void)
+int UtcDaliAnimationAnimateToVector4AlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToActorParentOrigiN(void)
+int UtcDaliAnimationAnimateToActorParentOriginP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToActorPositioN(void)
+int UtcDaliAnimationAnimateToActorPositionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToActorPositionAlphaFunctioN(void)
+int UtcDaliAnimationAnimateToActorPositionAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToActorOrientationQuaternioN(void)
+int UtcDaliAnimationAnimateToActorOrientationQuaternionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToActorOrientationAlphaFunctioN(void)
+int UtcDaliAnimationAnimateToActorOrientationAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateToActorColorGreeN(void)
+int UtcDaliAnimationAnimateToActorColorGreenP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctioN(void)
+int UtcDaliAnimationAnimateBetweenActorColorAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationAnimateAlphaFunctioN(void)
+int UtcDaliAnimationAnimateAlphaFunctionP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliAnimationExtendDuratioN(void)
+int UtcDaliAnimationExtendDurationP(void)
{
TestApplication application;
}
-int UtcDaliMatrixCtor(void)
+int UtcDaliMatrixConstructor01P(void)
{
- // Test initialized startup
- Matrix m1;
-
- float r1[] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
- float r2[] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
- Matrix mr1(r1);
- Matrix mr2(r2);
-
- DALI_TEST_EQUALS(m1, mr1, 0.001f, TEST_LOCATION);
+ Matrix m2(false);
- // Test uninitialized startup
- // Stack construct a matrix to non zero, then stack construct another matrix over the top of it.
- float r3[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f};
+ bool initialised = true;
{
- Matrix m3(r3);
- }
- {
- Matrix m2(false);
-
- bool initialised = true;
+ float* els = m2.AsFloat();
+ for(size_t idx=0; idx<16; ++idx, ++els)
{
- float* els = m2.AsFloat();
- for(size_t idx=0; idx<16; ++idx, ++els)
- {
- if(*els != 0.0f)
- initialised = false;
- }
+ if(*els != 0.0f)
+ initialised = false;
}
-
- DALI_TEST_EQUALS(initialised, false, TEST_LOCATION);
}
- Matrix m4(true);
- DALI_TEST_EQUALS(m4, mr1, 0.001f, TEST_LOCATION);
-
- m4 = m4;
- DALI_TEST_EQUALS(m4, mr1, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(initialised, false, TEST_LOCATION);
- Matrix m5(false);
- m5.SetIdentity();
- Matrix m6 = m5;
- DALI_TEST_EQUALS(m6, mr2, 0.001f, TEST_LOCATION);
END_TEST;
}
-// OrthoNormalise fixes floating point errors from matrix rotations
-int UtcDaliMatrixOrthoNormalize0(void)
+int UtcDaliMatrixConstructor02P(void)
{
- Matrix m;
- m.SetIdentity();
+ float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f};
+ Matrix m(r);
- for (int i=0;i<1000;++i)
+ float* els = m.AsFloat();
+ float* init = r;
+ bool initialised = true;
+ for(size_t idx=0; idx<16; ++idx, ++els, ++init)
{
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f) );
- axis.Normalize();
-
- m.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), Vector3::ZERO );
- m.OrthoNormalize();
+ if(*els != *init)
+ initialised = false;
}
+ DALI_TEST_EQUALS(initialised, true, TEST_LOCATION);
- bool success = true;
- success &= fabsf(m.GetXAxis().Dot(m.GetYAxis())) < 0.001f;
- success &= fabsf(m.GetYAxis().Dot(m.GetXAxis())) < 0.001f;
- success &= fabsf(m.GetZAxis().Dot(m.GetYAxis())) < 0.001f;
-
- success &= fabsf(m.GetXAxis().Length() - 1.0f) < 0.001f;
- success &= fabsf(m.GetYAxis().Length() - 1.0f) < 0.001f;
- success &= fabsf(m.GetZAxis().Length() - 1.0f) < 0.001f;
-
- DALI_TEST_CHECK(success);
END_TEST;
}
-// OrthoNormalize is not flipping the axes and is maintaining the translation
-int UtcDaliMatrixOrthoNormalize1(void)
+int UtcDaliMatrixConstructor03P(void)
{
- for (int i=0;i<1000;++i)
- {
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
- axis.Normalize();
- Vector3 center(10.0f, 15.0f, 5.0f);
+ float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f};
- Matrix m0;
- m0.SetIdentity();
- m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center );
+ Matrix ma(r);
+ Matrix mb(ma);
- Matrix m1(m0);
- m1.OrthoNormalize();
-
- DALI_TEST_EQUALS(m0.GetXAxis(), m1.GetXAxis(), 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(m0.GetYAxis(), m1.GetYAxis(), 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(m0.GetZAxis(), m1.GetZAxis(), 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(m0.GetTranslation(), m1.GetTranslation(), 0.001f, TEST_LOCATION);
+ float* els = ma.AsFloat();
+ float* init = mb.AsFloat();
+ bool initialised = true;
+ for(size_t idx=0; idx<16; ++idx, ++els, ++init)
+ {
+ if(*els != *init)
+ initialised = false;
}
+ DALI_TEST_EQUALS(initialised, true, TEST_LOCATION);
+
END_TEST;
}
-// Invert works
-int UtcDaliMatrixInvert01(void)
+int UtcDaliMatrixConstructor04P(void)
{
- // We're going to invert a whole load of different matrices to make sure we don't
- // fail on particular orientations.
- for (int i=0;i<1000;++i)
- {
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
- axis.Normalize();
- Vector3 center(f, cosf(f) * 100.0f, cosf(f*0.5f) * 50.0f);
-
- Matrix m0;
- m0.SetIdentity();
- m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center );
-
- Matrix m1(m0);
- m1.Invert();
-
- Matrix m2( false );
- Matrix::Multiply( m2, m0, m1 );
+ Quaternion q(Quaternion::IDENTITY);
+ Matrix m(q);
+ DALI_TEST_EQUALS(Matrix(Matrix::IDENTITY), m, 0.001, TEST_LOCATION);
+ END_TEST;
+}
- DALI_TEST_EQUALS(m2, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
+int UtcDaliMatrixAssignP(void)
+{
+ Matrix a(Matrix::IDENTITY);
+ Matrix b = a;
+ DALI_TEST_EQUALS(a, b, 0.001, TEST_LOCATION);
+ END_TEST;
+}
- m1.Invert(); // doube invert - should be back to m0
+int UtcDaliMatrixSetIdentityP(void)
+{
+ float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f,
+ 12.0f, 13.0f, 14.0f, 15.0f };
+ Matrix m(els);
+ m.SetIdentity();
- DALI_TEST_EQUALS(m0, m1, 0.001f, TEST_LOCATION);
- }
+ DALI_TEST_EQUALS(m, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
}
-
-int UtcDaliMatrixInvert02(void)
+int UtcDaliMatrixSetIdentityAndScaleP(void)
{
- Matrix m1 = Matrix::IDENTITY;
- m1.SetXAxis(Vector3(0.0f, 0.0f, 0.0f));
- DALI_TEST_EQUALS(m1.Invert(), false, TEST_LOCATION);
+ float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f,
+ 12.0f, 13.0f, 14.0f, 15.0f };
+ Matrix m(els);
+ m.SetIdentityAndScale(Vector3(4.0f, 4.0f, 4.0f));
+
+ float els2[] = { 4.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 4.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 4.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f };
+ Matrix r(els2);
+
+ DALI_TEST_EQUALS(m, r, 0.001f, TEST_LOCATION);
END_TEST;
}
-
-// Invert transform works
-int UtcDaliMatrixInvertTransform01(void)
+int UtcDaliMatrixInvertTransform01P(void)
{
for (int i=0;i<1000;++i)
{
END_TEST;
}
-
-// Invert transform works
-int UtcDaliMatrixInvertTransform02(void)
+int UtcDaliMatrixInvertTransform02P(void)
{
std::string exceptionString( "EqualsZero( mMatrix[3] ) && EqualsZero( mMatrix[7] ) && EqualsZero( mMatrix[11] ) && Equals( mMatrix[15], 1.0f" );
try
END_TEST;
}
-
-// GetXAxis
-int UtcDaliMatrixGetXAxis(void)
+int UtcDaliMatrixInvert01P(void)
{
- float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f };
- Matrix m(els);
+ // We're going to invert a whole load of different matrices to make sure we don't
+ // fail on particular orientations.
+ for (int i=0;i<1000;++i)
+ {
+ float f = i;
+ Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ axis.Normalize();
+ Vector3 center(f, cosf(f) * 100.0f, cosf(f*0.5f) * 50.0f);
- DALI_TEST_CHECK(m.GetXAxis() == Vector3(0.0f, 1.0f, 2.0f));
- END_TEST;
-}
+ Matrix m0;
+ m0.SetIdentity();
+ m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center );
-// GetYAxis
-int UtcDaliMatrixGetYAxis(void)
-{
- float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f };
- Matrix m(els);
+ Matrix m1(m0);
+ m1.Invert();
- DALI_TEST_CHECK(m.GetYAxis() == Vector3(4.0f, 5.0f, 6.0f));
+ Matrix m2( false );
+ Matrix::Multiply( m2, m0, m1 );
+
+ DALI_TEST_EQUALS(m2, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
+
+ m1.Invert(); // doube invert - should be back to m0
+
+ DALI_TEST_EQUALS(m0, m1, 0.001f, TEST_LOCATION);
+ }
END_TEST;
}
-// GetZAxis
-int UtcDaliMatrixGetZAxis(void)
+int UtcDaliMatrixInvert02P(void)
{
- float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f };
- Matrix m(els);
-
- DALI_TEST_CHECK(m.GetZAxis() == Vector3(8.0f, 9.0f, 10.0f));
+ Matrix m1 = Matrix::IDENTITY;
+ m1.SetXAxis(Vector3(0.0f, 0.0f, 0.0f));
+ DALI_TEST_EQUALS(m1.Invert(), false, TEST_LOCATION);
END_TEST;
}
-// GetTranslation
-int UtcDaliMatrixGetTranslation(void)
+int UtcDaliMatrixTransposeP(void)
{
- float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f };
- Matrix m(els);
+ float floats[] =
+ { 0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f,
+ 12.0f, 13.0f, 14.0f, 15.0f
+ };
- DALI_TEST_EQUALS(m.GetTranslation(), Vector4(12.0f, 13.0f, 14.0f, 15.0f), TEST_LOCATION);
+ Matrix m(floats);
+ m.Transpose();
+
+ bool success = true;
+
+ for (int x=0;x<4;++x)
+ {
+ for (int y=0;y<4;++y)
+ {
+ success &= (m.AsFloat()[x+y*4] == floats[x*4+y]);
+ }
+ }
+
+ DALI_TEST_CHECK(success);
END_TEST;
}
-// GetTranslation
-int UtcDaliMatrixGetTranslation3(void)
+int UtcDaliMatrixGetXAxisP(void)
{
float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f,
12.0f, 13.0f, 14.0f, 15.0f };
Matrix m(els);
- DALI_TEST_EQUALS(m.GetTranslation3(), Vector3(12.0f, 13.0f, 14.0f), TEST_LOCATION);
+ DALI_TEST_CHECK(m.GetXAxis() == Vector3(0.0f, 1.0f, 2.0f));
END_TEST;
}
-// SetIdentity
-int UtcDaliMatrixSetIdentity(void)
+int UtcDaliMatrixGetYAxisP(void)
{
float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f };
Matrix m(els);
- m.SetIdentity();
- DALI_TEST_EQUALS(m, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
+ DALI_TEST_CHECK(m.GetYAxis() == Vector3(4.0f, 5.0f, 6.0f));
END_TEST;
}
-
-int UtcDaliMatrixSetIdentityAndScale(void)
+int UtcDaliMatrixGetZAxisP(void)
{
float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
4.0f, 5.0f, 6.0f, 7.0f,
8.0f, 9.0f, 10.0f, 11.0f,
12.0f, 13.0f, 14.0f, 15.0f };
Matrix m(els);
- m.SetIdentityAndScale(Vector3(4.0f, 4.0f, 4.0f));
-
- float els2[] = { 4.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 4.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 4.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
- Matrix r(els2);
- DALI_TEST_EQUALS(m, r, 0.001f, TEST_LOCATION);
+ DALI_TEST_CHECK(m.GetZAxis() == Vector3(8.0f, 9.0f, 10.0f));
END_TEST;
}
-
-// SetXAxis
-int UtcDaliMatrixSetXAxis(void)
+int UtcDaliMatrixSetXAxisP(void)
{
Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
END_TEST;
}
-// SetYAxis
-int UtcDaliMatrixSetYAxis(void)
+int UtcDaliMatrixSetYAxisP(void)
{
Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
END_TEST;
}
-// SetZAxis
-int UtcDaliMatrixSetZAxis(void)
+int UtcDaliMatrixSetZAxisP(void)
{
Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
END_TEST;
}
-// SetTranslation
-int UtcDaliMatrixSetTranslation(void)
+int UtcDaliMatrixGetTranslationP(void)
+{
+ float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f,
+ 12.0f, 13.0f, 14.0f, 15.0f };
+ Matrix m(els);
+
+ DALI_TEST_EQUALS(m.GetTranslation(), Vector4(12.0f, 13.0f, 14.0f, 15.0f), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliMatrixGetTranslation3P(void)
+{
+ float els[] = { 0.0f, 1.0f, 2.0f, 3.0f,
+ 4.0f, 5.0f, 6.0f, 7.0f,
+ 8.0f, 9.0f, 10.0f, 11.0f,
+ 12.0f, 13.0f, 14.0f, 15.0f };
+ Matrix m(els);
+
+ DALI_TEST_EQUALS(m.GetTranslation3(), Vector3(12.0f, 13.0f, 14.0f), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliMatrixSetTranslationP(void)
{
Matrix m;
Vector4 v(2.0f, 3.0f, 4.0f, 5.0f);
END_TEST;
}
-// SetTranslation
-int UtcDaliMatrixSetTranslation3(void)
+int UtcDaliMatrixSetTranslation3P(void)
{
Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
END_TEST;
}
+int UtcDaliMatrixOrthoNormalize0P(void)
+{
+ // OrthoNormalise fixes floating point errors from matrix rotations
+ Matrix m;
+ m.SetIdentity();
+
+ for (int i=0;i<1000;++i)
+ {
+ float f = i;
+ Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ axis.Normalize();
+
+ m.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), Vector3::ZERO );
+ m.OrthoNormalize();
+ }
+
+ bool success = true;
+ success &= fabsf(m.GetXAxis().Dot(m.GetYAxis())) < 0.001f;
+ success &= fabsf(m.GetYAxis().Dot(m.GetXAxis())) < 0.001f;
+ success &= fabsf(m.GetZAxis().Dot(m.GetYAxis())) < 0.001f;
+ success &= fabsf(m.GetXAxis().Length() - 1.0f) < 0.001f;
+ success &= fabsf(m.GetYAxis().Length() - 1.0f) < 0.001f;
+ success &= fabsf(m.GetZAxis().Length() - 1.0f) < 0.001f;
-// Transpose
-int UtcDaliMatrixTranspose(void)
+ DALI_TEST_CHECK(success);
+ END_TEST;
+}
+
+int UtcDaliMatrixOrthoNormalize1P(void)
{
- float floats[] =
- { 0.0f, 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f, 7.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f
- };
+ // OrthoNormalize is not flipping the axes and is maintaining the translation
+ for (int i=0;i<1000;++i)
+ {
+ float f = i;
+ Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ axis.Normalize();
+ Vector3 center(10.0f, 15.0f, 5.0f);
- Matrix m(floats);
- m.Transpose();
+ Matrix m0;
+ m0.SetIdentity();
+ m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center );
- bool success = true;
+ Matrix m1(m0);
+ m1.OrthoNormalize();
- for (int x=0;x<4;++x)
+ DALI_TEST_EQUALS(m0.GetXAxis(), m1.GetXAxis(), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(m0.GetYAxis(), m1.GetYAxis(), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(m0.GetZAxis(), m1.GetZAxis(), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(m0.GetTranslation(), m1.GetTranslation(), 0.001f, TEST_LOCATION);
+ }
+ END_TEST;
+}
+
+int UtcDaliMatrixConstAsFloatP(void)
+{
+ float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f};
+ const Matrix m(r);
+
+ const float* els = m.AsFloat();
+ const float* init = r;
+ bool initialised = true;
+ for(size_t idx=0; idx<16; ++idx, ++els, ++init)
{
- for (int y=0;y<4;++y)
- {
- success &= (m.AsFloat()[x+y*4] == floats[x*4+y]);
- }
+ if(*els != *init)
+ initialised = false;
}
+ DALI_TEST_EQUALS(initialised, true, TEST_LOCATION);
+
- DALI_TEST_CHECK(success);
END_TEST;
}
-int UtcDaliMatrixOStreamOperator(void)
+int UtcDaliMatrixAsFloatP(void)
{
- std::ostringstream oss;
+ float r[] = { 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f, 1.0f, 2.0f, 3.0f, 4.0f};
+ Matrix m(r);
- Matrix matrix;
- matrix.SetIdentity();
-
- oss << matrix;
+ float* els = m.AsFloat();
+ float* init = r;
+ bool initialised = true;
+ for(size_t idx=0; idx<16; ++idx, ++els, ++init)
+ {
+ if(*els != *init)
+ initialised = false;
+ }
+ DALI_TEST_EQUALS(initialised, true, TEST_LOCATION);
- std::string expectedOutput = "[ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] ]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
-int UtcDaliMatrixMultiply(void)
+int UtcDaliMatrixMultiplyP(void)
{
Matrix m1 = Matrix::IDENTITY;
END_TEST;
}
-int UtcDaliMatrixOperatorMultiply01(void)
+int UtcDaliMatrixOperatorMultiply01P(void)
{
Vector4 v1(2.0f, 5.0f, 4.0f, 0.0f);
END_TEST;
}
-int UtcDaliMatrixOperatorMultiply02(void)
+int UtcDaliMatrixOperatorMultiply02P(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliMatrixOperatorEquals(void)
+int UtcDaliMatrixOperatorEqualsP(void)
{
Matrix m1 = Matrix::IDENTITY;
END_TEST;
}
-
-int UtcDaliMatrixOperatorNotEquals(void)
+int UtcDaliMatrixOperatorNotEqualsP(void)
{
Matrix m1 = Matrix::IDENTITY;
float els[] = {2.0f, 0.0f, 0.0f, 0.0f,
END_TEST;
}
-int UtcDaliMatrixGetTransformComponents01(void)
-{
- Matrix m2(Matrix::IDENTITY.AsFloat());
- Vector3 pos2;
- Vector3 scale2;
- Quaternion q2;
- m2.GetTransformComponents(pos2, q2, scale2);
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), pos2, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3(1.0f, 1.0f, 1.0f), scale2, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(Quaternion(), q2, 0.001, TEST_LOCATION);
- END_TEST;
-}
-
-
-int UtcDaliMatrixGetTransformComponents02(void)
-{
- // Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
- {
- for( float y=-1.0f; y<1.0f; y+=0.1f )
- {
- for( float z=-1.0f; z<1.0f; z+=0.1f )
- {
- Vector3 vForward(x, y, z);
- vForward.Normalize();
-
- for( float angle = 5.0f; angle <= 360.0f; angle += 15.0f)
- {
- Quaternion rotation1(Radian(Degree(angle)), vForward);
- Vector3 scale1(2.0f, 3.0f, 4.0f);
- Vector3 position1(1.0f, 2.0f, 3.0f);
-
- Matrix m1(false);
- m1.SetTransformComponents(scale1, rotation1, position1);
-
- Vector3 position2;
- Quaternion rotation2;
- Vector3 scale2;
- m1.GetTransformComponents(position2, rotation2, scale2);
-
- DALI_TEST_EQUALS(position1, position2, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(scale1, scale2, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(rotation1, rotation2, 0.001, TEST_LOCATION);
- }
- }
- }
- }
- END_TEST;
-}
-
-int UtcDaliMatrixSetTransformComponents01(void)
+int UtcDaliMatrixSetTransformComponents01P(void)
{
// Create an arbitrary vector
for( float x=-1.0f; x<=1.0f; x+=0.1f )
}
-int UtcDaliMatrixSetInverseTransformComponent01(void)
+int UtcDaliMatrixSetInverseTransformComponent01P(void)
{
// Create an arbitrary vector
for( float x=-1.0f; x<=1.0f; x+=0.1f )
END_TEST;
}
-int UtcDaliMatrixSetInverseTransformComponent02(void)
+int UtcDaliMatrixSetInverseTransformComponent02P(void)
{
// Create an arbitrary vector
for( float x=-1.0f; x<=1.0f; x+=0.1f )
}
END_TEST;
}
+
+int UtcDaliMatrixGetTransformComponents01P(void)
+{
+ Matrix m2(Matrix::IDENTITY.AsFloat());
+ Vector3 pos2;
+ Vector3 scale2;
+ Quaternion q2;
+ m2.GetTransformComponents(pos2, q2, scale2);
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), pos2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(1.0f, 1.0f, 1.0f), scale2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(Quaternion(), q2, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
+
+int UtcDaliMatrixGetTransformComponents02P(void)
+{
+ // Create an arbitrary vector
+ for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ {
+ for( float y=-1.0f; y<1.0f; y+=0.1f )
+ {
+ for( float z=-1.0f; z<1.0f; z+=0.1f )
+ {
+ Vector3 vForward(x, y, z);
+ vForward.Normalize();
+
+ for( float angle = 5.0f; angle <= 360.0f; angle += 15.0f)
+ {
+ Quaternion rotation1(Radian(Degree(angle)), vForward);
+ Vector3 scale1(2.0f, 3.0f, 4.0f);
+ Vector3 position1(1.0f, 2.0f, 3.0f);
+
+ Matrix m1(false);
+ m1.SetTransformComponents(scale1, rotation1, position1);
+
+ Vector3 position2;
+ Quaternion rotation2;
+ Vector3 scale2;
+ m1.GetTransformComponents(position2, rotation2, scale2);
+
+ DALI_TEST_EQUALS(position1, position2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(scale1, scale2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation1, rotation2, 0.001, TEST_LOCATION);
+ }
+ }
+ }
+ }
+ END_TEST;
+}
+
+
+int UtcDaliMatrixOStreamOperator(void)
+{
+ std::ostringstream oss;
+
+ Matrix matrix;
+ matrix.SetIdentity();
+
+ oss << matrix;
+
+ std::string expectedOutput = "[ [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1] ]";
+
+ DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ END_TEST;
+}
} // CheckTypeName
+template <typename T>
+struct GetCheckP
+{
+ GetCheckP(T value)
+ {
+ Property::Value v(value);
+ DALI_TEST_CHECK( v.Get<T>() == value );
+ }
+};
+
+template <typename T>
+struct CheckCopyCtorP
+{
+ CheckCopyCtorP(Property::Value value)
+ {
+ Property::Value copy( value );
+ DALI_TEST_CHECK( value.Get<T>() == copy.Get<T>() );
+ }
+};
+
+template <>
+struct CheckCopyCtorP<AngleAxis>
+{
+ CheckCopyCtorP(Property::Value value)
+ {
+ Property::Value copy( value );
+ AngleAxis a = value.Get<AngleAxis>();
+ AngleAxis b = copy.Get<AngleAxis>();
+ DALI_TEST_CHECK( a.angle == b.angle );
+ DALI_TEST_CHECK( a.axis == b.axis );
+ }
+};
+
+template <>
+struct CheckCopyCtorP<Property::Array>
+{
+ CheckCopyCtorP(Property::Value value)
+ {
+ Property::Value copy( value );
+ Property::Array a = value.Get<Property::Array>();
+ Property::Array b = copy.Get<Property::Array>();
+ DALI_TEST_CHECK( a.size() == b.size() );
+ }
+};
+
+template <>
+struct CheckCopyCtorP<Property::Map>
+{
+ CheckCopyCtorP(Property::Value value)
+ {
+ Property::Value copy( value );
+ Property::Map a = value.Get<Property::Map>();
+ Property::Map b = copy.Get<Property::Map>();
+ DALI_TEST_CHECK( a.Count() == b.Count() );
+ }
+};
+
+
+template <typename T>
+struct GetCheckN
+{
+ GetCheckN()
+ {
+ Property::Value v;
+ try
+ {
+ T got = v.Get<T>();
+ (void)got;
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+ }
+};
+
+template<>
+struct GetCheckN<Property::Array>
+{
+ GetCheckN()
+ {
+ Property::Value value;
+ try
+ {
+ Property::Array array = value.Get<Property::Array>();
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+ }
+};
+
+template<>
+struct GetCheckN<Property::Map>
+{
+ GetCheckN()
+ {
+ Property::Value value;
+ try
+ {
+ Property::Map map = value.Get<Property::Map>();
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+ }
+};
+
+
} // unnamed namespace
void utc_dali_property_value_startup(void)
test_return_value = TET_PASS;
}
-int UtcDaliPropertyValueConstructors01(void)
-{
- // Testing PropertyValue construction using Property::Type
- // also testing the PropertyTypes::GetName is correct for each type
+int UtcDaliPropertyValueConstructors01P(void)
+{
TestApplication application;
- tet_infoline("Testing Property::Value construction using Property::Type");
-
Property::Value value;
+
DALI_TEST_CHECK( value.GetType() == Property::NONE );
- Property::Type type = Property::NONE;
- CheckTypeName(type);
- // Value(Value&) ctor and Value(Type&) ctor
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( Property::NONE == type );
-
- // PropertyTypes
- type = Property::BOOLEAN;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<bool>() == type );
-
- type = Property::FLOAT;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<float>() == type );
-
- type = Property::INTEGER;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<int>() == type );
-
- type = Property::UNSIGNED_INTEGER;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<unsigned int>() == type );
-
- type = Property::VECTOR2;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Vector2>() == type );
-
- type = Property::VECTOR3;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Vector3>() == type );
-
- type = Property::VECTOR4;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Vector4>() == type );
-
- type = Property::MATRIX3;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Matrix3>() == type );
-
- type = Property::MATRIX;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Matrix>() == type );
+ END_TEST;
+}
- typedef Dali::Rect<int> Rectangle;
- type = Property::RECTANGLE;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Rectangle>() == type );
+int UtcDaliPropertyValueConstructors02P(void)
+{
+ TestApplication application;
+ Property::Value value(true);
- type = Property::ROTATION;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Quaternion>() == type );
+ DALI_TEST_CHECK( value.GetType() == Property::BOOLEAN );
+ DALI_TEST_CHECK( value.Get<bool>() == true );
- type = Property::ROTATION;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<AngleAxis>() == type );
+ END_TEST;
+}
- type = Property::STRING;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<std::string>() == type );
+int UtcDaliPropertyValueConstructors03P(void)
+{
+ TestApplication application;
+ Property::Value value(2.f);
- type = Property::ARRAY;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Property::Array>() == type );
+ DALI_TEST_CHECK( value.GetType() == Property::FLOAT );
+ DALI_TEST_CHECK( value.Get<float>() == 2.f );
- type = Property::MAP;
- CheckTypeName(type);
- DALI_TEST_CHECK( Property::Value(Property::Value(type)).GetType() == type );
- DALI_TEST_CHECK( PropertyTypes::Get<Property::Map>() == type );
END_TEST;
-
}
-int UtcDaliPropertyValueConstructors02(void)
+int UtcDaliPropertyValueConstructors04P(void)
{
- // Testing PropertyValue construction using value / reference types
- // also testing the PropertyTypes::Get return same value as constructed
-
TestApplication application;
- tet_infoline("Testing Property::Value construction using values / references");
+ Property::Value value(1);
- Property::Value value;
+ DALI_TEST_CHECK( value.GetType() == Property::INTEGER );
+ DALI_TEST_CHECK( value.Get<int>() == 1 );
- bool b = false;
- value = Property::Value(true);
- value.Get(b);
- DALI_TEST_CHECK( true == b );
+ END_TEST;
+}
- float f = 5.f;
- value = Property::Value(10.f);
- value.Get(f);
- DALI_TEST_CHECK( Dali::Equals(10.f, f) );
+int UtcDaliPropertyValueConstructors05P(void)
+{
+ TestApplication application;
+ Property::Value value(1u);
- int i = 5;
- value = Property::Value(10);
- value.Get(i);
- DALI_TEST_CHECK( 10 == i );
+ DALI_TEST_CHECK( value.GetType() == Property::UNSIGNED_INTEGER );
+ DALI_TEST_CHECK( value.Get<unsigned int>() == 1u );
- unsigned int ui = 5;
- value = Property::Value(10U);
- value.Get(ui);
- DALI_TEST_CHECK( 10 == ui );
+ END_TEST;
+}
- Vector2 v2 = Vector2(0,0);
- value = Property::Value( Vector2(1,1) );
- value.Get(v2);
- DALI_TEST_CHECK( Vector2(1,1) == v2 );
+int UtcDaliPropertyValueConstructors06P(void)
+{
+ TestApplication application;
+ Vector2 v(1,1);
+ Property::Value value(v);
- Vector3 v3 = Vector3(0.f,0.f,0.f);
- value = Property::Value( Vector3(1.f,1.f,1.f) );
- value.Get(v3);
- DALI_TEST_CHECK( Vector3(1.f,1.f,1.f) == v3 );
+ DALI_TEST_CHECK( value.GetType() == Property::VECTOR2 );
+ DALI_TEST_CHECK( value.Get<Vector2>() == v );
- Vector4 v4 = Vector4(0,0,0,0);
- value = Property::Value( Vector4(1,1,1,1) );
- value.Get(v4);
- DALI_TEST_CHECK( Vector4(1,1,1,1) == v4 );
+ END_TEST;
+}
- Matrix3 m3 = Matrix3(0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f);
- value = Property::Value( Matrix3::IDENTITY );
- value.Get(m3);
- DALI_TEST_CHECK( Matrix3::IDENTITY == m3 );
+int UtcDaliPropertyValueConstructors07P(void)
+{
+ TestApplication application;
+ Vector3 v(1.0,1.0,1.0);
+ Property::Value value(v);
- Matrix m = Matrix(true);
- value = Property::Value( Matrix::IDENTITY );
- value.Get(m);
- DALI_TEST_CHECK( Matrix::IDENTITY == m );
+ DALI_TEST_CHECK( value.GetType() == Property::VECTOR3 );
+ DALI_TEST_CHECK( value.Get<Vector3>() == v );
- typedef Dali::Rect<int> Rectangle;
- Rectangle r = Rectangle(0,0,0,0);
- value = Property::Value( Rectangle(1,1,1,1) );
- value.Get(r);
- DALI_TEST_CHECK( Rectangle(1,1,1,1) == r );
+ END_TEST;
+}
- Quaternion q = Quaternion(0,0,0,0);
- value = Property::Value( Quaternion(1,1,1,1) );
- value.Get(q);
- DALI_TEST_CHECK( Quaternion(1,1,1,1) == q );
+int UtcDaliPropertyValueConstructors08P(void)
+{
+ TestApplication application;
+ Matrix3 v(1.0,1.0,1.0, 1.0,1.0,1.0, 1.0,1.0,1.0);
+ Property::Value value(v);
- AngleAxis aa = AngleAxis( Degree(0), Vector3(0.f,0.f,0.f) );
- value = Property::Value( AngleAxis( Radian(Math::PI_2), Vector3::XAXIS ));
- value.Get(aa);
- Quaternion r8(Radian(Degree(aa.angle)), aa.axis);
- DALI_TEST_EQUALS(r8, Quaternion(Radian(Math::PI_2), Vector3::XAXIS), 0.001, TEST_LOCATION);
+ DALI_TEST_CHECK( value.GetType() == Property::MATRIX3 );
+ DALI_TEST_CHECK( value.Get<Matrix3>() == v );
- std::string s = "no";
- value = Property::Value("yes");
- value.Get(s);
- DALI_TEST_CHECK( "yes" == s );
+ END_TEST;
+}
- Property::Array array;
- value = Property::Value(Property::ARRAY);
- value.AppendItem(10);
- value.Get(array);
- int getItem = 0;
- array[0].Get(getItem);
- DALI_TEST_CHECK( getItem == 10 );
+int UtcDaliPropertyValueConstructors09P(void)
+{
+ TestApplication application;
+ float a[] = {1.0,1.0,1.0,1.0, 1.0,1.0,1.0,1.0, 1.0,1.0,1.0,1.0, 1.0,1.0,1.0,1.0};
+ Matrix v(a);
+ Property::Value value(v);
- Property::Map map;
- value = Property::Value(Property::MAP);
- value.SetValue("key", "value");
- value.Get(map);
- DALI_TEST_CHECK( map.GetKey(0) == "key" );
+ DALI_TEST_CHECK( value.GetType() == Property::MATRIX );
+ DALI_TEST_CHECK( value.Get<Matrix>() == v );
END_TEST;
}
+int UtcDaliPropertyValueConstructors10P(void)
+{
+ TestApplication application;
+ Rect<int> v(1.0,1.0,1.0,1.0);
+ Property::Value value(v);
+
+ DALI_TEST_CHECK( value.GetType() == Property::RECTANGLE );
+ DALI_TEST_CHECK( value.Get<Rect<int> >() == v );
-int UtcDaliPropertyValueCopyConstructors01(void)
+ END_TEST;
+}
+
+int UtcDaliPropertyValueConstructors11P(void)
{
TestApplication application;
- tet_infoline("Testing Property::Value copy construction using values / references");
+ AngleAxis v(Degree(1.0), Vector3(1.0,1.0,1.0));
+ Property::Value value(v);
- Property::Value value;
+ DALI_TEST_CHECK( value.GetType() == Property::ROTATION );
+ AngleAxis got = value.Get<AngleAxis>();
+ DALI_TEST_CHECK( got.angle == v.angle );
+ DALI_TEST_CHECK( got.axis == v.axis );
- value = Property::Value(true);
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( true == copy.Get<bool>() );
- }
+ END_TEST;
+}
- value = Property::Value(10.f);
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Dali::Equals(10.f, copy.Get<float>() ) );
- }
+int UtcDaliPropertyValueConstructors12P(void)
+{
+ TestApplication application;
+ Quaternion v( Vector4(1.0,1.0,1.0,1.0) );
+ Property::Value value(v);
- value = Property::Value(10);
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( 10 == copy.Get<int>() );
- }
+ DALI_TEST_CHECK( value.GetType() == Property::ROTATION );
+ DALI_TEST_CHECK( value.Get<Quaternion>() == v );
- value = Property::Value(10U);
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( 10 == copy.Get< unsigned int>() );
- }
+ END_TEST;
+}
- value = Property::Value( Vector2(1,1) );
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Vector2(1,1) == copy.Get<Vector2>() );
- }
+int UtcDaliPropertyValueConstructors13P(void)
+{
+ TestApplication application;
+ std::string v("1");
+ Property::Value value(v);
- value = Property::Value( Vector3(1.f,1.f,1.f) );
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Vector3(1.f,1.f,1.f) == copy.Get<Vector3>() );
- }
+ DALI_TEST_CHECK( value.GetType() == Property::STRING );
+ DALI_TEST_CHECK( value.Get<std::string>() == v );
- value = Property::Value( Vector4(1,1,1,1) );
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Vector4(1,1,1,1) == copy.Get<Vector4>() );
- }
+ END_TEST;
+}
- value = Property::Value( Matrix3::IDENTITY );
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Matrix3::IDENTITY == copy.Get<Matrix3>() );
- }
+int UtcDaliPropertyValueConstructors14P(void)
+{
+ TestApplication application;
- value = Property::Value( Matrix::IDENTITY );
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Matrix::IDENTITY == copy.Get<Matrix>() );
- }
+ Property::Value value(Property::ARRAY);
+ value.AppendItem(Property::Value(1));
- typedef Dali::Rect<int> Rectangle;
+ DALI_TEST_CHECK( value.GetType() == Property::ARRAY );
+ DALI_TEST_CHECK( value.GetSize() == 1);
- value = Property::Value( Rectangle(1,1,1,1) );
- {
- Property::Value copy( value );
- Rectangle copyRect;
- copy.Get(copyRect);
- DALI_TEST_CHECK( Rectangle(1,1,1,1) == copyRect);
- }
+ END_TEST;
+}
- value = Property::Value( Quaternion(1,1,1,1) );
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( Quaternion(1,1,1,1) == copy.Get<Quaternion>() );
- }
+int UtcDaliPropertyValueConstructors15P(void)
+{
+ TestApplication application;
- value = Property::Value( AngleAxis( Radian(Math::PI_2), Vector3::XAXIS ));
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( value.Get<AngleAxis>().axis == copy.Get<AngleAxis>().axis );
- DALI_TEST_CHECK( value.Get<AngleAxis>().angle == copy.Get<AngleAxis>().angle );
- }
+ Property::Value value(Property::MAP);
+ value.SetValue("1", Property::Value(1));
- value = Property::Value("yes");
- {
- Property::Value copy( value );
- DALI_TEST_CHECK( "yes" == copy.Get<std::string>() );
- }
+ DALI_TEST_CHECK( value.GetType() == Property::MAP );
+ DALI_TEST_CHECK( value.GetSize() == 1);
- Property::Array array;
- value = Property::Value(Property::ARRAY);
- value.AppendItem(10);
- {
- Property::Value copy( value );
- copy.Get( array );
- int getItem = 0;
- array[0].Get( getItem );
- DALI_TEST_CHECK( getItem == 10 );
- }
- Property::Map map;
- value = Property::Value(Property::MAP);
- value.SetValue("key", "value");
- {
- Property::Value copy( value );
- copy.Get( map );
- DALI_TEST_CHECK( map.GetKey(0) == "key" );
- }
+ END_TEST;
+}
+int UtcDaliPropertyValueCopyConstructor01P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<float> check(1.f);
END_TEST;
}
+int UtcDaliPropertyValueCopyConstructor02P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<bool> check(true);
+ END_TEST;
+}
-int UtcDaliPropertyValueAssignmentOperator01(void)
+int UtcDaliPropertyValueCopyConstructor03P(void)
{
- // Testing Property Value assignment
TestApplication application;
- tet_infoline("Testing Property::Value assignment operator");
+ CheckCopyCtorP<float> check(1.f);
+ END_TEST;
+}
- Property::Value value;
+int UtcDaliPropertyValueCopyConstructor04P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<int> check(1);
+ END_TEST;
+}
+int UtcDaliPropertyValueCopyConstructor05P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<unsigned int> check(1u);
+ END_TEST;
+}
- value = Property::Value(true);
- {
- Property::Value copy( false );
- copy = value;
- DALI_TEST_CHECK( true == copy.Get<bool>() );
- }
+int UtcDaliPropertyValueCopyConstructor06P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<Vector2> check( Vector2(1,1) );
+ END_TEST;
+}
- value = Property::Value(10.f);
- {
- Property::Value copy(false);
- copy = value;
+int UtcDaliPropertyValueCopyConstructor07P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<Vector3> check( Vector3(1.0,1.0,1.0) );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor08P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<Matrix3> check( Matrix3::IDENTITY );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor09P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<Matrix> check(Matrix::IDENTITY);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor10P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<Rect<int> > check( Rect<int>(1.0,1.0,1.0,1.0) );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor11P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<AngleAxis> check( AngleAxis(Degree(1.0), Vector3(1.0,1.0,1.0)) );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor12P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<Quaternion> check( Quaternion( Vector4(1.0, 1.0, 1.0, 1.0) ) );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor13P(void)
+{
+ TestApplication application;
+ CheckCopyCtorP<std::string> check( std::string("1") );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor14P(void)
+{
+ TestApplication application;
+ Property::Array value;
+ value.push_back(Property::Value(1));
+ CheckCopyCtorP<Property::Array> check(value);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueCopyConstructor15P(void)
+{
+ TestApplication application;
+ Property::Map value;
+ value["1"] = Property::Value(1);
+ CheckCopyCtorP<Property::Map> check(value);
+ END_TEST;
+}
+
+
+int UtcDaliPropertyValueAssignmentOperator01P(void)
+{
+ TestApplication application;
+ Property::Value value;
+ value = Property::Value(true);
+ {
+ Property::Value copy( false );
+ copy = value;
+ DALI_TEST_CHECK( true == copy.Get<bool>() );
+ }
+ END_TEST;
+}
+
+
+int UtcDaliPropertyValueAssignmentOperator02P(void)
+{
+ TestApplication application;
+ Property::Value value;
+ value = Property::Value(10.f);
+ {
+ Property::Value copy(false);
+ copy = value;
DALI_TEST_CHECK( Dali::Equals(10.f, copy.Get<float>() ) );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator03P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value(10);
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( 10 == copy.Get<int>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator04P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value(10U);
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( 10 == copy.Get< unsigned int>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator05P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( Vector2(1,1) );
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( Vector2(1,1) == copy.Get<Vector2>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator06P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( Vector3(1.f,1.f,1.f) );
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( Vector3(1.f,1.f,1.f) == copy.Get<Vector3>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator07P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( Vector4(1,1,1,1) );
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( Vector4(1,1,1,1) == copy.Get<Vector4>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator08P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( Matrix3::IDENTITY );
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( Matrix3::IDENTITY == copy.Get<Matrix3>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator09P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( Matrix::IDENTITY );
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( Matrix::IDENTITY == copy.Get<Matrix>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator10P(void)
+{
+ TestApplication application;
+ Property::Value value;
typedef Dali::Rect<int> Rectangle;
value = Property::Value( Rectangle(1,1,1,1) );
copy.Get(copyRect);
DALI_TEST_CHECK( Rectangle(1,1,1,1) == copyRect);
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator11P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( Quaternion(1,1,1,1) );
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( Quaternion(1,1,1,1) == copy.Get<Quaternion>() );
}
+ END_TEST;
+}
+
+int UtcDaliPropertyValueAssignmentOperator12P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value( AngleAxis( Radian(Math::PI_2), Vector3::XAXIS ));
{
Property::Value copy(false);
DALI_TEST_CHECK( value.Get<AngleAxis>().axis == copy.Get<AngleAxis>().axis );
DALI_TEST_CHECK( value.Get<AngleAxis>().angle == copy.Get<AngleAxis>().angle );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator13P(void)
+{
+ TestApplication application;
+ Property::Value value;
value = Property::Value("yes");
{
Property::Value copy(false);
copy = value;
DALI_TEST_CHECK( "yes" == copy.Get<std::string>() );
}
+ END_TEST;
+}
+int UtcDaliPropertyValueAssignmentOperator14P(void)
+{
+ TestApplication application;
+ Property::Value value;
Property::Array array;
value = Property::Value(Property::ARRAY);
value.AppendItem(10);
array[0].Get( getItem );
DALI_TEST_CHECK( getItem == 10 );
}
+ END_TEST;
+}
+
+int UtcDaliPropertyValueAssignmentOperator15P(void)
+{
+ TestApplication application;
+ Property::Value value;
Property::Map map;
value = Property::Value(Property::MAP);
value.SetValue("key", "value");
copy.Get( map );
DALI_TEST_CHECK( map.GetKey(0) == "key" );
}
+ END_TEST;
+}
+
+
+int UtcDaliPropertyValueGetTypeP(void)
+{
+ TestApplication application;
+
+ Property::Value value;
+ DALI_TEST_CHECK( value.GetType() == Property::NONE );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet01P(void)
+{
+ TestApplication application;
+ Property::Value value(true);
+ DALI_TEST_CHECK( value.Get<bool>() == true );
+ value = Property::Value(1.f);
+ DALI_TEST_CHECK( value.Get<float>() == 1.f );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet01N(void)
+{
+ TestApplication application;
+
+ Property::Value value;
+ try
+ {
+ value.Get<bool>() == true;
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet02P(void)
+{
+ TestApplication application;
+ Property::Value value(true);
+ DALI_TEST_CHECK( value.Get<bool>() == true );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet02N(void)
+{
+ TestApplication application;
+ GetCheckN<bool> check;
+ END_TEST;
+}
+
+
+int UtcDaliPropertyValueGet03P(void)
+{
+ TestApplication application;
+ GetCheckP<float> check(1.f);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet03N(void)
+{
+ TestApplication application;
+ GetCheckN<float> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet04P(void)
+{
+ TestApplication application;
+ GetCheckP<int> check(1);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet04N(void)
+{
+ TestApplication application;
+ GetCheckN<int> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet05P(void)
+{
+ TestApplication application;
+ GetCheckP<unsigned int> check(1u);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet05N(void)
+{
+ TestApplication application;
+ GetCheckN<unsigned int> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet06P(void)
+{
+ TestApplication application;
+ GetCheckP<Rect<int> > check(Rect<int>(1,1,1,1));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet06N(void)
+{
+ TestApplication application;
+ GetCheckN<Rect<int> > check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet07P(void)
+{
+ TestApplication application;
+ GetCheckP<Vector2> check(Vector2(1.0,1.0));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet07N(void)
+{
+ TestApplication application;
+ GetCheckN<Vector2> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet8P(void)
+{
+ TestApplication application;
+ GetCheckP<Vector3> check(Vector3(1.0,1.0,1.0));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet08N(void)
+{
+ TestApplication application;
+ GetCheckN<Vector3> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet09P(void)
+{
+ TestApplication application;
+ GetCheckP<Vector4> check(Vector4(1.0,1.0,1.0,1.0));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet09N(void)
+{
+ TestApplication application;
+ GetCheckN<Vector4> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet10P(void)
+{
+ TestApplication application;
+ GetCheckP<Matrix3> check(Matrix3(Matrix3::IDENTITY));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet10N(void)
+{
+ TestApplication application;
+ GetCheckN<Matrix3> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet11P(void)
+{
+ TestApplication application;
+ GetCheckP<Matrix> check(Matrix(Matrix::IDENTITY));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet11N(void)
+{
+ TestApplication application;
+ GetCheckN<Matrix> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet12P(void)
+{
+ TestApplication application;
+ AngleAxis a(Degree(1.0), Vector3(1.0,1.0,1.0));
+ Property::Value v(a);
+ AngleAxis b = v.Get<AngleAxis>();
+ DALI_TEST_CHECK(a.angle == b.angle);
+ DALI_TEST_CHECK(a.axis == b.axis);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet12N(void)
+{
+ TestApplication application;
+ GetCheckN<AngleAxis> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet13P(void)
+{
+ TestApplication application;
+ GetCheckP<Quaternion> check(Quaternion(1.0,1.0,1.0,1.0));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet13N(void)
+{
+ TestApplication application;
+ GetCheckN<Quaternion> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet14P(void)
+{
+ TestApplication application;
+ GetCheckP<std::string> check(std::string("astring"));
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet14N(void)
+{
+ TestApplication application;
+ GetCheckN<std::string> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet15P(void)
+{
+ TestApplication application;
+ Property::Value a(Property::ARRAY);
+ a.AppendItem(Property::Value(1));
+ Property::Array got = a.Get<Property::Array>();
+ DALI_TEST_CHECK(got[0].Get<int>() == 1);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet15N(void)
+{
+ TestApplication application;
+ GetCheckN<Property::Array> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet16P(void)
+{
+ TestApplication application;
+ Property::Value a(Property::MAP);
+ a.SetValue("key", Property::Value(1));
+ Property::Map got = a.Get<Property::Map>();
+ DALI_TEST_CHECK(got.GetValue(0).Get<int>() == 1);
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGet16N(void)
+{
+ TestApplication application;
+ GetCheckN<Property::Map> check;
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetValueP(void)
+{
+ TestApplication application;
+ Property::Value map(Property::MAP);
+ Property::Value a(1);
+ map.SetValue("key", a);
+ DALI_TEST_CHECK( map.GetValue("key").Get<int>() == 1 );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetValue01N(void)
+{
+ TestApplication application;
+ Property::Value value(1);
+
+ try
+ {
+ Property::Value got = value.GetValue("key");
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetValue02N(void)
+{
+ TestApplication application;
+ Property::Value value(Property::MAP);
+ value.SetValue("key", Property::Value(1));
+
+ try
+ {
+ Property::Value got = value.GetValue("nokey");
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Cannot find property map key", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueHasKeyP(void)
+{
+ TestApplication application;
+ Property::Value map(Property::MAP);
+ Property::Value a(1);
+ map.SetValue("key", a);
+ DALI_TEST_CHECK( map.HasKey("key") == true );
+ DALI_TEST_CHECK( map.HasKey("key2") == false );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueHasKeyN(void)
+{
+ TestApplication application;
+ Property::Value a(1);
+ DALI_TEST_CHECK( a.HasKey("key") == false );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetKeyP(void)
+{
+ TestApplication application;
+ Property::Value map(Property::MAP);
+ Property::Value a(1);
+ map.SetValue("key", a);
+ std::string empty;
+ DALI_TEST_CHECK( map.GetKey(-1) == empty );
+ DALI_TEST_CHECK( map.GetKey(1) == empty );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetKeyN(void)
+{
+ TestApplication application;
+ Property::Value a(1);
+ std::string empty;
+ DALI_TEST_CHECK( a.GetKey(0) == empty );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueSetValueP(void)
+{
+ TestApplication application;
+ Property::Value map(Property::MAP);
+ Property::Value a(1);
+ map.SetValue("key", a);
+ DALI_TEST_CHECK( map.GetValue("key").Get<int>() == 1 );
+ END_TEST;
+}
+
+int UtcDaliPropertyValueSetValueN(void)
+{
+ TestApplication application;
+ Property::Value value(1);
+
+ try
+ {
+ value.SetValue("key", Property::Value(1));
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetItem01P(void)
+{
+ TestApplication application;
+ Property::Value value(Property::ARRAY);
+ value.AppendItem(Property::Value(0));
+ value.SetItem(0, Property::Value(1));
+ DALI_TEST_CHECK( value.GetItem(0).Get<int>() == 1 );
+
+ value = Property::Value(Property::MAP);
+ value.SetValue("key", Property::Value(0));
+ value.SetItem(0, Property::Value(1));
+ DALI_TEST_CHECK( value.GetItem(0).Get<int>() == 1 );
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetItem01N(void)
+{
+ TestApplication application;
+
+ Property::Value value(1);
+
+ try
+ {
+ Property::Value item = value.GetItem(0);
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Cannot GetItem on property Type; not a container", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetItem02P(void)
+{
+ TestApplication application;
+ Property::Value value(Property::ARRAY);
+ value.AppendItem(Property::Value(0));
+ value.SetItem(0, Property::Value(1));
+ std::string key;
+ DALI_TEST_CHECK( value.GetItem(0, key).Get<int>() == 1 );
+ DALI_TEST_CHECK( key.size() == 0u );
+
+ value = Property::Value(Property::MAP);
+ value.SetValue("key", Property::Value(0));
+ value.SetItem(0, Property::Value(1));
+ DALI_TEST_CHECK( value.GetItem(0, key).Get<int>() == 1 );
+ DALI_TEST_CHECK( key.size() == 3 );
+ DALI_TEST_CHECK( key == std::string("key") );
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueGetItem02N(void)
+{
+ TestApplication application;
+
+ Property::Value value(1);
+ std::string key;
+ try
+ {
+ Property::Value item = value.GetItem(0, key);
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Cannot GetItem on property Type; not a container", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueSetItemP(void)
+{
+ TestApplication application;
+
+ Property::Value value(Property::ARRAY);
+ value.AppendItem(Property::Value(0));
+ value.SetItem(0, Property::Value(1));
+ DALI_TEST_CHECK( value.GetItem(0).Get<int>() == 1 );
+
+ value = Property::Value(Property::MAP);
+ value.SetValue("key", Property::Value(0));
+ value.SetItem(0, Property::Value(1));
+ DALI_TEST_CHECK( value.GetItem(0).Get<int>() == 1 );
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueSetItemN(void)
+{
+ TestApplication application;
+
+ Property::Value value(1);
+
+ try
+ {
+ value.SetItem(0, Property::Value(2));
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Cannot SetItem on property Type; not a container", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueAppendItemP(void)
+{
+ TestApplication application;
+
+ Property::Value value(Property::ARRAY);
+ value.AppendItem(Property::Value(1));
+ DALI_TEST_CHECK( value.GetItem(0).Get<int>() == 1 );
+
+ END_TEST;
+}
+
+int UtcDaliPropertyValueAppendItemN(void)
+{
+ TestApplication application;
+
+ Property::Value value(1);
+
+ try
+ {
+ Property::Value item = value.AppendItem(Property::Value(1));
+ tet_result(TET_FAIL);
+ }
+ catch( Dali::DaliException& e )
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "Property type invalid", TEST_LOCATION );
+ }
+ catch( ... )
+ {
+ tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_result(TET_FAIL);
+ }
END_TEST;
}
#include <iostream>
#include <sstream>
+#include <cmath> // isfinite
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
test_return_value = TET_PASS;
}
-int UtcDaliVector2Cons(void)
+int UtcDaliVector2Constructor01P(void)
{
- Vector3 v3(1.0f, 2.0f, 3.0f);
- Vector2 va;
- Vector2 vb(v3);
- Vector2 vc(11.0f, 123.0f);
-
- DALI_TEST_EQUALS(va.x, 0.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(va.y, 0.0f, 0.001f, TEST_LOCATION);
-
- DALI_TEST_EQUALS(vb.width, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vb.height, 2.0f, 0.001f, TEST_LOCATION);
-
- DALI_TEST_EQUALS(vc.width, 11.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vc.y, 123.0f, 0.001f, TEST_LOCATION);
-
- Vector4 vec4(5.0f,6.0f,7.0f,8.0f);
+ TestApplication application;
Vector2 vec2;
- vec2 = vec4;
- DALI_TEST_EQUALS(vec2.x, 5.0f, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(vec2.y, 6.0f, 0.001, TEST_LOCATION);
-
- Vector3 vec3(5.0f,6.0f,7.0f);
- vec2 = vec3;
- DALI_TEST_EQUALS(vec2.x, 5.0f, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(vec2.y, 6.0f, 0.001, TEST_LOCATION);
-
- Vector2 vec2b(vec4);
- DALI_TEST_EQUALS(vec2.x, 5.0f, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(vec2.y, 6.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.x, 0.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 0.0f, 0.001, TEST_LOCATION);
END_TEST;
}
+int UtcDaliVector2Constructor02P(void)
+{
+ TestApplication application;
+ Vector2 vec2(1.f,1.f);
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
-int UtcDaliVector2FitInside(void)
+int UtcDaliVector2Constructor03P(void)
{
- DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), FitInside( Vector2( 1.0f, 2.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 1.0f, 0.5f ), FitInside( Vector2( 1.0f, 2.0f ), Vector2( 20.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 20.0f ), FitInside( Vector2( 10.0f, 20.0f ), Vector2( 1.0f, 2.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 10.0f ), FitInside( Vector2( 100.0f, 10.0f ), Vector2( 10.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 20.0f, 10.0f ), FitInside( Vector2( 20.0f, 20.0f ), Vector2( 10.0f, 5.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 20.0f ), FitInside( Vector2( 20.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ TestApplication application;
+ float array[] = {1.f,1.f};
+ Vector2 vec2(array);
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector2FitScaleToFill(void)
+int UtcDaliVector2Constructor04P(void)
{
- DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), FitScaleToFill( Vector2( 1.0f, 2.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), FitScaleToFill( Vector2( 10.0f, 20.0f ), Vector2( 1.0f, 2.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 1.0f ), FitScaleToFill( Vector2( 100.0f, 10.0f ), Vector2( 10.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 5.0f, 5.0f ), FitScaleToFill( Vector2( 20.0f, 20.0f ), Vector2( 10.0f, 5.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 5.0f, 5.0f ), FitScaleToFill( Vector2( 20.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 20.0f, 40.0f ), FitScaleToFill( Vector2( 20.0f, 0.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 20.0f ), FitScaleToFill( Vector2( 0.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ TestApplication application;
+ Vector3 vec3(1.f,1.f,1.f);
+ Vector3 vec2(vec3);
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector2ShrinkInside(void)
+int UtcDaliVector2Constructor05P(void)
{
- DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), ShrinkInside( Vector2( 1.0f, 2.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), ShrinkInside( Vector2( 10.0f, 20.0f ), Vector2( 1.0f, 2.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 10.0f ), ShrinkInside( Vector2( 100.0f, 10.0f ), Vector2( 10.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 5.0f ), ShrinkInside( Vector2( 20.0f, 20.0f ), Vector2( 10.0f, 5.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 5.0f, 10.0f ), ShrinkInside( Vector2( 20.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 5.0f, 10.0f ), ShrinkInside( Vector2( 10.0f, 10.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 10.0f, 5.0f ), ShrinkInside( Vector2( 10.0f, 10.0f ), Vector2( 20.0f, 10.0f ) ), TEST_LOCATION );
+ TestApplication application;
+ Vector4 vec4(1.f,1.f,1.f,1.f);
+ Vector3 vec2(vec4);
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
+int UtcDaliVector2CopyConstructor01P(void)
+{
+ TestApplication application;
+ float array[] = {1.f,1.f};
+ Vector2 vec2;
+ vec2 = array;
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+int UtcDaliVector2CopyConstructor02P(void)
+{
+ TestApplication application;
+ Vector3 vec3(1.f,1.f,1.f);
+ Vector3 vec2;
+ vec2 = vec3;
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+int UtcDaliVector2CopyConstructor03P(void)
+{
+ TestApplication application;
+ Vector4 vec4(1.f,1.f,1.f,1.f);
+ Vector3 vec2;
+ vec2 = vec4;
+ DALI_TEST_EQUALS(vec2.x, 1.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.y, 1.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
-int UtcDaliVector2Add(void)
+int UtcDaliVector2AddP(void)
{
+ TestApplication application;
Vector2 v0(1.0f, 2.0f);
Vector2 v1(10.0f, 20.0f);
Vector2 r0(11.0f, 22.0f);
Vector2 v2 = v0+v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2AddAssignP(void)
+{
+ TestApplication application;
+ Vector2 v0(1.0f, 2.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(11.0f, 22.0f);
v0 += v1;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-
-// Subtract
-int UtcDaliVector2Subtract(void)
+int UtcDaliVector2SubtractP(void)
{
+ TestApplication application;
Vector2 v0(11.0f, 22.0f);
Vector2 v1(10.0f, 20.0f);
Vector2 r0(1.0f, 2.0f);
Vector2 v2 = v0-v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2SubtractAssignP(void)
+{
+ TestApplication application;
+ Vector2 v0(11.0f, 22.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(1.0f, 2.0f);
+
v0 -= v1;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-
-int UtcDaliVector2Negate(void)
+int UtcDaliVector2NegateP(void)
{
+ TestApplication application;
Vector2 v1(10.0f, 20.0f);
Vector2 r0(-10.0f, -20.0f);
END_TEST;
}
-
-// Multiply
-int UtcDaliVector2Multiply(void)
+int UtcDaliVector2Multiply01P(void)
{
+ TestApplication application;
Vector2 v0(2.0f, 3.0f);
Vector2 v1(10.0f, 20.0f);
Vector2 r0(20.0f, 60.0f);
Vector2 v2 = v0 * v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2Multiply02P(void)
+{
+ TestApplication application;
+ Vector2 v0(2.0f, 3.0f);
+ Vector2 r0(20.0f, 30.0f);
+
+ Vector2 v2 = v0 * 10.f;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVector2MultiplyAssign01P(void)
+{
+ TestApplication application;
+ Vector2 v0(2.0f, 3.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(20.0f, 60.0f);
+
v0 *= v1;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-// Divide
-int UtcDaliVector2Divide(void)
+int UtcDaliVector2MultiplyAssign02P(void)
+{
+ TestApplication application;
+ Vector2 v0(2.0f, 3.0f);
+ Vector2 r0(20.0f, 30.0f);
+
+ v0 *= 10.f;
+ DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2Divide01P(void)
{
+ TestApplication application;
Vector2 v0(1.0f, 1.0f);
Vector2 v1(2.0f, 3.0f);
Vector2 v2(4.0f, 9.0f);
DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION);
DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2Divide02P(void)
+{
+ TestApplication application;
+ Vector2 v0(1.0f, 1.0f);
+ Vector2 v1(3.0f, 3.0f);
+ Vector2 v2(9.0f, 9.0f);
+
+ DALI_TEST_EQUALS( v0/1.f, v0, TEST_LOCATION);
+ DALI_TEST_EQUALS( v1/1.f, v1, TEST_LOCATION);
+ DALI_TEST_EQUALS( v1/3.f, v0, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVector2DivideAssign01P(void)
+{
+ TestApplication application;
+ Vector2 v0(1.0f, 1.0f);
+ Vector2 v1(2.0f, 3.0f);
+ Vector2 v2(4.0f, 9.0f);
+
Vector2 v4(v0);
v4 /= v0;
DALI_TEST_EQUALS(v4, v0, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector2Scale(void)
+int UtcDaliVector2DivideAssign02P(void)
{
- Vector2 v0(2.0f, 4.0f);
- const Vector2 r0(20.0f, 40.0f);
- const Vector2 r1(10.0f, 20.0f);
- const Vector2 r2( 1.0f, 2.0f);
- const Vector2 r3(2.0f, 4.0f);
+ TestApplication application;
+ Vector2 v0(1.0f, 1.0f);
+ Vector2 v1(3.0f, 3.0f);
- Vector2 v2 = v0 * 10.0f;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ Vector2 v4(v0);
+ v4 /= 1.f;
+ DALI_TEST_EQUALS(v4, v0, TEST_LOCATION);
- v0 *= 5.0f;
- DALI_TEST_EQUALS(v0, r1, TEST_LOCATION);
+ Vector2 v5(v1);
+ v5 /= 1.f;
+ DALI_TEST_EQUALS(v5, v1, TEST_LOCATION);
- v2 = r0 / 10.0f;
- DALI_TEST_EQUALS(v2, r3, TEST_LOCATION);
+ Vector2 v6(v1);
+ v6 /= 3.f;
+ DALI_TEST_EQUALS(v6, v0, TEST_LOCATION);
- v2 = r1;
- v2 /= 10.0f;
- DALI_TEST_EQUALS(v2, r2, TEST_LOCATION);
END_TEST;
}
-// Equals
-int UtcDaliVector2Equals(void)
+int UtcDaliVector2EqualsP(void)
{
+ TestApplication application;
Vector2 v0(1.0f, 2.0f);
Vector2 v1(1.0f, 2.0f);
DALI_TEST_CHECK(v0 == v1);
+ END_TEST;
+}
+
+int UtcDaliVector2NotEqualsP(void)
+{
+ TestApplication application;
+ Vector2 v0(1.0f, 2.0f);
+ Vector2 v1(1.0f, 2.0f);
+
Vector2 v2 = Vector2(0.0f, 2.0f);
DALI_TEST_CHECK(v0 != v2);
END_TEST;
}
-// Length
-int UtcDaliVector2Length(void)
+int UtcDaliVector2OperatorSubscriptP(void)
{
- Vector2 v(1.0f, 2.0f);
- DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y), 0.001f, TEST_LOCATION);
+ TestApplication application;
+ Vector2 testVector(1.0f, 2.0f);
+
+ // read array subscripts
+ DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION );
+
+ // write array subscripts/read struct memebers
+ testVector[0] = 3.0f;
+ testVector[1] = 4.0f;
+
+ DALI_TEST_EQUALS( testVector.x, 3.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector.y, 4.0f, TEST_LOCATION );
- Vector2 v1(0.0f, 0.0f);
- DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION);
END_TEST;
}
-// Length squared
-int UtcDaliVector2LengthSquared(void)
+int UtcDaliVector2OperatorSubscriptN(void)
{
- Vector2 v(1.0f, 2.0f);
- DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y, 0.001f, TEST_LOCATION);
+ TestApplication application;
+ Vector2 testVector(1.0f, 2.0f);
+
+ try
+ {
+ float& w = testVector[4];
+ if(w==0.0f);
+ tet_result(TET_FAIL);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "index < 2", TEST_LOCATION);
+ }
- Vector2 v1(0.0f, 0.0f);
- DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION);
END_TEST;
}
-// Max
-int UtcDaliVector2Max(void)
+int UtcDaliVector2OperatorConstSubscriptP(void)
{
- Vector2 v0(2.0f, 1.0f);
- Vector2 v1(1.0f, 2.0f);
+ TestApplication application;
+ const Vector2 testVector2(3.0f, 4.0f);
+ const float& x = testVector2[0];
+ const float& y = testVector2[1];
+ DALI_TEST_EQUALS( x, 3.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( y, 4.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2OperatorConstSubscriptN(void)
+{
+ TestApplication application;
+ const Vector2 testVector2(3.0f, 4.0f);
+
+ try
+ {
+ const float& w = testVector2[4];
+ if(w==0.0f);
+ tet_result(TET_FAIL);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "index < 2" , TEST_LOCATION);
+ }
+
- DALI_TEST_EQUALS(Max(v0, v1), Vector2(2.0f, 2.0f), 0.01f, TEST_LOCATION);
END_TEST;
}
-// Min
-int UtcDaliVector2Min(void)
+
+int UtcDaliVector2LengthP(void)
{
- Vector2 v0(2.0f, 1.0f);
- Vector2 v1(1.0f, 2.0f);
+ TestApplication application;
+ Vector2 v(1.0f, 2.0f);
+ DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y), 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Min(v0, v1), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION);
+ Vector2 v1(0.0f, 0.0f);
+ DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector2Clamp(void)
+int UtcDaliVector2LengthSquaredP(void)
{
- tet_infoline("Testing Dali::Vector2::Clamp( const Vector2& v, const float& min, const float& max )");
+ TestApplication application;
+ Vector2 v(1.0f, 2.0f);
+ DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y, 0.001f, TEST_LOCATION);
- Vector2 v0(2.0f, 0.8f);
- Vector2 v1(-1.0f, 2.0f);
+ Vector2 v1(0.0f, 0.0f);
+ DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION);
+ END_TEST;
+}
- DALI_TEST_EQUALS( Clamp( v0, 0.9f, 1.1f ), Vector2(1.1f, 0.9f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( Clamp( v1, 1.0f, 1.0f ), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( Clamp( v1, 0.0f, 3.0f ), Vector2(0.0f, 2.0f), 0.01f, TEST_LOCATION );
+int UtcDaliVector2NormalizeP(void)
+{
+ TestApplication application;
+ for (float f=0.0f; f<6.0f; f+=1.0f)
+ {
+ Vector2 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f);
+ v.Normalize();
+ DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION);
+ }
END_TEST;
}
-int UtcDaliVector2ClampVector2(void)
+int UtcDaliVector2NormalizeN(void)
{
+ TestApplication application;
+ Vector2 v(0.0f, 0.0f);
+ v.Normalize();
+ DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2ClampVector2P(void)
+{
+ TestApplication application;
tet_infoline("Testing Dali::Vector2::Clamp( const Vector2& v, const Vector2& min, const Vector2& max )");
Vector2 v0(2.0f, 0.8f);
END_TEST;
}
-// Normalize
-int UtcDaliVector2Normalize(void)
+int UtcDaliVector2AsFloatP(void)
{
- for (float f=0.0f; f<6.0f; f+=1.0f)
- {
- Vector2 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f);
- v.Normalize();
- DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION);
- }
+ TestApplication application;
+ Vector2 vec2(1.f,1.f);
+ float* p = vec2.AsFloat();
- Vector4 v(0.0f, 0.0f, 0.0f, 1.0f);
- v.Normalize();
- DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
- END_TEST;
-}
+ DALI_TEST_EQUALS( p[0], 1.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( p[1], 1.f, 0.01f, TEST_LOCATION );
-int UtcDaliVector2OperatorSubscript(void)
-{
- tet_infoline("Testing Dali::Vector2::operator[]()");
+ p[0] = 2.f;
+ p[1] = 2.f;
- Vector2 testVector(1.0f, 2.0f);
+ DALI_TEST_EQUALS( p[0], 2.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( p[1], 2.f, 0.01f, TEST_LOCATION );
- // read array subscripts
- DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION );
+ END_TEST;
+}
- // write array subscripts/read struct memebers
- testVector[0] = 3.0f;
- testVector[1] = 4.0f;
+int UtcDaliVector2ConstAsFloatP(void)
+{
+ TestApplication application;
+ Vector2 vec2(1.f,1.f);
+ const float* p = vec2.AsFloat();
- DALI_TEST_EQUALS( testVector.x, 3.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector.y, 4.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( p[0], 1.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( p[1], 1.f, 0.01f, TEST_LOCATION );
- // write struct members/read array subscripts
- testVector.x = 5.0f;
- testVector.y = 6.0f;
+ END_TEST;
+}
- const Vector2 testVector2(3.0f, 4.0f);
- const float& x = testVector2[0];
- const float& y = testVector2[1];
- DALI_TEST_EQUALS( x, 3.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( y, 4.0f, TEST_LOCATION );
+int UtcDaliVector2XWidthP(void)
+{
+ TestApplication application;
+ Vector2 vec2(1.f,1.f);
+ DALI_TEST_EQUALS( vec2.x, 1.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( vec2.width, 1.f, 0.01f, TEST_LOCATION );
- try
- {
- float& w = testVector[4];
- if(w==0.0f);
- tet_result(TET_FAIL);
- }
- catch (Dali::DaliException& e)
- {
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 2", TEST_LOCATION);
- }
+ END_TEST;
+}
- try
- {
- const float& w = testVector2[4];
- if(w==0.0f);
- tet_result(TET_FAIL);
- }
- catch (Dali::DaliException& e)
- {
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 2" , TEST_LOCATION);
- }
+int UtcDaliVector2YHeightP(void)
+{
+ TestApplication application;
+ Vector2 vec2(1.f,1.f);
+ DALI_TEST_EQUALS( vec2.y, 1.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( vec2.height, 1.f, 0.01f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliVector2OStreamOperator(void)
+int UtcDaliVector2OStreamOperatorP(void)
{
+ TestApplication application;
std::ostringstream oss;
Vector2 vector(1, 2);
DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
+
+
+int UtcDaliVector2MaxP(void)
+{
+ TestApplication application;
+ Vector2 v0(2.0f, 1.0f);
+ Vector2 v1(1.0f, 2.0f);
+
+ DALI_TEST_EQUALS(Max(v0, v1), Vector2(2.0f, 2.0f), 0.01f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2MinP(void)
+{
+ TestApplication application;
+ Vector2 v0(2.0f, 1.0f);
+ Vector2 v1(1.0f, 2.0f);
+
+ DALI_TEST_EQUALS(Min(v0, v1), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2ClampP(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::Vector2::Clamp( const Vector2& v, const float& min, const float& max )");
+
+ Vector2 v0(2.0f, 0.8f);
+ Vector2 v1(-1.0f, 2.0f);
+
+ DALI_TEST_EQUALS( Clamp( v0, 0.9f, 1.1f ), Vector2(1.1f, 0.9f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Clamp( v1, 1.0f, 1.0f ), Vector2(1.0f, 1.0f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Clamp( v1, 0.0f, 3.0f ), Vector2(0.0f, 2.0f), 0.01f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2FitInsideP(void)
+{
+ TestApplication application;
+ DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), FitInside( Vector2( 1.0f, 2.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 1.0f, 0.5f ), FitInside( Vector2( 1.0f, 2.0f ), Vector2( 20.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 20.0f ), FitInside( Vector2( 10.0f, 20.0f ), Vector2( 1.0f, 2.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 10.0f ), FitInside( Vector2( 100.0f, 10.0f ), Vector2( 10.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 20.0f, 10.0f ), FitInside( Vector2( 20.0f, 20.0f ), Vector2( 10.0f, 5.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 20.0f ), FitInside( Vector2( 20.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2FitInside01N(void)
+{
+ TestApplication application;
+ Size size = FitInside( Vector2( 1.0f, 2.0f ), Vector2( 0.0f, 0.0f ) );
+ DALI_TEST_EQUALS( false, std::isfinite(size.y), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2FitScaleToFillP(void)
+{
+ TestApplication application;
+ DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), FitScaleToFill( Vector2( 1.0f, 2.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), FitScaleToFill( Vector2( 10.0f, 20.0f ), Vector2( 1.0f, 2.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 1.0f ), FitScaleToFill( Vector2( 100.0f, 10.0f ), Vector2( 10.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 5.0f, 5.0f ), FitScaleToFill( Vector2( 20.0f, 20.0f ), Vector2( 10.0f, 5.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 5.0f, 5.0f ), FitScaleToFill( Vector2( 20.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 20.0f, 40.0f ), FitScaleToFill( Vector2( 20.0f, 0.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 20.0f ), FitScaleToFill( Vector2( 0.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ END_TEST;
+}
+
+
+int UtcDaliVector2FitScaleToFillN(void)
+{
+ TestApplication application;
+ Vector2 target(0.f, 0.f);
+ Size size = FitScaleToFill( target, Vector2( 0.0f, 0.0f ) );
+ DALI_TEST_EQUALS( size, target, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2ShrinkInsideP(void)
+{
+ TestApplication application;
+ DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), ShrinkInside( Vector2( 1.0f, 2.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 1.0f, 2.0f ), ShrinkInside( Vector2( 10.0f, 20.0f ), Vector2( 1.0f, 2.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 10.0f ), ShrinkInside( Vector2( 100.0f, 10.0f ), Vector2( 10.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 5.0f ), ShrinkInside( Vector2( 20.0f, 20.0f ), Vector2( 10.0f, 5.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 5.0f, 10.0f ), ShrinkInside( Vector2( 20.0f, 20.0f ), Vector2( 5.0f, 10.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 5.0f, 10.0f ), ShrinkInside( Vector2( 10.0f, 10.0f ), Vector2( 10.0f, 20.0f ) ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Vector2( 10.0f, 5.0f ), ShrinkInside( Vector2( 10.0f, 10.0f ), Vector2( 20.0f, 10.0f ) ), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2ShrinkInside01N(void)
+{
+ TestApplication application;
+ Vector2 target(0.f, 0.f);
+ Size size = ShrinkInside( Vector2( -1.0f, 1.0f ), Vector2( 0.0f, 1.0f ) );
+ DALI_TEST_EQUALS( false, std::isfinite(size.x), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector2ShrinkInside02N(void)
+{
+ TestApplication application;
+ Vector2 target(0.f, 0.f);
+ Size size = ShrinkInside( Vector2( -1.0f, -1.0f ), Vector2( 1.0f, 0.0f ) );
+ DALI_TEST_EQUALS( false, std::isfinite(size.y), TEST_LOCATION );
+ END_TEST;
+}
+
#include <iostream>
#include <sstream>
+#include <cmath> // isfinite
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
test_return_value = TET_PASS;
}
-int UtcDaliVector3Cons(void)
+int UtcDaliVector3Constructor01P(void)
{
+ TestApplication application;
Vector3 va;
- Vector3 vb(Vector2(1.0f, 2.0f));
- Vector3 vc(Vector4(5.63f, 2.31f, 9.83f, 11.23f));
- float array[] = {1.0f, 2.0f, 3.0f};
- Vector3 vd(array);
-
DALI_TEST_EQUALS(va.x, 0.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(va.y, 0.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(va.z, 0.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
- DALI_TEST_EQUALS(vb.x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vb.y, 2.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vb.z, 0.0f, 0.001f, TEST_LOCATION);
-
- DALI_TEST_EQUALS(vc.x, 5.63f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vc.y, 2.31f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vc.z, 9.83f, 0.001f, TEST_LOCATION);
-
- DALI_TEST_EQUALS(vd.x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vd.y, 2.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vd.z, 3.0f, 0.001f, TEST_LOCATION);
-
- Vector3* vecPtr = new Vector3(1.0f, 2.0f, 3.0f);
- DALI_TEST_CHECK( vecPtr != NULL );
- DALI_TEST_EQUALS(vecPtr->x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vecPtr->y, 2.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vecPtr->z, 3.0f, 0.001f, TEST_LOCATION);
+int UtcDaliVector3Constructor02P(void)
+{
+ TestApplication application;
+ Vector3 va(1.f, 1.f, 1.f);
+ DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.z, 1.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
- Vector3 vec3;
- vec3 = *vecPtr;
- delete vecPtr;
+int UtcDaliVector3Constructor03P(void)
+{
+ TestApplication application;
+ float array [] = {1.f, 1.f, 1.f};
+ Vector3 va(array);
+ DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.z, 1.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
- Vector3 vec3b(vd);
- DALI_TEST_EQUALS(vec3b.x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vec3b.y, 2.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vec3b.z, 3.0f, 0.001f, TEST_LOCATION);
+int UtcDaliVector3Constructor04P(void)
+{
+ TestApplication application;
+ Vector2 vec2(1.f,1.f);
+ Vector3 va(vec2);
+ DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.z, 0.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
- Vector3 vec3c = vd;
- DALI_TEST_EQUALS(vec3c.x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vec3c.y, 2.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vec3c.z, 3.0f, 0.001f, TEST_LOCATION);
+int UtcDaliVector3Constructor05P(void)
+{
+ TestApplication application;
+ Vector4 vec4(1.f, 1.f, 1.f, 1.f);
+ Vector3 va(vec4);
+ DALI_TEST_EQUALS(va.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.y, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.z, 1.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector3Assign(void)
+int UtcDaliVector3Assign01P(void)
{
+ TestApplication application;
Vector3 v0;
const float array[] = { 1.0f, 2.0f, 3.0f };
v0 = (const float*)array;
DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(v0.z, 3.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
+int UtcDaliVector3Assign02P(void)
+{
+ TestApplication application;
Vector2 vec2_q(1.0f, 2.0f);
Vector3 vec3a;
vec3a = vec2_q;
DALI_TEST_EQUALS(vec3a.x, 1.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(vec3a.y, 2.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(vec3a.z, 0.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
+int UtcDaliVector3Assign03P(void)
+{
+ TestApplication application;
Vector4 vec4_q(4.0f, 3.0f, 2.0f, 1.0f);
Vector3 vec3b;
vec3b = vec4_q;
END_TEST;
}
-
-// Add
-int UtcDaliVector3Add(void)
+int UtcDaliVector3Add01P(void)
{
+ TestApplication application;
Vector3 v0(1.0f, 2.0f, 3.0f);
Vector3 v1(10.0f, 20.0f, 30.0f);
Vector3 r0(11.0f, 22.0f, 33.0f);
Vector3 v2 = v0+v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
- v0 += v1;
- DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-// Constants
-int UtcDaliVector3Constants(void)
+int UtcDaliVector3Add02P(void)
{
- Vector3 va = Vector3::ZERO;
- Vector3 vb = Vector3::ONE;
- Vector3 vc = Vector3::XAXIS;
-
- DALI_TEST_EQUALS(va.x, 0.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(va.y, 0.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(va.z, 0.0f, 0.001f, TEST_LOCATION);
+ TestApplication application;
+ Vector3 v0(1.0f, 2.0f, 3.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(11.0f, 22.0f, 33.0f);
- DALI_TEST_EQUALS(vb.x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vb.y, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vb.z, 1.0f, 0.001f, TEST_LOCATION);
+ v0 += v1;
+ DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
- DALI_TEST_EQUALS(vc.x, 1.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vc.y, 0.0f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS(vc.z, 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-// Cross
-int UtcDaliVector3Cross(void)
+int UtcDaliVector3Subtract01P(void)
{
- DALI_TEST_EQUALS(Vector3::XAXIS.Cross(Vector3::YAXIS), Vector3::ZAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::YAXIS.Cross(Vector3::ZAXIS), Vector3::XAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::ZAXIS.Cross(Vector3::XAXIS), Vector3::YAXIS, 0.0001f, TEST_LOCATION);
-
- DALI_TEST_EQUALS(Vector3::XAXIS.Cross(Vector3::ZAXIS), -Vector3::YAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::YAXIS.Cross(Vector3::XAXIS), -Vector3::ZAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::ZAXIS.Cross(Vector3::YAXIS), -Vector3::XAXIS, 0.0001f, TEST_LOCATION);
-
- Vector3 v0(2.0f, 3.0f, 4.0f);
+ TestApplication application;
+ Vector3 v0(11.0f, 22.0f, 33.0f);
Vector3 v1(10.0f, 20.0f, 30.0f);
- Vector3 result( (v0.y * v1.z) - (v0.z * v1.y),
- (v0.z * v1.x) - (v0.x * v1.z),
- (v0.x * v1.y) - (v0.y * v1.x) );
+ Vector3 r0(1.0f, 2.0f, 3.0f);
+ Vector3 v2 = v0-v1;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
- DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION);
END_TEST;
}
-// Dot
-int UtcDaliVector3Dot(void)
+int UtcDaliVector3Subtract02P(void)
{
- DALI_TEST_EQUALS(Vector3::XAXIS.Dot(Vector3::YAXIS), 0.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::XAXIS.Dot(Vector3::ZAXIS), 0.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::XAXIS.Dot(Vector3::XAXIS), 1.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::YAXIS.Dot(Vector3::YAXIS), 1.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3::ZAXIS.Dot(Vector3::ZAXIS), 1.0f, TEST_LOCATION);
-
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f).Dot(Vector3(1.0f, 0.0f, 0.0f)), 1.0f, TEST_LOCATION);
-
- for (float x = 0; x<6.0f; x+=1.0f)
- {
- Vector3 v0(cosf(x), sinf(x), 0.0f);
- Vector3 v1(sinf(x), -cosf(x), 0.0f);
- DALI_TEST_EQUALS(v0.Dot(v1), 0.0f, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(v0.Dot(v0), 1.0f, 0.0001f, TEST_LOCATION);
-
- v0 = Vector3(cosf(x), 0.0f, sinf(x));
- v1 = Vector3(sinf(x), 0.0f, -cosf(x));
- DALI_TEST_EQUALS(v0.Dot(v0), 1.0f, 0.0001f, TEST_LOCATION);
- }
-
- Vector3 v0 = Vector3(12.0f, 7.0f, 9.0f);
- v0.Normalize();
+ TestApplication application;
+ Vector3 v0(11.0f, 22.0f, 33.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(1.0f, 2.0f, 3.0f);
- Vector3 v1 = v0 * 2.0f;
- DALI_TEST_EQUALS(v0.Dot(v1), 2.0f, 0.001f, TEST_LOCATION);
+ v0 -= v1;
+ DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-
-// Equals
-int UtcDaliVector3Equals(void)
+int UtcDaliVector3Multiply01P(void)
{
- Vector3 v0(1.0f, 2.0f, 3.0f);
- Vector3 v1(1.0f, 2.0f, 3.0f);
-
- DALI_TEST_CHECK(v0 == v1);
-
- Vector3 v2 = Vector3(0.0f, 2.0f, 3.0f);
- DALI_TEST_CHECK(v0 != v2);
-
- v2 = Vector3(1.0f, 0.0f, 3.0f);
- DALI_TEST_CHECK(v0 != v2);
-
- v2 = Vector3(1.0f, 2.0f, 0.0f);
- DALI_TEST_CHECK(v0 != v2);
+ TestApplication application;
+ Vector3 v0(2.0f, 3.0f, 4.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(20.0f, 60.0f, 120.0f);
- v2 = Vector3(11.0f, 22.0f, 33.0f);
- DALI_TEST_CHECK(v0 != v2);
+ Vector3 v2 = v0 * v1;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
}
-
-// Length
-int UtcDaliVector3Length(void)
+int UtcDaliVector3Multiply02P(void)
{
- Vector3 v(1.0f, 2.0f, 3.0f);
- DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y + v.z*v.z), 0.001f, TEST_LOCATION);
-
- Vector3 v1(0.0f, 0.0f, 0.0f);
- DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION);
+ TestApplication application;
+ Vector3 v0(2.0f, 3.0f, 4.0f);
+ Vector3 r0(20.0f, 30.0f, 40.0f);
+ Vector3 v2 = v0 * 10.f;
+ DALI_TEST_EQUALS(v2, r0, 0.001, TEST_LOCATION);
END_TEST;
}
-// Length squared
-int UtcDaliVector3LengthSquared(void)
+int UtcDaliVector3Multiply03P(void)
{
- Vector3 v(1.0f, 2.0f, 3.0f);
- DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y + v.z*v.z, 0.001f, TEST_LOCATION);
-
- Vector3 v1(0.0f, 0.0f, 0.0f);
- DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION);
+ TestApplication application;
+ Vector3 v0(2.0f, 3.0f, 4.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(20.0f, 60.0f, 120.0f);
+ v0 *= v1;
+ DALI_TEST_EQUALS(v0, r0, 0.001, TEST_LOCATION);
END_TEST;
}
-// Max
-int UtcDaliVector3Max(void)
+int UtcDaliVector3Multiply04P(void)
{
- Vector3 v0(2.0f, 1.0f, 3.0f);
- Vector3 v1(1.0f, 2.0f, 3.0f);
-
- DALI_TEST_EQUALS(Max(v0, v1), Vector3(2.0f, 2.0f, 3.0f), 0.01f, TEST_LOCATION);
+ TestApplication application;
+ Vector3 v0(2.0f, 3.0f, 4.0f);
+ Vector3 r0(20.0f, 30.0f, 40.0f);
+ v0 *= 10.f;
+ DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-// Min
-int UtcDaliVector3Min(void)
+int UtcDaliVector3Multiply05P(void)
{
- Vector3 v0(2.0f, 2.0f, 1.0f);
- Vector3 v1(1.0f, 1.0f, 2.0f);
-
- DALI_TEST_EQUALS(Min(v0, v1), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION);
+ TestApplication application;
+ Vector3 vec3(Vector3::YAXIS);
+ Quaternion rotation(Radian(Math::PI_2), Vector3::ZAXIS);
+ Vector3 result(-Vector3::XAXIS);
+ vec3 *= rotation;
+ DALI_TEST_EQUALS( vec3, result, 0.001, TEST_LOCATION );
END_TEST;
}
-int UtcDaliVector3Clamp(void)
+int UtcDaliVector3Divide01P(void)
{
- tet_infoline("Testing Dali::Vector3::Clamp()");
+ TestApplication application;
+ Vector3 v0(1.0f, 1.0f, 1.0f);
+ Vector3 v1(2.0f, 3.0f, 5.0f);
+ Vector3 v2(4.0f, 9.0f, 25.0f);
- Vector3 v0( 2.0f, 1.0f, 0.0f );
- Vector3 v1( -1.0f, 2.0f, 1.0f );
+ DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION);
+ DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION);
+ DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION);
+ DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION);
- DALI_TEST_EQUALS( Clamp( v0, 0.9f, 1.1f ), Vector3(1.1f, 1.0f, 0.9f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( Clamp( v1, 1.0f, 1.0f ), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION );
END_TEST;
}
-int UtcDaliVector3ClampVector3(void)
+int UtcDaliVector3Divide02P(void)
{
- tet_infoline("Testing Dali::Vector3::Clamp( const Vector3& v, const Vector3& min, const Vector3& max )");
-
- Vector3 v0(2.0f, 0.8f, 0.0f);
- Vector3 v1(-1.0f, 2.0f, 10.0f);
- Vector3 v2(10.0f, 5.0f, 0.0f);
- Vector3 v3(8.0f, 10.0f, 5.0f);
- Vector3 v4(4.9f, 5.1f, 10.0f);
- Vector3 min(1.0f, 4.0f, 1.5f);
- Vector3 max(9.0f, 6.0f, 8.0f);
-
- v0.Clamp( min, max );
- v1.Clamp( min, max );
- v2.Clamp( min, max );
- v3.Clamp( min, max );
- v4.Clamp( min, max );
-
- DALI_TEST_EQUALS( v0, Vector3(2.0f, 4.0f, 1.5f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v1, Vector3(1.0f, 4.0f, 8.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v2, Vector3(9.0f, 5.0f, 1.5f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v3, Vector3(8.0f, 6.0f, 5.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v4, Vector3(4.9f, 5.1f, 8.0f), 0.01f, TEST_LOCATION );
+ TestApplication application;
+ Vector3 v0(3.0f, 6.0f, 9.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
+ Vector3 r(3.0f, 3.0f, 3.0f);
+ Vector3 v2 = v0 / v1;
+ DALI_TEST_EQUALS(v2, r, TEST_LOCATION);
END_TEST;
}
-// Multiply
-int UtcDaliVector3Multiply(void)
+int UtcDaliVector3Divide03P(void)
{
- Vector3 v0(2.0f, 3.0f, 4.0f);
- Vector3 v1(10.0f, 20.0f, 30.0f);
- Vector3 r0(20.0f, 60.0f, 120.0f);
-
- Vector3 v2 = v0 * v1;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
-
- v0 *= v1;
- DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
+ TestApplication application;
+ Vector3 v0(3.0f, 6.0f, 9.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
+ Vector3 v2 = v0 / 3.f;
+ DALI_TEST_EQUALS(v2, v1, TEST_LOCATION);
END_TEST;
}
-
-// Divide
-int UtcDaliVector3Divide(void)
+int UtcDaliVector3Divide04P(void)
{
- Vector3 v0(1.0f, 1.0f, 1.0f);
- Vector3 v1(2.0f, 3.0f, 5.0f);
- Vector3 v2(4.0f, 9.0f, 25.0f);
-
- DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION);
- DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION);
- DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION);
- DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION);
-
+ TestApplication application;
+ Vector3 v0(3.0f, 6.0f, 9.0f);
+ Vector3 v1(1.0f, 1.0f, 1.0f);
Vector3 v4(v0);
v4 /= v0;
- DALI_TEST_EQUALS(v4, v0, TEST_LOCATION);
-
- Vector3 v5(v1);
- v5 /= v0;
- DALI_TEST_EQUALS(v5, v1, TEST_LOCATION);
-
- Vector3 v6(v1);
- v6 /= v6;
- DALI_TEST_EQUALS(v6, v0, TEST_LOCATION);
-
- v2 /= v1;
- DALI_TEST_EQUALS(v2, v1, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(v4, v1, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector3Scale(void)
+int UtcDaliVector3Divide05P(void)
{
- Vector3 v0(2.0f, 4.0f, 8.0f);
- const Vector3 r0(20.0f, 40.0f, 80.0f);
- const Vector3 r1(10.0f, 20.0f, 40.0f);
- const Vector3 r2( 1.0f, 2.0f, 4.0f);
- const Vector3 r3(2.0f, 4.0f, 8.0f);
-
- Vector3 v2 = v0 * 10.0f;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ TestApplication application;
+ Vector3 v0(3.0f, 6.0f, 9.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
+ Vector3 v4(v0);
+ v4 /= 3.f;
+ DALI_TEST_EQUALS(v4, v1, TEST_LOCATION);
+ END_TEST;
+}
- v0 *= 5.0f;
- DALI_TEST_EQUALS(v0, r1, TEST_LOCATION);
- v2 = r0 / 10.0f;
- DALI_TEST_EQUALS(v2, r3, TEST_LOCATION);
+int UtcDaliVector3NegateP(void)
+{
+ TestApplication application;
+ Vector3 v1(10.0f, 20.0f, 30.f);
+ Vector3 r0(-10.0f, -20.0f, -30.f);
- v2 = r1;
- v2 /= 10.0f;
- DALI_TEST_EQUALS(v2, r2, TEST_LOCATION);
+ Vector3 v2 = -v1;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
}
-
-
-// Normalize
-int UtcDaliVector3Normalize(void)
+int UtcDaliVector3EqualsP(void)
{
- for (float f=0.0f; f<6.0f; f+=1.0f)
- {
- Vector3 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f, cosf(f+2.0f)*10.0f);
- v.Normalize();
- DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION);
- }
+ TestApplication application;
+ Vector3 v0(1.0f, 2.0f, 3.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
- Vector3 v(0.0f, 0.0f, 0.0f);
- v.Normalize();
- DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
+ DALI_TEST_CHECK(v0 == v1);
END_TEST;
}
-// Subtract
-int UtcDaliVector3Subtract(void)
+int UtcDaliVector3NotEqualsP(void)
{
- Vector3 v0(11.0f, 22.0f, 33.0f);
- Vector3 v1(10.0f, 20.0f, 30.0f);
- Vector3 r0(1.0f, 2.0f, 3.0f);
+ TestApplication application;
+ Vector3 v0(1.0f, 2.0f, 3.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
+ Vector3 v2 = Vector3(0.0f, 2.0f, 3.0f);
+ DALI_TEST_CHECK(v0 != v2);
- Vector3 v2 = v0-v1;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ v2 = Vector3(1.0f, 0.0f, 3.0f);
+ DALI_TEST_CHECK(v0 != v2);
- v0 -= v1;
- DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
+ v2 = Vector3(1.0f, 2.0f, 0.0f);
+ DALI_TEST_CHECK(v0 != v2);
+
+ v2 = Vector3(11.0f, 22.0f, 33.0f);
+ DALI_TEST_CHECK(v0 != v2);
END_TEST;
}
-int UtcDaliVector3OperatorSubscript(void)
+int UtcDaliVector3OperatorSubscriptP(void)
{
+ TestApplication application;
Vector3 testVector(1.0f, 2.0f, 3.0f);
// read array subscripts
DALI_TEST_EQUALS( testVector[0], 7.0f, TEST_LOCATION );
DALI_TEST_EQUALS( testVector[1], 8.0f, TEST_LOCATION );
DALI_TEST_EQUALS( testVector[2], 9.0f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector3ConstOperatorSubscriptP(void)
+{
+ TestApplication application;
+ Vector3 testVector(1.0f, 2.0f, 3.0f);
// write struct members/read array subscripts
const Vector3 testVector2(1.0f, 2.0f, 3.0f);
END_TEST;
}
-int UtcDaliVector3OStreamOperator(void)
+int UtcDaliVector3DotP(void)
{
- std::ostringstream oss;
+ TestApplication application;
+ DALI_TEST_EQUALS(Vector3::XAXIS.Dot(Vector3::YAXIS), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::XAXIS.Dot(Vector3::ZAXIS), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::XAXIS.Dot(Vector3::XAXIS), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::YAXIS.Dot(Vector3::YAXIS), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::ZAXIS.Dot(Vector3::ZAXIS), 1.0f, TEST_LOCATION);
- Vector3 vector(1, 2, 3);
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f).Dot(Vector3(1.0f, 0.0f, 0.0f)), 1.0f, TEST_LOCATION);
- oss << vector;
+ for (float x = 0; x<6.0f; x+=1.0f)
+ {
+ Vector3 v0(cosf(x), sinf(x), 0.0f);
+ Vector3 v1(sinf(x), -cosf(x), 0.0f);
+ DALI_TEST_EQUALS(v0.Dot(v1), 0.0f, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.Dot(v0), 1.0f, 0.0001f, TEST_LOCATION);
- std::string expectedOutput = "[1, 2, 3]";
+ v0 = Vector3(cosf(x), 0.0f, sinf(x));
+ v1 = Vector3(sinf(x), 0.0f, -cosf(x));
+ DALI_TEST_EQUALS(v0.Dot(v0), 1.0f, 0.0001f, TEST_LOCATION);
+ }
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ Vector3 v0 = Vector3(12.0f, 7.0f, 9.0f);
+ v0.Normalize();
+
+ Vector3 v1 = v0 * 2.0f;
+ DALI_TEST_EQUALS(v0.Dot(v1), 2.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector3Rotate(void)
+int UtcDaliVector3CrossP(void)
{
TestApplication application;
+ DALI_TEST_EQUALS(Vector3::XAXIS.Cross(Vector3::YAXIS), Vector3::ZAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::YAXIS.Cross(Vector3::ZAXIS), Vector3::XAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::ZAXIS.Cross(Vector3::XAXIS), Vector3::YAXIS, 0.0001f, TEST_LOCATION);
- Vector3 vec3(Vector3::YAXIS);
- Quaternion rotation( Dali::ANGLE_90, Vector3::ZAXIS );
- Vector3 result(-Vector3::XAXIS);
- vec3 *= rotation;
- DALI_TEST_EQUALS( vec3, result, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3::XAXIS.Cross(Vector3::ZAXIS), -Vector3::YAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::YAXIS.Cross(Vector3::XAXIS), -Vector3::ZAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::ZAXIS.Cross(Vector3::YAXIS), -Vector3::XAXIS, 0.0001f, TEST_LOCATION);
+
+ Vector3 v0(2.0f, 3.0f, 4.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 result( (v0.y * v1.z) - (v0.z * v1.y),
+ (v0.z * v1.x) - (v0.x * v1.z),
+ (v0.x * v1.y) - (v0.y * v1.x) );
+
+
+ DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3LengthP(void)
+{
+ TestApplication application;
+ Vector3 v(1.0f, 2.0f, 3.0f);
+ DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y + v.z*v.z), 0.001f, TEST_LOCATION);
+
+ Vector3 v1(0.0f, 0.0f, 0.0f);
+ DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3LengthSquaredP(void)
+{
+ TestApplication application;
+ Vector3 v(1.0f, 2.0f, 3.0f);
+ DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y + v.z*v.z, 0.001f, TEST_LOCATION);
+
+ Vector3 v1(0.0f, 0.0f, 0.0f);
+ DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3NormalizeP(void)
+{
+ TestApplication application;
+ for (float f=0.0f; f<6.0f; f+=1.0f)
+ {
+ Vector3 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f, cosf(f+2.0f)*10.0f);
+ v.Normalize();
+ DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION);
+ }
+
+ Vector3 v(0.0f, 0.0f, 0.0f);
+ v.Normalize();
+ DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector3AsFloat(void)
+int UtcDaliVector3ClampVector3P(void)
{
+ TestApplication application;
+
+ Vector3 v0(2.0f, 0.8f, 0.0f);
+ Vector3 v1(-1.0f, 2.0f, 10.0f);
+ Vector3 v2(10.0f, 5.0f, 0.0f);
+ Vector3 v3(8.0f, 10.0f, 5.0f);
+ Vector3 v4(4.9f, 5.1f, 10.0f);
+ Vector3 min(1.0f, 4.0f, 1.5f);
+ Vector3 max(9.0f, 6.0f, 8.0f);
+
+ v0.Clamp( min, max );
+ v1.Clamp( min, max );
+ v2.Clamp( min, max );
+ v3.Clamp( min, max );
+ v4.Clamp( min, max );
+
+ DALI_TEST_EQUALS( v0, Vector3(2.0f, 4.0f, 1.5f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( v1, Vector3(1.0f, 4.0f, 8.0f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( v2, Vector3(9.0f, 5.0f, 1.5f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( v3, Vector3(8.0f, 6.0f, 5.0f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( v4, Vector3(4.9f, 5.1f, 8.0f), 0.01f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector3AsFloatP(void)
+{
+ TestApplication application;
float values[] = {0.0f, 1.0f, 2.0f};
Vector3 v0(values);
DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION);
}
+ END_TEST;
+}
+
+int UtcDaliVector3ConstAsFloatP(void)
+{
+ TestApplication application;
+ float values[] = {0.0f, 1.0f, 2.0f};
+ Vector3 v0(values);
+
const Vector3 v1(values);
for (int i=0;i<3;++i)
{
END_TEST;
}
-int UtcDaliVector3AsVectorXY(void)
+int UtcDaliVector3ConstAsVectorXYP(void)
+{
+ TestApplication application;
+ float values[] = {0.0f, 1.0f, 2.0f};
+ const Vector3 v0(values);
+ DALI_TEST_EQUALS(v0.GetVectorXY().x, values[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.GetVectorXY().y, values[1], TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3AsVectorXYP(void)
{
+ TestApplication application;
float values[] = {0.0f, 1.0f, 2.0f};
Vector3 v0(values);
- const Vector3 v1(5.0f, 10.0f, 15.0f);
- // X = 0.0
- // Y = 1.0
- // Z = 2.0
DALI_TEST_EQUALS(v0.GetVectorXY().x, values[0], TEST_LOCATION);
DALI_TEST_EQUALS(v0.GetVectorXY().y, values[1], TEST_LOCATION);
+ END_TEST;
+}
- v0.GetVectorXY() = v1.GetVectorYZ();
- // X = y
- // Y = z
- // Z = 2.0
- DALI_TEST_EQUALS(v0.GetVectorXY().x, v1.y, TEST_LOCATION);
- DALI_TEST_EQUALS(v0.GetVectorXY().y, v1.z, TEST_LOCATION);
- DALI_TEST_EQUALS(v0.z, values[2], TEST_LOCATION);
+int UtcDaliVector3ConstAsVectorXZP(void)
+{
+ TestApplication application;
+ float values[] = {0.0f, 1.0f, 2.0f};
+ const Vector3 v0(values);
- v0.GetVectorYZ() = v1.GetVectorXY();
- // X = y
- // Y = x
- // Z = y
- DALI_TEST_EQUALS(v0.x, v1.y, TEST_LOCATION);
- DALI_TEST_EQUALS(v0.y, v1.x, TEST_LOCATION);
- DALI_TEST_EQUALS(v0.z, v1.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.GetVectorYZ().x, values[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.GetVectorYZ().y, values[2], TEST_LOCATION);
END_TEST;
}
+int UtcDaliVector3AsVectorXZP(void)
+{
+ TestApplication application;
+ float values[] = {0.0f, 1.0f, 2.0f};
+ Vector3 v0(values);
+
+ DALI_TEST_EQUALS(v0.GetVectorYZ().x, values[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.GetVectorYZ().y, values[2], TEST_LOCATION);
+ END_TEST;
+}
-int UtcDaliVector3FitKeepAspectRatio(void)
+int UtcDaliVector3OStreamOperatorP(void)
+{
+ TestApplication application;
+ std::ostringstream oss;
+
+ Vector3 vector(1, 2, 3);
+
+ oss << vector;
+
+ std::string expectedOutput = "[1, 2, 3]";
+
+ DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3MinP(void)
+{
+ TestApplication application;
+ Vector3 v0(2.0f, 2.0f, 1.0f);
+ Vector3 v1(1.0f, 1.0f, 2.0f);
+
+ DALI_TEST_EQUALS(Min(v0, v1), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3MaxP(void)
+{
+ TestApplication application;
+ Vector3 v0(2.0f, 1.0f, 3.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
+
+ DALI_TEST_EQUALS(Max(v0, v1), Vector3(2.0f, 2.0f, 3.0f), 0.01f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector3ClampP(void)
+{
+ TestApplication application;
+ Vector3 v0( 2.0f, 1.0f, 0.0f );
+ Vector3 v1( -1.0f, 2.0f, 1.0f );
+
+ DALI_TEST_EQUALS( Clamp( v0, 0.9f, 1.1f ), Vector3(1.1f, 1.0f, 0.9f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS( Clamp( v1, 1.0f, 1.0f ), Vector3(1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector3FitKeepAspectRatioP(void)
{
TestApplication application;
Vector3 target(10.0f, 20.0f, 30.0f);
END_TEST;
}
-int UtcDaliVector3FillKeepAspectRatio(void)
+int UtcDaliVector3FillKeepAspectRatioP(void)
{
TestApplication application;
Vector3 target(10.0f, 20.0f, 30.0f);
END_TEST;
}
-int UtcDaliVector3FillXYKeepAspectRatio(void)
+int UtcDaliVector3FillXYKeepAspectRatioP(void)
{
TestApplication application;
Vector3 target(10.0f, 20.0f, 30.0f);
END_TEST;
}
-int UtcDaliVector3ShrinkInsideKeepAspectRatio(void)
+int UtcDaliVector3ShrinkInsideKeepAspectRatioP(void)
{
TestApplication application;
Vector3 target(1.0f, 2.0f, 3.0f);
DALI_TEST_EQUALS( ShrinkInsideKeepAspectRatio( source2, target ), Vector3::ONE, 0.001, TEST_LOCATION );
END_TEST;
}
+
+int UtcDaliVector3ShrinkInsideKeepAspectRatioN(void)
+{
+ TestApplication application;
+ Vector3 target(-1.0f, -1.0f, -1.0f);
+ Vector3 source(0.0f, 0.0f, 0.0f);
+
+ Vector3 shrink = ShrinkInsideKeepAspectRatio( target, source );
+
+ DALI_TEST_EQUALS( false, std::isfinite(shrink.y), TEST_LOCATION );
+ END_TEST;
+}
+
+int UtcDaliVector3ConstantsP(void)
+{
+ TestApplication application;
+ Vector3 va = Vector3::ZERO;
+ Vector3 vb = Vector3::ONE;
+ Vector3 vc = Vector3::XAXIS;
+
+ DALI_TEST_EQUALS(va.x, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.y, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(va.z, 0.0f, 0.001f, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(vb.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(vb.y, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(vb.z, 1.0f, 0.001f, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(vc.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(vc.y, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(vc.z, 0.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
+
test_return_value = TET_PASS;
}
+int UtcDaliVector4Constructor01P(void)
+{
+ Vector4 v;
+ DALI_TEST_EQUALS(v.x, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.y, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.z, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.w, 0.0f, TEST_LOCATION);
+ END_TEST;
+}
+int UtcDaliVector4Constructor02P(void)
+{
+ Vector4 v(1.0f, 2.0f, 3.0f, 4.f);
+ DALI_TEST_EQUALS(v.x, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.y, 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.z, 3.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.w, 4.0f, TEST_LOCATION);
+ END_TEST;
+}
-// Constructor
-int UtcDaliVector4Vector4(void)
+int UtcDaliVector4Constructor03P(void)
{
- float f[] = {2.0f, 3.0f, 4.0f, 5.0f};
- Vector2 vec2(1.0f, 2.0f);
- Vector3 vec3(1.0f, 2.0f, 3.0f);
- Vector4 v0(f);
- Vector4 v1(f[0], f[1], f[2], f[3]);
- Vector4 v2(v0);
- Vector4 v3;
- v3 = (const float*) f;
- Vector4 v4(vec2);
- Vector4 v5(vec3);
+ float f [] = {1.0f, 2.0f, 3.0f, 4.f};
+ Vector4 v(f);
+ DALI_TEST_EQUALS(v.x, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.y, 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.z, 3.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.w, 4.0f, TEST_LOCATION);
+ END_TEST;
+}
- DALI_TEST_EQUALS(v0, v1, TEST_LOCATION);
- DALI_TEST_EQUALS(v0, v2, TEST_LOCATION);
- DALI_TEST_EQUALS(v3, v0, TEST_LOCATION);
- DALI_TEST_EQUALS(v4, Vector4(1.0f, 2.0f, 0.0f, 0.0f), TEST_LOCATION);
- DALI_TEST_EQUALS(v5, Vector4(1.0f, 2.0f, 3.0f, 0.0f), TEST_LOCATION);
- DALI_TEST_CHECK(v0 == v1);
+int UtcDaliVector4Constructor04P(void)
+{
+ Vector2 vec2(1.f, 2.f);
+ Vector4 v(vec2);
+ DALI_TEST_EQUALS(v.x, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.y, 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.z, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.w, 0.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Constructor05P(void)
+{
+ Vector3 vec3(1.f, 2.f, 3.f);
+ Vector4 v(vec3);
+ DALI_TEST_EQUALS(v.x, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.y, 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.z, 3.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.w, 0.0f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Assign01P(void)
+{
+ Vector4 v0;
+ const float array[] = { 1.0f, 2.0f, 3.0f, 4.f };
+ v0 = (const float*)array;
+
+ DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.z, 3.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.w, 4.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Assign02P(void)
+{
+ Vector2 vec2(1.f, 2.f);
+ Vector4 v0;
+ v0 = vec2;
+ DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.z, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.z, 0.0f, 0.001f, TEST_LOCATION);
+ END_TEST;
+}
- v1 = vec2;
- v2 = vec3;
- DALI_TEST_EQUALS(v1.x, 1.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(v1.y, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(v2.x, 1.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(v2.y, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(v2.z, 3.0f, TEST_LOCATION);
+int UtcDaliVector4Assign03P(void)
+{
+ Vector3 vec3(1.f, 2.f, 3.f);
+ Vector4 v0;
+ v0 = vec3;
+ DALI_TEST_EQUALS(v0.x, 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.y, 2.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.z, 3.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.w, 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-// Add
-int UtcDaliVector4Add(void)
+int UtcDaliVector4Add01P(void)
{
Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f);
Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
Vector4 v2 = v0+v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Add02P(void)
+{
+ Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f);
+ Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
+ Vector4 r0(11.0f, 22.0f, 33.0f, 44.0f);
+
v0 += v1;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-// Constants
-int UtcDaliVector4Constants(void)
+int UtcDaliVector4Subtract01P(void)
{
- float f[] = {2.0f, 3.0f, 4.0f, 5.0f};
- Vector4 v0(f);
- Vector4 v1(f[0], f[1], f[2], f[3]);
- Vector4 v2(v0);
+ Vector4 v0(11.0f, 22.0f, 33.0f, 44.0f);
+ Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
+ Vector4 r0(1.0f, 2.0f, 3.0f, 4.0f);
- DALI_TEST_EQUALS(v0, v1, TEST_LOCATION);
- DALI_TEST_EQUALS(v0, v2, TEST_LOCATION);
- DALI_TEST_CHECK(v0 == v1);
+ Vector4 v2 = v0-v1;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
}
-// Cross
-int UtcDaliVector4Cross(void)
+int UtcDaliVector4Subtract02P(void)
{
- DALI_TEST_EQUALS(Vector4::XAXIS.Cross(Vector4::YAXIS), Vector4::ZAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector4::YAXIS.Cross(Vector4::ZAXIS), Vector4::XAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector4::ZAXIS.Cross(Vector4::XAXIS), Vector4::YAXIS, 0.0001f, TEST_LOCATION);
+ Vector4 v0(11.0f, 22.0f, 33.0f, 44.0f);
+ Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
+ Vector4 r0(1.0f, 2.0f, 3.0f, 4.0f);
- DALI_TEST_EQUALS(Vector4::XAXIS.Cross(Vector4::ZAXIS), -Vector4::YAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector4::YAXIS.Cross(Vector4::XAXIS), -Vector4::ZAXIS, 0.0001f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector4::ZAXIS.Cross(Vector4::YAXIS), -Vector4::XAXIS, 0.0001f, TEST_LOCATION);
+ v0 -= v1;
+ DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
+ END_TEST;
+}
+int UtcDaliVector4Multiply01P(void)
+{
Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f);
- Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
- Vector4 result( (v0.y * v1.z) - (v0.z * v1.y),
- (v0.z * v1.x) - (v0.x * v1.z),
- (v0.x * v1.y) - (v0.y * v1.x),
- 0.0f);
+ Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
+ Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f);
- DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION);
+ Vector4 v2 = v0 * v1;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVector4Multiply02P(void)
+{
+ Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f);
+ Vector4 v2 = v0 * 10.0f;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Multiply03P(void)
+{
+ Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f);
+ Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
+ Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f);
+
+ v0 *= v1;
+ DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Multiply04P(void)
+{
+ Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f);
+ Vector4 v2(r0);
+ v0 *= 10.0f;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4Divide01P(void)
+{
+ Vector4 v0(1.0f, 1.0f, 1.0f, 1.0f);
+ Vector4 v1(2.0f, 3.0f, 5.0f, 7.0f);
+ Vector4 v2(4.0f, 9.0f, 25.0f, 49.0f);
+
+ DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION);
+ DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION);
+ DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION);
+ DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION);
+
+
+ END_TEST;
+}
+
+int UtcDaliVector4Divide02P(void)
+{
+ Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f);
+ const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f);
+ const Vector4 r2( 1.0f, 2.0f, 4.0f, 8.0f);
+ const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f);
+
+ Vector4 v2 = r0 / 10.0f;
+ DALI_TEST_EQUALS(v2, r3, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVector4Divide03P(void)
+{
+ Vector4 v0(1.0f, 1.0f, 1.0f, 1.0f);
+ Vector4 v1(2.0f, 3.0f, 5.0f, 7.0f);
+ Vector4 v2(4.0f, 9.0f, 25.0f, 49.0f);
+
+ Vector4 v4(v0);
+ v4 /= v0;
+ DALI_TEST_EQUALS(v4, v0, TEST_LOCATION);
+
+ Vector4 v5(v1);
+ v5 /= v0;
+ DALI_TEST_EQUALS(v5, v1, TEST_LOCATION);
+
+ Vector4 v6(v1);
+ v6 /= v6;
+ DALI_TEST_EQUALS(v6, v0, TEST_LOCATION);
+
+ v2 /= v1;
+ DALI_TEST_EQUALS(v2, v1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVector4Divide04P(void)
+{
+ Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f);
+ const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f);
+ const Vector4 r2( 1.0f, 2.0f, 4.0f, 8.0f);
+ const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f);
+
+ Vector4 v2(r0);
+ v2 /= 10.0f;
+ DALI_TEST_EQUALS(v2, r3, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliVector4NegateP(void)
+{
+ TestApplication application;
+ Vector4 v1(10.0f, 20.0f, 30.f, 40.f);
+ Vector4 r0(-10.0f, -20.0f, -30.f, -40.f);
+
+ Vector4 v2 = -v1;
+ DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector4EqualsP(void)
+{
+ Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f);
+ Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f);
+
+ DALI_TEST_CHECK(v0 == v1);
+ END_TEST;
+}
+
+int UtcDaliVector4NotEqualsP(void)
+{
+ Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f);
+ Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f);
+
+ Vector4 v2 = Vector4(0.0f, 2.0f, 3.0f, 4.0f);
+ DALI_TEST_CHECK(v0 != v2);
+
+ v2 = Vector4(1.0f, 0.0f, 3.0f, 4.0f);
+ DALI_TEST_CHECK(v0 != v2);
+
+ v2 = Vector4(1.0f, 2.0f, 0.0f, 4.0f);
+ DALI_TEST_CHECK(v0 != v2);
+
+ v2 = Vector4(1.0f, 2.0f, 3.0f, 0.0f);
+ DALI_TEST_CHECK(v0 != v2);
+ END_TEST;
+}
+
+int UtcDaliVector4OperatorSubscriptP(void)
+{
+ Vector4 testVector(1.0f, 2.0f, 3.0f, 4.0f);
+
+ // read array subscripts
+ DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[2], 3.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[3], 4.0f, TEST_LOCATION );
+
+ // write array subscripts/read struct memebers
+ testVector[0] = 5.0f;
+ testVector[1] = 6.0f;
+ testVector[2] = 7.0f;
+ testVector[3] = 8.0f;
+
+ DALI_TEST_EQUALS( testVector.x, 5.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector.y, 6.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector.z, 7.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector.w, 8.0f, TEST_LOCATION );
+
+ // write struct members/read array subscripts
+ testVector.x = 9.0f;
+ testVector.y = 10.0f;
+ testVector.z = 11.0f;
+ testVector.w = 12.0f;
+
+ DALI_TEST_EQUALS( testVector[0], 9.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[1], 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[2], 11.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( testVector[3], 12.0f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
+int UtcDaliVector4ConstOperatorSubscriptP(void)
+{
+ Vector4 testVector(1.0f, 2.0f, 3.0f, 4.0f);
+
+ // write struct members/read array subscripts
+ const Vector4 testVector2(1.0f, 2.0f, 3.0f, 4.0f);
+ const float& x = testVector2[0];
+ const float& y = testVector2[1];
+ const float& z ( testVector2[2] );
+ const float& w ( testVector2[3] );
+
+ DALI_TEST_EQUALS( x, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( y, 2.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( z, 3.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS( w, 4.0f, TEST_LOCATION );
+
+ try
+ {
+ float& w = testVector[4];
+ if(w==0.0f);
+ tet_result(TET_FAIL);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION );
+ }
+
+ try
+ {
+ const float& w = testVector2[4];
+ if(w==0.0f);
+ tet_result(TET_FAIL);
+ }
+ catch (Dali::DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION );
+ }
END_TEST;
}
-// Dot
-int UtcDaliVector4Dot(void)
+int UtcDaliVector4Dot01P(void)
{
DALI_TEST_EQUALS(Vector4::XAXIS.Dot(Vector4::YAXIS), 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector4::XAXIS.Dot(Vector4::ZAXIS), 0.0f, TEST_LOCATION);
END_TEST;
}
-// Dot (with vector3)
-int UtcDaliVector4DotVector3(void)
+int UtcDaliVector4DotVector302P(void)
{
DALI_TEST_EQUALS(Vector4::XAXIS.Dot(Vector3::YAXIS), 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector4::XAXIS.Dot(Vector3::ZAXIS), 0.0f, TEST_LOCATION);
END_TEST;
}
-// Dot4
-int UtcDaliVector4Dot4(void)
+int UtcDaliVector4Dot4P(void)
{
DALI_TEST_EQUALS(Vector4::XAXIS.Dot4(Vector4::YAXIS), 0.0f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector4::XAXIS.Dot4(Vector4::ZAXIS), 0.0f, TEST_LOCATION);
END_TEST;
}
-// Equals
-int UtcDaliVector4Equals(void)
+int UtcDaliVector4CrossP(void)
{
- Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f);
- Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f);
-
- DALI_TEST_CHECK(v0 == v1);
-
- Vector4 v2 = Vector4(0.0f, 2.0f, 3.0f, 4.0f);
- DALI_TEST_CHECK(v0 != v2);
+ DALI_TEST_EQUALS(Vector4::XAXIS.Cross(Vector4::YAXIS), Vector4::ZAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4::YAXIS.Cross(Vector4::ZAXIS), Vector4::XAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4::ZAXIS.Cross(Vector4::XAXIS), Vector4::YAXIS, 0.0001f, TEST_LOCATION);
- v2 = Vector4(1.0f, 0.0f, 3.0f, 4.0f);
- DALI_TEST_CHECK(v0 != v2);
+ DALI_TEST_EQUALS(Vector4::XAXIS.Cross(Vector4::ZAXIS), -Vector4::YAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4::YAXIS.Cross(Vector4::XAXIS), -Vector4::ZAXIS, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4::ZAXIS.Cross(Vector4::YAXIS), -Vector4::XAXIS, 0.0001f, TEST_LOCATION);
- v2 = Vector4(1.0f, 2.0f, 0.0f, 4.0f);
- DALI_TEST_CHECK(v0 != v2);
+ Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f);
+ Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
+ Vector4 result( (v0.y * v1.z) - (v0.z * v1.y),
+ (v0.z * v1.x) - (v0.x * v1.z),
+ (v0.x * v1.y) - (v0.y * v1.x),
+ 0.0f);
- v2 = Vector4(1.0f, 2.0f, 3.0f, 0.0f);
- DALI_TEST_CHECK(v0 != v2);
+ DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION);
END_TEST;
}
-// Length
-int UtcDaliVector4Length(void)
+int UtcDaliVector4LengthP(void)
{
Vector4 v(1.0f, 2.0f, 3.0f, 4.0f);
DALI_TEST_EQUALS(v.Length(), sqrtf(v.x*v.x + v.y*v.y + v.z*v.z), 0.001f, TEST_LOCATION);
END_TEST;
}
-// Length squared
-int UtcDaliVector4LengthSquared(void)
+int UtcDaliVector4LengthSquaredP(void)
{
Vector4 v(1.0f, 2.0f, 3.0f, 4.0f);
DALI_TEST_EQUALS(v.LengthSquared(), v.x*v.x + v.y*v.y + v.z*v.z, 0.001f, TEST_LOCATION);
END_TEST;
}
-// Max
-int UtcDaliVector4Max(void)
-{
- Vector4 v0(2.0f, 2.0f, 1.0f, 1.0f);
- Vector4 v1(1.0f, 1.0f, 2.0f, 2.0f);
-
- DALI_TEST_EQUALS(Max(v0, v1), Vector4(2.0f, 2.0f, 2.0f, 2.0f), 0.01f, TEST_LOCATION);
- END_TEST;
-}
-
-// Min
-int UtcDaliVector4Min(void)
-{
- Vector4 v0(2.0f, 2.0f, 1.0f, 1.0f);
- Vector4 v1(1.0f, 1.0f, 2.0f, 2.0f);
-
- DALI_TEST_EQUALS(Min(v0, v1), Vector4(1.0f, 1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION);
- END_TEST;
-}
-
-// Clamp
-int UtcDaliVector4Clamp(void)
+int UtcDaliVector4NormalizeP(void)
{
- tet_infoline("Testing Dali::Vector4::Clamp()");
-
- Vector4 v0(2.0f, 2.0f, -2.0f, -2.0f);
- DALI_TEST_EQUALS(Clamp(v0, -1.0f, 1.0f), Vector4(1.0f, 1.0f, -1.0f, -1.0f), 0.01f, TEST_LOCATION);
-
- Vector4 v1(1.0f, 0.0f, 0.0f, -1.0f);
- DALI_TEST_EQUALS(Clamp(v1, -1.0f, 1.0f), v1, 0.01f, TEST_LOCATION);
+ for (float f=0.0f; f<6.0f; f+=1.0f)
+ {
+ Vector4 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f, cosf(f+2.0f)*10.0f, 1.0f);
+ v.Normalize();
+ DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION);
+ }
+ Vector4 v(0.0f, 0.0f, 0.0f, 1.0f);
+ v.Normalize();
+ DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector4ClampVector4(void)
+int UtcDaliVector4ClampVector4P(void)
{
tet_infoline("Testing Dali::Vector4::Clamp( const Vector4& v, const Vector4& min, const Vector4& max )");
END_TEST;
}
-// Multiply
-int UtcDaliVector4Multiply(void)
+int UtcDaliVector4AsFloatP(void)
{
- Vector4 v0(2.0f, 3.0f, 4.0f, 5.0f);
- Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
- Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f);
+ float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
+ Vector4 v0(values);
- Vector4 v2 = v0 * v1;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ for (int i=0;i<4;++i)
+ {
+ DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION);
+ }
- v0 *= v1;
- DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
END_TEST;
}
-// Divide
-int UtcDaliVector4Divide(void)
+int UtcDaliVector4ConstAsFloatP(void)
{
- Vector4 v0(1.0f, 1.0f, 1.0f, 1.0f);
- Vector4 v1(2.0f, 3.0f, 5.0f, 7.0f);
- Vector4 v2(4.0f, 9.0f, 25.0f, 49.0f);
-
- DALI_TEST_EQUALS( v0/v0, v0, TEST_LOCATION);
- DALI_TEST_EQUALS( v1/v0, v1, TEST_LOCATION);
- DALI_TEST_EQUALS( v1/v1, v0, TEST_LOCATION);
- DALI_TEST_EQUALS( v2/v1, v1, TEST_LOCATION);
-
- Vector4 v4(v0);
- v4 /= v0;
- DALI_TEST_EQUALS(v4, v0, TEST_LOCATION);
-
- Vector4 v5(v1);
- v5 /= v0;
- DALI_TEST_EQUALS(v5, v1, TEST_LOCATION);
-
- Vector4 v6(v1);
- v6 /= v6;
- DALI_TEST_EQUALS(v6, v0, TEST_LOCATION);
-
- v2 /= v1;
- DALI_TEST_EQUALS(v2, v1, TEST_LOCATION);
+ float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
+ Vector4 v0(values);
+ const Vector4 v1(values);
+ for (int i=0;i<4;++i)
+ {
+ DALI_TEST_EQUALS(v1.AsFloat()[i], values[i], TEST_LOCATION);
+ }
END_TEST;
}
-int UtcDaliVector4Scale(void)
+int UtcDaliVector4OStreamOperatorP(void)
{
- Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
- const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f);
- const Vector4 r1(10.0f, 20.0f, 40.0f, 80.0f);
- const Vector4 r2( 1.0f, 2.0f, 4.0f, 8.0f);
- const Vector4 r3(2.0f, 4.0f, 8.0f, 16.0f);
-
- Vector4 v2 = v0 * 10.0f;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
-
- v0 *= 5.0f;
- DALI_TEST_EQUALS(v0, r1, TEST_LOCATION);
-
- v2 = r0 / 10.0f;
- DALI_TEST_EQUALS(v2, r3, TEST_LOCATION);
+ std::ostringstream oss;
- v2 = r1;
- v2 /= 10.0f;
- DALI_TEST_EQUALS(v2, r2, TEST_LOCATION);
- END_TEST;
-}
+ Vector4 vector(1.0f, 2.0f, 3.0f, 4.0f);
+ oss << vector;
-// Normalize
-int UtcDaliVector4Normalize(void)
-{
- for (float f=0.0f; f<6.0f; f+=1.0f)
- {
- Vector4 v(cosf(f)*10.0f, cosf(f+1.0f)*10.0f, cosf(f+2.0f)*10.0f, 1.0f);
- v.Normalize();
- DALI_TEST_EQUALS(v.LengthSquared(), 1.0f, 0.001f, TEST_LOCATION);
- }
+ std::string expectedOutput = "[1, 2, 3, 4]";
- Vector4 v(0.0f, 0.0f, 0.0f, 1.0f);
- v.Normalize();
- DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
+ DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
-// Subtract
-int UtcDaliVector4Subtract(void)
+int UtcDaliVector4MaxP(void)
{
- Vector4 v0(11.0f, 22.0f, 33.0f, 44.0f);
- Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
- Vector4 r0(1.0f, 2.0f, 3.0f, 4.0f);
-
- Vector4 v2 = v0-v1;
- DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
+ Vector4 v0(2.0f, 2.0f, 1.0f, 1.0f);
+ Vector4 v1(1.0f, 1.0f, 2.0f, 2.0f);
- v0 -= v1;
- DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
+ DALI_TEST_EQUALS(Max(v0, v1), Vector4(2.0f, 2.0f, 2.0f, 2.0f), 0.01f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector4OperatorSubscript(void)
+int UtcDaliVector4MinP(void)
{
- Vector4 testVector(1.0f, 2.0f, 3.0f, 4.0f);
-
- // read array subscripts
- DALI_TEST_EQUALS( testVector[0], 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[1], 2.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[2], 3.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[3], 4.0f, TEST_LOCATION );
-
- // write array subscripts/read struct memebers
- testVector[0] = 5.0f;
- testVector[1] = 6.0f;
- testVector[2] = 7.0f;
- testVector[3] = 8.0f;
-
- DALI_TEST_EQUALS( testVector.x, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector.y, 6.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector.z, 7.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector.w, 8.0f, TEST_LOCATION );
-
- // write struct members/read array subscripts
- testVector.x = 9.0f;
- testVector.y = 10.0f;
- testVector.z = 11.0f;
- testVector.w = 12.0f;
-
- DALI_TEST_EQUALS( testVector[0], 9.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[1], 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[2], 11.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector[3], 12.0f, TEST_LOCATION );
-
-
- // write struct members/read array subscripts
- const Vector4 testVector2(1.0f, 2.0f, 3.0f, 4.0f);
- const float& x = testVector2[0];
- const float& y = testVector2[1];
- const float& z ( testVector2[2] );
- const float& w ( testVector2[3] );
-
- DALI_TEST_EQUALS( x, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( y, 2.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( z, 3.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( w, 4.0f, TEST_LOCATION );
-
- try
- {
- float& w = testVector[4];
- if(w==0.0f);
- tet_result(TET_FAIL);
- }
- catch (Dali::DaliException& e)
- {
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION );
- }
+ Vector4 v0(2.0f, 2.0f, 1.0f, 1.0f);
+ Vector4 v1(1.0f, 1.0f, 2.0f, 2.0f);
- try
- {
- const float& w = testVector2[4];
- if(w==0.0f);
- tet_result(TET_FAIL);
- }
- catch (Dali::DaliException& e)
- {
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION );
- }
+ DALI_TEST_EQUALS(Min(v0, v1), Vector4(1.0f, 1.0f, 1.0f, 1.0f), 0.01f, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector4OStreamOperator(void)
+int UtcDaliVector4ClampP(void)
{
- std::ostringstream oss;
-
- Vector4 vector(1.0f, 2.0f, 3.0f, 4.0f);
+ tet_infoline("Testing Dali::Vector4::Clamp()");
- oss << vector;
+ Vector4 v0(2.0f, 2.0f, -2.0f, -2.0f);
+ DALI_TEST_EQUALS(Clamp(v0, -1.0f, 1.0f), Vector4(1.0f, 1.0f, -1.0f, -1.0f), 0.01f, TEST_LOCATION);
- std::string expectedOutput = "[1, 2, 3, 4]";
+ Vector4 v1(1.0f, 0.0f, 0.0f, -1.0f);
+ DALI_TEST_EQUALS(Clamp(v1, -1.0f, 1.0f), v1, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
-int UtcDaliVector4AsFloat(void)
+int UtcDaliVector4ConstantsP(void)
{
- float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
- Vector4 v0(values);
-
- for (int i=0;i<4;++i)
- {
- DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION);
- }
+ float f[] = {2.0f, 3.0f, 4.0f, 5.0f};
+ Vector4 v0(f);
+ Vector4 v1(f[0], f[1], f[2], f[3]);
+ Vector4 v2(v0);
- const Vector4 v1(values);
- for (int i=0;i<4;++i)
- {
- DALI_TEST_EQUALS(v1.AsFloat()[i], values[i], TEST_LOCATION);
- }
+ DALI_TEST_EQUALS(v0, v1, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0, v2, TEST_LOCATION);
+ DALI_TEST_CHECK(v0 == v1);
END_TEST;
}
case Property::ROTATION:
{
- mImpl = new Impl( value.Get<Quaternion>() );
+ // Orientations have two representations
+ DALI_ASSERT_DEBUG( typeid(Quaternion) == value.mImpl->mValue.GetType() ||
+ typeid(AngleAxis) == value.mImpl->mValue.GetType() );
+
+ if ( typeid(Quaternion) == value.mImpl->mValue.GetType() )
+ {
+ mImpl = new Impl( value.Get<Quaternion>() );
+ }
+ else
+ {
+ mImpl = new Impl( value.Get<AngleAxis>() );
+ }
break;
}
case Property::ROTATION:
{
- mImpl->mValue = value.Get<Quaternion>();
+ // Orientations have two representations
+ DALI_ASSERT_DEBUG( typeid(Quaternion) == value.mImpl->mValue.GetType() ||
+ typeid(AngleAxis) == value.mImpl->mValue.GetType() );
+
+ if ( typeid(Quaternion) == value.mImpl->mValue.GetType() )
+ {
+ mImpl = new Impl( value.Get<Quaternion>() );
+ }
+ else
+ {
+ mImpl = new Impl( value.Get<AngleAxis>() );
+ }
break;
}