#include <stdio.h>
#include <stdlib.h>
-#define assert(exp) \
- if (!(exp)) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert(exp) \
+ if(!(exp)) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Following expression is not true:\n" \
- "%s\n", #exp); \
- return 1; \
- }
+ "%s\n", \
+ #exp); \
+ return 1; \
+ }
-#define assert_eq(var, ref) \
- if (var != ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_eq(var, ref) \
+ if(var != ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Values \"%s\" and \"%s\" are not equal:\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, (int)var, #ref, (int)ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ (int)var, \
+ #ref, \
+ (int)ref); \
+ return 1; \
+ }
-#define assert_neq(var, ref) \
- if (var == ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_neq(var, ref) \
+ if(var == ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Values \"%s\" and \"%s\" are equal:\n" \
- "%s == %s == %d\n", \
- #var, #ref, #var, #ref, (int)ref); \
- return 1; \
- }
+ "%s == %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ #ref, \
+ (int)ref); \
+ return 1; \
+ }
-#define assert_gt(var, ref) \
- if (var <= ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_gt(var, ref) \
+ if(var <= ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not greater than \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
-#define assert_geq(var, ref) \
- if (var < ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_geq(var, ref) \
+ if(var < ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not greater or equal to \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
-#define assert_lt(var, ref) \
- if (var >= ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_lt(var, ref) \
+ if(var >= ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not lower than \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
-#define assert_leq(var, ref) \
- if (var > ref) { \
- fprintf(stderr, \
- "Assert fail in %s:%d\n", __FILE__, __LINE__); \
- fprintf(stderr, \
+#define assert_leq(var, ref) \
+ if(var > ref) \
+ { \
+ fprintf(stderr, \
+ "Assert fail in %s:%d\n", \
+ __FILE__, \
+ __LINE__); \
+ fprintf(stderr, \
"Value \"%s\" is not lower or equal to \"%s\":\n" \
- "%s == %d, %s == %d\n", \
- #var, #ref, #var, var, #ref, ref); \
- return 1; \
- }
+ "%s == %d, %s == %d\n", \
+ #var, \
+ #ref, \
+ #var, \
+ var, \
+ #ref, \
+ ref); \
+ return 1; \
+ }
#endif // ASSERT_H
#define SIGNAL_HELPER
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
class TestButton
{
public:
-
- TestButton( unsigned int id )
+ TestButton(unsigned int id)
: mId(id)
{
}
void Press()
{
- mPanelDown.Emit( *this );
+ mPanelDown.Emit(*this);
}
void Release()
{
- mPanelUp.Emit( *this );
+ mPanelUp.Emit(*this);
}
- typedef Signal< void (TestButton&) > PanelDownSignal;
- typedef Signal< void (TestButton&) > PanelUpSignal;
+ typedef Signal<void(TestButton&)> PanelDownSignal;
+ typedef Signal<void(TestButton&)> PanelUpSignal;
PanelDownSignal& DownSignal()
{
}
private:
-
- int mId;
+ int mId;
PanelDownSignal mPanelDown;
PanelUpSignal mPanelUp;
};
class TestApp : public ConnectionTracker
{
public:
-
TestApp()
- : mButtonPressed( false ),
- mVoidFunctionCalled( false )
+ : mButtonPressed(false),
+ mVoidFunctionCalled(false)
{
}
- void OnButtonPress( TestButton& button )
+ void OnButtonPress(TestButton& button)
{
mButtonPressed = true;
- mButtonId = button.GetId();
+ mButtonId = button.GetId();
}
- void OnButtonRelease( TestButton& button )
+ void OnButtonRelease(TestButton& button)
{
mButtonPressed = false;
- mButtonId = button.GetId();
+ mButtonId = button.GetId();
}
int GetButtonPressedId()
bool mButtonPressed;
bool mVoidFunctionCalled;
- int mButtonId;
+ int mButtonId;
};
class TestSignals
{
public:
-
// Void return, no parameters
- typedef Signal<void ()> VoidRetNoParamSignal;
+ typedef Signal<void()> VoidRetNoParamSignal;
// Void return, 1 value parameter
- typedef Signal<void (int)> VoidRet1ValueParamSignal;
+ typedef Signal<void(int)> VoidRet1ValueParamSignal;
// Void return, 1 reference parameter
- typedef Signal< void (int&)> VoidRet1RefParamSignal;
+ typedef Signal<void(int&)> VoidRet1RefParamSignal;
// Void return, 2 value parameters
- typedef Signal<void (int, int)> VoidRet2ValueParamSignal;
+ typedef Signal<void(int, int)> VoidRet2ValueParamSignal;
// Void return, 3 value parameters
- typedef Signal<void (int, int, int)> VoidRet3ValueParamSignal;
+ typedef Signal<void(int, int, int)> VoidRet3ValueParamSignal;
// bool return, 1 value parameter
- typedef Signal< bool (float)> BoolRet1ValueParamSignal;
+ typedef Signal<bool(float)> BoolRet1ValueParamSignal;
// bool return, 2 value parameter
- typedef Signal<bool (float, int) > BoolRet2ValueParamSignal;
+ typedef Signal<bool(float, int)> BoolRet2ValueParamSignal;
// int return, 2 value parameter
- typedef Signal<int (float, int)> IntRet2ValueParamSignal;
+ typedef Signal<int(float, int)> IntRet2ValueParamSignal;
// float return, 0 parameters
- typedef Signal< float () > FloatRet0ParamSignal;
+ typedef Signal<float()> FloatRet0ParamSignal;
// float return, 1 value parameters
- typedef Signal< float (float ) > FloatRet1ParamSignal;
+ typedef Signal<float(float)> FloatRet1ParamSignal;
// float return, 2 value parameters
- typedef Signal<float (float, float) > FloatRet2ValueParamSignal;
+ typedef Signal<float(float, float)> FloatRet2ValueParamSignal;
// float return, 3 value parameters
- typedef Signal<float (float, float, float) > FloatRet3ValueParamSignal;
+ typedef Signal<float(float, float, float)> FloatRet3ValueParamSignal;
// void return, 3 value parameters
- typedef Signal<void (float, float, float) > VoidSignalTypeFloatValue3;
-
+ typedef Signal<void(float, float, float)> VoidSignalTypeFloatValue3;
- VoidRetNoParamSignal& SignalVoidNone() { return mSignalVoid0; }
- VoidRet1RefParamSignal& SignalVoid1Ref() { return mSignalVoid1R; }
- VoidRet1ValueParamSignal& SignalVoid1Value() { return mSignalVoid1V; }
- VoidRet2ValueParamSignal& SignalVoid2Value() { return mSignalVoid2V; }
- VoidRet3ValueParamSignal& SignalVoid3Value() { return mSignalVoid3V; }
+ VoidRetNoParamSignal& SignalVoidNone()
+ {
+ return mSignalVoid0;
+ }
+ VoidRet1RefParamSignal& SignalVoid1Ref()
+ {
+ return mSignalVoid1R;
+ }
+ VoidRet1ValueParamSignal& SignalVoid1Value()
+ {
+ return mSignalVoid1V;
+ }
+ VoidRet2ValueParamSignal& SignalVoid2Value()
+ {
+ return mSignalVoid2V;
+ }
+ VoidRet3ValueParamSignal& SignalVoid3Value()
+ {
+ return mSignalVoid3V;
+ }
- BoolRet1ValueParamSignal& SignalBool1Value() { return mSignalBool1V; }
- BoolRet2ValueParamSignal& SignalBool2Value() { return mSignalBool2V; }
- IntRet2ValueParamSignal& SignalInt2Value() { return mSignalInt2V; }
- FloatRet0ParamSignal& SignalFloat0() { return mSignalFloat0; }
- FloatRet1ParamSignal& SignalFloat1Value() {return mSignalFloat1V; }
- FloatRet2ValueParamSignal& SignalFloat2Value() { return mSignalFloat2V; }
+ BoolRet1ValueParamSignal& SignalBool1Value()
+ {
+ return mSignalBool1V;
+ }
+ BoolRet2ValueParamSignal& SignalBool2Value()
+ {
+ return mSignalBool2V;
+ }
+ IntRet2ValueParamSignal& SignalInt2Value()
+ {
+ return mSignalInt2V;
+ }
+ FloatRet0ParamSignal& SignalFloat0()
+ {
+ return mSignalFloat0;
+ }
+ FloatRet1ParamSignal& SignalFloat1Value()
+ {
+ return mSignalFloat1V;
+ }
+ FloatRet2ValueParamSignal& SignalFloat2Value()
+ {
+ return mSignalFloat2V;
+ }
- VoidSignalTypeFloatValue3& VoidSignalFloatValue3() { return mVoidSignalFloatValue3; }
- FloatRet3ValueParamSignal& SignalFloat3Value() { return mFloatSignalFloatValue3; }
+ VoidSignalTypeFloatValue3& VoidSignalFloatValue3()
+ {
+ return mVoidSignalFloatValue3;
+ }
+ FloatRet3ValueParamSignal& SignalFloat3Value()
+ {
+ return mFloatSignalFloatValue3;
+ }
TestSignals()
{
void CheckNoConnections()
{
- DALI_TEST_EQUALS( mSignalVoid0.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalVoid1R.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalVoid1V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalVoid2V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalVoid3V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalBool1V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalBool2V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalInt2V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalFloat0.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalFloat1V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mSignalFloat2V.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mVoidSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mFloatSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(mSignalVoid0.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalVoid1R.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalVoid1V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalVoid2V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalVoid3V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalBool1V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalBool2V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalInt2V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalFloat0.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalFloat1V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mSignalFloat2V.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mVoidSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mFloatSignalFloatValue3.GetConnectionCount(), 0u, TEST_LOCATION);
}
void EmitVoidSignalVoid()
void EmitVoidSignal2IntValue(int p1, int p2)
{
- mSignalVoid2V.Emit(p1,p2);
+ mSignalVoid2V.Emit(p1, p2);
}
void EmitVoidSignal3IntValue(int p1, int p2, int p3)
{
- mSignalVoid3V.Emit(p1,p2,p3);
+ mSignalVoid3V.Emit(p1, p2, p3);
}
-
bool EmitBoolSignalFloatValue(float p1)
{
return mSignalBool1V.Emit(p1);
return mSignalInt2V.Emit(p1, p2);
}
- float EmitFloat1VSignal(float p1 )
+ float EmitFloat1VSignal(float p1)
{
- return mSignalFloat1V.Emit(p1 );
+ return mSignalFloat1V.Emit(p1);
}
float EmitFloat2VSignal(float p1, float p2)
}
private:
-
- VoidRetNoParamSignal mSignalVoid0;
- VoidRet1RefParamSignal mSignalVoid1R;
- VoidRet1ValueParamSignal mSignalVoid1V;
- VoidRet2ValueParamSignal mSignalVoid2V;
- VoidRet3ValueParamSignal mSignalVoid3V;
-
- BoolRet1ValueParamSignal mSignalBool1V;
- BoolRet2ValueParamSignal mSignalBool2V;
- IntRet2ValueParamSignal mSignalInt2V;
- FloatRet0ParamSignal mSignalFloat0;
- FloatRet1ParamSignal mSignalFloat1V;
- FloatRet2ValueParamSignal mSignalFloat2V;
- VoidSignalTypeFloatValue3 mVoidSignalFloatValue3;
- FloatRet3ValueParamSignal mFloatSignalFloatValue3;
+ VoidRetNoParamSignal mSignalVoid0;
+ VoidRet1RefParamSignal mSignalVoid1R;
+ VoidRet1ValueParamSignal mSignalVoid1V;
+ VoidRet2ValueParamSignal mSignalVoid2V;
+ VoidRet3ValueParamSignal mSignalVoid3V;
+
+ BoolRet1ValueParamSignal mSignalBool1V;
+ BoolRet2ValueParamSignal mSignalBool2V;
+ IntRet2ValueParamSignal mSignalInt2V;
+ FloatRet0ParamSignal mSignalFloat0;
+ FloatRet1ParamSignal mSignalFloat1V;
+ FloatRet2ValueParamSignal mSignalFloat2V;
+ VoidSignalTypeFloatValue3 mVoidSignalFloatValue3;
+ FloatRet3ValueParamSignal mFloatSignalFloatValue3;
};
/**
class TestSlotHandler : public ConnectionTracker
{
public:
-
TestSlotHandler()
- : mIntParam1( 0 ),
- mIntParam2( 0 ),
- mIntParam3( 0 ),
- mFloatParam1( 0.0f ),
- mFloatParam2( 0.0f ),
- mFloatParam3( 0.0f ),
- mBoolReturn( false ),
- mIntReturn( 0 ),
- mFloatReturn( 0.0f ),
- mHandled( false ),
- mHandledCount( 0 )
+ : mIntParam1(0),
+ mIntParam2(0),
+ mIntParam3(0),
+ mFloatParam1(0.0f),
+ mFloatParam2(0.0f),
+ mFloatParam3(0.0f),
+ mBoolReturn(false),
+ mIntReturn(0),
+ mFloatReturn(0.0f),
+ mHandled(false),
+ mHandledCount(0)
{
}
void Reset()
{
- mIntParam1 = 0;
- mIntParam2 = 0;
- mIntParam3 = 0;
+ mIntParam1 = 0;
+ mIntParam2 = 0;
+ mIntParam3 = 0;
mFloatParam1 = 0.0f;
mFloatParam2 = 0.0f;
mFloatParam3 = 0.0f;
- mBoolReturn = false;
- mIntReturn = 0;
+ mBoolReturn = false;
+ mIntReturn = 0;
mFloatReturn = 0.0f;
- mHandled = false;
+ mHandled = false;
}
void VoidSlotVoid()
void VoidSlotVoidAlternative()
{
- mHandled = true;
- ++mHandledCount;
+ mHandled = true;
+ ++mHandledCount;
}
- void VoidSlotIntRef( int& p1 )
+ void VoidSlotIntRef(int& p1)
{
mIntParam1 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- void VoidSlotIntValue( int p1 )
+ void VoidSlotIntValue(int p1)
{
mIntParam1 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- void VoidDuplicateSlotIntValue( int p1 )
+ void VoidDuplicateSlotIntValue(int p1)
{
mIntParam2 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- void VoidSlotIntValueIntValue( int p1, int p2 )
+ void VoidSlotIntValueIntValue(int p1, int p2)
{
mIntParam1 = p1;
mIntParam2 = p2;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- bool BoolSlotFloatValue( float p1 )
+ bool BoolSlotFloatValue(float p1)
{
mFloatParam1 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
return mBoolReturn;
}
- bool BoolSlotFloatValueIntValue( float p1, int p2 )
+ bool BoolSlotFloatValueIntValue(float p1, int p2)
{
mFloatParam1 = p1;
- mIntParam2 = p2;
- mHandled = true;
+ mIntParam2 = p2;
+ mHandled = true;
++mHandledCount;
return mBoolReturn;
}
- int IntSlotFloatValueIntValue( float p1, int p2 )
+ int IntSlotFloatValueIntValue(float p1, int p2)
{
mFloatParam1 = p1;
- mIntParam2 = p2;
- mHandled = true;
+ mIntParam2 = p2;
+ mHandled = true;
++mHandledCount;
return mIntReturn;
}
return mFloatReturn;
}
- float FloatSlotFloatValueFloatValue( float p1, float p2 )
+ float FloatSlotFloatValueFloatValue(float p1, float p2)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
return mFloatReturn;
}
- void VoidSlotFloatValue3( float p1, float p2, float p3 )
+ void VoidSlotFloatValue3(float p1, float p2, float p3)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
mFloatParam3 = p3;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- float FloatSlotFloatValue3( float p1, float p2, float p3 )
+ float FloatSlotFloatValue3(float p1, float p2, float p3)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
mFloatParam3 = p3;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
return mFloatReturn;
}
- int mIntParam1, mIntParam2, mIntParam3;
+ int mIntParam1, mIntParam2, mIntParam3;
float mFloatParam1, mFloatParam2, mFloatParam3;
- bool mBoolReturn;
- int mIntReturn;
+ bool mBoolReturn;
+ int mIntReturn;
float mFloatReturn;
- bool mHandled;
- int mHandledCount;
+ bool mHandled;
+ int mHandledCount;
};
/**
class TestSlotDisconnector : public ConnectionTracker
{
public:
-
TestSlotDisconnector()
- : mIntParam1( 0 ),
- mIntParam2( 0 ),
- mIntParam3( 0 ),
- mFloatParam1( 0.0f ),
- mFloatParam2( 0.0f ),
- mBoolReturn( false ),
- mIntReturn( 0 ),
- mFloatReturn( 0.0f ),
- mHandled( false )
+ : mIntParam1(0),
+ mIntParam2(0),
+ mIntParam3(0),
+ mFloatParam1(0.0f),
+ mFloatParam2(0.0f),
+ mBoolReturn(false),
+ mIntReturn(0),
+ mFloatReturn(0.0f),
+ mHandled(false)
{
}
void Reset()
{
- mIntParam1 = 0;
- mIntParam2 = 0;
- mIntParam3 = 0;
+ mIntParam1 = 0;
+ mIntParam2 = 0;
+ mIntParam3 = 0;
mFloatParam1 = 0.0f;
mFloatParam2 = 0.0f;
- mBoolReturn = false;
- mIntReturn = 0;
+ mBoolReturn = false;
+ mIntReturn = 0;
mFloatReturn = 0.0f;
- mHandled = false;
+ mHandled = false;
}
- void VoidConnectVoid( TestSignals::VoidRetNoParamSignal& signal )
+ void VoidConnectVoid(TestSignals::VoidRetNoParamSignal& signal)
{
mVoidSignalVoid = &signal;
- signal.Connect( this, &TestSlotDisconnector::VoidSlotVoid );
+ signal.Connect(this, &TestSlotDisconnector::VoidSlotVoid);
}
void VoidSlotVoid()
{
- mVoidSignalVoid->Disconnect( this, &TestSlotDisconnector::VoidSlotVoid );
+ mVoidSignalVoid->Disconnect(this, &TestSlotDisconnector::VoidSlotVoid);
mHandled = true;
}
- void VoidConnectIntRef( TestSignals::VoidRet1RefParamSignal& signal )
+ void VoidConnectIntRef(TestSignals::VoidRet1RefParamSignal& signal)
{
mVoidSignalIntRef = &signal;
- signal.Connect( this, &TestSlotDisconnector::VoidSlotIntRef );
+ signal.Connect(this, &TestSlotDisconnector::VoidSlotIntRef);
}
- void VoidSlotIntRef( int& p1 )
+ void VoidSlotIntRef(int& p1)
{
- mVoidSignalIntRef->Disconnect( this, &TestSlotDisconnector::VoidSlotIntRef );
+ mVoidSignalIntRef->Disconnect(this, &TestSlotDisconnector::VoidSlotIntRef);
mIntParam1 = p1;
- mHandled = true;
+ mHandled = true;
}
- void VoidSlotIntValue( int p1 )
+ void VoidSlotIntValue(int p1)
{
mIntParam1 = p1;
- mHandled = true;
+ mHandled = true;
}
- void VoidSlotIntValueIntValue( int p1, int p2 )
+ void VoidSlotIntValueIntValue(int p1, int p2)
{
mIntParam1 = p1;
mIntParam2 = p2;
- mHandled = true;
+ mHandled = true;
}
- bool BoolSlotFloatValue( float p1 )
+ bool BoolSlotFloatValue(float p1)
{
mFloatParam1 = p1;
- mHandled = true;
+ mHandled = true;
return mBoolReturn;
}
- bool BoolSlotFloatValueIntValue( float p1, int p2 )
+ bool BoolSlotFloatValueIntValue(float p1, int p2)
{
mFloatParam1 = p1;
- mIntParam2 = p2;
- mHandled = true;
+ mIntParam2 = p2;
+ mHandled = true;
return mBoolReturn;
}
- int IntSlotFloatValueIntValue( float p1, int p2 )
+ int IntSlotFloatValueIntValue(float p1, int p2)
{
mFloatParam1 = p1;
- mIntParam2 = p2;
- mHandled = true;
+ mIntParam2 = p2;
+ mHandled = true;
return mIntReturn;
}
return mFloatReturn;
}
- float FloatSlotFloatValueFloatValue( float p1, float p2 )
+ float FloatSlotFloatValueFloatValue(float p1, float p2)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
- mHandled = true;
+ mHandled = true;
return mFloatReturn;
}
TestSignals::VoidRetNoParamSignal* mVoidSignalVoid;
TestSignals::VoidRet1RefParamSignal* mVoidSignalIntRef;
- int mIntParam1, mIntParam2, mIntParam3;
+ int mIntParam1, mIntParam2, mIntParam3;
float mFloatParam1, mFloatParam2;
- bool mBoolReturn;
- int mIntReturn;
+ bool mBoolReturn;
+ int mIntReturn;
float mFloatReturn;
- bool mHandled;
+ bool mHandled;
};
/**
class TestSlotMultiDisconnector : public ConnectionTracker
{
public:
-
static const int NUM_SLOTS = 10;
TestSlotMultiDisconnector()
- : mVoidSignalVoid( NULL )
+ : mVoidSignalVoid(NULL)
{
Reset();
}
void Reset()
{
- for( int i=0; i<NUM_SLOTS; ++i )
+ for(int i = 0; i < NUM_SLOTS; ++i)
{
mSlotHandled[i] = false;
}
}
- void ConnectAll( TestSignals::VoidRetNoParamSignal& signal )
+ void ConnectAll(TestSignals::VoidRetNoParamSignal& signal)
{
mVoidSignalVoid = &signal;
- signal.Connect( this, &TestSlotMultiDisconnector::Slot0 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot1 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot2 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot3 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot4 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot5 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot6 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot7 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot8 );
- signal.Connect( this, &TestSlotMultiDisconnector::Slot9 );
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot0);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot1);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot2);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot3);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot4);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot5);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot6);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot7);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot8);
+ signal.Connect(this, &TestSlotMultiDisconnector::Slot9);
}
void Slot0()
mSlotHandled[3] = true;
// Disconnect the odd numbered lots, because we can
- mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot1 );
- mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot3 );
- mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot5 );
- mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot7 );
- mVoidSignalVoid->Disconnect( this, &TestSlotMultiDisconnector::Slot9 );
+ mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot1);
+ mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot3);
+ mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot5);
+ mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot7);
+ mVoidSignalVoid->Disconnect(this, &TestSlotMultiDisconnector::Slot9);
}
void Slot4()
bool mSlotHandled[NUM_SLOTS];
};
-
/**
* A version of TestSlotHandler which disconnects during the callback
*/
class TestEmitDuringCallback : public ConnectionTracker
{
public:
-
TestEmitDuringCallback()
- : mVoidSignalVoid( NULL ),
- mFloatRet0ParamSignal( NULL),
- mFloatRet1ParamSignal( NULL ),
- mFloatRet2ParamSignal( NULL ),
- mFloatRet3ParamSignal( NULL ),
- mHandled( false )
+ : mVoidSignalVoid(NULL),
+ mFloatRet0ParamSignal(NULL),
+ mFloatRet1ParamSignal(NULL),
+ mFloatRet2ParamSignal(NULL),
+ mFloatRet3ParamSignal(NULL),
+ mHandled(false)
{
}
- void VoidConnectVoid( TestSignals::VoidRetNoParamSignal& signal )
+ void VoidConnectVoid(TestSignals::VoidRetNoParamSignal& signal)
{
mVoidSignalVoid = &signal;
- signal.Connect( this, &TestEmitDuringCallback::VoidSlotVoid );
+ signal.Connect(this, &TestEmitDuringCallback::VoidSlotVoid);
}
- void FloatRet0ParamConnect( TestSignals::FloatRet0ParamSignal& signal )
+ void FloatRet0ParamConnect(TestSignals::FloatRet0ParamSignal& signal)
{
mFloatRet0ParamSignal = &signal;
- signal.Connect( this, &TestEmitDuringCallback::FloatRet0Param );
+ signal.Connect(this, &TestEmitDuringCallback::FloatRet0Param);
}
- void FloatRet1ParamConnect( TestSignals::FloatRet1ParamSignal& signal )
+ void FloatRet1ParamConnect(TestSignals::FloatRet1ParamSignal& signal)
{
mFloatRet1ParamSignal = &signal;
- signal.Connect( this, &TestEmitDuringCallback::FloatRet1Param );
+ signal.Connect(this, &TestEmitDuringCallback::FloatRet1Param);
}
- void FloatRet2ParamConnect( TestSignals::FloatRet2ValueParamSignal& signal )
+ void FloatRet2ParamConnect(TestSignals::FloatRet2ValueParamSignal& signal)
{
mFloatRet2ParamSignal = &signal;
- signal.Connect( this, &TestEmitDuringCallback::FloatRet2Param );
+ signal.Connect(this, &TestEmitDuringCallback::FloatRet2Param);
}
- void FloatRet3ParamConnect( TestSignals::FloatRet3ValueParamSignal& signal )
+ void FloatRet3ParamConnect(TestSignals::FloatRet3ValueParamSignal& signal)
{
mFloatRet3ParamSignal = &signal;
- signal.Connect( this, &TestEmitDuringCallback::FloatRet3Param );
+ signal.Connect(this, &TestEmitDuringCallback::FloatRet3Param);
}
- void DeleteDuringEmitConnect( TestSignals::VoidRetNoParamSignal& signal )
+ void DeleteDuringEmitConnect(TestSignals::VoidRetNoParamSignal& signal)
{
mVoidSignalVoid = &signal;
- signal.Connect( this, &TestEmitDuringCallback::DeleteSignalDuringEmit );
+ signal.Connect(this, &TestEmitDuringCallback::DeleteSignalDuringEmit);
}
void VoidSlotVoid()
float FloatRet0Param()
{
- // Emitting during Emit is very bad!
+ // Emitting during Emit is very bad!
mHandled = true;
return mFloatRet0ParamSignal->Emit();
}
- float FloatRet1Param( float x )
+ float FloatRet1Param(float x)
{
// Emitting during Emit is very bad!
mHandled = true;
return mFloatRet1ParamSignal->Emit(x);
}
- float FloatRet2Param( float x, float y )
+ float FloatRet2Param(float x, float y)
{
// Emitting during Emit is very bad!
mHandled = true;
- return mFloatRet2ParamSignal->Emit( x, y );
+ return mFloatRet2ParamSignal->Emit(x, y);
}
- float FloatRet3Param( float x, float y, float z)
+ float FloatRet3Param(float x, float y, float z)
{
// Emitting during Emit is very bad!
mHandled = true;
- return mFloatRet3ParamSignal->Emit( x, y, z );
+ return mFloatRet3ParamSignal->Emit(x, y, z);
}
- TestSignals::VoidRetNoParamSignal* mVoidSignalVoid;
+ TestSignals::VoidRetNoParamSignal* mVoidSignalVoid;
TestSignals::FloatRet0ParamSignal* mFloatRet0ParamSignal;
- TestSignals::FloatRet1ParamSignal* mFloatRet1ParamSignal;
+ TestSignals::FloatRet1ParamSignal* mFloatRet1ParamSignal;
TestSignals::FloatRet2ValueParamSignal* mFloatRet2ParamSignal;
TestSignals::FloatRet3ValueParamSignal* mFloatRet3ParamSignal;
-
bool mHandled;
};
-
/**
* A version of TestSlotHandler which uses SlotDelegate
*/
class TestSlotDelegateHandler // This does not inherit from ConnectionTrackerInterface!
{
public:
-
TestSlotDelegateHandler()
- : mSlotDelegate( this ),
- mIntParam1( 0 ),
- mIntParam2( 0 ),
- mIntParam3( 0 ),
- mFloatParam1( 0.0f ),
- mFloatParam2( 0.0f ),
- mFloatParam3( 0.0f ),
- mBoolReturn( false ),
- mIntReturn( 0 ),
- mFloatReturn( 0.0f ),
- mHandled( false ),
- mHandledCount( 0 )
+ : mSlotDelegate(this),
+ mIntParam1(0),
+ mIntParam2(0),
+ mIntParam3(0),
+ mFloatParam1(0.0f),
+ mFloatParam2(0.0f),
+ mFloatParam3(0.0f),
+ mBoolReturn(false),
+ mIntReturn(0),
+ mFloatReturn(0.0f),
+ mHandled(false),
+ mHandledCount(0)
{
}
void Reset()
{
- mIntParam1 = 0;
- mIntParam2 = 0;
- mIntParam3 = 0;
+ mIntParam1 = 0;
+ mIntParam2 = 0;
+ mIntParam3 = 0;
mFloatParam1 = 0.0f;
mFloatParam2 = 0.0f;
mFloatParam3 = 0.0f;
- mBoolReturn = false;
- mIntReturn = 0;
+ mBoolReturn = false;
+ mIntReturn = 0;
mFloatReturn = 0.0f;
- mHandled = false;
+ mHandled = false;
}
void VoidSlotVoid()
++mHandledCount;
}
- void VoidSlotIntRef( int& p1 )
+ void VoidSlotIntRef(int& p1)
{
mIntParam1 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- void VoidSlotIntValue( int p1 )
+ void VoidSlotIntValue(int p1)
{
mIntParam1 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- void VoidDuplicateSlotIntValue( int p1 )
+ void VoidDuplicateSlotIntValue(int p1)
{
mIntParam2 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- void VoidSlotIntValueIntValue( int p1, int p2 )
+ void VoidSlotIntValueIntValue(int p1, int p2)
{
mIntParam1 = p1;
mIntParam2 = p2;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- bool BoolSlotFloatValue( float p1 )
+ bool BoolSlotFloatValue(float p1)
{
mFloatParam1 = p1;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
return mBoolReturn;
}
- bool BoolSlotFloatValueIntValue( float p1, int p2 )
+ bool BoolSlotFloatValueIntValue(float p1, int p2)
{
mFloatParam1 = p1;
- mIntParam2 = p2;
- mHandled = true;
+ mIntParam2 = p2;
+ mHandled = true;
++mHandledCount;
return mBoolReturn;
}
- int IntSlotFloatValueIntValue( float p1, int p2 )
+ int IntSlotFloatValueIntValue(float p1, int p2)
{
mFloatParam1 = p1;
- mIntParam2 = p2;
- mHandled = true;
+ mIntParam2 = p2;
+ mHandled = true;
++mHandledCount;
return mIntReturn;
}
return mFloatReturn;
}
- float FloatSlotFloatValueFloatValue( float p1, float p2 )
+ float FloatSlotFloatValueFloatValue(float p1, float p2)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
return mFloatReturn;
}
- void VoidSlotFloatValue3( float p1, float p2, float p3 )
+ void VoidSlotFloatValue3(float p1, float p2, float p3)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
mFloatParam3 = p3;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
}
- float FloatSlotFloatValue3( float p1, float p2, float p3 )
+ float FloatSlotFloatValue3(float p1, float p2, float p3)
{
mFloatParam1 = p1;
mFloatParam2 = p2;
mFloatParam3 = p3;
- mHandled = true;
+ mHandled = true;
++mHandledCount;
return mFloatReturn;
}
SlotDelegate<TestSlotDelegateHandler> mSlotDelegate;
- int mIntParam1, mIntParam2, mIntParam3;
+ int mIntParam1, mIntParam2, mIntParam3;
float mFloatParam1, mFloatParam2, mFloatParam3;
- bool mBoolReturn;
- int mIntReturn;
+ bool mBoolReturn;
+ int mIntReturn;
float mFloatReturn;
- bool mHandled;
- int mHandledCount;
+ bool mHandled;
+ int mHandledCount;
};
/**
class TestBasicConnectionTrackerInterface : public ConnectionTrackerInterface
{
public:
-
TestBasicConnectionTrackerInterface()
- : mCallbackHandled( false ),
- mCallback( NULL ),
- mSlotObserver( NULL )
+ : mCallbackHandled(false),
+ mCallback(NULL),
+ mSlotObserver(NULL)
{
}
~TestBasicConnectionTrackerInterface()
{
- if( mSlotObserver && mCallback )
+ if(mSlotObserver && mCallback)
{
// Notify signal since the slot has been destroyed
- mSlotObserver->SlotDisconnected( mCallback );
+ mSlotObserver->SlotDisconnected(mCallback);
// mCallback and mSlotObserver are not owned
}
}
*/
virtual std::size_t GetConnectionCount() const
{
- if( mCallback )
+ if(mCallback)
{
return 1u;
}
/**
* @copydoc ConnectionTrackerInterface::SignalConnected
*/
- virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
+ virtual void SignalConnected(SlotObserver* slotObserver, CallbackBase* callback)
{
- DALI_ASSERT_ALWAYS( NULL == mCallback && "Only one connection supported!" );
+ DALI_ASSERT_ALWAYS(NULL == mCallback && "Only one connection supported!");
- mCallback = callback;
+ mCallback = callback;
mSlotObserver = slotObserver;
}
/**
* @copydoc ConnectionTrackerInterface::SignalDisconnected
*/
- virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
+ virtual void SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback)
{
- if( mSlotObserver == slotObserver )
+ if(mSlotObserver == slotObserver)
{
mSlotObserver = NULL;
- mCallback = NULL;
+ mCallback = NULL;
// mCallback and mSlotObserver are not owned
}
}
*/
void RemoveNullCallback()
{
- mSlotObserver->SlotDisconnected( NULL );
+ mSlotObserver->SlotDisconnected(NULL);
}
private:
-
- TestBasicConnectionTrackerInterface( const TestBasicConnectionTrackerInterface& ); ///< undefined copy constructor
- TestBasicConnectionTrackerInterface& operator=( const TestBasicConnectionTrackerInterface& ); ///< undefined assignment operator
+ TestBasicConnectionTrackerInterface(const TestBasicConnectionTrackerInterface&); ///< undefined copy constructor
+ TestBasicConnectionTrackerInterface& operator=(const TestBasicConnectionTrackerInterface&); ///< undefined assignment operator
public:
-
bool mCallbackHandled;
private:
-
CallbackBase* mCallback; ///< callback, has ownership
SlotObserver* mSlotObserver; ///< a pointer to the slot observer (not owned)
};
-
-
-
// for testing static function callbacks
class StaticFunctionHandlers
{
public:
- StaticFunctionHandlers()
- {
- staticFunctionHandled = false;
- }
- void Reset()
- {
- staticFunctionHandled = false;
- }
+ StaticFunctionHandlers()
+ {
+ staticFunctionHandled = false;
+ }
+ void Reset()
+ {
+ staticFunctionHandled = false;
+ }
- static void VoidSlotVoid()
- {
- staticFunctionHandled = true;
- }
- static void VoidSlot1Param( int p1 )
- {
- staticFunctionHandled = true;
- }
- static void VoidSlot2Param( int p1, int p2 )
- {
- staticFunctionHandled = true;
- }
- static void VoidSlot3Param( int p1, int p2, int p3 )
- {
- staticFunctionHandled = true;
- }
+ static void VoidSlotVoid()
+ {
+ staticFunctionHandled = true;
+ }
+ static void VoidSlot1Param(int p1)
+ {
+ staticFunctionHandled = true;
+ }
+ static void VoidSlot2Param(int p1, int p2)
+ {
+ staticFunctionHandled = true;
+ }
+ static void VoidSlot3Param(int p1, int p2, int p3)
+ {
+ staticFunctionHandled = true;
+ }
- static float RetSlot0Param( )
- {
- staticFunctionHandled = true;
- return 0;
- }
- static float RetSlot1Param( float p1 )
- {
- staticFunctionHandled = true;
- return 0;
- }
- static float RetSlot2Param( float p1, float p2 )
- {
- staticFunctionHandled = true;
- return 0;
- }
- static float RetSlot3Param( float p1, float p2, float p3 )
- {
- staticFunctionHandled = true;
- return 0;
- }
+ static float RetSlot0Param()
+ {
+ staticFunctionHandled = true;
+ return 0;
+ }
+ static float RetSlot1Param(float p1)
+ {
+ staticFunctionHandled = true;
+ return 0;
+ }
+ static float RetSlot2Param(float p1, float p2)
+ {
+ staticFunctionHandled = true;
+ return 0;
+ }
+ static float RetSlot3Param(float p1, float p2, float p3)
+ {
+ staticFunctionHandled = true;
+ return 0;
+ }
- static bool staticFunctionHandled;
+ static bool staticFunctionHandled;
};
-
/**
* test functor, we store a reference to a bool which is outside of the functor
* so when the functor is copied, the copy can reference the original data
*/
struct TestFunctor
{
- TestFunctor( bool& functorCalled):
- mFunctorCalled( functorCalled )
- {
- };
+ TestFunctor(bool& functorCalled)
+ : mFunctorCalled(functorCalled){};
void operator()()
{
struct VoidFunctorVoid
{
- VoidFunctorVoid( bool& functorCalled):
- mFunctorCalled( functorCalled )
+ VoidFunctorVoid(bool& functorCalled)
+ : mFunctorCalled(functorCalled)
{
-
}
void operator()()
typedef int (*tc_fun_ptr)(void);
/* struct describing specific testcase */
-typedef struct testcase_s {
- const char* name;
- tc_fun_ptr function;
- void_fun_ptr startup;
- void_fun_ptr cleanup;
+typedef struct testcase_s
+{
+ const char* name;
+ tc_fun_ptr function;
+ void_fun_ptr startup;
+ void_fun_ptr cleanup;
} testcase;
#endif // TESTCASE_H
-#include <string.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <test-harness.h>
+
#include "tct-dali-internal-core.h"
-int main(int argc, char * const argv[])
+int main(int argc, char* const argv[])
{
int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
const char* optString = "sf";
- bool optRerunFailed(true);
- bool optRunSerially(false);
+ bool optRerunFailed(true);
+ bool optRunSerially(false);
int nextOpt = 0;
do
{
- nextOpt = getopt( argc, argv, optString );
+ nextOpt = getopt(argc, argv, optString);
switch(nextOpt)
{
case 'f':
exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
break;
}
- } while( nextOpt != -1 );
+ } while(nextOpt != -1);
- if( optind == argc ) // no testcase name in argument list
+ if(optind == argc) // no testcase name in argument list
{
- if( optRunSerially )
+ if(optRunSerially)
{
- result = TestHarness::RunAll( argv[0], tc_array );
+ result = TestHarness::RunAll(argv[0], tc_array);
}
else
{
- result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+ result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
}
}
else
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-
#include <dali-test-suite-utils.h>
#include <dali/public-api/signals/callback.h>
+#include <stdlib.h>
+
+#include <iostream>
// Internal headers are allowed here
#include <dali/internal/event/actors/actor-impl.h>
namespace TestCallback
{
Internal::Actor* disconnectedActor = nullptr;
-int callCount = 0;
-void Function( Internal::Actor* actor )
+int callCount = 0;
+void Function(Internal::Actor* actor)
{
disconnectedActor = actor;
++callCount;
void Reset()
{
- callCount = 0;
+ callCount = 0;
disconnectedActor = nullptr;
}
{
TestApplication application;
- auto scene = application.GetScene();
- auto actor = Actor::New();
- auto& actorImpl = GetImplementation( actor );
+ auto scene = application.GetScene();
+ auto actor = Actor::New();
+ auto& actorImpl = GetImplementation(actor);
// Ensure we're not observing anything at the start
ActorObserver actorObserver;
- DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+ DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION);
// Set the actor and ensure GetActor returns the correct pointer
- actorObserver.SetActor( &actorImpl );
- DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+ actorObserver.SetActor(&actorImpl);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION);
- scene.Add( actor );
- DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+ scene.Add(actor);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION);
// Removing the actor from the scene should make it return null
- scene.Remove( actor );
- DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+ scene.Remove(actor);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION);
// Adding the actor back to the scene should mean it returning the actor again
- scene.Add( actor );
- DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+ scene.Add(actor);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION);
// Resetting the actor should return nullptr
actorObserver.ResetActor();
- DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+ DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION);
// Set the actor again
- actorObserver.SetActor( &actorImpl );
- DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
+ actorObserver.SetActor(&actorImpl);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION);
// Create another Actor and observe that (don't add it to the scene just yet)
{
- auto actor2 = Actor::New();
- auto& actor2Impl = GetImplementation( actor2 );
- actorObserver.SetActor( &actor2Impl );
- DALI_TEST_EQUALS( actorObserver.GetActor(), &actor2Impl, TEST_LOCATION );
+ auto actor2 = Actor::New();
+ auto& actor2Impl = GetImplementation(actor2);
+ actorObserver.SetActor(&actor2Impl);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), &actor2Impl, TEST_LOCATION);
}
// Actor destroyed now, should return nullptr
- DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
+ DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION);
END_TEST;
}
{
{
// Scope lifetime of Actor
- auto actor = Actor::New();
- auto& actorImpl = GetImplementation( actor );
+ auto actor = Actor::New();
+ auto& actorImpl = GetImplementation(actor);
// Now scope the lifetime of ActorObserver
{
ActorObserver actorObserver;
- actorObserver.SetActor( &actorImpl );
+ actorObserver.SetActor(&actorImpl);
} // ActorObserver goes out of scope
- } // Actor goes out of scope
+ } // Actor goes out of scope
// If we get here without a crash, then it's all good
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
- catch( ... )
+ catch(...)
{
- tet_infoline( "ActorObserver did not clean up properly" );
- DALI_TEST_CHECK( false );
+ tet_infoline("ActorObserver did not clean up properly");
+ DALI_TEST_CHECK(false);
}
END_TEST;
// Copy empty observer
ActorObserver observer1;
- ActorObserver observer2( std::move( observer1 ) );
- DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
- DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+ ActorObserver observer2(std::move(observer1));
+ DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION);
// Assign empty observer
- observer1 = std::move( observer2 );
- DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
- DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+ observer1 = std::move(observer2);
+ DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION);
// Ensure self assignment doesn't change anything
- observer1 = std::move( observer1 );
- observer2 = std::move( observer2 );
- DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
- DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+ observer1 = std::move(observer1);
+ observer2 = std::move(observer2);
+ DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION);
END_TEST;
}
// Ensure new observer is observing the correct actor
// Ensure previous observer is not observing anything any more
- auto actor = Actor::New();
- auto& actorImpl = GetImplementation( actor );
+ auto actor = Actor::New();
+ auto& actorImpl = GetImplementation(actor);
ActorObserver observer1;
- observer1.SetActor( &actorImpl );
- DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION );
+ observer1.SetActor(&actorImpl);
+ DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION);
// Move constructor
- ActorObserver observer2( std::move( observer1 ) );
- DALI_TEST_EQUALS( observer1.GetActor(), nullptr, TEST_LOCATION );
- DALI_TEST_EQUALS( observer2.GetActor(), &actorImpl, TEST_LOCATION );
+ ActorObserver observer2(std::move(observer1));
+ DALI_TEST_EQUALS(observer1.GetActor(), nullptr, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.GetActor(), &actorImpl, TEST_LOCATION);
// Move assignment
- observer1 = std::move( observer2 );
- DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION );
- DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+ observer1 = std::move(observer2);
+ DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION);
// Self assignment
- observer1 = std::move( observer1 );
- observer2 = std::move( observer2 );
- DALI_TEST_EQUALS( observer1.GetActor(), &actorImpl, TEST_LOCATION );
- DALI_TEST_EQUALS( observer2.GetActor(), nullptr, TEST_LOCATION );
+ observer1 = std::move(observer1);
+ observer2 = std::move(observer2);
+ DALI_TEST_EQUALS(observer1.GetActor(), &actorImpl, TEST_LOCATION);
+ DALI_TEST_EQUALS(observer2.GetActor(), nullptr, TEST_LOCATION);
END_TEST;
}
{
{
// Scope lifetime of Actor
- auto actor = Actor::New();
- auto& actorImpl = GetImplementation( actor );
+ auto actor = Actor::New();
+ auto& actorImpl = GetImplementation(actor);
// Score lifetime of observers
{
ActorObserver observer1;
- observer1.SetActor( &actorImpl );
- ActorObserver observer2( std::move( observer1 ) );
+ observer1.SetActor(&actorImpl);
+ ActorObserver observer2(std::move(observer1));
} // Both observers die here
- } // Actor goes out of scope
+ } // Actor goes out of scope
// If we get here without a crash, then it's all good
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
- catch( ... )
+ catch(...)
{
- tet_infoline( "ActorObserver did not clean up properly" );
- DALI_TEST_CHECK( false );
+ tet_infoline("ActorObserver did not clean up properly");
+ DALI_TEST_CHECK(false);
}
END_TEST;
// Test to ensure the passed in callback is called when the observed actor is disconnected
TestCallback::Reset();
- auto scene = application.GetScene();
- auto actor = Actor::New();
- auto& actorImpl = GetImplementation( actor );
- scene.Add( actor );
+ auto scene = application.GetScene();
+ auto actor = Actor::New();
+ auto& actorImpl = GetImplementation(actor);
+ scene.Add(actor);
- ActorObserver actorObserver( MakeCallback( &TestCallback::Function ) );
- actorObserver.SetActor( &actorImpl );
- DALI_TEST_EQUALS( actorObserver.GetActor(), &actorImpl, TEST_LOCATION );
- DALI_TEST_EQUALS( TestCallback::disconnectedActor, nullptr, TEST_LOCATION );
+ ActorObserver actorObserver(MakeCallback(&TestCallback::Function));
+ actorObserver.SetActor(&actorImpl);
+ DALI_TEST_EQUALS(actorObserver.GetActor(), &actorImpl, TEST_LOCATION);
+ DALI_TEST_EQUALS(TestCallback::disconnectedActor, nullptr, TEST_LOCATION);
// Remove Actor from scene
actor.Unparent();
- DALI_TEST_EQUALS( actorObserver.GetActor(), nullptr, TEST_LOCATION );
- DALI_TEST_EQUALS( TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION );
+ DALI_TEST_EQUALS(actorObserver.GetActor(), nullptr, TEST_LOCATION);
+ DALI_TEST_EQUALS(TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION);
END_TEST;
}
try
{
- auto scene = application.GetScene();
- auto actor = Actor::New();
- auto& actorImpl = GetImplementation( actor );
- scene.Add( actor );
+ auto scene = application.GetScene();
+ auto actor = Actor::New();
+ auto& actorImpl = GetImplementation(actor);
+ scene.Add(actor);
- ActorObserver *observer1 = new ActorObserver( MakeCallback( &TestCallback::Function ) );
- observer1->SetActor( &actorImpl );
+ ActorObserver* observer1 = new ActorObserver(MakeCallback(&TestCallback::Function));
+ observer1->SetActor(&actorImpl);
// Move observer1 into a new observer
- ActorObserver* observer2 = new ActorObserver( std::move( *observer1 ) );
+ ActorObserver* observer2 = new ActorObserver(std::move(*observer1));
// Remove actor from scene, function should be called only once
actor.Unparent();
- DALI_TEST_EQUALS( TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION );
- DALI_TEST_EQUALS( TestCallback::callCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(TestCallback::disconnectedActor, &actorImpl, TEST_LOCATION);
+ DALI_TEST_EQUALS(TestCallback::callCount, 1, TEST_LOCATION);
// Delete both observers here, only one of them should delete the callback
delete observer1;
delete observer2;
// If we get here without a crash, then the callback has NOT been double-freed
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( false );
- tet_infoline( "Callback double Freed" );
+ DALI_TEST_CHECK(false);
+ tet_infoline("Callback double Freed");
}
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
+#include <dali-test-suite-utils.h>
#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
// Internal headers are allowed here
-
using namespace Dali;
void utc_dali_internal_core_startup()
namespace
{
-
class RelayoutSignalHandler : public Dali::ConnectionTracker
{
public:
-
- RelayoutSignalHandler( TestApplication& application )
- : mApplication( application ),
- mSignalCalled( false )
+ RelayoutSignalHandler(TestApplication& application)
+ : mApplication(application),
+ mSignalCalled(false)
{
}
// callback to be connected to RelayoutSignal
- void RelayoutCallback( Actor actor )
+ void RelayoutCallback(Actor actor)
{
tet_infoline("RelayoutCallback is called");
}
TestApplication& mApplication;
- bool mSignalCalled;
+ bool mSignalCalled;
};
} // anonymous namespace
TestApplication application;
tet_infoline("Testing Dali::Integration::Core::ProcessEvents");
- Vector3 size( 100.0f, 100.0f, 0.0f );
- Vector3 position( 100.0f, 100.0f, 0.0f );
+ Vector3 size(100.0f, 100.0f, 0.0f);
+ Vector3 position(100.0f, 100.0f, 0.0f);
Actor actor = Actor::New();
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- actor.SetProperty( Actor::Property::SIZE, size );
- actor.SetProperty( Actor::Property::POSITION, position );
- application.GetScene().Add( actor );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ actor.SetProperty(Actor::Property::SIZE, size);
+ actor.SetProperty(Actor::Property::POSITION, position);
+ application.GetScene().Add(actor);
- RelayoutSignalHandler relayoutSignal( application );
- actor.OnRelayoutSignal().Connect( &relayoutSignal, &RelayoutSignalHandler::RelayoutCallback );
+ RelayoutSignalHandler relayoutSignal(application);
+ actor.OnRelayoutSignal().Connect(&relayoutSignal, &RelayoutSignalHandler::RelayoutCallback);
application.SendNotification();
- DALI_TEST_EQUALS( relayoutSignal.mSignalCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(relayoutSignal.mSignalCalled, true, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), size, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), position, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE).Get<Vector3>(), size, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), position, TEST_LOCATION);
END_TEST;
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
// Internal headers are allowed here
namespace
{
-
unsigned int gTestObjectConstructed = 0;
-unsigned int gTestObjectDestructed = 0;
-unsigned int gTestObjectMethod = 0;
-unsigned int gTestObjectDataAccess = 0;
+unsigned int gTestObjectDestructed = 0;
+unsigned int gTestObjectMethod = 0;
+unsigned int gTestObjectDataAccess = 0;
} // namespace
-
class TestObject
{
public:
-
TestObject()
- : mData1( 0 ),
- mData2( false )
+ : mData1(0),
+ mData2(false)
{
gTestObjectConstructed++;
}
}
private:
-
unsigned int mData1;
- bool mData2;
-
+ bool mData2;
};
int UtcDaliFixedSizeMemoryPoolCreate(void)
{
gTestObjectConstructed = 0;
- gTestObjectDestructed = 0;
- gTestObjectMethod = 0;
- gTestObjectDataAccess = 0;
+ gTestObjectDestructed = 0;
+ gTestObjectMethod = 0;
+ gTestObjectDataAccess = 0;
- Internal::FixedSizeMemoryPool memoryPool( Internal::TypeSizeWithAlignment< TestObject >::size );
+ Internal::FixedSizeMemoryPool memoryPool(Internal::TypeSizeWithAlignment<TestObject>::size);
- TestObject* testObject1 = new (memoryPool.Allocate()) TestObject();
- DALI_TEST_CHECK( testObject1 );
- DALI_TEST_EQUALS( gTestObjectConstructed, 1U, TEST_LOCATION );
+ TestObject* testObject1 = new(memoryPool.Allocate()) TestObject();
+ DALI_TEST_CHECK(testObject1);
+ DALI_TEST_EQUALS(gTestObjectConstructed, 1U, TEST_LOCATION);
testObject1->Method();
- DALI_TEST_EQUALS( gTestObjectMethod, 1U, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTestObjectMethod, 1U, TEST_LOCATION);
testObject1->DataAccess();
- DALI_TEST_EQUALS( gTestObjectDataAccess, 1U, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTestObjectDataAccess, 1U, TEST_LOCATION);
testObject1->~TestObject();
- memoryPool.Free( testObject1 );
- DALI_TEST_EQUALS( gTestObjectDestructed, 1U, TEST_LOCATION );
+ memoryPool.Free(testObject1);
+ DALI_TEST_EQUALS(gTestObjectDestructed, 1U, TEST_LOCATION);
END_TEST;
}
int UtcDaliFixedSizeMemoryPoolStressTest(void)
{
gTestObjectConstructed = 0;
- gTestObjectDestructed = 0;
- gTestObjectMethod = 0;
- gTestObjectDataAccess = 0;
+ gTestObjectDestructed = 0;
+ gTestObjectMethod = 0;
+ gTestObjectDataAccess = 0;
const size_t initialCapacity = 32;
const size_t maximumCapacity = 1024;
const unsigned int numObjects = 1024 * 1024;
- Internal::FixedSizeMemoryPool memoryPool( Internal::TypeSizeWithAlignment< TestObject >::size, initialCapacity, maximumCapacity );
+ Internal::FixedSizeMemoryPool memoryPool(Internal::TypeSizeWithAlignment<TestObject>::size, initialCapacity, maximumCapacity);
Dali::Vector<TestObject*> objects;
- objects.Reserve( numObjects );
+ objects.Reserve(numObjects);
- for( unsigned int i = 0; i < numObjects; ++i )
+ for(unsigned int i = 0; i < numObjects; ++i)
{
- TestObject* testObject = new ( memoryPool.Allocate() ) TestObject();
- DALI_TEST_CHECK( testObject );
+ TestObject* testObject = new(memoryPool.Allocate()) TestObject();
+ DALI_TEST_CHECK(testObject);
- objects.PushBack( testObject );
+ objects.PushBack(testObject);
}
- DALI_TEST_EQUALS( gTestObjectConstructed, numObjects, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTestObjectConstructed, numObjects, TEST_LOCATION);
- for( unsigned int i = 0; i < numObjects; ++i )
+ for(unsigned int i = 0; i < numObjects; ++i)
{
objects[i]->~TestObject();
- memoryPool.Free( objects[i] );
+ memoryPool.Free(objects[i]);
}
- DALI_TEST_EQUALS( gTestObjectDestructed, numObjects, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTestObjectDestructed, numObjects, TEST_LOCATION);
END_TEST;
}
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
#include <dali/integration-api/bitmap.h>
-#include <iostream>
-#include <algorithm>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
+#include <algorithm>
+#include <iostream>
+
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
#include <mesh-builder.h>
using namespace Dali;
-#define MAKE_SHADER(A)#A
+#define MAKE_SHADER(A) #A
const char* VERTEX_SHADER = MAKE_SHADER(
-attribute mediump vec2 aPosition;
-attribute mediump vec2 aTexCoord;
-uniform mediump mat4 uMvpMatrix;
-uniform mediump vec3 uSize;
-varying mediump vec2 vTexCoord;
-
-void main()
-{
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
- vertexPosition.xyz *= uSize;
- vertexPosition = uMvpMatrix * vertexPosition;
- vTexCoord = aTexCoord;
- gl_Position = vertexPosition;
-}
-);
+ attribute mediump vec2 aPosition;
+ attribute mediump vec2 aTexCoord;
+ uniform mediump mat4 uMvpMatrix;
+ uniform mediump vec3 uSize;
+ varying mediump vec2 vTexCoord;
+
+ void main() {
+ mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
+ vertexPosition.xyz *= uSize;
+ vertexPosition = uMvpMatrix * vertexPosition;
+ vTexCoord = aTexCoord;
+ gl_Position = vertexPosition;
+ });
const char* FRAGMENT_SHADER = MAKE_SHADER(
-uniform Sampler2D sTexture;
-varying mediump vec2 vTexCoord;
-void main()
-{
- gl_FragColor = texture2D( sTexture, vTexCoord );
-}
-);
+ uniform Sampler2D sTexture;
+ varying mediump vec2 vTexCoord;
+ void main() {
+ gl_FragColor = texture2D(sTexture, vTexCoord);
+ });
-Actor CreateMeshActorToScene( TestApplication& application, Vector3 parentOrigin = ParentOrigin::CENTER, Vector3 anchorPoint = AnchorPoint::CENTER, Shader::Hint::Value shaderHints = Shader::Hint::NONE )
+Actor CreateMeshActorToScene(TestApplication& application, Vector3 parentOrigin = ParentOrigin::CENTER, Vector3 anchorPoint = AnchorPoint::CENTER, Shader::Hint::Value shaderHints = Shader::Hint::NONE)
{
- Integration::PixelBuffer* pixelBuffer = new Integration::PixelBuffer[ 4 ];
- PixelData pixelData = PixelData::New(pixelBuffer, 4, 1, 1, Pixel::RGBA8888, PixelData::DELETE_ARRAY);
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Integration::PixelBuffer* pixelBuffer = new Integration::PixelBuffer[4];
+ PixelData pixelData = PixelData::New(pixelBuffer, 4, 1, 1, Pixel::RGBA8888, PixelData::DELETE_ARRAY);
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
image.Upload(pixelData);
- Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER, shaderHints );
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = Shader::New(VERTEX_SHADER, FRAGMENT_SHADER, shaderHints);
TextureSet textureSet = TextureSet::New();
textureSet.SetTexture(0u, image);
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor meshActor = Actor::New();
- meshActor.AddRenderer( renderer );
- meshActor.SetProperty( Actor::Property::SIZE, Vector3( 400.0f, 400.0f, 0.1f ) );
- meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, parentOrigin );
- meshActor.SetProperty( Actor::Property::ANCHOR_POINT, anchorPoint );
- application.GetScene().Add( meshActor );
+ meshActor.AddRenderer(renderer);
+ meshActor.SetProperty(Actor::Property::SIZE, Vector3(400.0f, 400.0f, 0.1f));
+ meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, parentOrigin);
+ meshActor.SetProperty(Actor::Property::ANCHOR_POINT, anchorPoint);
+ application.GetScene().Add(meshActor);
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
return meshActor;
}
-bool GetCameraDepths( TestApplication& application, float& nearPlane, float& farPlane, float& cameraDepth )
+bool GetCameraDepths(TestApplication& application, float& nearPlane, float& farPlane, float& cameraDepth)
{
RenderTaskList renderTasks = application.GetScene().GetRenderTaskList();
- CameraActor cameraActor;
- for( unsigned int i = 0; i < renderTasks.GetTaskCount(); ++i )
+ CameraActor cameraActor;
+ for(unsigned int i = 0; i < renderTasks.GetTaskCount(); ++i)
{
- RenderTask task = renderTasks.GetTask( i );
- cameraActor = task.GetCameraActor();
- if( cameraActor )
+ RenderTask task = renderTasks.GetTask(i);
+ cameraActor = task.GetCameraActor();
+ if(cameraActor)
{
break;
}
}
- if( cameraActor )
+ if(cameraActor)
{
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- nearPlane = cameraActor.GetNearClippingPlane();
- farPlane = cameraActor.GetFarClippingPlane();
- cameraDepth = cameraActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z;
+ nearPlane = cameraActor.GetNearClippingPlane();
+ farPlane = cameraActor.GetFarClippingPlane();
+ cameraDepth = cameraActor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z;
}
return !!cameraActor;
int UtcFrustumCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- CreateMeshActorToScene( application );
+ CreateMeshActorToScene(application);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumLeftCullP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = -0.01f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_RIGHT );
+ float offset = -0.01f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_RIGHT);
- float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 sceneSize = application.GetScene().GetSize();
- meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( -radius / sceneSize.width + offset, 0.5f, 0.5f ) );
- meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(-radius / sceneSize.width + offset, 0.5f, 0.5f));
+ meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be sphere culled
- DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumLeftCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = 0.01f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_RIGHT );
+ float offset = 0.01f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_RIGHT);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumRightCullP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = 1.01f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_LEFT );
+ float offset = 1.01f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_LEFT);
- float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 sceneSize = application.GetScene().GetSize();
- meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( radius / sceneSize.width + offset, 0.5f, 0.5f ) );
- meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(radius / sceneSize.width + offset, 0.5f, 0.5f));
+ meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be sphere culled
- DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumRightCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = 0.99f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( offset, 0.5f, 0.5f ), AnchorPoint::CENTER_LEFT );
+ float offset = 0.99f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(offset, 0.5f, 0.5f), AnchorPoint::CENTER_LEFT);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumTopCullP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = -0.01f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::BOTTOM_CENTER );
+ float offset = -0.01f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::BOTTOM_CENTER);
- float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 sceneSize = application.GetScene().GetSize();
- meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, -radius / sceneSize.width + offset, 0.5f ) );
- meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5f, -radius / sceneSize.width + offset, 0.5f));
+ meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be sphere culled
- DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumTopCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = 0.01f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::BOTTOM_CENTER );
+ float offset = 0.01f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::BOTTOM_CENTER);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be box culled
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumBottomCullP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = 1.01f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::TOP_CENTER );
+ float offset = 1.01f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::TOP_CENTER);
- float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
Vector2 sceneSize = application.GetScene().GetSize();
- meshActor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5f, radius / sceneSize.width + offset, 0.5f ) );
- meshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ meshActor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5f, radius / sceneSize.width + offset, 0.5f));
+ meshActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be sphere culled
- DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumBottomCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- float offset = 0.99f;
- Actor meshActor = CreateMeshActorToScene( application, Vector3( 0.5f, offset, 0.5f ), AnchorPoint::TOP_CENTER );
+ float offset = 0.99f;
+ Actor meshActor = CreateMeshActorToScene(application, Vector3(0.5f, offset, 0.5f), AnchorPoint::TOP_CENTER);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumNearCullP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
float nearPlane, farPlane, cameraDepth;
- DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
+ DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth));
- Actor meshActor = CreateMeshActorToScene( application );
- Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
+ Actor meshActor = CreateMeshActorToScene(application);
+ Vector3 meshPosition = meshActor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- float radius = meshActor.GetTargetSize().Length() * 0.5f;
- float offset = radius + 0.1f;
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float offset = radius + 0.1f;
meshPosition.z = cameraDepth - nearPlane + offset;
- meshActor.SetProperty( Actor::Property::POSITION, meshPosition );
+ meshActor.SetProperty(Actor::Property::POSITION, meshPosition);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be sphere culled
- DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumNearCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
float nearPlane, farPlane, cameraDepth;
- DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
+ DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth));
- Actor meshActor = CreateMeshActorToScene( application );
- Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
+ Actor meshActor = CreateMeshActorToScene(application);
+ Vector3 meshPosition = meshActor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- float offset = meshActor.GetTargetSize().z - 0.1f;
+ float offset = meshActor.GetTargetSize().z - 0.1f;
meshPosition.z = cameraDepth - nearPlane + offset;
- meshActor.SetProperty( Actor::Property::POSITION, meshPosition );
+ meshActor.SetProperty(Actor::Property::POSITION, meshPosition);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumFarCullP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
float nearPlane, farPlane, cameraDepth;
- DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
+ DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth));
- Actor meshActor = CreateMeshActorToScene( application );
- Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
+ Actor meshActor = CreateMeshActorToScene(application);
+ Vector3 meshPosition = meshActor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- float radius = meshActor.GetTargetSize().Length() * 0.5f;
- float offset = radius + 0.1f;
+ float radius = meshActor.GetTargetSize().Length() * 0.5f;
+ float offset = radius + 0.1f;
meshPosition.z = cameraDepth - farPlane - offset;
- meshActor.SetProperty( Actor::Property::POSITION, meshPosition );
+ meshActor.SetProperty(Actor::Property::POSITION, meshPosition);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This will be sphere culled
- DALI_TEST_CHECK( !drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumFarCullN(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
float nearPlane, farPlane, cameraDepth;
- DALI_TEST_CHECK( GetCameraDepths( application, nearPlane, farPlane, cameraDepth ) );
+ DALI_TEST_CHECK(GetCameraDepths(application, nearPlane, farPlane, cameraDepth));
- Actor meshActor = CreateMeshActorToScene( application );
- Vector3 meshPosition = meshActor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
+ Actor meshActor = CreateMeshActorToScene(application);
+ Vector3 meshPosition = meshActor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- float offset = meshActor.GetTargetSize().z - 0.1f;
+ float offset = meshActor.GetTargetSize().z - 0.1f;
meshPosition.z = cameraDepth - farPlane - offset;
- meshActor.SetProperty( Actor::Property::POSITION, meshPosition );
+ meshActor.SetProperty(Actor::Property::POSITION, meshPosition);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
int UtcFrustumCullDisabledP(void)
{
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
- drawTrace.Enable( true );
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ drawTrace.Enable(true);
- CreateMeshActorToScene( application, Vector3( 7.0f, 0.5f, 0.5f ), AnchorPoint::CENTER, Shader::Hint::MODIFIES_GEOMETRY );
+ CreateMeshActorToScene(application, Vector3(7.0f, 0.5f, 0.5f), AnchorPoint::CENTER, Shader::Hint::MODIFIES_GEOMETRY);
drawTrace.Reset();
application.SendNotification();
- application.Render( 16 );
+ application.Render(16);
// This should not be culled
- DALI_TEST_CHECK( drawTrace.FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(drawTrace.FindMethod("DrawElements"));
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/internal/event/events/gesture-impl.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
// TestGesture Struct (Gesture constructor is protected)
struct TestGesture : public Internal::Gesture
{
public:
TestGesture(GestureType::Value type, GestureState state)
- : Gesture(type, state) {}
+ : Gesture(type, state)
+ {
+ }
- virtual ~TestGesture() {}
+ virtual ~TestGesture()
+ {
+ }
};
-} // anon namespace
+} // namespace
int UtcDaliGestureConstructorP(void)
{
TestApplication application; // Reset all test adapter return codes
Gesture empty;
- DALI_TEST_CHECK( !empty );
+ DALI_TEST_CHECK(!empty);
- Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED));
DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION);
- Gesture pinch( new TestGesture(GestureType::PINCH, GestureState::CLEAR) );
+ Gesture pinch(new TestGesture(GestureType::PINCH, GestureState::CLEAR));
DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CLEAR, pinch.GetState(), TEST_LOCATION);
// Test move constructor
const auto refCount = pan.GetObjectPtr()->ReferenceCount();
- Gesture pan3( std::move( pan ) );
+ Gesture pan3(std::move(pan));
DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, pan3.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
TestApplication application; // Reset all test adapter return codes
// Test Assignment operator
- Gesture pan( new TestGesture(GestureType::PAN, GestureState::FINISHED) );
+ Gesture pan(new TestGesture(GestureType::PAN, GestureState::FINISHED));
DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION);
- Gesture test( new TestGesture(GestureType::PINCH, GestureState::STARTED) );
+ Gesture test(new TestGesture(GestureType::PINCH, GestureState::STARTED));
DALI_TEST_EQUALS(GestureType::PINCH, test.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, test.GetState(), TEST_LOCATION);
// Move assignment
const auto refCount = pan.GetObjectPtr()->ReferenceCount();
- Gesture pan3;
+ Gesture pan3;
DALI_TEST_EQUALS(pan3, Gesture(), TEST_LOCATION);
pan3 = std::move(pan);
DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION);
{
TestApplication application; // Reset all test adapter return codes
- Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED));
DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
END_TEST;
{
TestApplication application; // Reset all test adapter return codes
- Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED));
DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION);
GetImplementation(pan).SetState(GestureState::FINISHED);
{
TestApplication application; // Reset all test adapter return codes
- Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ Gesture pan(new TestGesture(GestureType::PAN, GestureState::STARTED));
DALI_TEST_EQUALS(0, pan.GetTime(), TEST_LOCATION);
GetImplementation(pan).SetTime(61282);
END_TEST;
}
-
*
*/
-#include <iostream>
-
-#include <stdlib.h>
+#include <dali-test-suite-utils.h>
#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
// Internal headers are allowed here
-
using namespace Dali;
void utc_dali_internal_handles_startup()
test_return_value = TET_PASS;
}
-
int UtcDaliCameraActorConstructorRefObject(void)
{
TestApplication application;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/long-press-gesture-devel.h>
#include <dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
{
TestApplication application;
- LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED );
+ LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION);
// Test Copy constructor
- GetImplementation( gesture ).SetNumberOfTouches( 5u );
+ GetImplementation(gesture).SetNumberOfTouches(5u);
LongPressGesture gesture2(gesture);
DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION);
// Test move constructor
- const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
- LongPressGesture gesture3( std::move( gesture ) );
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ LongPressGesture gesture3(std::move(gesture));
DALI_TEST_EQUALS(gesture, LongPressGesture(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture3.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
int UtcDaliLongPressGestureAssignmentP(void)
{
// Test Assignment operator
- LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED );
+ LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION);
- GetImplementation( gesture ).SetNumberOfTouches( 5u );
+ GetImplementation(gesture).SetNumberOfTouches(5u);
- LongPressGesture gesture2 = DevelLongPressGesture::New( GestureState::FINISHED );
+ LongPressGesture gesture2 = DevelLongPressGesture::New(GestureState::FINISHED);
DALI_TEST_EQUALS(GestureState::FINISHED, gesture2.GetState(), TEST_LOCATION);
gesture2 = gesture;
DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION);
// Move assignment
- const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
LongPressGesture gesture3;
DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
gesture3 = std::move(gesture);
{
TestApplication application;
- LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED );
+ LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1, TEST_LOCATION);
GetImplementation(gesture).SetNumberOfTouches(4);
{
TestApplication application;
- LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED );
- DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
- DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+ LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION);
GetImplementation(gesture).SetScreenPoint(Vector2(100.0f, 300.0f));
DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION);
- DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- LongPressGesture gesture = DevelLongPressGesture::New( GestureState::STARTED );
- DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
- DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+ LongPressGesture gesture = DevelLongPressGesture::New(GestureState::STARTED);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION);
GetImplementation(gesture).SetLocalPoint(Vector2(100.0f, 300.0f));
DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION);
- DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION);
END_TEST;
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
// Internal headers are allowed here
int testObjectDataAccess;
MemoryPoolObjectAllocatorTestObjectTracking()
- : testObjectDestructed( 0 ),
- testObjectMethod( 0 ),
- testObjectDataAccess( 0 )
+ : testObjectDestructed(0),
+ testObjectMethod(0),
+ testObjectDataAccess(0)
{
}
};
class MemoryPoolObjectAllocatorTestObject
{
public:
-
MemoryPoolObjectAllocatorTestObject()
- : mData1( 0 ),
- mData2( false ),
- mTracking( NULL )
+ : mData1(0),
+ mData2(false),
+ mTracking(NULL)
{
}
~MemoryPoolObjectAllocatorTestObject()
{
- if( mTracking )
+ if(mTracking)
{
mTracking->testObjectDestructed++;
}
void Method()
{
- if( mTracking )
+ if(mTracking)
{
mTracking->testObjectMethod++;
}
mData1++;
mData2 = true;
- if( mTracking )
+ if(mTracking)
{
mTracking->testObjectDataAccess++;
}
}
- void SetTracking( MemoryPoolObjectAllocatorTestObjectTracking* tracking )
+ void SetTracking(MemoryPoolObjectAllocatorTestObjectTracking* tracking)
{
mTracking = tracking;
}
private:
-
- int mData1;
+ int mData1;
bool mData2;
MemoryPoolObjectAllocatorTestObjectTracking* mTracking;
int UtcDaliMemoryPoolObjectAllocatorObjectAllocation(void)
{
-
- Internal::MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator;
+ Internal::MemoryPoolObjectAllocator<MemoryPoolObjectAllocatorTestObject> allocator;
// Allocate an object
MemoryPoolObjectAllocatorTestObject* testObject1 = allocator.Allocate();
- DALI_TEST_CHECK( testObject1 );
+ DALI_TEST_CHECK(testObject1);
MemoryPoolObjectAllocatorTestObjectTracking tracking1;
- testObject1->SetTracking( &tracking1 );
+ testObject1->SetTracking(&tracking1);
testObject1->Method();
- DALI_TEST_EQUALS( tracking1.testObjectMethod, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracking1.testObjectMethod, 1, TEST_LOCATION);
testObject1->DataAccess();
- DALI_TEST_EQUALS( tracking1.testObjectDataAccess, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracking1.testObjectDataAccess, 1, TEST_LOCATION);
- allocator.Destroy( testObject1 );
- DALI_TEST_EQUALS( tracking1.testObjectDestructed, 1, TEST_LOCATION );
+ allocator.Destroy(testObject1);
+ DALI_TEST_EQUALS(tracking1.testObjectDestructed, 1, TEST_LOCATION);
// Reset and allocate another object
allocator.ResetMemoryPool();
MemoryPoolObjectAllocatorTestObject* testObject2 = allocator.Allocate();
- DALI_TEST_CHECK( testObject2 );
+ DALI_TEST_CHECK(testObject2);
MemoryPoolObjectAllocatorTestObjectTracking tracking2;
- testObject2->SetTracking( &tracking2 );
+ testObject2->SetTracking(&tracking2);
testObject2->Method();
- DALI_TEST_EQUALS( tracking2.testObjectMethod, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracking2.testObjectMethod, 1, TEST_LOCATION);
testObject2->DataAccess();
- DALI_TEST_EQUALS( tracking2.testObjectDataAccess, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracking2.testObjectDataAccess, 1, TEST_LOCATION);
- allocator.Destroy( testObject2 );
- DALI_TEST_EQUALS( tracking2.testObjectDestructed, 1, TEST_LOCATION );
+ allocator.Destroy(testObject2);
+ DALI_TEST_EQUALS(tracking2.testObjectDestructed, 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliMemoryPoolObjectAllocatorObjectRawAllocation(void)
{
- Internal::MemoryPoolObjectAllocator< MemoryPoolObjectAllocatorTestObject > allocator;
+ Internal::MemoryPoolObjectAllocator<MemoryPoolObjectAllocatorTestObject> allocator;
- MemoryPoolObjectAllocatorTestObject* testObject = new ( allocator.AllocateRaw() ) MemoryPoolObjectAllocatorTestObject();
- DALI_TEST_CHECK( testObject );
+ MemoryPoolObjectAllocatorTestObject* testObject = new(allocator.AllocateRaw()) MemoryPoolObjectAllocatorTestObject();
+ DALI_TEST_CHECK(testObject);
MemoryPoolObjectAllocatorTestObjectTracking tracking;
- testObject->SetTracking( &tracking );
+ testObject->SetTracking(&tracking);
testObject->Method();
- DALI_TEST_EQUALS( tracking.testObjectMethod, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracking.testObjectMethod, 1, TEST_LOCATION);
testObject->DataAccess();
- DALI_TEST_EQUALS( tracking.testObjectDataAccess, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracking.testObjectDataAccess, 1, TEST_LOCATION);
- allocator.Destroy( testObject );
- DALI_TEST_EQUALS( tracking.testObjectDestructed, 1, TEST_LOCATION );
+ allocator.Destroy(testObject);
+ DALI_TEST_EQUALS(tracking.testObjectDestructed, 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliMemoryPoolObjectAllocatorObjectAllocationPOD(void)
{
- Internal::MemoryPoolObjectAllocator< bool > allocator;
+ Internal::MemoryPoolObjectAllocator<bool> allocator;
bool* testObject1 = allocator.Allocate();
- DALI_TEST_CHECK( testObject1 );
+ DALI_TEST_CHECK(testObject1);
- allocator.Destroy( testObject1 );
+ allocator.Destroy(testObject1);
allocator.ResetMemoryPool();
bool* testObject2 = allocator.Allocate();
- DALI_TEST_CHECK( testObject2 );
+ DALI_TEST_CHECK(testObject2);
- allocator.Destroy( testObject2 );
+ allocator.Destroy(testObject2);
END_TEST;
}
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
/// Takes in a reference to a bool which is set to true when the destructor is called
class OwnedClass
{
public:
-
- OwnedClass( bool& destructorCalled )
- : mDestructorCalled( destructorCalled )
+ OwnedClass(bool& destructorCalled)
+ : mDestructorCalled(destructorCalled)
{
mDestructorCalled = false;
}
}
private:
-
bool& mDestructorCalled;
};
functionCalled = true;
}
- bool functionCalled{ false };
+ bool functionCalled{false};
};
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
bool deleted = false;
{
- OwnerPointer< OwnedClass > pointer( new OwnedClass( deleted ) );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ OwnerPointer<OwnedClass> pointer(new OwnedClass(deleted));
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
}
// OwnerPointer out-of-scope, object should be deleted.
- DALI_TEST_EQUALS( deleted, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(deleted, true, TEST_LOCATION);
END_TEST;
}
{
// Ensure the default constructor is created as expected.
- OwnerPointer< OwnedClass > pointer;
- DALI_TEST_CHECK( pointer.Get() == nullptr );
+ OwnerPointer<OwnedClass> pointer;
+ DALI_TEST_CHECK(pointer.Get() == nullptr);
END_TEST;
}
{
// Call copy constructor and assignment operator
- bool deleted = false;
- OwnedClass* owned = new OwnedClass( deleted );
+ bool deleted = false;
+ OwnedClass* owned = new OwnedClass(deleted);
- OwnerPointer< OwnedClass > first( owned );
- DALI_TEST_CHECK( first.Get() == owned );
+ OwnerPointer<OwnedClass> first(owned);
+ DALI_TEST_CHECK(first.Get() == owned);
{
// Copy constructor, first should have a nullptr now, no object deletion
- OwnerPointer< OwnedClass > second( first );
- DALI_TEST_CHECK( first.Get() == nullptr );
- DALI_TEST_CHECK( second.Get() == owned);
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ OwnerPointer<OwnedClass> second(first);
+ DALI_TEST_CHECK(first.Get() == nullptr);
+ DALI_TEST_CHECK(second.Get() == owned);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
// Self assignment, nothing should change or be deleted.
- first = first;
+ first = first;
second = second;
- DALI_TEST_CHECK( first.Get() == nullptr );
- DALI_TEST_CHECK( second.Get() == owned );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ DALI_TEST_CHECK(first.Get() == nullptr);
+ DALI_TEST_CHECK(second.Get() == owned);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
// Assign second to first, no deletion, second should have a nullptr now
first = second;
- DALI_TEST_CHECK( first.Get() == owned );
- DALI_TEST_CHECK( second.Get() == nullptr );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ DALI_TEST_CHECK(first.Get() == owned);
+ DALI_TEST_CHECK(second.Get() == nullptr);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
}
// second is out-of-scope now, no object deletion
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
// Assign to an empty pointer, owned object should be deleted
- OwnerPointer< OwnedClass > empty;
+ OwnerPointer<OwnedClass> empty;
first = empty;
- DALI_TEST_EQUALS( deleted, true, TEST_LOCATION );
- DALI_TEST_CHECK( first.Get() == nullptr );
- DALI_TEST_CHECK( empty.Get() == nullptr );
+ DALI_TEST_EQUALS(deleted, true, TEST_LOCATION);
+ DALI_TEST_CHECK(first.Get() == nullptr);
+ DALI_TEST_CHECK(empty.Get() == nullptr);
END_TEST;
}
{
// Call move constructor and move assignment operator
- bool deleted = false;
- OwnedClass* owned = new OwnedClass( deleted );
+ bool deleted = false;
+ OwnedClass* owned = new OwnedClass(deleted);
- OwnerPointer< OwnedClass > first( owned );
- DALI_TEST_CHECK( first.Get() == owned );
+ OwnerPointer<OwnedClass> first(owned);
+ DALI_TEST_CHECK(first.Get() == owned);
{
// Move constructor, first should have a nullptr now, no object deletion
- OwnerPointer< OwnedClass > second( std::move( first ) );
- DALI_TEST_CHECK( first.Get() == nullptr );
- DALI_TEST_CHECK( second.Get() == owned);
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ OwnerPointer<OwnedClass> second(std::move(first));
+ DALI_TEST_CHECK(first.Get() == nullptr);
+ DALI_TEST_CHECK(second.Get() == owned);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
// Self assignment, nothing should change or be deleted.
- first = std::move( first );
- second = std::move( second );
- DALI_TEST_CHECK( first.Get() == nullptr );
- DALI_TEST_CHECK( second.Get() == owned );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ first = std::move(first);
+ second = std::move(second);
+ DALI_TEST_CHECK(first.Get() == nullptr);
+ DALI_TEST_CHECK(second.Get() == owned);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
// Assign second to first, no deletion, second should have a nullptr now
- first = std::move( second );
- DALI_TEST_CHECK( first.Get() == owned );
- DALI_TEST_CHECK( second.Get() == nullptr );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ first = std::move(second);
+ DALI_TEST_CHECK(first.Get() == owned);
+ DALI_TEST_CHECK(second.Get() == nullptr);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
}
// second is out-of-scope now, no object deletion
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
// Assign to an empty pointer, owned object should be deleted
- OwnerPointer< OwnedClass > empty;
- first = std::move( empty );
- DALI_TEST_EQUALS( deleted, true, TEST_LOCATION );
- DALI_TEST_CHECK( first.Get() == nullptr );
- DALI_TEST_CHECK( empty.Get() == nullptr );
+ OwnerPointer<OwnedClass> empty;
+ first = std::move(empty);
+ DALI_TEST_EQUALS(deleted, true, TEST_LOCATION);
+ DALI_TEST_CHECK(first.Get() == nullptr);
+ DALI_TEST_CHECK(empty.Get() == nullptr);
END_TEST;
}
{
// Check the indirection operators
- using Ptr = OwnerPointer< int >;
+ using Ptr = OwnerPointer<int>;
{
- int* rawIntPtr( new int( 200 ) );
- Ptr nonConstPtr( rawIntPtr );
- DALI_TEST_CHECK( rawIntPtr == &( *nonConstPtr ) );
- DALI_TEST_EQUALS( *nonConstPtr, 200, TEST_LOCATION );
+ int* rawIntPtr(new int(200));
+ Ptr nonConstPtr(rawIntPtr);
+ DALI_TEST_CHECK(rawIntPtr == &(*nonConstPtr));
+ DALI_TEST_EQUALS(*nonConstPtr, 200, TEST_LOCATION);
}
{
- int* rawIntPtr2( new int( 300 ) );
- const Ptr constPtr( rawIntPtr2 );
- DALI_TEST_CHECK( rawIntPtr2 == &( *constPtr ) );
- DALI_TEST_EQUALS( *constPtr, 300, TEST_LOCATION );
+ int* rawIntPtr2(new int(300));
+ const Ptr constPtr(rawIntPtr2);
+ DALI_TEST_CHECK(rawIntPtr2 == &(*constPtr));
+ DALI_TEST_EQUALS(*constPtr, 300, TEST_LOCATION);
}
END_TEST;
{
// Check the pointer operators
- using Ptr = OwnerPointer< ClassWithFunction >;
+ using Ptr = OwnerPointer<ClassWithFunction>;
// Check if function is called as expected when using a const OwnerPointer
{
- ClassWithFunction* rawPtr( new ClassWithFunction );
- Ptr nonConstPtr( rawPtr );
- DALI_TEST_EQUALS( rawPtr->functionCalled, false, TEST_LOCATION );
+ ClassWithFunction* rawPtr(new ClassWithFunction);
+ Ptr nonConstPtr(rawPtr);
+ DALI_TEST_EQUALS(rawPtr->functionCalled, false, TEST_LOCATION);
nonConstPtr->MyFunction();
- DALI_TEST_EQUALS( rawPtr->functionCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(rawPtr->functionCalled, true, TEST_LOCATION);
}
-
// Check if function is called as expected when using a const OwnerPointer
{
- ClassWithFunction* rawPtr2( new ClassWithFunction );
- const Ptr constPtr( rawPtr2 );
- DALI_TEST_EQUALS( rawPtr2->functionCalled, false, TEST_LOCATION );
+ ClassWithFunction* rawPtr2(new ClassWithFunction);
+ const Ptr constPtr(rawPtr2);
+ DALI_TEST_EQUALS(rawPtr2->functionCalled, false, TEST_LOCATION);
constPtr->MyFunction();
- DALI_TEST_EQUALS( rawPtr2->functionCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(rawPtr2->functionCalled, true, TEST_LOCATION);
}
END_TEST;
}
{
// Check the comparison operator
- using Ptr = OwnerPointer< int >;
+ using Ptr = OwnerPointer<int>;
- int* rawIntPtr( new int( 200 ) );
- Ptr ownerPtr( rawIntPtr );
- DALI_TEST_CHECK( ownerPtr == rawIntPtr );
- DALI_TEST_CHECK( ! ( ownerPtr == nullptr ) );
+ int* rawIntPtr(new int(200));
+ Ptr ownerPtr(rawIntPtr);
+ DALI_TEST_CHECK(ownerPtr == rawIntPtr);
+ DALI_TEST_CHECK(!(ownerPtr == nullptr));
END_TEST;
}
bool deleted = false;
- OwnerPointer< OwnedClass > pointer( new OwnedClass( deleted ) );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
+ OwnerPointer<OwnedClass> pointer(new OwnedClass(deleted));
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
pointer.Reset();
- DALI_TEST_EQUALS( deleted, true, TEST_LOCATION );
- DALI_TEST_CHECK( pointer.Get() == nullptr );
+ DALI_TEST_EQUALS(deleted, true, TEST_LOCATION);
+ DALI_TEST_CHECK(pointer.Get() == nullptr);
// Reset the empty pointer, should have no effect but there shouldn't be any crash
pointer.Reset();
- DALI_TEST_CHECK( pointer.Get() == nullptr );
+ DALI_TEST_CHECK(pointer.Get() == nullptr);
END_TEST;
}
bool deleted = false;
- OwnedClass* rawPtr = new OwnedClass( deleted );
- OwnerPointer< OwnedClass > pointer( rawPtr );
+ OwnedClass* rawPtr = new OwnedClass(deleted);
+ OwnerPointer<OwnedClass> pointer(rawPtr);
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( pointer.Release() == rawPtr );
- DALI_TEST_EQUALS( deleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( pointer.Get() == nullptr );
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(pointer.Release() == rawPtr);
+ DALI_TEST_EQUALS(deleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(pointer.Get() == nullptr);
// Release the empty pointer, should have no effect but there shouldn't be any crash
- DALI_TEST_CHECK( pointer.Release() == nullptr );
- DALI_TEST_CHECK( pointer.Get() == nullptr );
+ DALI_TEST_CHECK(pointer.Release() == nullptr);
+ DALI_TEST_CHECK(pointer.Get() == nullptr);
END_TEST;
}
{
// Check the Get method
- using Ptr = OwnerPointer< int >;
+ using Ptr = OwnerPointer<int>;
- int* rawIntPtr( new int( 200 ) );
- Ptr ownerPtr( rawIntPtr );
- DALI_TEST_CHECK( ownerPtr.Get() == rawIntPtr );
+ int* rawIntPtr(new int(200));
+ Ptr ownerPtr(rawIntPtr);
+ DALI_TEST_CHECK(ownerPtr.Get() == rawIntPtr);
END_TEST;
}
{
// Ensure the Swap method swaps the pointers and doesn't delete any objects
- using Ptr = OwnerPointer< OwnedClass >;
+ using Ptr = OwnerPointer<OwnedClass>;
- bool firstObjectDeleted = false;
+ bool firstObjectDeleted = false;
bool secondObjectDeleted = false;
- OwnedClass* firstRawPtr = new OwnedClass( firstObjectDeleted );
- OwnedClass* secondRawPtr = new OwnedClass( secondObjectDeleted );
+ OwnedClass* firstRawPtr = new OwnedClass(firstObjectDeleted);
+ OwnedClass* secondRawPtr = new OwnedClass(secondObjectDeleted);
- Ptr firstPtr( firstRawPtr );
- Ptr secondPtr( secondRawPtr );
+ Ptr firstPtr(firstRawPtr);
+ Ptr secondPtr(secondRawPtr);
// Check initial values
- DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_EQUALS( secondObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( firstPtr == firstRawPtr );
- DALI_TEST_CHECK( secondPtr == secondRawPtr );
+ DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(secondObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(firstPtr == firstRawPtr);
+ DALI_TEST_CHECK(secondPtr == secondRawPtr);
// Call Swap on first and ensure swap is done and there's no deletion
- firstPtr.Swap( secondPtr );
- DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_EQUALS( secondObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( firstPtr == secondRawPtr );
- DALI_TEST_CHECK( secondPtr == firstRawPtr );
+ firstPtr.Swap(secondPtr);
+ DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(secondObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(firstPtr == secondRawPtr);
+ DALI_TEST_CHECK(secondPtr == firstRawPtr);
// Swap back using second, again no deletion
- secondPtr.Swap( firstPtr );
- DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_EQUALS( secondObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( firstPtr == firstRawPtr );
- DALI_TEST_CHECK( secondPtr == secondRawPtr );
+ secondPtr.Swap(firstPtr);
+ DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(secondObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(firstPtr == firstRawPtr);
+ DALI_TEST_CHECK(secondPtr == secondRawPtr);
// Swap with self, nothing should change or be deleted
- firstPtr.Swap( firstPtr );
- DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( firstPtr == firstRawPtr );
+ firstPtr.Swap(firstPtr);
+ DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(firstPtr == firstRawPtr);
// Swap with an empty OwnerPointer, no deletion but firstPtr should be empty now
Ptr emptyPtr;
- firstPtr.Swap( emptyPtr );
- DALI_TEST_EQUALS( firstObjectDeleted, false, TEST_LOCATION );
- DALI_TEST_CHECK( firstPtr == nullptr );
- DALI_TEST_CHECK( emptyPtr == firstRawPtr );
+ firstPtr.Swap(emptyPtr);
+ DALI_TEST_EQUALS(firstObjectDeleted, false, TEST_LOCATION);
+ DALI_TEST_CHECK(firstPtr == nullptr);
+ DALI_TEST_CHECK(emptyPtr == firstRawPtr);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/pinch-gesture-devel.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
{
TestApplication application; // Reset all test adapter return codes
- PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED );
+ PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture.GetScale(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION);
- PinchGesture gesture2 = DevelPinchGesture::New( GestureState::CONTINUING );
+ PinchGesture gesture2 = DevelPinchGesture::New(GestureState::CONTINUING);
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture2.GetScale(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture2.GetSpeed(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION);
- PinchGesture gesture3 = DevelPinchGesture::New( GestureState::FINISHED );
+ PinchGesture gesture3 = DevelPinchGesture::New(GestureState::FINISHED);
DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture3.GetScale(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture3.GetSpeed(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, gesture3.GetType(), TEST_LOCATION);
// Test copy constructor
- GetImplementation( gesture3 ).SetScale( 3.0f );
- GetImplementation( gesture3 ).SetSpeed( 5.0f );
+ GetImplementation(gesture3).SetScale(3.0f);
+ GetImplementation(gesture3).SetSpeed(5.0f);
PinchGesture pinch(gesture3);
DALI_TEST_EQUALS(GestureState::FINISHED, pinch.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION);
// Test move constructor
- const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
- PinchGesture gesture4( std::move( gesture ) );
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PinchGesture gesture4(std::move(gesture));
DALI_TEST_CHECK(!gesture);
DALI_TEST_EQUALS(GestureType::PINCH, gesture4.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
int UtcDaliPinchGestureAssignment(void)
{
// Test Assignment operator
- PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED );
+ PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture.GetScale(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION);
- PinchGesture gesture2 = DevelPinchGesture::New( GestureState::CONTINUING );
+ PinchGesture gesture2 = DevelPinchGesture::New(GestureState::CONTINUING);
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture2.GetScale(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture2.GetSpeed(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION);
- GetImplementation( gesture2 ).SetScale( 3.0f );
- GetImplementation( gesture2 ).SetSpeed( 5.0f );
+ GetImplementation(gesture2).SetScale(3.0f);
+ GetImplementation(gesture2).SetSpeed(5.0f);
gesture = gesture2;
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION);
// Move assignment
- const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
PinchGesture gesture3;
DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
gesture3 = std::move(gesture);
int UtcDaliPinchGestureSetGetScaleP(void)
{
- PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED );
+ PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetScale(), 0.0f, TEST_LOCATION);
GetImplementation(gesture).SetScale(123.0f);
int UtcDaliPinchGestureSetGetSpeedP(void)
{
- PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED );
+ PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetSpeed(), 0.0f, TEST_LOCATION);
GetImplementation(gesture).SetSpeed(123.0f);
int UtcDaliPinchGestureSetGetScreenCenterPointP(void)
{
- PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED );
+ PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION);
GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f));
- DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliPinchGestureSetGetLocalCenterPointP(void)
{
- PinchGesture gesture = DevelPinchGesture::New( GestureState::STARTED );
+ PinchGesture gesture = DevelPinchGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION);
- GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f));
- DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+ GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
-#include <dali/internal/event/events/pinch-gesture/pinch-gesture-processor.h>
-#include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-processor.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
void TestAbortWithState(GestureState state)
{
TestApplication application;
Internal::PinchGestureProcessor processor;
- Integration::Scene scene( application.GetScene() );
- Internal::Scene& sceneImpl = GetImplementation( scene );
- Internal::PinchGestureEvent event(state);
+ Integration::Scene scene(application.GetScene());
+ Internal::Scene& sceneImpl = GetImplementation(scene);
+ Internal::PinchGestureEvent event(state);
try
{
processor.Process(sceneImpl, event);
- DALI_TEST_CHECK( false ); // Should not get here as we expect an abort
+ DALI_TEST_CHECK(false); // Should not get here as we expect an abort
}
catch(...)
{
- DALI_TEST_CHECK( true ); // We aborted, so the test has passed
+ DALI_TEST_CHECK(true); // We aborted, so the test has passed
}
}
-} // anon namespace
+} // namespace
int UtcDaliPinchGestureProcessorProcessClearStateN(void)
{
TestAbortWithState(GestureState::POSSIBLE);
END_TEST;
}
-
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/rotation-gesture-devel.h>
#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
{
TestApplication application; // Reset all test adapter return codes
- RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED );
+ RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION);
- RotationGesture gesture2 = DevelRotationGesture::New( GestureState::CONTINUING );
+ RotationGesture gesture2 = DevelRotationGesture::New(GestureState::CONTINUING);
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION);
- RotationGesture gesture3 = DevelRotationGesture::New( GestureState::FINISHED );
+ RotationGesture gesture3 = DevelRotationGesture::New(GestureState::FINISHED);
DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture3.GetRotation().radian, TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture3.GetType(), TEST_LOCATION);
// Test copy constructor
- GetImplementation( gesture3 ).SetRotation( Radian( 3.0f ));
+ GetImplementation(gesture3).SetRotation(Radian(3.0f));
RotationGesture rotation(gesture3);
DALI_TEST_EQUALS(GestureState::FINISHED, rotation.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, rotation.GetType(), TEST_LOCATION);
// Test move constructor
- const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
- RotationGesture gesture4( std::move( gesture ) );
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ RotationGesture gesture4(std::move(gesture));
DALI_TEST_CHECK(!gesture);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture4.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
int UtcDaliRotationGestureAssignment(void)
{
// Test Assignment operator
- RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED );
+ RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION);
- RotationGesture gesture2 = DevelRotationGesture::New( GestureState::CONTINUING );
+ RotationGesture gesture2 = DevelRotationGesture::New(GestureState::CONTINUING);
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION);
- GetImplementation( gesture2 ).SetRotation( Radian( 3.0f ));
+ GetImplementation(gesture2).SetRotation(Radian(3.0f));
gesture = gesture2;
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION);
// Move assignment
- const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
RotationGesture gesture3;
DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
gesture3 = std::move(gesture);
int UtcDaliRotationGestureSetGetRotationP(void)
{
- RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED );
+ RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetRotation(), Radian(), TEST_LOCATION);
GetImplementation(gesture).SetRotation(Dali::ANGLE_270);
int UtcDaliRotationGestureSetGetScreenCenterPointP(void)
{
- RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED );
+ RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION);
- GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f,321.0f));
- DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+ GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliRotationGestureSetGetLocalCenterPointP(void)
{
- RotationGesture gesture = DevelRotationGesture::New( GestureState::STARTED );
+ RotationGesture gesture = DevelRotationGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION);
- GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f));
- DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+ GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/tap-gesture-devel.h>
#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-
// Positive test case for a method
int UtcDaliTapGestureConstructor(void)
{
TestApplication application; // Reset all test adapter return codes
- TapGesture gesture = DevelTapGesture::New( GestureState::STARTED );
+ TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION);
// Test Copy constructor
- GetImplementation( gesture ).SetNumberOfTouches( 5u );
- GetImplementation( gesture ).SetNumberOfTaps( 2u );
+ GetImplementation(gesture).SetNumberOfTouches(5u);
+ GetImplementation(gesture).SetNumberOfTaps(2u);
TapGesture gesture2(gesture);
DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
// Test move constructor
const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
- TapGesture gesture3( std::move( gesture ) );
+ TapGesture gesture3(std::move(gesture));
DALI_TEST_CHECK(!gesture);
DALI_TEST_EQUALS(GestureType::TAP, gesture3.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
int UtcDaliTapGestureAssignment(void)
{
// Test Assignment operator
- TapGesture gesture = DevelTapGesture::New( GestureState::STARTED );
+ TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION);
- GetImplementation( gesture ).SetNumberOfTouches( 5u );
- GetImplementation( gesture ).SetNumberOfTaps( 2u );
+ GetImplementation(gesture).SetNumberOfTouches(5u);
+ GetImplementation(gesture).SetNumberOfTaps(2u);
TapGesture gesture2;
gesture2 = gesture;
int UtcDaliTapGestureSetGetNumberOfTapsP(void)
{
- TapGesture gesture = DevelTapGesture::New( GestureState::STARTED );
+ TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 1u, TEST_LOCATION);
GetImplementation(gesture).SetNumberOfTaps(123u);
int UtcDaliTapGestureSetGetNumberOfTouchesP(void)
{
- TapGesture gesture = DevelTapGesture::New( GestureState::STARTED );
+ TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1u, TEST_LOCATION);
GetImplementation(gesture).SetNumberOfTouches(321u);
int UtcDaliTapGestureSetGetScreenPointP(void)
{
- TapGesture gesture = DevelTapGesture::New( GestureState::STARTED );
+ TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION);
- GetImplementation(gesture).SetScreenPoint(Vector2(123.0f,321.0f));
- DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+ GetImplementation(gesture).SetScreenPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliTapGestureSetGetLocalPointP(void)
{
- TapGesture gesture = DevelTapGesture::New( GestureState::STARTED );
+ TapGesture gesture = DevelTapGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION);
- GetImplementation(gesture).SetLocalPoint(Vector2(123.0f,321.0f));
- DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+ GetImplementation(gesture).SetLocalPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(123.0f, 321.0f), TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
-#include <dali/internal/event/events/tap-gesture/tap-gesture-processor.h>
-#include <dali/internal/event/events/tap-gesture/tap-gesture-event.h>
#include <dali/internal/event/common/scene-impl.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-event.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-processor.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
void TestAbortWithState(GestureState state)
{
TestApplication application;
Internal::TapGestureProcessor processor;
- Integration::Scene scene( application.GetScene() );
- Internal::Scene& sceneImpl = GetImplementation( scene );
- Internal::TapGestureEvent event(state);
+ Integration::Scene scene(application.GetScene());
+ Internal::Scene& sceneImpl = GetImplementation(scene);
+ Internal::TapGestureEvent event(state);
try
{
processor.Process(sceneImpl, event);
- DALI_TEST_CHECK( false ); // Should not get here as we expect an abort
+ DALI_TEST_CHECK(false); // Should not get here as we expect an abort
}
catch(...)
{
- DALI_TEST_CHECK( true ); // We aborted, so the test has passed
+ DALI_TEST_CHECK(true); // We aborted, so the test has passed
}
}
-} // anon namespace
+} // namespace
int UtcDaliTapGestureProcessorProcessClearStateN(void)
{
TestAbortWithState(GestureState::FINISHED);
END_TEST;
}
-
// First TET_PASS should set to zero
// first TET_FAIL should prevent any further TET_PASS from setting back to zero
// Any TET_FAIL should set to fail or leave as fail
- if( test_return_value != 1 )
+ if(test_return_value != 1)
test_return_value = value;
}
#define END_TEST \
- return ((test_return_value>0)?1:0)
+ return ((test_return_value > 0) ? 1 : 0)
extern "C"
{
+ void tet_infoline(const char* str)
+ {
+ fprintf(stderr, "%s\n", str);
+ }
-void tet_infoline(const char* str)
-{
- fprintf(stderr, "%s\n", str);
-}
-
-void tet_printf(const char *format, ...)
-{
- va_list arg;
- va_start(arg, format);
- vfprintf(stderr, format, arg);
- va_end(arg);
-}
+ void tet_printf(const char* format, ...)
+ {
+ va_list arg;
+ va_start(arg, format);
+ vfprintf(stderr, format, arg);
+ va_end(arg);
+ }
}
-
bool operator==(TimePeriod a, TimePeriod b)
{
- return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds) ;
+ return Equals(a.durationSeconds, b.durationSeconds) && Equals(a.delaySeconds, b.delaySeconds);
}
-std::ostream& operator<<( std::ostream& ostream, TimePeriod value )
+std::ostream& operator<<(std::ostream& ostream, TimePeriod value)
{
return ostream << "( Duration:" << value.durationSeconds << " Delay:" << value.delaySeconds << ")";
}
-std::ostream& operator<<( std::ostream& ostream, Radian angle )
+std::ostream& operator<<(std::ostream& ostream, Radian angle)
{
ostream << angle.radian;
return ostream;
}
-std::ostream& operator<<( std::ostream& ostream, Degree angle )
+std::ostream& operator<<(std::ostream& ostream, Degree angle)
{
ostream << angle.degree;
return ostream;
}
-void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location )
+void DALI_TEST_EQUALS(const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location)
{
- DALI_TEST_EQUALS< const BaseHandle& >( baseHandle1, baseHandle2, location );
+ DALI_TEST_EQUALS<const BaseHandle&>(baseHandle1, baseHandle2, location);
}
-void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* location )
+void DALI_TEST_EQUALS(const size_t value1, const uint32_t value2, const char* location)
{
- DALI_TEST_EQUALS< uint32_t >( ( uint32_t )( value1 ), value2, location );
+ DALI_TEST_EQUALS<uint32_t>((uint32_t)(value1), value2, location);
}
-void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* location )
+void DALI_TEST_EQUALS(const uint32_t value1, const size_t value2, const char* location)
{
- DALI_TEST_EQUALS< uint32_t >( value1, ( uint32_t )( value2 ), location );
+ DALI_TEST_EQUALS<uint32_t>(value1, (uint32_t)(value2), location);
}
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool equivalent = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
- for (int32_t i=0;i<9;++i)
+ for(int32_t i = 0; i < 9; ++i)
{
- if( ! (fabsf(m1[i] - m2[i])< GetRangedEpsilon(m1[i], m2[i])) )
+ if(!(fabsf(m1[i] - m2[i]) < GetRangedEpsilon(m1[i], m2[i])))
{
equivalent = false;
}
}
- if( !equivalent )
+ if(!equivalent)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[3], m1[6], m2[0], m2[3], m2[6],
- m1[1], m1[4], m1[7], m2[1], m2[4], m2[7],
- m1[2], m1[5], m1[8], m2[2], m2[5], m2[8] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[3],m1[6],m2[0],m2[3],m2[6],
+ m1[1],m1[4],m1[7],m2[1],m2[4],m2[7],
+ m1[2],m1[5],m1[8],m2[2],m2[5],m2[8]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location)
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool equivalent = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
- for (int32_t i=0;i<9;++i)
+ for(int32_t i = 0; i < 9; ++i)
{
- equivalent &= (fabsf(m1[i] - m2[i])<epsilon);
+ equivalent &= (fabsf(m1[i] - m2[i]) < epsilon);
}
- if (!equivalent)
+ if(!equivalent)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[3], m1[6], m2[0], m2[3], m2[6],
- m1[1], m1[4], m1[7], m2[1], m2[4], m2[7],
- m1[2], m1[5], m1[8], m2[2], m2[5], m2[8] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[3],m1[6],m2[0],m2[3],m2[6],
+ m1[1],m1[4],m1[7],m2[1],m2[4],m2[7],
+ m1[2],m1[5],m1[8],m2[2],m2[5],m2[8]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location)
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool identical = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool identical = true;
int32_t i;
- for (i=0;i<16;++i)
+ for(i = 0; i < 16; ++i)
{
if(m1[i] != m2[i])
{
}
}
- if (!identical)
+ if(!identical)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[4], m1[8], m1[12], m2[0], m2[4], m2[8], m2[12],
- m1[1], m1[5], m1[9], m1[13], m2[1], m2[5], m2[9], m2[13],
- m1[2], m1[6], m1[10], m1[14], m2[2], m2[6], m2[10], m2[14],
- m1[3], m1[7], m1[11], m1[15], m2[3], m2[7], m2[11], m2[15] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[4],m1[8],m1[12],m2[0],m2[4],m2[8],m2[12],
+ m1[1],m1[5],m1[9],m1[13],m2[1],m2[5],m2[9],m2[13],
+ m1[2],m1[6],m1[10],m1[14],m2[2],m2[6],m2[10],m2[14],
+ m1[3],m1[7],m1[11],m1[15],m2[3],m2[7],m2[11],m2[15]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location)
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location)
{
- const float* m1 = matrix1.AsFloat();
- const float* m2 = matrix2.AsFloat();
- bool equivalent = true;
+ const float* m1 = matrix1.AsFloat();
+ const float* m2 = matrix2.AsFloat();
+ bool equivalent = true;
- for (int32_t i=0;i<16;++i)
+ for(int32_t i = 0; i < 16; ++i)
{
- equivalent &= (fabsf(m1[i] - m2[i])<epsilon);
+ equivalent &= (fabsf(m1[i] - m2[i]) < epsilon);
}
- if (!equivalent)
+ if(!equivalent)
{
// Align each float to 1234.67, i.e. 3.6 will be " 3.60"
- fprintf( stderr, "%s, checking\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
- "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- location,
- m1[0], m1[4], m1[8], m1[12], m2[0], m2[4], m2[8], m2[12],
- m1[1], m1[5], m1[9], m1[13], m2[1], m2[5], m2[9], m2[13],
- m1[2], m1[6], m1[10], m1[14], m2[2], m2[6], m2[10], m2[14],
- m1[3], m1[7], m1[11], m1[15], m2[3], m2[7], m2[11], m2[15] );
+ // clang-format off
+ fprintf(stderr, "%s, checking\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f == %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n"
+ "%7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
+ location,
+ m1[0],m1[4],m1[8],m1[12],m2[0],m2[4],m2[8],m2[12],
+ m1[1],m1[5],m1[9],m1[13],m2[1],m2[5],m2[9],m2[13],
+ m1[2],m1[6],m1[10],m1[14],m2[2],m2[6],m2[10],m2[14],
+ m1[3],m1[7],m1[11],m1[15],m2[3],m2[7],m2[11],m2[15]);
+ // clang-format on
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
-
/**
* Test whether two strings are equal.
* @param[in] str1 The first string
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location)
+void DALI_TEST_EQUALS(const std::string& str1, const char* str2, const char* location)
{
DALI_TEST_EQUALS(str1.c_str(), str2, location);
}
-void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* location)
+void DALI_TEST_EQUALS(Property::Value& str1, const char* str2, const char* location)
{
bool result = false;
- if( str1.GetType() == Property::STRING )
+ if(str1.GetType() == Property::STRING)
{
std::string string;
str1.Get(string);
result = !string.compare(str2);
}
- if( result )
+ if(result)
{
tet_result(TET_PASS);
}
}
}
-void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location)
+void DALI_TEST_EQUALS(const char* str1, const std::string& str2, const char* location)
{
DALI_TEST_EQUALS(str1, str2.c_str(), location);
}
-void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location )
+void DALI_TEST_ASSERT(DaliException& e, std::string conditionSubString, const char* location)
{
- if( NULL == strstr( e.condition, conditionSubString.c_str() ) )
+ if(NULL == strstr(e.condition, conditionSubString.c_str()))
{
- fprintf(stderr, "Expected substring '%s' : actual exception string '%s' : location %s\n", conditionSubString.c_str(), e.condition, location );
+ fprintf(stderr, "Expected substring '%s' : actual exception string '%s' : location %s\n", conditionSubString.c_str(), e.condition, location);
tet_result(TET_FAIL);
throw("TET_FAIL");
}
}
// Functor to test whether an Applied signal is emitted
-ConstraintAppliedCheck::ConstraintAppliedCheck( bool& signalReceived )
-: mSignalReceived( signalReceived )
+ConstraintAppliedCheck::ConstraintAppliedCheck(bool& signalReceived)
+: mSignalReceived(signalReceived)
{
}
-void ConstraintAppliedCheck::operator()( Constraint& constraint )
+void ConstraintAppliedCheck::operator()(Constraint& constraint)
{
mSignalReceived = true;
}
void ConstraintAppliedCheck::CheckSignalReceived()
{
- if ( !mSignalReceived )
+ if(!mSignalReceived)
{
- fprintf(stderr, "Expected Applied signal was not received\n" );
- tet_result( TET_FAIL );
+ fprintf(stderr, "Expected Applied signal was not received\n");
+ tet_result(TET_FAIL);
throw("TET_FAIL");
}
else
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
}
void ConstraintAppliedCheck::CheckSignalNotReceived()
{
- if ( mSignalReceived )
+ if(mSignalReceived)
{
- fprintf(stderr, "Unexpected Applied signal was received\n" );
- tet_result( TET_FAIL );
+ fprintf(stderr, "Unexpected Applied signal was received\n");
+ tet_result(TET_FAIL);
throw("TET_FAIL");
}
else
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
}
namespace Test
{
-
struct ObjectDestructionFunctor
{
// Create a ObjectDestructionFunctor passing in a Dali::RefObject* to be monitored and a bool variable.
// Create ObjectRegistry instance and connect to the ObjectDestroyedSignal passing in the above functor for the callback.
// Get the ObjectPointer (Actor::GetObjectPtr) of the Actor to be checked for destruction and assign it to the Dali::RefObject*
// Check the bool variable which would be true when object destroyed.
- ObjectDestructionFunctor( Dali::RefObject* objectPtr, bool& refObjectDestroyed )
- : refObjectPointerToCheck( objectPtr ),
- refObjectDestroyedBoolean( refObjectDestroyed )
+ ObjectDestructionFunctor(Dali::RefObject* objectPtr, bool& refObjectDestroyed)
+ : refObjectPointerToCheck(objectPtr),
+ refObjectDestroyedBoolean(refObjectDestroyed)
{
refObjectDestroyed = false;
}
- void operator()( const Dali::RefObject* objectPointer )
+ void operator()(const Dali::RefObject* objectPointer)
{
- if ( refObjectPointerToCheck == objectPointer )
+ if(refObjectPointerToCheck == objectPointer)
{
refObjectDestroyedBoolean = true;
}
}
Dali::RefObject* refObjectPointerToCheck;
- bool& refObjectDestroyedBoolean;
+ bool& refObjectDestroyedBoolean;
};
-ObjectDestructionTracker::ObjectDestructionTracker( ObjectRegistry objectRegistry )
-: mObjectRegistry( objectRegistry ),
- mRefObjectDestroyed( false)
+ObjectDestructionTracker::ObjectDestructionTracker(ObjectRegistry objectRegistry)
+: mObjectRegistry(objectRegistry),
+ mRefObjectDestroyed(false)
{
}
-void ObjectDestructionTracker::Start( Actor actor )
+void ObjectDestructionTracker::Start(Actor actor)
{
- ObjectDestructionFunctor destructionFunctor( actor.GetObjectPtr(), mRefObjectDestroyed );
- mObjectRegistry.ObjectDestroyedSignal().Connect( this, destructionFunctor );
+ ObjectDestructionFunctor destructionFunctor(actor.GetObjectPtr(), mRefObjectDestroyed);
+ mObjectRegistry.ObjectDestroyedSignal().Connect(this, destructionFunctor);
}
bool ObjectDestructionTracker::IsDestroyed()
{
- return mRefObjectDestroyed;
+ return mRefObjectDestroyed;
}
} // namespace Test
// EXTERNAL INCLUDES
#include <cstdarg>
#include <cstdio>
-#include <iostream>
#include <cstring>
+#include <iostream>
#include <string>
// INTERNAL INCLUDES
extern "C"
{
-void tet_infoline(const char*str);
-void tet_printf(const char *format, ...);
+ void tet_infoline(const char* str);
+ void tet_printf(const char* format, ...);
}
-#include "test-application.h"
#include "test-actor-utils.h"
+#include "test-application.h"
#include "test-gesture-generator.h"
using namespace Dali;
* Inspired by https://stackoverflow.com/questions/1706346/file-macro-manipulation-handling-at-compile-time
* answer by Chetan Reddy
*/
-constexpr int32_t basenameIndex( const char * const path, const int32_t index = 0, const int32_t slashIndex = -1 )
+constexpr int32_t basenameIndex(const char* const path, const int32_t index = 0, const int32_t slashIndex = -1)
{
- return path[ index ]
- ? ( path[ index ] == '/'
- ? basenameIndex( path, index + 1, index )
- : basenameIndex( path, index + 1, slashIndex ) )
- : ( slashIndex + 1 );
+ return path[index]
+ ? (path[index] == '/'
+ ? basenameIndex(path, index + 1, index)
+ : basenameIndex(path, index + 1, slashIndex))
+ : (slashIndex + 1);
}
-#define __FILELINE__ ( { static const int32_t basenameIdx = basenameIndex( __FILE__ ); \
+#define __FILELINE__ ({ static const int32_t basenameIdx = basenameIndex( __FILE__ ); \
static_assert (basenameIdx >= 0, "compile-time basename" ); \
- __FILE__ ":" STRINGIZE(__LINE__) + basenameIdx ; } )
+ __FILE__ ":" STRINGIZE(__LINE__) + basenameIdx ; })
#define TEST_LOCATION __FILELINE__
-#define TEST_INNER_LOCATION(x) ( std::string(x) + " (" + STRINGIZE(__LINE__) + ")" ).c_str()
+#define TEST_INNER_LOCATION(x) (std::string(x) + " (" + STRINGIZE(__LINE__) + ")").c_str()
#define TET_UNDEF 2
#define TET_FAIL 1
void tet_result(int32_t value);
#define END_TEST \
- return ((test_return_value>0)?1:0)
+ return ((test_return_value > 0) ? 1 : 0)
void tet_infoline(const char* str);
-void tet_printf(const char *format, ...);
+void tet_printf(const char* format, ...);
/**
* DALI_TEST_CHECK is a wrapper for tet_result.
* If the condition evaluates to false, the test is stopped.
* @param[in] The boolean expression to check
*/
-#define DALI_TEST_CHECK(condition) \
-if ( (condition) ) \
-{ \
- tet_result(TET_PASS); \
-} \
-else \
-{ \
- fprintf(stderr, "Test failed in %s, condition: %s\n", __FILELINE__, #condition ); \
- tet_result(TET_FAIL); \
- throw("TET_FAIL"); \
-}
-
+#define DALI_TEST_CHECK(condition) \
+ if((condition)) \
+ { \
+ tet_result(TET_PASS); \
+ } \
+ else \
+ { \
+ fprintf(stderr, "Test failed in %s, condition: %s\n", __FILELINE__, #condition); \
+ tet_result(TET_FAIL); \
+ throw("TET_FAIL"); \
+ }
-bool operator==(TimePeriod a, TimePeriod b);
-std::ostream& operator<<( std::ostream& ostream, TimePeriod value );
-std::ostream& operator<<( std::ostream& ostream, Radian angle );
-std::ostream& operator<<( std::ostream& ostream, Degree angle );
+bool operator==(TimePeriod a, TimePeriod b);
+std::ostream& operator<<(std::ostream& ostream, TimePeriod value);
+std::ostream& operator<<(std::ostream& ostream, Radian angle);
+std::ostream& operator<<(std::ostream& ostream, Degree angle);
/**
* Test whether two values are equal.
template<typename Type>
inline void DALI_TEST_EQUALS(Type value1, Type value2, const char* location)
{
- if( !CompareType<Type>(value1, value2, 0.01f) )
+ if(!CompareType<Type>(value1, value2, 0.01f))
{
std::ostringstream o;
o << value1 << " == " << value2 << std::endl;
fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str());
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* @param[in] value1 The first value
* @param[in] value2 The second value
*/
-#define DALI_TEST_EQUAL( v1, v2 ) DALI_TEST_EQUALS( v1, v2, __FILELINE__ )
+#define DALI_TEST_EQUAL(v1, v2) DALI_TEST_EQUALS(v1, v2, __FILELINE__)
template<typename Type>
inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char* location)
{
- if( !CompareType<Type>(value1, value2, epsilon) )
+ if(!CompareType<Type>(value1, value2, epsilon))
{
std::ostringstream o;
o << value1 << " == " << value2 << std::endl;
fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str());
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
template<typename Type>
inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const char* location)
{
- if( CompareType<Type>(value1, value2, epsilon) )
+ if(CompareType<Type>(value1, value2, epsilon))
{
std::ostringstream o;
o << value1 << " != " << value2 << std::endl;
fprintf(stderr, "Test failed in %s, checking %s", location, o.str().c_str());
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
}
}
-
/**
* Test whether two TimePeriods are within a certain distance of each other.
* @param[in] value1 The first value
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<TimePeriod>( TimePeriod value1, TimePeriod value2, float epsilon, const char* location)
+inline void DALI_TEST_EQUALS<TimePeriod>(TimePeriod value1, TimePeriod value2, float epsilon, const char* location)
{
- if ((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon))
+ if((fabs(value1.durationSeconds - value2.durationSeconds) > epsilon))
{
fprintf(stderr, "Test failed in %s, checking durations %f == %f, epsilon %f\n", location, value1.durationSeconds, value2.durationSeconds, epsilon);
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
- else if ((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon))
+ else if((fabs(value1.delaySeconds - value2.delaySeconds) > epsilon))
{
fprintf(stderr, "Test failed in %s, checking delays %f == %f, epsilon %f\n", location, value1.delaySeconds, value2.delaySeconds, epsilon);
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* @param[in] baseHandle2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location );
+void DALI_TEST_EQUALS(const BaseHandle& baseHandle1, const BaseHandle& baseHandle2, const char* location);
/**
* Test whether a size_t value and an uint32_t are equal.
* @param[in] value2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const size_t value1, const uint32_t value2, const char* location );
+void DALI_TEST_EQUALS(const size_t value1, const uint32_t value2, const char* location);
/**
* Test whether an uint32_t and a size_t value and are equal.
* @param[in] value2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const uint32_t value1, const size_t value2, const char* location );
+void DALI_TEST_EQUALS(const uint32_t value1, const size_t value2, const char* location);
/**
* Test whether two Matrix3 objects are equal.
* @param[in] matrix2 The second object
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, const char* location);
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, const char* location);
/** Test whether two Matrix3 objects are equal (fuzzy compare).
* @param[in] matrix1 The first object
* @param[in] epsilon The epsilon to use for comparison
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location);
+void DALI_TEST_EQUALS(const Matrix3& matrix1, const Matrix3& matrix2, float epsilon, const char* location);
/**
* Test whether two Matrix objects are equal.
* @param[in] matrix2 The second object
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, const char* location);
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, const char* location);
/**
* Test whether two Matrix objects are equal (fuzzy-compare).
* @param[in] matrix2 The second object
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location);
+void DALI_TEST_EQUALS(const Matrix& matrix1, const Matrix& matrix2, float epsilon, const char* location);
/**
* Test whether two strings are equal.
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<const char*>( const char* str1, const char* str2, const char* location)
+inline void DALI_TEST_EQUALS<const char*>(const char* str1, const char* str2, const char* location)
{
- if (strcmp(str1, str2))
+ if(strcmp(str1, str2))
{
fprintf(stderr, "Test failed in %s, checking '%s' == '%s'\n", location, str1, str2);
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* @param[in] location The TEST_LOCATION macro should be used here
*/
template<>
-inline void DALI_TEST_EQUALS<const std::string&>( const std::string &str1, const std::string &str2, const char* location)
+inline void DALI_TEST_EQUALS<const std::string&>(const std::string& str1, const std::string& str2, const char* location)
{
DALI_TEST_EQUALS(str1.c_str(), str2.c_str(), location);
}
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( Property::Value& str1, const char* str2, const char* location);
+void DALI_TEST_EQUALS(Property::Value& str1, const char* str2, const char* location);
/**
* Test whether two strings are equal.
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const std::string &str1, const char* str2, const char* location);
+void DALI_TEST_EQUALS(const std::string& str1, const char* str2, const char* location);
/**
* Test whether two strings are equal.
* @param[in] str2 The second string
* @param[in] location The TEST_LOCATION macro should be used here
*/
-void DALI_TEST_EQUALS( const char* str1, const std::string &str2, const char* location);
+void DALI_TEST_EQUALS(const char* str1, const std::string& str2, const char* location);
/**
* Test if a property value type is equal to a trivial type.
*/
template<typename Type>
-inline void DALI_TEST_VALUE_EQUALS( Property::Value&& value1, Type value2, float epsilon, const char* location)
+inline void DALI_TEST_VALUE_EQUALS(Property::Value&& value1, Type value2, float epsilon, const char* location)
{
Property::Value value2b(value2);
DALI_TEST_EQUALS(value1, value2b, epsilon, location);
}
-
/**
* Test whether one unsigned integer value is greater than another.
* Test succeeds if value1 > value2
* @param[in] value2 The second value
* @param[in] location The TEST_LOCATION macro should be used here
*/
-template< typename T >
-void DALI_TEST_GREATER( T value1, T value2, const char* location)
+template<typename T>
+void DALI_TEST_GREATER(T value1, T value2, const char* location)
{
- if (!(value1 > value2))
+ if(!(value1 > value2))
{
- std::cerr << "Test failed in " << location << ", checking " << value1 <<" > " << value2 << "\n";
+ std::cerr << "Test failed in " << location << ", checking " << value1 << " > " << value2 << "\n";
tet_result(TET_FAIL);
- throw("TET_FAIL"); \
+ throw("TET_FAIL");
}
else
{
* assertion which triggered the exception.
* @param[in] location The TEST_LOCATION macro should be used here.
*/
-void DALI_TEST_ASSERT( DaliException& e, std::string conditionSubString, const char* location );
+void DALI_TEST_ASSERT(DaliException& e, std::string conditionSubString, const char* location);
/**
* Print the assert
* @param[in] e The exception that we expect was fired by a runtime assertion failure.
*/
-inline void DALI_TEST_PRINT_ASSERT( DaliException& e )
+inline void DALI_TEST_PRINT_ASSERT(DaliException& e)
{
- tet_printf("Assertion %s failed at %s\n", e.condition, e.location );
+ tet_printf("Assertion %s failed at %s\n", e.condition, e.location);
}
/**
* @param expressions code to execute
* @param assertstring the substring expected in the assert
*/
-#define DALI_TEST_ASSERTION( expressions, assertstring ) \
-try \
-{ \
- TestApplication::EnableLogging( false ); \
- expressions; \
- TestApplication::EnableLogging( true ); \
- fprintf(stderr, "Test failed in %s, expected assert: '%s' didn't occur\n", __FILELINE__, assertstring ); \
- tet_result(TET_FAIL); \
- throw("TET_FAIL"); } \
-catch( Dali::DaliException& e ) \
-{ \
- DALI_TEST_ASSERT( e, assertstring, TEST_LOCATION ); \
-}
+#define DALI_TEST_ASSERTION(expressions, assertstring) \
+ try \
+ { \
+ TestApplication::EnableLogging(false); \
+ expressions; \
+ TestApplication::EnableLogging(true); \
+ fprintf(stderr, "Test failed in %s, expected assert: '%s' didn't occur\n", __FILELINE__, assertstring); \
+ tet_result(TET_FAIL); \
+ throw("TET_FAIL"); \
+ } \
+ catch(Dali::DaliException & e) \
+ { \
+ DALI_TEST_ASSERT(e, assertstring, TEST_LOCATION); \
+ }
// Functor to test whether an Applied signal is emitted
struct ConstraintAppliedCheck
{
- ConstraintAppliedCheck( bool& signalReceived );
- void operator()( Constraint& constraint );
- void Reset();
- void CheckSignalReceived();
- void CheckSignalNotReceived();
+ ConstraintAppliedCheck(bool& signalReceived);
+ void operator()(Constraint& constraint);
+ void Reset();
+ void CheckSignalReceived();
+ void CheckSignalNotReceived();
bool& mSignalReceived; // owned by individual tests
};
/**
* A Helper to test default functions
*/
-template <typename T>
+template<typename T>
struct DefaultFunctionCoverage
{
DefaultFunctionCoverage()
{
- T a;
- T *b = new T(a);
+ T a;
+ T* b = new T(a);
DALI_TEST_CHECK(b);
a = *b;
delete b;
class ObjectDestructionTracker : public ConnectionTracker
{
public:
-
/**
* @brief Call in main part of code
* @param[in] objectRegistry The object Registry being used
*/
- ObjectDestructionTracker( ObjectRegistry objectRegistry );
+ ObjectDestructionTracker(ObjectRegistry objectRegistry);
/**
* @brief Call in sub bock of code where the Actor being checked is still alive.
*
* @param[in] actor Actor to be checked for destruction
*/
- void Start( Actor actor );
+ void Start(Actor actor);
/**
* @brief Call to check if Actor alive or destroyed.
private:
ObjectRegistry mObjectRegistry;
- bool mRefObjectDestroyed;
+ bool mRefObjectDestroyed;
};
} // namespace Test
namespace Dali
{
-
Shader CreateShader()
{
- return Shader::New( "vertexSrc", "fragmentSrc" );
+ return Shader::New("vertexSrc", "fragmentSrc");
}
TextureSet CreateTextureSet()
return TextureSet::New();
}
-TextureSet CreateTextureSet( Texture texture )
+TextureSet CreateTextureSet(Texture texture)
{
TextureSet textureSet = TextureSet::New();
textureSet.SetTexture(0u, texture);
VertexBuffer CreateVertexBuffer()
{
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+ texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- VertexBuffer vertexData = VertexBuffer::New( texturedQuadVertexFormat );
+ VertexBuffer vertexData = VertexBuffer::New(texturedQuadVertexFormat);
return vertexData;
}
Geometry CreateQuadGeometry(void)
{
- VertexBuffer vertexData = CreateVertexBuffer();
- const float halfQuadSize = .5f;
- struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+ VertexBuffer vertexData = CreateVertexBuffer();
+ const float halfQuadSize = .5f;
+ struct TexturedQuadVertex
+ {
+ Vector2 position;
+ Vector2 textureCoordinates;
+ };
TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+ {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+ {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+ {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
vertexData.SetData(texturedQuadVertexData, 4);
- unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
+ unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexData );
- geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+ geometry.AddVertexBuffer(vertexData);
+ geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
return geometry;
}
-
-
} // namespace Dali
namespace Dali
{
-
-Shader CreateShader();
-TextureSet CreateTextureSet();
-TextureSet CreateTextureSet( Texture texture );
-Geometry CreateQuadGeometry();
+Shader CreateShader();
+TextureSet CreateTextureSet();
+TextureSet CreateTextureSet(Texture texture);
+Geometry CreateQuadGeometry();
VertexBuffer CreateVertexBuffer();
-}
+} // namespace Dali
#endif // MESH_BUILDER_H
namespace Dali
{
-
namespace
{
-
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- \n
- void main()\n
- {\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- gl_Position = uMvpMatrix * vertexPosition;\n
- }\n
-);
+ attribute mediump vec2 aPosition;\n
+ uniform mediump mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ \n void main()\n {
+ \n
+ mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
+ \n
+ vertexPosition.xyz *= uSize;
+ \n
+ gl_Position = uMvpMatrix * vertexPosition;
+ \n
+ }\n);
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
uniform lowp vec4 uColor;\n
- \n
- void main()\n
- {\n
- gl_FragColor = uColor;\n
- }\n
-);
+ \n void main()\n {
+ \n
+ gl_FragColor = uColor;
+ \n
+ }\n);
} // unnamed namespace
Actor CreateRenderableActor()
{
- return CreateRenderableActor( Texture(), VERTEX_SHADER, FRAGMENT_SHADER );
+ return CreateRenderableActor(Texture(), VERTEX_SHADER, FRAGMENT_SHADER);
}
-Actor CreateRenderableActor( Texture texture )
+Actor CreateRenderableActor(Texture texture)
{
- return CreateRenderableActor( texture, VERTEX_SHADER, FRAGMENT_SHADER );
+ return CreateRenderableActor(texture, VERTEX_SHADER, FRAGMENT_SHADER);
}
-Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader )
+Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader)
{
// Create the geometry
Geometry geometry = CreateQuadGeometry();
// Create Shader
- Shader shader = Shader::New( vertexShader, fragmentShader );
+ Shader shader = Shader::New(vertexShader, fragmentShader);
// Create renderer from geometry and material
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
// Create actor and set renderer
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
// If we a texture, then create a texture-set and add to renderer
- if( texture )
+ if(texture)
{
TextureSet textureSet = TextureSet::New();
- textureSet.SetTexture( 0u, texture );
- renderer.SetTextures( textureSet );
+ textureSet.SetTexture(0u, texture);
+ renderer.SetTextures(textureSet);
// Set actor to the size of the texture if set
- actor.SetProperty( Actor::Property::SIZE, Vector2( texture.GetWidth(), texture.GetHeight() ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(texture.GetWidth(), texture.GetHeight()));
}
return actor;
namespace Dali
{
-
class Actor;
class Image;
class Texture;
* @param[in] texture Texture to set.
* @return An actor with a renderer.
*/
-Actor CreateRenderableActor( Texture texture );
+Actor CreateRenderableActor(Texture texture);
/**
* @brief Creates a renderable-actor with a texture and custom shaders.
* @param[in] fragmentShader The fragment-shader.
* @return An actor with a renderer.
*/
-Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader );
+Actor CreateRenderableActor(Texture texture, const std::string& vertexShader, const std::string& fragmentShader);
} // namespace Dali
*/
#include "test-addon-manager.h"
+
#include <dali-test-suite-utils.h>
-#include <cstring>
#include <dlfcn.h>
+#include <cstring>
+
#ifndef ADDON_LIBS_PATH
#define ADDON_LIBS_PATH ""
#endif
{
namespace Test
{
-
std::vector<std::string> AddOnManager::EnumerateAddOns()
{
std::string listFileName(ADDON_LIBS_PATH);
// Read list of available test addons
tet_printf("Enumerating addons, file: %s\n", listFileName.c_str());
std::vector<std::string> addons{};
- auto* fin = fopen( listFileName.c_str(), "r" );
- char* lineBuf = new char[256];
- size_t n = 256;
- while( getline( &lineBuf, &n, fin ) > 0 )
+ auto* fin = fopen(listFileName.c_str(), "r");
+ char* lineBuf = new char[256];
+ size_t n = 256;
+ while(getline(&lineBuf, &n, fin) > 0)
{
tet_printf("Adding %s\n", lineBuf);
- addons.emplace_back( lineBuf );
+ addons.emplace_back(lineBuf);
}
fclose(fin);
- delete [] lineBuf;
+ delete[] lineBuf;
std::vector<std::string> retval{};
// Open addons
- for( auto& name : addons )
+ for(auto& name : addons)
{
std::string path(ADDON_LIBS_PATH);
path += "/";
path += name;
mAddOnCache.emplace_back();
- mAddOnCache.back().handle = dlopen( path.c_str(), RTLD_DEEPBIND|RTLD_LAZY );
- if( !mAddOnCache.back().handle )
+ mAddOnCache.back().handle = dlopen(path.c_str(), RTLD_DEEPBIND | RTLD_LAZY);
+ if(!mAddOnCache.back().handle)
{
mAddOnCache.back().valid = false;
- tet_printf( "Can't open addon lib: %s\n", path.c_str());
+ tet_printf("Can't open addon lib: %s\n", path.c_str());
continue;
}
// Here addon must self register
- if( !mAddOnCache.back().valid )
+ if(!mAddOnCache.back().valid)
{
puts("Addon invalid!");
}
else
{
- tet_printf( "Valid AddOn: %s\n", mAddOnCache.back().name.c_str() );
- retval.emplace_back( mAddOnCache.back().name );
+ tet_printf("Valid AddOn: %s\n", mAddOnCache.back().name.c_str());
+ retval.emplace_back(mAddOnCache.back().name);
}
}
*/
}
-void AddOnManager::RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable )
+void AddOnManager::RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable)
{
// Register the dispatch table
auto& entry = mAddOnCache.back();
- entry.name = dispatchTable->name;
- tet_printf( "Registering AddOn: %s\n", entry.name.c_str());
- entry.GetGlobalProc = dispatchTable->GetGlobalProc;
+ entry.name = dispatchTable->name;
+ tet_printf("Registering AddOn: %s\n", entry.name.c_str());
+ entry.GetGlobalProc = dispatchTable->GetGlobalProc;
entry.GetInstanceProc = dispatchTable->GetInstanceProc;
- entry.GetAddOnInfo = dispatchTable->GetAddOnInfo;
- entry.OnStart = dispatchTable->OnStart;
- entry.OnStop = dispatchTable->OnStop;
- entry.OnPause = dispatchTable->OnPause;
- entry.OnResume = dispatchTable->OnResume;
- entry.valid = true;
+ entry.GetAddOnInfo = dispatchTable->GetAddOnInfo;
+ entry.OnStart = dispatchTable->OnStart;
+ entry.OnStop = dispatchTable->OnStop;
+ entry.OnPause = dispatchTable->OnPause;
+ entry.OnResume = dispatchTable->OnResume;
+ entry.valid = true;
}
-bool AddOnManager::GetAddOnInfo(const std::string& name, AddOnInfo& info )
+bool AddOnManager::GetAddOnInfo(const std::string& name, AddOnInfo& info)
{
auto retval = false;
- std::find_if( mAddOnCache.begin(), mAddOnCache.end(),
- [&retval, name, &info]( AddOnCacheEntry& entry )
- {
+ std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&retval, name, &info](AddOnCacheEntry& entry) {
if(entry.name == name)
{
- entry.GetAddOnInfo( info );
+ entry.GetAddOnInfo(info);
retval = true;
return true;
}
return retval;
}
-std::vector<AddOnLibrary> AddOnManager::LoadAddOns( const std::vector<std::string>& addonNames )
+std::vector<AddOnLibrary> AddOnManager::LoadAddOns(const std::vector<std::string>& addonNames)
{
if(mAddOnCache.empty())
{
}
std::vector<AddOnLibrary> retval{};
- for( auto& name : addonNames)
+ for(auto& name : addonNames)
{
size_t index = 0;
- auto iter = std::find_if( mAddOnCache.begin(), mAddOnCache.end(),
- [&retval, name, &index]( AddOnCacheEntry& entry )
+ auto iter = std::find_if(mAddOnCache.begin(), mAddOnCache.end(), [&retval, name, &index](AddOnCacheEntry& entry) {
+ index++;
+ if(entry.name == name)
{
- index++;
- if(entry.name == name)
- {
- return true;
- }
- return false;
- });
- if( iter != mAddOnCache.end() )
+ return true;
+ }
+ return false;
+ });
+ if(iter != mAddOnCache.end())
{
- retval.emplace_back( *reinterpret_cast<void**>( &index ) );
+ retval.emplace_back(*reinterpret_cast<void**>(&index));
}
else
{
- retval.emplace_back( nullptr );
+ retval.emplace_back(nullptr);
}
}
return retval;
}
-void* AddOnManager::GetGlobalProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName )
+void* AddOnManager::GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName)
{
- auto index = *reinterpret_cast<const size_t*>( &addOnLibrary );
- return mAddOnCache[index-1].GetGlobalProc( procName );
+ auto index = *reinterpret_cast<const size_t*>(&addOnLibrary);
+ return mAddOnCache[index - 1].GetGlobalProc(procName);
}
-void* AddOnManager::GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName )
+void* AddOnManager::GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName)
{
- auto index = *reinterpret_cast<const size_t*>( &addOnLibrary );
- return mAddOnCache[index-1].GetInstanceProc( procName );
+ auto index = *reinterpret_cast<const size_t*>(&addOnLibrary);
+ return mAddOnCache[index - 1].GetInstanceProc(procName);
}
void AddOnManager::Start()
{
- for( auto& entry : mAddOnCache )
+ for(auto& entry : mAddOnCache)
{
if(entry.OnStart)
{
void AddOnManager::Resume()
{
- for( auto& entry : mAddOnCache )
+ for(auto& entry : mAddOnCache)
{
if(entry.OnResume)
{
void AddOnManager::Stop()
{
- for( auto& entry : mAddOnCache )
+ for(auto& entry : mAddOnCache)
{
if(entry.OnStop)
{
void AddOnManager::Pause()
{
- for( auto& entry : mAddOnCache )
+ for(auto& entry : mAddOnCache)
{
if(entry.OnPause)
{
}
}
-}
-}
-
+} // namespace Test
+} // namespace Dali
#include <dali/integration-api/addon-manager.h>
#include <dali/public-api/common/vector-wrapper.h>
+
#include <string>
namespace Dali
class AddOnManager : public Dali::Integration::AddOnManager
{
public:
-
/**
* @brief Constructor, initialised by the Adaptor
*/
std::vector<std::string> EnumerateAddOns() override;
- bool GetAddOnInfo(const std::string& name, AddOnInfo& info ) override;
+ bool GetAddOnInfo(const std::string& name, AddOnInfo& info) override;
- std::vector<AddOnLibrary> LoadAddOns( const std::vector<std::string>& addonNames ) override;
+ std::vector<AddOnLibrary> LoadAddOns(const std::vector<std::string>& addonNames) override;
- void* GetGlobalProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) override;
+ void* GetGlobalProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) override;
- void* GetInstanceProc( const Dali::AddOnLibrary& addOnLibrary, const char* procName ) override;
+ void* GetInstanceProc(const Dali::AddOnLibrary& addOnLibrary, const char* procName) override;
- void RegisterAddOnDispatchTable( const AddOnDispatchTable* dispatchTable ) override;
+ void RegisterAddOnDispatchTable(const AddOnDispatchTable* dispatchTable) override;
void Start() override;
struct AddOnCacheEntry
{
std::string name{};
- AddOnInfo info{};
+ AddOnInfo info{};
// library handle
- void* handle {nullptr};
+ void* handle{nullptr};
// main function pointers
- void(*GetAddOnInfo)(AddOnInfo& ) = nullptr; ///< Returns AddOnInfo structure
- void*(*GetInstanceProc)( const char* ) = nullptr; ///< Returns pointer of instance function (member funtion)
- void*(*GetGlobalProc)( const char* ) = nullptr; ///< Returns pointer of global function (non-member function)
-
- void(*OnStart)() = nullptr;
- void(*OnResume)() = nullptr;
- void(*OnPause)() = nullptr;
- void(*OnStop)() = nullptr;
+ void (*GetAddOnInfo)(AddOnInfo&) = nullptr; ///< Returns AddOnInfo structure
+ void* (*GetInstanceProc)(const char*) = nullptr; ///< Returns pointer of instance function (member funtion)
+ void* (*GetGlobalProc)(const char*) = nullptr; ///< Returns pointer of global function (non-member function)
+
+ void (*OnStart)() = nullptr;
+ void (*OnResume)() = nullptr;
+ void (*OnPause)() = nullptr;
+ void (*OnStop)() = nullptr;
bool valid = false;
};
namespace Dali
{
-
bool TestApplication::mLoggingEnabled = true;
-TestApplication::TestApplication( uint32_t surfaceWidth,
- uint32_t surfaceHeight,
- uint32_t horizontalDpi,
- uint32_t verticalDpi,
- bool initialize,
- bool enablePartialUpdate )
-: mCore( NULL ),
- mSurfaceWidth( surfaceWidth ),
- mSurfaceHeight( surfaceHeight ),
- mFrame( 0u ),
- mDpi{ horizontalDpi, verticalDpi },
+TestApplication::TestApplication(uint32_t surfaceWidth,
+ uint32_t surfaceHeight,
+ uint32_t horizontalDpi,
+ uint32_t verticalDpi,
+ bool initialize,
+ bool enablePartialUpdate)
+: mCore(NULL),
+ mSurfaceWidth(surfaceWidth),
+ mSurfaceHeight(surfaceHeight),
+ mFrame(0u),
+ mDpi{horizontalDpi, verticalDpi},
mLastVSyncTime(0u),
mPartialUpdateEnabled(enablePartialUpdate)
{
- if( initialize )
+ if(initialize)
{
Initialize();
}
// We always need the first update!
mStatus.keepUpdating = Integration::KeepUpdating::STAGE_KEEP_RENDERING;
- mCore = Dali::Integration::Core::New( mRenderController,
- mPlatformAbstraction,
- mGlAbstraction,
- mGlSyncAbstraction,
- mGlContextHelperAbstraction,
- Integration::RenderToFrameBuffer::FALSE,
- Integration::DepthBufferAvailable::TRUE,
- Integration::StencilBufferAvailable::TRUE,
- mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE );
+ mCore = Dali::Integration::Core::New(mRenderController,
+ mPlatformAbstraction,
+ mGlAbstraction,
+ mGlSyncAbstraction,
+ mGlContextHelperAbstraction,
+ Integration::RenderToFrameBuffer::FALSE,
+ Integration::DepthBufferAvailable::TRUE,
+ Integration::StencilBufferAvailable::TRUE,
+ mPartialUpdateEnabled ? Integration::PartialUpdateAvailable::TRUE : Integration::PartialUpdateAvailable::FALSE);
mCore->ContextCreated();
Dali::Integration::Log::InstallLogFunction(logFunction);
Dali::Integration::Trace::LogContextFunction logContextFunction(&TestApplication::LogContext);
- Dali::Integration::Trace::InstallLogContextFunction( logContextFunction );
+ Dali::Integration::Trace::InstallLogContextFunction(logContextFunction);
- Dali::Integration::Trace::LogContext( true, "Test" );
+ Dali::Integration::Trace::LogContext(true, "Test");
}
void TestApplication::CreateScene()
{
- mScene = Dali::Integration::Scene::New( Size( static_cast<float>( mSurfaceWidth ), static_cast<float>( mSurfaceHeight ) ) );
- mScene.SetDpi( Vector2( static_cast<float>( mDpi.x ), static_cast<float>( mDpi.y ) ) );
+ mScene = Dali::Integration::Scene::New(Size(static_cast<float>(mSurfaceWidth), static_cast<float>(mSurfaceHeight)));
+ mScene.SetDpi(Vector2(static_cast<float>(mDpi.x), static_cast<float>(mDpi.y)));
}
void TestApplication::InitializeCore()
delete mCore;
}
-void TestApplication::LogContext( bool start, const char* tag )
+void TestApplication::LogContext(bool start, const char* tag)
{
- if( start )
+ if(start)
{
fprintf(stderr, "INFO: Trace Start: %s\n", tag);
}
void TestApplication::LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
{
- if( mLoggingEnabled )
+ if(mLoggingEnabled)
{
switch(level)
{
mCore->ProcessEvents();
}
-void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* location )
+void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location)
{
- if( GetUpdateStatus() == 0 &&
- mRenderStatus.NeedsUpdate() == false &&
- ! GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc) )
+ if(GetUpdateStatus() == 0 &&
+ mRenderStatus.NeedsUpdate() == false &&
+ !GetRenderController().WasCalled(TestRenderController::RequestUpdateFunc))
{
- fprintf(stderr, "WARNING - Update not required :%s\n", location==NULL?"NULL":location);
+ fprintf(stderr, "WARNING - Update not required :%s\n", location == NULL ? "NULL" : location);
}
- uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
- float elapsedSeconds = static_cast<float>( intervalMilliseconds ) * 0.001f;
+ uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
+ float elapsedSeconds = static_cast<float>(intervalMilliseconds) * 0.001f;
- mCore->Update( elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false );
+ mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false);
GetRenderController().Initialize();
mLastVSyncTime = nextVSyncTime;
}
-bool TestApplication::Render( uint32_t intervalMilliseconds, const char* location )
+bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location)
{
- DoUpdate( intervalMilliseconds, location );
+ DoUpdate(intervalMilliseconds, location);
// Reset the status
- mRenderStatus.SetNeedsUpdate( false );
- mRenderStatus.SetNeedsPostRender( false );
+ mRenderStatus.SetNeedsUpdate(false);
+ mRenderStatus.SetNeedsPostRender(false);
- mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
- mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ );
- mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ );
- mCore->PostRender( false /*do not skip rendering*/ );
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+ mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+ mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+ mCore->PostRender(false /*do not skip rendering*/);
mFrame++;
{
DoUpdate(intervalMilliseconds, location);
- mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
mCore->PreRender(mScene, damagedRects);
return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
return mStatus.KeepUpdating();
}
-bool TestApplication::UpdateOnly( uint32_t intervalMilliseconds )
+bool TestApplication::UpdateOnly(uint32_t intervalMilliseconds)
{
- DoUpdate( intervalMilliseconds );
+ DoUpdate(intervalMilliseconds);
return mStatus.KeepUpdating();
}
return mRenderStatus.NeedsPostRender();
}
-bool TestApplication::RenderOnly( )
+bool TestApplication::RenderOnly()
{
// Update Time values
- mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
- mCore->RenderScene( mRenderStatus, mScene, true /*render the off-screen buffers*/ );
- mCore->RenderScene( mRenderStatus, mScene, false /*render the surface*/ );
- mCore->PostRender( false /*do not skip rendering*/ );
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+ mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+ mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+ mCore->PostRender(false /*do not skip rendering*/);
mFrame++;
mCore->ContextCreated();
}
-uint32_t TestApplication::Wait( uint32_t durationToWait )
+uint32_t TestApplication::Wait(uint32_t durationToWait)
{
int time = 0;
- for(uint32_t i = 0; i <= ( durationToWait / RENDER_FRAME_INTERVAL); i++)
+ for(uint32_t i = 0; i <= (durationToWait / RENDER_FRAME_INTERVAL); i++)
{
SendNotification();
Render(RENDER_FRAME_INTERVAL);
return time;
}
-} // Namespace dali
+} // namespace Dali
*/
// INTERNAL INCLUDES
+#include <dali/integration-api/resource-policies.h>
+#include <dali/integration-api/scene.h>
+#include <dali/integration-api/trace.h>
+#include <dali/public-api/common/dali-common.h>
#include <test-platform-abstraction.h>
-#include "test-gl-sync-abstraction.h"
+
#include "test-gl-abstraction.h"
#include "test-gl-context-helper-abstraction.h"
+#include "test-gl-sync-abstraction.h"
#include "test-render-controller.h"
-#include <dali/public-api/common/dali-common.h>
-#include <dali/integration-api/resource-policies.h>
-#include <dali/integration-api/trace.h>
-#include <dali/integration-api/scene.h>
namespace Dali
{
-
class DALI_CORE_API TestApplication : public ConnectionTracker
{
public:
-
// Default values derived from H2 device.
- static const uint32_t DEFAULT_SURFACE_WIDTH = 480;
+ static const uint32_t DEFAULT_SURFACE_WIDTH = 480;
static const uint32_t DEFAULT_SURFACE_HEIGHT = 800;
static constexpr uint32_t DEFAULT_HORIZONTAL_DPI = 220;
static const uint32_t RENDER_FRAME_INTERVAL = 16;
- TestApplication( uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
- uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
- uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI,
- uint32_t verticalDpi = DEFAULT_VERTICAL_DPI,
- bool initialize = true,
- bool enablePartialUpdate = false );
+ TestApplication(uint32_t surfaceWidth = DEFAULT_SURFACE_WIDTH,
+ uint32_t surfaceHeight = DEFAULT_SURFACE_HEIGHT,
+ uint32_t horizontalDpi = DEFAULT_HORIZONTAL_DPI,
+ uint32_t verticalDpi = DEFAULT_VERTICAL_DPI,
+ bool initialize = true,
+ bool enablePartialUpdate = false);
void Initialize();
void CreateCore();
void CreateScene();
void InitializeCore();
~TestApplication() override;
- static void LogMessage( Dali::Integration::Log::DebugPriority level, std::string& message );
- static void LogContext( bool start, const char* tag );
- Dali::Integration::Core& GetCore();
- TestPlatformAbstraction& GetPlatform();
- TestRenderController& GetRenderController();
- TestGlAbstraction& GetGlAbstraction();
- TestGlSyncAbstraction& GetGlSyncAbstraction();
+ static void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message);
+ static void LogContext(bool start, const char* tag);
+ Dali::Integration::Core& GetCore();
+ TestPlatformAbstraction& GetPlatform();
+ TestRenderController& GetRenderController();
+ TestGlAbstraction& GetGlAbstraction();
+ TestGlSyncAbstraction& GetGlSyncAbstraction();
TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
- void ProcessEvent(const Integration::Event& event);
- void SendNotification();
- bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
- bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
- bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
- uint32_t GetUpdateStatus();
- bool UpdateOnly( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL );
- bool RenderOnly( );
- void ResetContext();
- bool GetRenderNeedsUpdate();
- bool GetRenderNeedsPostRender();
- uint32_t Wait( uint32_t durationToWait );
- static void EnableLogging( bool enabled )
+ void ProcessEvent(const Integration::Event& event);
+ void SendNotification();
+ bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+ bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
+ bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
+ uint32_t GetUpdateStatus();
+ bool UpdateOnly(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL);
+ bool RenderOnly();
+ void ResetContext();
+ bool GetRenderNeedsUpdate();
+ bool GetRenderNeedsPostRender();
+ uint32_t Wait(uint32_t durationToWait);
+ static void EnableLogging(bool enabled)
{
mLoggingEnabled = enabled;
}
}
private:
- void DoUpdate( uint32_t intervalMilliseconds, const char* location=NULL );
+ void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
protected:
- TestPlatformAbstraction mPlatformAbstraction;
- TestRenderController mRenderController;
- TestGlAbstraction mGlAbstraction;
- TestGlSyncAbstraction mGlSyncAbstraction;
+ TestPlatformAbstraction mPlatformAbstraction;
+ TestRenderController mRenderController;
+ TestGlAbstraction mGlAbstraction;
+ TestGlSyncAbstraction mGlSyncAbstraction;
TestGlContextHelperAbstraction mGlContextHelperAbstraction;
Integration::UpdateStatus mStatus;
Integration::RenderStatus mRenderStatus;
- Integration::Core* mCore;
+ Integration::Core* mCore;
Dali::Integration::Scene mScene;
uint32_t mSurfaceWidth;
uint32_t mSurfaceHeight;
uint32_t mFrame;
- struct { uint32_t x; uint32_t y; } mDpi;
- uint32_t mLastVSyncTime;
- bool mPartialUpdateEnabled;
+ struct
+ {
+ uint32_t x;
+ uint32_t y;
+ } mDpi;
+ uint32_t mLastVSyncTime;
+ bool mPartialUpdateEnabled;
static bool mLoggingEnabled;
};
-} // Dali
+} // namespace Dali
#endif // DALI_TEST_APPLICATION_H
#define DALI_TEST_COMPARE_TYPES_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dali/public-api/dali-core.h>
using namespace Dali;
-
-template <typename Type>
+template<typename Type>
inline bool CompareType(Type value1, Type value2, float epsilon)
{
return value1 == value2;
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<float>(float value1, float value2, float epsilon)
{
return fabsf(value1 - value2) < epsilon;
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<Vector2>(Vector2 vector1, Vector2 vector2, float epsilon)
{
- return fabsf(vector1.x - vector2.x)<epsilon && fabsf(vector1.y - vector2.y)<epsilon;
+ return fabsf(vector1.x - vector2.x) < epsilon && fabsf(vector1.y - vector2.y) < epsilon;
}
/**
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<Vector3>(Vector3 vector1, Vector3 vector2, float epsilon)
{
- return fabsf(vector1.x - vector2.x)<epsilon &&
- fabsf(vector1.y - vector2.y)<epsilon &&
- fabsf(vector1.z - vector2.z)<epsilon;
+ return fabsf(vector1.x - vector2.x) < epsilon &&
+ fabsf(vector1.y - vector2.y) < epsilon &&
+ fabsf(vector1.z - vector2.z) < epsilon;
}
-
/**
* A helper for fuzzy-comparing Vector4 objects
* @param[in] vector1 the first object
* @param[in] epsilon difference threshold
* @returns true if difference is smaller than epsilon threshold, false otherwise
*/
-template <>
+template<>
inline bool CompareType<Vector4>(Vector4 vector1, Vector4 vector2, float epsilon)
{
- return fabsf(vector1.x - vector2.x)<epsilon &&
- fabsf(vector1.y - vector2.y)<epsilon &&
- fabsf(vector1.z - vector2.z)<epsilon &&
- fabsf(vector1.w - vector2.w)<epsilon;
+ return fabsf(vector1.x - vector2.x) < epsilon &&
+ fabsf(vector1.y - vector2.y) < epsilon &&
+ fabsf(vector1.z - vector2.z) < epsilon &&
+ fabsf(vector1.w - vector2.w) < epsilon;
}
-template <>
+template<>
inline bool CompareType<Quaternion>(Quaternion q1, Quaternion q2, float epsilon)
{
Quaternion q2N = -q2; // These quaternions represent the same rotation
return CompareType<Vector4>(q1.mVector, q2.mVector, epsilon) || CompareType<Vector4>(q1.mVector, q2N.mVector, epsilon);
}
-template <>
+template<>
inline bool CompareType<Radian>(Radian q1, Radian q2, float epsilon)
{
return CompareType<float>(q1.radian, q2.radian, epsilon);
}
-template <>
+template<>
inline bool CompareType<Degree>(Degree q1, Degree q2, float epsilon)
{
return CompareType<float>(q1.degree, q2.degree, epsilon);
}
-template <>
+template<>
inline bool CompareType<Extents>(Extents extents1, Extents extents2, float epsilon)
{
return (extents1.start == extents2.start) &&
(extents1.bottom == extents2.bottom);
}
-template <>
+template<>
inline bool CompareType<Property::Value>(Property::Value q1, Property::Value q2, float epsilon)
{
Property::Type type = q1.GetType();
- if( type != q2.GetType() )
+ if(type != q2.GetType())
{
return false;
}
bool a, b;
q1.Get(a);
q2.Get(b);
- result = a == b;
+ result = a == b;
break;
}
case Property::INTEGER:
int a, b;
q1.Get(a);
q2.Get(b);
- result = a == b;
+ result = a == b;
break;
}
case Property::FLOAT:
float a, b;
q1.Get(a);
q2.Get(b);
- result = CompareType<float>(a, b, epsilon);
+ result = CompareType<float>(a, b, epsilon);
break;
}
case Property::VECTOR2:
case Property::MAP:
{
//TODO: Implement this?
- DALI_ASSERT_ALWAYS( 0 && "Not implemented");
+ DALI_ASSERT_ALWAYS(0 && "Not implemented");
result = false;
break;
}
Extents a, b;
q1.Get(a);
q2.Get(b);
- result = CompareType<Extents>( a, b, epsilon );
+ result = CompareType<Extents>(a, b, epsilon);
break;
}
case Property::NONE:
return result;
}
-
-
#endif
using namespace Dali;
-std::vector< std::string > MasterCallStack;
-bool gOnRelayout = false;
+std::vector<std::string> MasterCallStack;
+bool gOnRelayout = false;
namespace Test
{
struct TestCustomActor;
}
-
TestCustomActor TestCustomActor::New()
{
Impl::TestCustomActor* impl = new Impl::TestCustomActor;
- TestCustomActor custom( *impl ); // takes ownership
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
TestCustomActor TestCustomActor::NewNegoSize()
{
- Impl::TestCustomActor* impl = new Impl::TestCustomActor( true );
- TestCustomActor custom( *impl ); // takes ownership
- custom.SetProperty( Dali::Actor::Property::NAME, "SizeNegotiationActor" );
+ Impl::TestCustomActor* impl = new Impl::TestCustomActor(true);
+ TestCustomActor custom(*impl); // takes ownership
+ custom.SetProperty(Dali::Actor::Property::NAME, "SizeNegotiationActor");
impl->Initialize();
return custom;
}
-TestCustomActor TestCustomActor::NewVariant1( Actor childToAdd )
+TestCustomActor TestCustomActor::NewVariant1(Actor childToAdd)
{
- Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1( childToAdd );
- TestCustomActor custom( *impl ); // takes ownership
+ Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant1(childToAdd);
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
TestCustomActor TestCustomActor::NewVariant2()
{
Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant2();
- TestCustomActor custom( *impl ); // takes ownership
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
return custom;
}
-TestCustomActor TestCustomActor::NewVariant3( Actor childToAdd )
+TestCustomActor TestCustomActor::NewVariant3(Actor childToAdd)
{
- Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3( childToAdd );
- TestCustomActor custom( *impl ); // takes ownership
+ Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant3(childToAdd);
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
TestCustomActor TestCustomActor::NewVariant4()
{
Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant4();
- TestCustomActor custom( *impl ); // takes ownership
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
TestCustomActor TestCustomActor::NewVariant5(Integration::Scene scene)
{
Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant5(scene);
- TestCustomActor custom( *impl ); // takes ownership
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
TestCustomActor TestCustomActor::NewVariant6(Integration::Scene scene)
{
Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant6(scene);
- TestCustomActor custom( *impl ); // takes ownership
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
return custom;
}
-TestCustomActor TestCustomActor::NewVariant7( const char* name )
+TestCustomActor TestCustomActor::NewVariant7(const char* name)
{
Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant7();
- TestCustomActor custom( *impl ); // takes ownership
+ TestCustomActor custom(*impl); // takes ownership
- impl->Initialize( name );
+ impl->Initialize(name);
return custom;
}
-TestCustomActor TestCustomActor::NewVariant8( Actor rival )
+TestCustomActor TestCustomActor::NewVariant8(Actor rival)
{
- Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8( rival );
- TestCustomActor custom( *impl ); // takes ownership
+ Impl::TestCustomActor* impl = new Impl::TestCustomActorVariant8(rival);
+ TestCustomActor custom(*impl); // takes ownership
impl->Initialize();
return static_cast<Impl::TestCustomActor&>(GetImplementation());
}
-std::vector< std::string >& TestCustomActor::GetMethodsCalled()
+std::vector<std::string>& TestCustomActor::GetMethodsCalled()
{
return GetImpl().mMethodsCalled;
}
Vector3 TestCustomActor::GetNaturalSize()
{
- return Vector3( 0.0f, 0.0f, 0.0f );
+ return Vector3(0.0f, 0.0f, 0.0f);
}
-float TestCustomActor::GetHeightForWidth( float width )
+float TestCustomActor::GetHeightForWidth(float width)
{
return 0.0f;
}
-float TestCustomActor::GetWidthForHeight( float height )
+float TestCustomActor::GetWidthForHeight(float height)
{
return 0.0f;
}
-void TestCustomActor::OnRelayout( const Vector2& size, RelayoutContainer& container )
+void TestCustomActor::OnRelayout(const Vector2& size, RelayoutContainer& container)
{
}
-void TestCustomActor::OnLayoutNegotiated( float size, Dimension::Type dimension )
+void TestCustomActor::OnLayoutNegotiated(float size, Dimension::Type dimension)
{
}
-void TestCustomActor::OnCalculateRelayoutSize( Dimension::Type dimension )
+void TestCustomActor::OnCalculateRelayoutSize(Dimension::Type dimension)
{
}
GetImpl().TestRelayoutRequest();
}
-float TestCustomActor::TestGetHeightForWidthBase( float width )
+float TestCustomActor::TestGetHeightForWidthBase(float width)
{
- return GetImpl().TestGetHeightForWidthBase( width );
+ return GetImpl().TestGetHeightForWidthBase(width);
}
-float TestCustomActor::TestGetWidthForHeightBase( float height )
+float TestCustomActor::TestGetWidthForHeightBase(float height)
{
- return GetImpl().TestGetWidthForHeightBase( height );
+ return GetImpl().TestGetWidthForHeightBase(height);
}
-float TestCustomActor::TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
+float TestCustomActor::TestCalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension)
{
- return GetImpl().TestCalculateChildSizeBase( child, dimension );
+ return GetImpl().TestCalculateChildSizeBase(child, dimension);
}
-bool TestCustomActor::TestRelayoutDependentOnChildrenBase( Dimension::Type dimension )
+bool TestCustomActor::TestRelayoutDependentOnChildrenBase(Dimension::Type dimension)
{
- return GetImpl().TestRelayoutDependentOnChildrenBase( dimension );
+ return GetImpl().TestRelayoutDependentOnChildrenBase(dimension);
}
uint32_t TestCustomActor::GetDepth()
{
}
-TestCustomActor::TestCustomActor( Impl::TestCustomActor& impl )
-: CustomActor( impl )
+TestCustomActor::TestCustomActor(Impl::TestCustomActor& impl)
+: CustomActor(impl)
{
}
-TestCustomActor::TestCustomActor( Dali::Internal::CustomActor* internal )
-: CustomActor( internal )
+TestCustomActor::TestCustomActor(Dali::Internal::CustomActor* internal)
+: CustomActor(internal)
{
}
-TestCustomActor TestCustomActor::DownCast( BaseHandle handle )
+TestCustomActor TestCustomActor::DownCast(BaseHandle handle)
{
TestCustomActor actor;
- CustomActor custom = Dali::CustomActor::DownCast(handle);
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
Test::Impl::TestCustomActor* impl = dynamic_cast<Test::Impl::TestCustomActor*>(&customImpl);
- if( impl )
+ if(impl)
{
actor = TestCustomActor(customImpl.GetOwner());
}
namespace Impl
{
-
TestCustomActor::TestCustomActor()
-: CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) ),
- mDaliProperty( Property::INVALID_INDEX ),
- mSizeSet( Vector3::ZERO ),
- mTargetSize( Vector3::ZERO ),
- mNego( false ),
+: CustomActorImpl(ActorFlags(DISABLE_SIZE_NEGOTIATION)),
+ mDaliProperty(Property::INVALID_INDEX),
+ mSizeSet(Vector3::ZERO),
+ mTargetSize(Vector3::ZERO),
+ mNego(false),
mDepth(0u),
- develProp6( 10.0f )
+ develProp6(10.0f)
{
}
TestCustomActor::TestCustomActor(bool nego)
-: CustomActorImpl( ActorFlags() ),
- mDaliProperty( Property::INVALID_INDEX ),
- mSizeSet( Vector3::ZERO ),
- mTargetSize( Vector3::ZERO ),
- mNego( nego ),
- develProp6( 10.0f )
+: CustomActorImpl(ActorFlags()),
+ mDaliProperty(Property::INVALID_INDEX),
+ mSizeSet(Vector3::ZERO),
+ mTargetSize(Vector3::ZERO),
+ mNego(nego),
+ develProp6(10.0f)
{
}
/**
{
}
-void TestCustomActor::Initialize( const char* name )
+void TestCustomActor::Initialize(const char* name)
{
- mDaliProperty = Self().RegisterProperty( "Dali", std::string("no"), Property::READ_WRITE);
+ mDaliProperty = Self().RegisterProperty("Dali", std::string("no"), Property::READ_WRITE);
- OnInitialize( name );
+ OnInitialize(name);
}
-void TestCustomActor::OnInitialize( const char* name ) {}
+void TestCustomActor::OnInitialize(const char* name)
+{
+}
/**
* Resets the call stack
*/
void TestCustomActor::ResetCallStack()
{
- mSizeSet = Vector3();
+ mSizeSet = Vector3();
mTargetSize = Vector3();
mMethodsCalled.clear();
}
-void TestCustomActor::AddToCallStacks( const char* method )
+void TestCustomActor::AddToCallStacks(const char* method)
{
- mMethodsCalled.push_back( method );
+ mMethodsCalled.push_back(method);
// Combine Actor name with method string
- std::string nameAndMethod( Self().GetProperty< std::string >( Dali::Actor::Property::NAME ) );
- if ( 0 == nameAndMethod.size() )
+ std::string nameAndMethod(Self().GetProperty<std::string>(Dali::Actor::Property::NAME));
+ if(0 == nameAndMethod.size())
{
nameAndMethod = "Unknown: ";
}
}
nameAndMethod += method;
- MasterCallStack.push_back( nameAndMethod );
+ MasterCallStack.push_back(nameAndMethod);
}
// From CustomActorImpl
-void TestCustomActor::OnSceneConnection( int depth )
+void TestCustomActor::OnSceneConnection(int depth)
{
AddToCallStacks("OnSceneConnection");
mDepth = depth;
{
AddToCallStacks("OnChildRemove");
}
-void TestCustomActor::OnPropertySet( Property::Index index, const Property::Value& propertyValue )
+void TestCustomActor::OnPropertySet(Property::Index index, const Property::Value& propertyValue)
{
AddToCallStacks("OnPropertySet");
}
}
Vector3 TestCustomActor::GetNaturalSize()
{
- return Vector3( 0.0f, 0.0f, 0.0f );
+ return Vector3(0.0f, 0.0f, 0.0f);
}
-float TestCustomActor::GetHeightForWidth( float width )
+float TestCustomActor::GetHeightForWidth(float width)
{
return 0.0f;
}
-float TestCustomActor::GetWidthForHeight( float height )
+float TestCustomActor::GetWidthForHeight(float height)
{
return 0.0f;
}
-void TestCustomActor::OnRelayout( const Vector2& size, RelayoutContainer& container )
+void TestCustomActor::OnRelayout(const Vector2& size, RelayoutContainer& container)
{
gOnRelayout = true;
}
-void TestCustomActor::OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+void TestCustomActor::OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
{
}
-void TestCustomActor::OnCalculateRelayoutSize( Dimension::Type dimension )
+void TestCustomActor::OnCalculateRelayoutSize(Dimension::Type dimension)
{
}
-float TestCustomActor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
+float TestCustomActor::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
{
return 0.0f;
}
-void TestCustomActor::OnLayoutNegotiated( float size, Dimension::Type dimension )
+void TestCustomActor::OnLayoutNegotiated(float size, Dimension::Type dimension)
{
}
-bool TestCustomActor::RelayoutDependentOnChildren( Dimension::Type dimension )
+bool TestCustomActor::RelayoutDependentOnChildren(Dimension::Type dimension)
{
return false;
}
RelayoutRequest();
}
-float TestCustomActor::TestGetHeightForWidthBase( float width )
+float TestCustomActor::TestGetHeightForWidthBase(float width)
{
- return GetHeightForWidthBase( width );
+ return GetHeightForWidthBase(width);
}
-float TestCustomActor::TestGetWidthForHeightBase( float height )
+float TestCustomActor::TestGetWidthForHeightBase(float height)
{
- return GetWidthForHeightBase( height );
+ return GetWidthForHeightBase(height);
}
-float TestCustomActor::TestCalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension )
+float TestCustomActor::TestCalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension)
{
- return CalculateChildSizeBase( child, dimension );
+ return CalculateChildSizeBase(child, dimension);
}
-bool TestCustomActor::TestRelayoutDependentOnChildrenBase( Dimension::Type dimension )
+bool TestCustomActor::TestRelayoutDependentOnChildrenBase(Dimension::Type dimension)
{
- return RelayoutDependentOnChildrenBase( dimension );
+ return RelayoutDependentOnChildrenBase(dimension);
}
-void TestCustomActor::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+void TestCustomActor::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value)
{
- Test::TestCustomActor actor = Test::TestCustomActor::DownCast( Dali::BaseHandle( object ) );
+ Test::TestCustomActor actor = Test::TestCustomActor::DownCast(Dali::BaseHandle(object));
- if ( actor )
+ if(actor)
{
TestCustomActor& actorImpl = GetImpl(actor);
switch(index)
}
}
-Property::Value TestCustomActor::GetProperty( BaseObject* object, Property::Index index )
+Property::Value TestCustomActor::GetProperty(BaseObject* object, Property::Index index)
{
- Test::TestCustomActor actor = Test::TestCustomActor::DownCast( Dali::BaseHandle( object ) );
+ Test::TestCustomActor actor = Test::TestCustomActor::DownCast(Dali::BaseHandle(object));
- if ( actor )
+ if(actor)
{
TestCustomActor& actorImpl = GetImpl(actor);
switch(index)
return Property::Value();
}
-
BaseHandle CreateActor()
{
return Test::TestCustomActor::New();
}
-DALI_TYPE_REGISTRATION_BEGIN( Test::TestCustomActor, Dali::CustomActor, CreateActor );
+DALI_TYPE_REGISTRATION_BEGIN(Test::TestCustomActor, Dali::CustomActor, CreateActor);
-DALI_PROPERTY_REGISTRATION( Test, TestCustomActor, "testProperty1", FLOAT, TEST_PROPERTY1)
-DALI_PROPERTY_REGISTRATION( Test, TestCustomActor, "testProperty2", VECTOR4, TEST_PROPERTY2)
-DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty3", VECTOR4, DEVEL_TEST_PROPERTY3)
-DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty4", INTEGER, DEVEL_TEST_PROPERTY4)
-DALI_DEVEL_PROPERTY_REGISTRATION( Test, TestCustomActor, "develTestProperty5", FLOAT, DEVEL_TEST_PROPERTY5)
-DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Test, TestCustomActor, "develTestProperty6", FLOAT, DEVEL_TEST_PROPERTY6)
+DALI_PROPERTY_REGISTRATION(Test, TestCustomActor, "testProperty1", FLOAT, TEST_PROPERTY1)
+DALI_PROPERTY_REGISTRATION(Test, TestCustomActor, "testProperty2", VECTOR4, TEST_PROPERTY2)
+DALI_DEVEL_PROPERTY_REGISTRATION(Test, TestCustomActor, "develTestProperty3", VECTOR4, DEVEL_TEST_PROPERTY3)
+DALI_DEVEL_PROPERTY_REGISTRATION(Test, TestCustomActor, "develTestProperty4", INTEGER, DEVEL_TEST_PROPERTY4)
+DALI_DEVEL_PROPERTY_REGISTRATION(Test, TestCustomActor, "develTestProperty5", FLOAT, DEVEL_TEST_PROPERTY5)
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Test, TestCustomActor, "develTestProperty6", FLOAT, DEVEL_TEST_PROPERTY6)
DALI_TYPE_REGISTRATION_END()
-} // Impl
-} // Test namespace
+} // namespace Impl
+} // namespace Test
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/integration-api/scene.h>
+#include <dali/public-api/dali-core.h>
-extern std::vector< std::string > MasterCallStack;
-extern bool gOnRelayout;
+extern std::vector<std::string> MasterCallStack;
+extern bool gOnRelayout;
namespace Test
{
enum PropertyRange
{
PROPERTY_START_INDEX = Dali::PROPERTY_REGISTRATION_START_INDEX,
- PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000
+ PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000
};
struct Property
TestCustomActor();
static TestCustomActor New();
static TestCustomActor NewNegoSize();
- static TestCustomActor NewVariant1( Actor childToAdd );
+ static TestCustomActor NewVariant1(Actor childToAdd);
static TestCustomActor NewVariant2();
- static TestCustomActor NewVariant3( Actor childToAdd );
+ static TestCustomActor NewVariant3(Actor childToAdd);
static TestCustomActor NewVariant4();
- static TestCustomActor NewVariant5( Dali::Integration::Scene scene );
- static TestCustomActor NewVariant6( Dali::Integration::Scene scene );
- static TestCustomActor NewVariant7( const char* name );
- static TestCustomActor NewVariant8( Actor rival );
- static TestCustomActor DownCast( Dali::BaseHandle handle );
+ static TestCustomActor NewVariant5(Dali::Integration::Scene scene);
+ static TestCustomActor NewVariant6(Dali::Integration::Scene scene);
+ static TestCustomActor NewVariant7(const char* name);
+ static TestCustomActor NewVariant8(Actor rival);
+ static TestCustomActor DownCast(Dali::BaseHandle handle);
virtual ~TestCustomActor();
Impl::TestCustomActor& GetImpl();
- TestCustomActor( TestCustomActor&& rhs ) = default;
- TestCustomActor& operator=( TestCustomActor&& rhs ) = default;
-
- std::vector< std::string >& GetMethodsCalled();
- void ResetCallStack();
- void SetDaliProperty(std::string s);
- Dali::Vector3 GetSize();
- Dali::Vector3 GetTargetSize();
- virtual Dali::Vector3 GetNaturalSize();
- virtual float GetHeightForWidth( float width );
- virtual float GetWidthForHeight( float height );
- virtual void OnRelayout( const Dali::Vector2& size, Dali::RelayoutContainer& container );
- virtual void OnLayoutNegotiated( float size, Dali::Dimension::Type dimension );
- virtual void OnCalculateRelayoutSize( Dali::Dimension::Type dimension );
- void TestRelayoutRequest();
- float TestGetHeightForWidthBase( float width );
- float TestGetWidthForHeightBase( float height );
- float TestCalculateChildSizeBase( const Dali::Actor& child, Dali::Dimension::Type dimension );
- bool TestRelayoutDependentOnChildrenBase( Dali::Dimension::Type dimension );
- uint32_t GetDepth();
+ TestCustomActor(TestCustomActor&& rhs) = default;
+ TestCustomActor& operator=(TestCustomActor&& rhs) = default;
+
+ std::vector<std::string>& GetMethodsCalled();
+ void ResetCallStack();
+ void SetDaliProperty(std::string s);
+ Dali::Vector3 GetSize();
+ Dali::Vector3 GetTargetSize();
+ virtual Dali::Vector3 GetNaturalSize();
+ virtual float GetHeightForWidth(float width);
+ virtual float GetWidthForHeight(float height);
+ virtual void OnRelayout(const Dali::Vector2& size, Dali::RelayoutContainer& container);
+ virtual void OnLayoutNegotiated(float size, Dali::Dimension::Type dimension);
+ virtual void OnCalculateRelayoutSize(Dali::Dimension::Type dimension);
+ void TestRelayoutRequest();
+ float TestGetHeightForWidthBase(float width);
+ float TestGetWidthForHeightBase(float height);
+ float TestCalculateChildSizeBase(const Dali::Actor& child, Dali::Dimension::Type dimension);
+ bool TestRelayoutDependentOnChildrenBase(Dali::Dimension::Type dimension);
+ uint32_t GetDepth();
private:
- TestCustomActor( Impl::TestCustomActor& impl );
+ TestCustomActor(Impl::TestCustomActor& impl);
explicit TestCustomActor(Dali::Internal::CustomActor* internal);
};
-
namespace DevelTestCustomActor
{
namespace Property
{
enum Type
{
- TEST_PROPERTY1 = Test::TestCustomActor::Property::TEST_PROPERTY1,
- TEST_PROPERTY2 = Test::TestCustomActor::Property::TEST_PROPERTY2,
- DEVEL_TEST_PROPERTY3 = TEST_PROPERTY2+1,
- DEVEL_TEST_PROPERTY4 = TEST_PROPERTY2+2,
- DEVEL_TEST_PROPERTY5 = TEST_PROPERTY2+3,
- DEVEL_TEST_PROPERTY6 = TEST_PROPERTY2+4
+ TEST_PROPERTY1 = Test::TestCustomActor::Property::TEST_PROPERTY1,
+ TEST_PROPERTY2 = Test::TestCustomActor::Property::TEST_PROPERTY2,
+ DEVEL_TEST_PROPERTY3 = TEST_PROPERTY2 + 1,
+ DEVEL_TEST_PROPERTY4 = TEST_PROPERTY2 + 2,
+ DEVEL_TEST_PROPERTY5 = TEST_PROPERTY2 + 3,
+ DEVEL_TEST_PROPERTY6 = TEST_PROPERTY2 + 4
};
} // Namespace Property
} // Namespace DevelTestCustomActor
-
// TypeRegistry needs custom actor Implementations to have the same name (namespaces are ignored so we use one here)
namespace Impl
{
-
struct TestCustomActor : public Dali::CustomActorImpl
{
public:
TestCustomActor();
TestCustomActor(bool nego);
virtual ~TestCustomActor();
- void Initialize( const char* name = NULL );
- virtual void OnInitialize( const char* name );
- void ResetCallStack();
- void AddToCallStacks( const char* method );
- void OnSceneConnection( int depth ) override;
- void OnSceneDisconnection() override;
- void OnChildAdd(Dali::Actor& child) override;
- void OnChildRemove(Dali::Actor& child) override;
- void OnPropertySet( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) override;
- void OnSizeSet(const Dali::Vector3& targetSize) override;
- void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override;
- virtual void OnKeyInputFocusGained();
- virtual void OnKeyInputFocusLost();
- Dali::Vector3 GetNaturalSize() override;
- float GetHeightForWidth( float width ) override;
- float GetWidthForHeight( float height ) override;
- void OnRelayout( const Dali::Vector2& size, Dali::RelayoutContainer& container ) override;
- void OnSetResizePolicy( Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension ) override;
- void OnCalculateRelayoutSize( Dali::Dimension::Type dimension ) override;
- float CalculateChildSize( const Dali::Actor& child, Dali::Dimension::Type dimension ) override;
- void OnLayoutNegotiated( float size, Dali::Dimension::Type dimension ) override;
- bool RelayoutDependentOnChildren( Dali::Dimension::Type dimension = Dali::Dimension::ALL_DIMENSIONS ) override;
- static void SetProperty( Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value );
- static Dali::Property::Value GetProperty( Dali::BaseObject* object, Dali::Property::Index index );
-
- void SetDaliProperty(std::string s);
- void TestRelayoutRequest();
- float TestGetHeightForWidthBase( float width );
- float TestGetWidthForHeightBase( float height );
- float TestCalculateChildSizeBase( const Dali::Actor& child, Dali::Dimension::Type dimension );
- bool TestRelayoutDependentOnChildrenBase( Dali::Dimension::Type dimension );
+ void Initialize(const char* name = NULL);
+ virtual void OnInitialize(const char* name);
+ void ResetCallStack();
+ void AddToCallStacks(const char* method);
+ void OnSceneConnection(int depth) override;
+ void OnSceneDisconnection() override;
+ void OnChildAdd(Dali::Actor& child) override;
+ void OnChildRemove(Dali::Actor& child) override;
+ void OnPropertySet(Dali::Property::Index index, const Dali::Property::Value& propertyValue) override;
+ void OnSizeSet(const Dali::Vector3& targetSize) override;
+ void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override;
+ virtual void OnKeyInputFocusGained();
+ virtual void OnKeyInputFocusLost();
+ Dali::Vector3 GetNaturalSize() override;
+ float GetHeightForWidth(float width) override;
+ float GetWidthForHeight(float height) override;
+ void OnRelayout(const Dali::Vector2& size, Dali::RelayoutContainer& container) override;
+ void OnSetResizePolicy(Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension) override;
+ void OnCalculateRelayoutSize(Dali::Dimension::Type dimension) override;
+ float CalculateChildSize(const Dali::Actor& child, Dali::Dimension::Type dimension) override;
+ void OnLayoutNegotiated(float size, Dali::Dimension::Type dimension) override;
+ bool RelayoutDependentOnChildren(Dali::Dimension::Type dimension = Dali::Dimension::ALL_DIMENSIONS) override;
+ static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value);
+ static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index index);
+
+ void SetDaliProperty(std::string s);
+ void TestRelayoutRequest();
+ float TestGetHeightForWidthBase(float width);
+ float TestGetWidthForHeightBase(float height);
+ float TestCalculateChildSizeBase(const Dali::Actor& child, Dali::Dimension::Type dimension);
+ bool TestRelayoutDependentOnChildrenBase(Dali::Dimension::Type dimension);
public:
- Dali::Property::Index mDaliProperty;
- std::vector< std::string > mMethodsCalled;
- Dali::Vector3 mSizeSet;
- Dali::Vector3 mTargetSize;
- bool mNego;
- uint32_t mDepth;
+ Dali::Property::Index mDaliProperty;
+ std::vector<std::string> mMethodsCalled;
+ Dali::Vector3 mSizeSet;
+ Dali::Vector3 mTargetSize;
+ bool mNego;
+ uint32_t mDepth;
float prop1;
Dali::Vector4 prop2;
float develProp6;
};
-inline TestCustomActor& GetImpl( Test::TestCustomActor& handle )
+inline TestCustomActor& GetImpl(Test::TestCustomActor& handle)
{
- DALI_ASSERT_ALWAYS( handle );
+ DALI_ASSERT_ALWAYS(handle);
Dali::RefObject& object = handle.GetImplementation();
- return static_cast<TestCustomActor&>( object );
+ return static_cast<TestCustomActor&>(object);
}
-inline const TestCustomActor& GetImpl( const Test::TestCustomActor& handle )
+inline const TestCustomActor& GetImpl(const Test::TestCustomActor& handle)
{
- DALI_ASSERT_ALWAYS( handle );
+ DALI_ASSERT_ALWAYS(handle);
const Dali::RefObject& object = handle.GetImplementation();
- return static_cast<const TestCustomActor&>( object );
+ return static_cast<const TestCustomActor&>(object);
}
-
/**
* Variant which adds a new child during OnSceneConnection
*/
/**
* Constructor
*/
- TestCustomActorVariant1( Dali::Actor childToAdd )
- : mChildToAdd( childToAdd )
+ TestCustomActorVariant1(Dali::Actor childToAdd)
+ : mChildToAdd(childToAdd)
{
}
// From CustomActorImpl
- void OnSceneConnection( int depth ) override
+ void OnSceneConnection(int depth) override
{
// Chain up first
- TestCustomActor::OnSceneConnection( depth );
+ TestCustomActor::OnSceneConnection(depth);
// Add the child
- Self().Add( mChildToAdd );
+ Self().Add(mChildToAdd);
}
Dali::Actor mChildToAdd;
}
// From CustomActorImpl
- virtual void OnSceneConnection( int depth )
+ virtual void OnSceneConnection(int depth)
{
// Chain up first
- TestCustomActor::OnSceneConnection( depth );
+ TestCustomActor::OnSceneConnection(depth);
// Remove all the children
- for( uint32_t i=0, num=Self().GetChildCount(); i<num; ++i )
+ for(uint32_t i = 0, num = Self().GetChildCount(); i < num; ++i)
{
- Self().Remove( Self().GetChildAt(0) );
+ Self().Remove(Self().GetChildAt(0));
}
}
};
/**
* Constructor
*/
- TestCustomActorVariant3( Dali::Actor childToAdd )
- : mChildToAdd( childToAdd )
+ TestCustomActorVariant3(Dali::Actor childToAdd)
+ : mChildToAdd(childToAdd)
{
}
TestCustomActor::OnSceneDisconnection();
// Add the child
- Self().Add( mChildToAdd );
+ Self().Add(mChildToAdd);
}
Dali::Actor mChildToAdd;
TestCustomActor::OnSceneDisconnection();
// Remove all the children
- for( uint32_t i=0, num=Self().GetChildCount(); i<num; ++i )
+ for(uint32_t i = 0, num = Self().GetChildCount(); i < num; ++i)
{
- Self().Remove( Self().GetChildAt(0) );
+ Self().Remove(Self().GetChildAt(0));
}
}
};
}
// From CustomActorImpl
- virtual void OnSceneConnection( int depth )
+ virtual void OnSceneConnection(int depth)
{
// Chain up first
- TestCustomActor::OnSceneConnection( depth );
+ TestCustomActor::OnSceneConnection(depth);
// Take parent off-stage
Dali::Actor parent = Self().GetParent();
- if ( parent )
+ if(parent)
{
- mScene.Remove( parent );
+ mScene.Remove(parent);
}
}
// Put parent on-stage
Dali::Actor parent = Self().GetParent();
- if ( parent )
+ if(parent)
{
- mScene.Add( parent );
+ mScene.Add(parent);
}
}
{
}
- virtual void OnInitialize( const char* name )
+ virtual void OnInitialize(const char* name)
{
// We need to do this early, before the OnChildAdd is recorded
- Self().SetProperty( Dali::Actor::Property::NAME, name );
+ Self().SetProperty(Dali::Actor::Property::NAME, name);
mContainer = Dali::Actor::New();
- mContainer.SetProperty( Dali::Actor::Property::NAME, "Container" );
- Self().Add( mContainer );
+ mContainer.SetProperty(Dali::Actor::Property::NAME, "Container");
+ Self().Add(mContainer);
}
// From CustomActorImpl
TestCustomActor::OnChildAdd(child);
// Reparent child
- if ( child != mContainer )
+ if(child != mContainer)
{
- mContainer.Add( child );
+ mContainer.Add(child);
}
}
/**
* Constructor
*/
- TestCustomActorVariant8( Dali::Actor rival )
- : mRivalContainer( rival )
+ TestCustomActorVariant8(Dali::Actor rival)
+ : mRivalContainer(rival)
{
}
// Chain up first
TestCustomActor::OnChildRemove(child);
- mRivalContainer.Remove( child ); // attempt to block reparenting to rival (should be a NOOP)
+ mRivalContainer.Remove(child); // attempt to block reparenting to rival (should be a NOOP)
}
Dali::Actor mRivalContainer;
class SimpleTestCustomActor : public Dali::CustomActorImpl
{
public:
-
/**
* Constructor
*/
SimpleTestCustomActor()
- : CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) )
+ : CustomActorImpl(ActorFlags(DISABLE_SIZE_NEGOTIATION))
{
}
}
// From CustomActorImpl
- void OnSceneConnection( int depth ) override
+ void OnSceneConnection(int depth) override
{
}
void OnSceneDisconnection() override
}
Dali::Vector3 GetNaturalSize() override
{
- return Dali::Vector3( 0.0f, 0.0f, 0.0f );
+ return Dali::Vector3(0.0f, 0.0f, 0.0f);
}
- float GetHeightForWidth( float width ) override
+ float GetHeightForWidth(float width) override
{
return 0.0f;
}
- float GetWidthForHeight( float height ) override
+ float GetWidthForHeight(float height) override
{
return 0.0f;
}
- void OnRelayout( const Dali::Vector2& size, Dali::RelayoutContainer& container ) override
+ void OnRelayout(const Dali::Vector2& size, Dali::RelayoutContainer& container) override
{
}
- void OnSetResizePolicy( Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension ) override
+ void OnSetResizePolicy(Dali::ResizePolicy::Type policy, Dali::Dimension::Type dimension) override
{
}
- void OnCalculateRelayoutSize( Dali::Dimension::Type dimension ) override
+ void OnCalculateRelayoutSize(Dali::Dimension::Type dimension) override
{
}
- float CalculateChildSize( const Dali::Actor& child, Dali::Dimension::Type dimension ) override
+ float CalculateChildSize(const Dali::Actor& child, Dali::Dimension::Type dimension) override
{
return 0.0f;
}
- void OnLayoutNegotiated( float size, Dali::Dimension::Type dimension ) override
+ void OnLayoutNegotiated(float size, Dali::Dimension::Type dimension) override
{
}
- bool RelayoutDependentOnChildren( Dali::Dimension::Type dimension = Dali::Dimension::ALL_DIMENSIONS ) override
+ bool RelayoutDependentOnChildren(Dali::Dimension::Type dimension = Dali::Dimension::ALL_DIMENSIONS) override
{
return false;
}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace
{
-const uint32_t RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const uint32_t RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
+ Integration::Point point;
+ point.SetState(state);
point.SetDeviceId(4);
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( stateA );
+ Integration::Point point;
+ point.SetState(stateA);
point.SetDeviceId(4);
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- point.SetState( stateB);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ point.SetState(stateB);
point.SetDeviceId(7);
- touchEvent.points.push_back( point );
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
return RENDER_FRAME_INTERVAL;
}
-void TestStartLongPress( TestApplication& application, float x, float y, uint32_t time )
+void TestStartLongPress(TestApplication& application, float x, float y, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time));
}
-void TestTriggerLongPress( TestApplication& application )
+void TestTriggerLongPress(TestApplication& application)
{
application.GetPlatform().TriggerTimer();
}
-void TestGenerateLongPress( TestApplication& application, float x, float y, uint32_t time )
+void TestGenerateLongPress(TestApplication& application, float x, float y, uint32_t time)
{
- TestStartLongPress( application, x, y, time );
- TestTriggerLongPress( application );
+ TestStartLongPress(application, x, y, time);
+ TestTriggerLongPress(application);
}
-void TestEndLongPress( TestApplication& application, float x, float y, uint32_t time )
+void TestEndLongPress(TestApplication& application, float x, float y, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time));
}
-void TestGeneratePinch( TestApplication& application)
+void TestGeneratePinch(TestApplication& application)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 55.0f ), PointState::UP, Vector2( 20.0f, 58.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(20.0f, 55.0f), PointState::UP, Vector2(20.0f, 58.0f), 200));
}
-void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestStartPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, a1, PointState::DOWN, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, a1, PointState::DOWN, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestContinuePinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time +150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestEndPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, a2, PointState::UP, b2, time +50 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, a2, PointState::UP, b2, time + 50));
}
-void TestGenerateMiniPan( TestApplication& application)
+void TestGenerateMiniPan(TestApplication& application)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 250 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 255 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 250));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 255));
}
-void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time )
+void TestStartPan(TestApplication& application, Vector2 start, Vector2 end, uint32_t& time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, start, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, start, time));
time += RENDER_FRAME_INTERVAL;
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, end, time));
time += RENDER_FRAME_INTERVAL;
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, end, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, end, time));
time += RENDER_FRAME_INTERVAL;
}
-void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time )
+void TestMovePan(TestApplication& application, Vector2 pos, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, pos, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, pos, time));
}
-void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time )
+void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, pos, time ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, pos, time));
}
-void TestGenerateTap( TestApplication& application, float x, float y, uint32_t time_down )
+void TestGenerateTap(TestApplication& application, float x, float y, uint32_t time_down)
{
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( x, y ), time_down ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( x, y ), time_down + 20 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(x, y), time_down));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(x, y), time_down + 20));
}
-void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down )
+void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( x1, y1 ), PointState::DOWN, Vector2( x2, y2 ), time_down ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( x1, y1 ), PointState::UP, Vector2( x2, y2 ), time_down + 20 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(x1, y1), PointState::DOWN, Vector2(x2, y2), time_down));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(x1, y1), PointState::UP, Vector2(x2, y2), time_down + 20));
}
-void TestGenerateRotation( TestApplication& application )
+void TestGenerateRotation(TestApplication& application)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 25.0f, 95.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 30.0f, 100.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 35.0f, 105.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 40.0f, 110.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), PointState::UP, Vector2( 45.0f, 115.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(25.0f, 95.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(30.0f, 100.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(35.0f, 105.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(40.0f, 110.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(20.0f, 20.0f), PointState::UP, Vector2(45.0f, 115.0f), 200));
}
-void TestStartRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestStartRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, a1, PointState::DOWN, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, a1, PointState::DOWN, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestContinueRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestContinueRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time + 50 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time + 100 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a2, PointState::MOTION, b2, time +150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time + 50));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 100));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a2, PointState::MOTION, b2, time + 150));
}
-void TestEndRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time )
+void TestEndRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time)
{
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, a1, PointState::MOTION, b1, time ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, a2, PointState::UP, b2, time +50 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, a1, PointState::MOTION, b1, time));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, a2, PointState::UP, b2, time + 50));
}
} // namespace Dali
#define DALI_TEST_GESTURE_GENERATOR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Produces the initial touch of a long press
*/
-void TestStartLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+void TestStartLongPress(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450);
/**
* Triggers the timer to begin a long press gesture
*/
-void TestTriggerLongPress( TestApplication& application );
+void TestTriggerLongPress(TestApplication& application);
/**
* Produces the initial press and triggers the timer to begin a long press gesture
*/
-void TestGenerateLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+void TestGenerateLongPress(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450);
/**
* End a long press by lifting the touch
*/
-void TestEndLongPress( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450 );
+void TestEndLongPress(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time = 450);
/**
* Produces a vertical pinch gesture between (20,20) and (20,90)
*/
-void TestGeneratePinch( TestApplication& application );
+void TestGeneratePinch(TestApplication& application);
/**
* Produces the gesture started event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestStartPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestStartPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture continuing event of a pinch, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestContinuePinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestContinuePinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture finished event of a pinch, using 2 touches, 50ms apart
*/
-void TestEndPinch( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestEndPinch(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a pan gesture from (20,20) to (20,40)
*/
-void TestGenerateMiniPan( TestApplication& application );
+void TestGenerateMiniPan(TestApplication& application);
/**
* Produces the start event of a pan gesture, assuming minimum distance moved between start and end is greater than 15
* in either direction or 11 in both (x&y). Time will be incremented using the standard frame interval per touch movement
*/
-void TestStartPan( TestApplication& application, Vector2 start, Vector2 end, uint32_t& time );
+void TestStartPan(TestApplication& application, Vector2 start, Vector2 end, uint32_t& time);
/**
* Continues a pan event by creating a single touch at pos.
* N.B This does not increment the time
*/
-void TestMovePan( TestApplication& application, Vector2 pos, uint32_t time = 400);
+void TestMovePan(TestApplication& application, Vector2 pos, uint32_t time = 400);
/**
* End a pan gesture at position pos
*/
-void TestEndPan( TestApplication& application, Vector2 pos, uint32_t time = 500);
+void TestEndPan(TestApplication& application, Vector2 pos, uint32_t time = 500);
/**
* Produces a single point tap gesture with a 20ms interval
*/
-void TestGenerateTap( TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100 );
+void TestGenerateTap(TestApplication& application, float x = 20.0f, float y = 20.0f, uint32_t time_down = 100);
/**
* Produce a tap gesture with two touch points and a 20ms interval
*/
-void TestGenerateTwoPointTap( TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down );
+void TestGenerateTwoPointTap(TestApplication& application, float x1, float y1, float x2, float y2, uint32_t time_down);
/**
* Produces a rotation gesture.
*/
-void TestGenerateRotation( TestApplication& application );
+void TestGenerateRotation(TestApplication& application);
/**
* Produces the gesture started event of a rotation, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestStartRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestStartRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture continuing event of a rotation, using 4 touches, 50ms apart, starting with 1, ending at 2
*/
-void TestContinueRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestContinueRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
/**
* Produces a gesture finished event of a rotation, using 2 touches, 50ms apart
*/
-void TestEndRotation( TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time );
+void TestEndRotation(TestApplication& application, Vector2 a1, Vector2 b1, Vector2 a2, Vector2 b2, uint32_t time);
} // namespace Dali
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
TestGlAbstraction::TestGlAbstraction()
{
Initialize();
}
-TestGlAbstraction::~TestGlAbstraction() {}
+TestGlAbstraction::~TestGlAbstraction()
+{
+}
void TestGlAbstraction::Initialize()
{
- mCurrentProgram = 0;
- mCompileStatus = GL_TRUE;
- mLinkStatus = GL_TRUE;
- mNumberOfActiveUniforms = 0;
- mGetAttribLocationResult = 0;
- mGetErrorResult = 0;
- mGetStringResult = NULL;
- mIsBufferResult = 0;
- mIsEnabledResult = 0;
- mIsFramebufferResult = 0;
- mIsProgramResult = 0;
- mIsRenderbufferResult = 0;
- mIsShaderResult = 0;
- mIsTextureResult = 0;
- mActiveTextureUnit = 0;
- mCheckFramebufferStatusResult = 0;
- mFramebufferStatus = 0;
- mFramebufferDepthAttached = 0;
- mFramebufferStencilAttached = 0;
+ mCurrentProgram = 0;
+ mCompileStatus = GL_TRUE;
+ mLinkStatus = GL_TRUE;
+ mNumberOfActiveUniforms = 0;
+ mGetAttribLocationResult = 0;
+ mGetErrorResult = 0;
+ mGetStringResult = NULL;
+ mIsBufferResult = 0;
+ mIsEnabledResult = 0;
+ mIsFramebufferResult = 0;
+ mIsProgramResult = 0;
+ mIsRenderbufferResult = 0;
+ mIsShaderResult = 0;
+ mIsTextureResult = 0;
+ mActiveTextureUnit = 0;
+ mCheckFramebufferStatusResult = 0;
+ mFramebufferStatus = 0;
+ mFramebufferDepthAttached = 0;
+ mFramebufferStencilAttached = 0;
mFramebufferColorAttachmentCount = 0;
- mFrameBufferColorStatus = 0;
- mNumBinaryFormats = 0;
- mBinaryFormats = 0;
- mProgramBinaryLength = 0;
+ mFrameBufferColorStatus = 0;
+ mNumBinaryFormats = 0;
+ mBinaryFormats = 0;
+ mProgramBinaryLength = 0;
mVertexAttribArrayChanged = false;
- mGetProgramBinaryCalled = false;
+ mGetProgramBinaryCalled = false;
mLastShaderCompiled = 0;
- mLastClearBitMask = 0;
- mLastClearColor = Color::TRANSPARENT;
- mClearCount = 0;
+ mLastClearBitMask = 0;
+ mLastClearColor = Color::TRANSPARENT;
+ mClearCount = 0;
mLastBlendEquationRgb = 0;
mLastBlendEquationAlpha = 0;
mLastBlendFuncDstRgb = 0;
mLastBlendFuncSrcAlpha = 0;
mLastBlendFuncDstAlpha = 0;
- mLastAutoTextureIdUsed = 0;
- mNumGeneratedTextures = 0;
- mLastShaderIdUsed = 0;
- mLastProgramIdUsed = 0;
- mLastUniformIdUsed = 0;
- mLastDepthMask = false;
+ mLastAutoTextureIdUsed = 0;
+ mNumGeneratedTextures = 0;
+ mLastShaderIdUsed = 0;
+ mLastProgramIdUsed = 0;
+ mLastUniformIdUsed = 0;
+ mLastDepthMask = false;
mUniforms.clear();
mProgramUniforms1i.clear();
mTexParamaterTrace.Reset();
mDrawTrace.Reset();
- for( unsigned int i=0; i<MAX_ATTRIBUTE_CACHE_SIZE; ++i )
+ for(unsigned int i = 0; i < MAX_ATTRIBUTE_CACHE_SIZE; ++i)
{
mVertexAttribArrayState[i] = false;
}
return true;
}
-bool TestGlAbstraction::TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const
+bool TestGlAbstraction::TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const
{
- return ( ( imageGlFormat == GL_RGB ) && ( textureGlFormat == GL_RGBA ) );
+ return ((imageGlFormat == GL_RGB) && (textureGlFormat == GL_RGBA));
}
-} // Namespace dali
+} // namespace Dali
bool BlendEnabled(const Dali::TraceCallStack& callStack)
{
std::stringstream out;
out << GL_BLEND;
- bool blendEnabled = callStack.FindMethodAndParams( "Enable", out.str() );
+ bool blendEnabled = callStack.FindMethodAndParams("Enable", out.str());
return blendEnabled;
}
{
std::stringstream out;
out << GL_BLEND;
- bool blendEnabled = callStack.FindMethodAndParams( "Disable", out.str() );
+ bool blendEnabled = callStack.FindMethodAndParams("Disable", out.str());
return blendEnabled;
}
-
*/
// EXTERNAL INCLUDES
-#include <sstream>
-#include <string>
-#include <cstring>
-#include <map>
#include <cstdio>
+#include <cstring>
#include <cstring> // for strcmp
+#include <map>
+#include <sstream>
+#include <string>
#include <typeinfo>
// INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
#include <dali/devel-api/rendering/frame-buffer-devel.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
-#include <test-trace-call-stack.h>
+#include <dali/public-api/dali-core.h>
#include <test-compare-types.h>
+#include <test-trace-call-stack.h>
namespace Dali
{
-
static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 64;
-static const char *mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] =
-{
+static const char* mStdAttribs[MAX_ATTRIBUTE_CACHE_SIZE] =
+ {
"aPosition", // ATTRIB_POSITION
"aNormal", // ATTRIB_NORMAL
"aTexCoord", // ATTRIB_TEXCOORD
"aBoneIndices" // ATTRIB_BONE_INDICES
};
-class DALI_CORE_API TestGlAbstraction: public Dali::Integration::GlAbstraction
+class DALI_CORE_API TestGlAbstraction : public Dali::Integration::GlAbstraction
{
public:
TestGlAbstraction();
bool IsSurfacelessContextSupported() const override;
- bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const override;
+ bool TextureRequiresConverting(const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage) const override;
/* OpenGL ES 2.0 */
- inline void ActiveTexture( GLenum textureUnit ) override
+ inline void ActiveTexture(GLenum textureUnit) override
{
mActiveTextureUnit = textureUnit - GL_TEXTURE0;
}
return mActiveTextureUnit + GL_TEXTURE0;
}
- inline void AttachShader( GLuint program, GLuint shader ) override
+ inline void AttachShader(GLuint program, GLuint shader) override
{
std::stringstream out;
out << program << ", " << shader;
TraceCallStack::NamedParams namedParams;
namedParams["program"] = ToString(program);
- namedParams["shader"] = ToString(shader);
+ namedParams["shader"] = ToString(shader);
mShaderTrace.PushCall("AttachShader", out.str(), namedParams);
}
- inline void BindAttribLocation( GLuint program, GLuint index, const char* name ) override
+ inline void BindAttribLocation(GLuint program, GLuint index, const char* name) override
{
}
- inline void BindBuffer( GLenum target, GLuint buffer ) override
+ inline void BindBuffer(GLenum target, GLuint buffer) override
{
}
- inline void BindFramebuffer( GLenum target, GLuint framebuffer ) override
+ inline void BindFramebuffer(GLenum target, GLuint framebuffer) override
{
//Add 010 bit;
mFramebufferStatus |= 2;
}
- inline void BindRenderbuffer( GLenum target, GLuint renderbuffer ) override
+ inline void BindRenderbuffer(GLenum target, GLuint renderbuffer) override
{
}
* @param[in] activeTextureUnit The specific active texture unit.
* @return A vector containing the IDs that were bound.
*/
- inline const std::vector<GLuint>& GetBoundTextures( GLuint activeTextureUnit ) const
+ inline const std::vector<GLuint>& GetBoundTextures(GLuint activeTextureUnit) const
{
- return mActiveTextures[ activeTextureUnit - GL_TEXTURE0 ].mBoundTextures;
+ return mActiveTextures[activeTextureUnit - GL_TEXTURE0].mBoundTextures;
}
/**
{
mBoundTextures.clear();
- for( unsigned int i=0; i<MIN_TEXTURE_UNIT_LIMIT; ++i )
+ for(unsigned int i = 0; i < MIN_TEXTURE_UNIT_LIMIT; ++i)
{
- mActiveTextures[ i ].mBoundTextures.clear();
+ mActiveTextures[i].mBoundTextures.clear();
}
}
- inline void BindTexture( GLenum target, GLuint texture ) override
+ inline void BindTexture(GLenum target, GLuint texture) override
{
// Record the bound textures for future checks
- if( texture )
+ if(texture)
{
- mBoundTextures.push_back( texture );
+ mBoundTextures.push_back(texture);
- if( mActiveTextureUnit < MIN_TEXTURE_UNIT_LIMIT )
+ if(mActiveTextureUnit < MIN_TEXTURE_UNIT_LIMIT)
{
- mActiveTextures[ mActiveTextureUnit ].mBoundTextures.push_back( texture );
+ mActiveTextures[mActiveTextureUnit].mBoundTextures.push_back(texture);
}
}
out << target << ", " << texture;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
+ namedParams["target"] = ToString(target);
namedParams["texture"] = ToString(texture);
mTextureTrace.PushCall("BindTexture", out.str(), namedParams);
return mLastBlendColor;
}
- inline void BlendEquation( GLenum mode ) override
+ inline void BlendEquation(GLenum mode) override
{
mLastBlendEquationRgb = mode;
mLastBlendEquationAlpha = mode;
}
- inline void BlendEquationSeparate( GLenum modeRgb, GLenum modeAlpha ) override
+ inline void BlendEquationSeparate(GLenum modeRgb, GLenum modeAlpha) override
{
mLastBlendEquationRgb = modeRgb;
mLastBlendEquationAlpha = modeAlpha;
inline void BlendFunc(GLenum sfactor, GLenum dfactor) override
{
- mLastBlendFuncSrcRgb = sfactor;
- mLastBlendFuncDstRgb = dfactor;
+ mLastBlendFuncSrcRgb = sfactor;
+ mLastBlendFuncDstRgb = dfactor;
mLastBlendFuncSrcAlpha = sfactor;
mLastBlendFuncDstAlpha = dfactor;
}
inline void BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) override
{
- mLastBlendFuncSrcRgb = srcRGB;
- mLastBlendFuncDstRgb = dstRGB;
+ mLastBlendFuncSrcRgb = srcRGB;
+ mLastBlendFuncDstRgb = dstRGB;
mLastBlendFuncSrcAlpha = srcAlpha;
mLastBlendFuncDstAlpha = dstAlpha;
}
inline void BufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) override
{
- mBufferDataCalls.push_back(size);
+ mBufferDataCalls.push_back(size);
}
inline void BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) override
{
- mBufferSubDataCalls.push_back(size);
+ mBufferSubDataCalls.push_back(size);
}
inline GLenum CheckFramebufferStatus(GLenum target) override
{
//If it has the three last bits set to 1 - 111, then the three minimum functions to create a
//Framebuffer texture have been called
- if( mFramebufferStatus == 7 )
+ if(mFramebufferStatus == 7)
{
return GL_FRAMEBUFFER_COMPLETE;
}
out << s;
TraceCallStack::NamedParams namedParams;
- namedParams["s"] = ToString( s );
+ namedParams["s"] = ToString(s);
- mStencilFunctionTrace.PushCall( "ClearStencil", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("ClearStencil", out.str(), namedParams);
}
inline void ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) override
{
- mColorMaskParams.red = red;
+ mColorMaskParams.red = red;
mColorMaskParams.green = green;
- mColorMaskParams.blue = blue;
+ mColorMaskParams.blue = blue;
mColorMaskParams.alpha = alpha;
}
inline void CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) override
{
std::stringstream out;
- out << target<<", "<<level<<", "<<width << ", " << height;
+ out << target << ", " << level << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["internalformat"] = ToString(internalformat);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
- namedParams["border"] = ToString(border);
- namedParams["size"] = ToString(imageSize);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ namedParams["border"] = ToString(border);
+ namedParams["size"] = ToString(imageSize);
mTextureTrace.PushCall("CompressedTexImage2D", out.str(), namedParams);
}
inline void CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) override
{
std::stringstream out;
- out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+ out << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["xoffset"] = ToString(xoffset);
namedParams["yoffset"] = ToString(yoffset);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
mTextureTrace.PushCall("CompressedTexSubImage2D", out.str(), namedParams);
}
TraceCallStack::NamedParams namedParams;
- for(GLsizei i=0; i<n; i++)
+ for(GLsizei i = 0; i < n; i++)
{
out << textures[i] << ", ";
std::stringstream paramName;
- paramName<<"texture["<<i<<"]";
+ paramName << "texture[" << i << "]";
namedParams[paramName.str()] = ToString(textures[i]);
mDeletedTextureIds.push_back(textures[i]);
mNumGeneratedTextures--;
return mDeletedTextureIds.size() == 0;
}
- inline bool CheckTextureDeleted( GLuint textureId )
+ inline bool CheckTextureDeleted(GLuint textureId)
{
bool found = false;
- for(std::vector<GLuint>::iterator iter=mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter)
+ for(std::vector<GLuint>::iterator iter = mDeletedTextureIds.begin(); iter != mDeletedTextureIds.end(); ++iter)
{
if(*iter == textureId)
{
out << program << ", " << shader;
TraceCallStack::NamedParams namedParams;
namedParams["program"] = ToString(program);
- namedParams["shader"] = ToString(shader);
+ namedParams["shader"] = ToString(shader);
mShaderTrace.PushCall("DetachShader", out.str(), namedParams);
}
inline void DisableVertexAttribArray(GLuint index) override
{
- SetVertexAttribArray( index, false );
+ SetVertexAttribArray(index, false);
}
inline void DrawArrays(GLenum mode, GLint first, GLsizei count) override
std::stringstream out;
out << mode << ", " << first << ", " << count;
TraceCallStack::NamedParams namedParams;
- namedParams["mode"] = ToString(mode);
+ namedParams["mode"] = ToString(mode);
namedParams["first"] = ToString(first);
namedParams["count"] = ToString(count);
mDrawTrace.PushCall("DrawArrays", out.str(), namedParams);
out << mode << ", " << count << ", " << type << ", indices";
TraceCallStack::NamedParams namedParams;
- namedParams["mode"] = ToString(mode);
+ namedParams["mode"] = ToString(mode);
namedParams["count"] = ToString(count);
- namedParams["type"] = ToString(type);
+ namedParams["type"] = ToString(type);
// Skip void pointers - are they of any use?
mDrawTrace.PushCall("DrawElements", out.str(), namedParams);
}
inline void EnableVertexAttribArray(GLuint index) override
{
- SetVertexAttribArray( index, true);
+ SetVertexAttribArray(index, true);
}
inline void Finish(void) override
inline void FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) override
{
- if (attachment == GL_DEPTH_ATTACHMENT)
+ if(attachment == GL_DEPTH_ATTACHMENT)
{
mFramebufferDepthAttached = true;
}
- else if (attachment == GL_STENCIL_ATTACHMENT)
+ else if(attachment == GL_STENCIL_ATTACHMENT)
{
mFramebufferStencilAttached = true;
}
mFramebufferStatus |= 4;
//We check 4 attachment colors
- if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS))
+ if((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS))
{
uint8_t mask = 1 << (attachment - GL_COLOR_ATTACHMENT0);
- if ((mFrameBufferColorStatus & mask) == 0)
+ if((mFrameBufferColorStatus & mask) == 0)
{
mFrameBufferColorStatus |= mask;
++mFramebufferColorAttachmentCount;
inline void GenerateMipmap(GLenum target) override
{
std::stringstream out;
- out<<target;
+ out << target;
TraceCallStack::NamedParams namedParams;
namedParams["target"] = ToString(target);
inline void GenFramebuffers(GLsizei n, GLuint* framebuffers) override
{
- for( int i = 0; i < n; i++ )
+ for(int i = 0; i < n; i++)
{
framebuffers[i] = i + 1;
}
inline void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) override
{
- for( int i = 0; i < n; i++ )
+ for(int i = 0; i < n; i++)
{
renderbuffers[i] = i + 1;
}
* This method can be used by test cases, to manipulate the texture IDs generated by GenTextures.
* @param[in] ids A vector containing the next IDs to be generated
*/
- inline void SetNextTextureIds( const std::vector<GLuint>& ids )
+ inline void SetNextTextureIds(const std::vector<GLuint>& ids)
{
mNextTextureIds = ids;
}
inline void GenTextures(GLsizei count, GLuint* textures) override
{
- for( int i=0; i<count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( !mNextTextureIds.empty() )
+ if(!mNextTextureIds.empty())
{
- *(textures+i) = mNextTextureIds[0];
- mNextTextureIds.erase( mNextTextureIds.begin() );
+ *(textures + i) = mNextTextureIds[0];
+ mNextTextureIds.erase(mNextTextureIds.begin());
}
else
{
- *(textures+i) = ++mLastAutoTextureIdUsed;
+ *(textures + i) = ++mLastAutoTextureIdUsed;
}
mNumGeneratedTextures++;
}
namedParams["count"] = ToString(count);
std::stringstream out;
- for(int i=0; i<count; i++)
+ for(int i = 0; i < count; i++)
{
out << textures[i];
- if(i<count-1)
+ if(i < count - 1)
{
out << ", ";
}
std::ostringstream oss;
- oss<<"indices["<<i<<"]";
+ oss << "indices[" << i << "]";
namedParams[oss.str()] = ToString(textures[i]);
}
{
case 0:
*length = snprintf(name, bufsize, "sTexture");
- *type = GL_SAMPLER_2D;
- *size = 1;
+ *type = GL_SAMPLER_2D;
+ *size = 1;
break;
case 1:
*length = snprintf(name, bufsize, "sEffect");
- *type = GL_SAMPLER_2D;
- *size = 1;
+ *type = GL_SAMPLER_2D;
+ *size = 1;
break;
case 2:
*length = snprintf(name, bufsize, "sGloss");
- *type = GL_SAMPLER_2D;
- *size = 1;
+ *type = GL_SAMPLER_2D;
+ *size = 1;
break;
default:
break;
{
}
- inline int GetAttribLocation(GLuint program, const char* name) override
+ inline int GetAttribLocation(GLuint program, const char* name) override
{
std::string attribName(name);
- for( unsigned int i = 0; i < ATTRIB_TYPE_LAST; ++i )
+ for(unsigned int i = 0; i < ATTRIB_TYPE_LAST; ++i)
{
- if( mStdAttribs[i] == attribName )
+ if(mStdAttribs[i] == attribName)
{
return i;
}
inline void GetIntegerv(GLenum pname, GLint* params) override
{
- switch( pname )
+ switch(pname)
{
case GL_MAX_TEXTURE_SIZE:
*params = 2048;
inline void GetProgramiv(GLuint program, GLenum pname, GLint* params) override
{
- switch( pname )
+ switch(pname)
{
case GL_LINK_STATUS:
*params = mLinkStatus;
inline void GetShaderiv(GLuint shader, GLenum pname, GLint* params) override
{
- switch( pname ) {
+ switch(pname)
+ {
case GL_COMPILE_STATUS:
*params = mCompileStatus;
break;
inline GLint GetUniformLocation(GLuint program, const char* name) override
{
ProgramUniformMap::iterator it = mUniforms.find(program);
- if( it == mUniforms.end() )
+ if(it == mUniforms.end())
{
// Not a valid program ID
mGetErrorResult = GL_INVALID_OPERATION;
return -1;
}
- UniformIDMap& uniformIDs = it->second;
- UniformIDMap::iterator it2 = uniformIDs.find( name );
- if( it2 == uniformIDs.end() )
+ UniformIDMap& uniformIDs = it->second;
+ UniformIDMap::iterator it2 = uniformIDs.find(name);
+ if(it2 == uniformIDs.end())
{
// Uniform not found, so add it...
uniformIDs[name] = ++mLastUniformIdUsed;
namedParams["program"] = ToString(program);
mShaderTrace.PushCall("LinkProgram", out.str(), namedParams);
- mNumberOfActiveUniforms=3;
+ mNumberOfActiveUniforms = 3;
GetUniformLocation(program, "sTexture");
GetUniformLocation(program, "sEffect");
GetUniformLocation(program, "sGloss");
inline void Scissor(GLint x, GLint y, GLsizei width, GLsizei height) override
{
- mScissorParams.x = x;
- mScissorParams.y = y;
- mScissorParams.width = width;
+ mScissorParams.x = x;
+ mScissorParams.y = y;
+ mScissorParams.width = width;
mScissorParams.height = height;
std::stringstream out;
out << x << ", " << y << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["x"] = ToString( x );
- namedParams["y"] = ToString( y );
- namedParams["width"] = ToString( width );
- namedParams["height"] = ToString( height );
- mScissorTrace.PushCall( "Scissor", out.str(), namedParams );
+ namedParams["x"] = ToString(x);
+ namedParams["y"] = ToString(y);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ mScissorTrace.PushCall("Scissor", out.str(), namedParams);
}
inline void ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) override
stringBuilder += string[i];
}
mShaderSources[shader] = stringBuilder;
- mLastShaderCompiled = shader;
+ mLastShaderCompiled = shader;
}
inline void GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) override
{
- const std::string shaderSource = mShaderSources[shader];
- const int shaderSourceLength = static_cast<int>(shaderSource.length());
- if( shaderSourceLength < bufsize )
+ const std::string shaderSource = mShaderSources[shader];
+ const int shaderSourceLength = static_cast<int>(shaderSource.length());
+ if(shaderSourceLength < bufsize)
{
- strncpy( source, shaderSource.c_str(), shaderSourceLength );
+ strncpy(source, shaderSource.c_str(), shaderSourceLength);
*length = shaderSourceLength;
}
else
{
- *length = bufsize -1;
+ *length = bufsize - 1;
strncpy(source, shaderSource.c_str(), *length);
source[*length] = 0x0;
}
out << func << ", " << ref << ", " << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["func"] = ToString( func );
- namedParams["ref"] = ToString( ref );
- namedParams["mask"] = ToString( mask );
+ namedParams["func"] = ToString(func);
+ namedParams["ref"] = ToString(ref);
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilFunc", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilFunc", out.str(), namedParams);
}
inline void StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) override
out << face << ", " << func << ", " << ref << ", " << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["face"] = ToString( face );
- namedParams["func"] = ToString( func );
- namedParams["ref"] = ToString( ref );
- namedParams["mask"] = ToString( mask );
+ namedParams["face"] = ToString(face);
+ namedParams["func"] = ToString(func);
+ namedParams["ref"] = ToString(ref);
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilFuncSeparate", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilFuncSeparate", out.str(), namedParams);
}
inline void StencilMask(GLuint mask) override
out << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["mask"] = ToString( mask );
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilMask", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilMask", out.str(), namedParams);
}
inline void StencilMaskSeparate(GLenum face, GLuint mask) override
out << face << ", " << mask;
TraceCallStack::NamedParams namedParams;
- namedParams["face"] = ToString( face );
- namedParams["mask"] = ToString( mask );
+ namedParams["face"] = ToString(face);
+ namedParams["mask"] = ToString(mask);
- mStencilFunctionTrace.PushCall( "StencilMaskSeparate", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilMaskSeparate", out.str(), namedParams);
}
inline void StencilOp(GLenum fail, GLenum zfail, GLenum zpass) override
out << fail << ", " << zfail << ", " << zpass;
TraceCallStack::NamedParams namedParams;
- namedParams["fail"] = ToString( fail );
- namedParams["zfail"] = ToString( zfail );
- namedParams["zpass"] = ToString( zpass );
+ namedParams["fail"] = ToString(fail);
+ namedParams["zfail"] = ToString(zfail);
+ namedParams["zpass"] = ToString(zpass);
- mStencilFunctionTrace.PushCall( "StencilOp", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilOp", out.str(), namedParams);
}
inline void StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) override
out << face << ", " << fail << ", " << zfail << "," << zpass;
TraceCallStack::NamedParams namedParams;
- namedParams["face"] = ToString( face );
- namedParams["fail"] = ToString( fail );
- namedParams["zfail"] = ToString( zfail );
- namedParams["zpass"] = ToString( zpass );
+ namedParams["face"] = ToString(face);
+ namedParams["fail"] = ToString(fail);
+ namedParams["zfail"] = ToString(zfail);
+ namedParams["zpass"] = ToString(zpass);
- mStencilFunctionTrace.PushCall( "StencilOpSeparate", out.str(), namedParams );
+ mStencilFunctionTrace.PushCall("StencilOpSeparate", out.str(), namedParams);
}
inline void TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) override
{
std::stringstream out;
- out << target<<", "<<level<<", "<<width << ", " << height;
+ out << target << ", " << level << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["internalformat"] = ToString(internalformat);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
- namedParams["border"] = ToString(border);
- namedParams["format"] = ToString(format);
- namedParams["type"] = ToString(type);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
+ namedParams["border"] = ToString(border);
+ namedParams["format"] = ToString(format);
+ namedParams["type"] = ToString(type);
mTextureTrace.PushCall("TexImage2D", out.str(), namedParams);
}
TraceCallStack::NamedParams namedParams;
namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
- namedParams["param"] = ToString(param);
+ namedParams["pname"] = ToString(pname);
+ namedParams["param"] = ToString(param);
mTexParamaterTrace.PushCall("TexParameterf", out.str(), namedParams);
}
out << target << ", " << pname << ", " << params[0];
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
namedParams["params[0]"] = ToString(params[0]);
mTexParamaterTrace.PushCall("TexParameterfv", out.str(), namedParams);
out << target << ", " << pname << ", " << param;
TraceCallStack::NamedParams namedParams;
namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
- namedParams["param"] = ToString(param);
+ namedParams["pname"] = ToString(pname);
+ namedParams["param"] = ToString(param);
mTexParamaterTrace.PushCall("TexParameteri", out.str(), namedParams);
}
std::stringstream out;
out << target << ", " << pname << ", " << params[0];
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["pname"] = ToString(pname);
+ namedParams["target"] = ToString(target);
+ namedParams["pname"] = ToString(pname);
namedParams["params[0]"] = ToString(params[0]);
mTexParamaterTrace.PushCall("TexParameteriv", out.str(), namedParams);
}
inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) override
{
std::stringstream out;
- out << target << ", "<<level <<", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
+ out << target << ", " << level << ", " << xoffset << ", " << yoffset << ", " << width << ", " << height;
TraceCallStack::NamedParams namedParams;
- namedParams["target"] = ToString(target);
- namedParams["level"] = ToString(level);
+ namedParams["target"] = ToString(target);
+ namedParams["level"] = ToString(level);
namedParams["xoffset"] = ToString(xoffset);
namedParams["yoffset"] = ToString(yoffset);
- namedParams["width"] = ToString(width);
- namedParams["height"] = ToString(height);
+ namedParams["width"] = ToString(width);
+ namedParams["height"] = ToString(height);
mTextureTrace.PushCall("TexSubImage2D", out.str(), namedParams);
}
- inline void Uniform1f(GLint location, GLfloat value ) override
+ inline void Uniform1f(GLint location, GLfloat value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, value ) )
+ if(!mProgramUniforms1f.SetUniformValue(mCurrentProgram, location, value))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1fv(GLint location, GLsizei count, const GLfloat* v) override
{
std::string params;
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- params = params + ToString( v[i] ) + ",";
+ params = params + ToString(v[i]) + ",";
}
- AddUniformCallToTraceStack( location, params );
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms1f.SetUniformValue( mCurrentProgram, location, v[i] ) )
+ if(!mProgramUniforms1f.SetUniformValue(mCurrentProgram, location, v[i]))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform1i(GLint location, GLint x) override
{
- std::string params = ToString( x );
+ std::string params = ToString(x);
- AddUniformCallToTraceStack( location, params );
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram, location, x ) )
+ if(!mProgramUniforms1i.SetUniformValue(mCurrentProgram, location, x))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform1iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms1i.SetUniformValue( mCurrentProgram,
- location,
- v[i] ) )
+ if(!mProgramUniforms1i.SetUniformValue(mCurrentProgram,
+ location,
+ v[i]))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform2f(GLint location, GLfloat x, GLfloat y) override
{
- std::string params = ToString( x ) + "," + ToString( y );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
- location,
- Vector2( x, y ) ) )
+ if(!mProgramUniforms2f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector2(x, y)))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform2fv(GLint location, GLsizei count, const GLfloat* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms2f.SetUniformValue( mCurrentProgram,
- location,
- Vector2( v[2*i], v[2*i+1] ) ) )
+ if(!mProgramUniforms2f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector2(v[2 * i], v[2 * i + 1])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform2i(GLint location, GLint x, GLint y) override
{
- std::string params = ToString( x ) + "," + ToString( y );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform2iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms3f.SetUniformValue( mCurrentProgram,
- location,
- Vector3( x, y, z ) ) )
+ if(!mProgramUniforms3f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector3(x, y, z)))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform3fv(GLint location, GLsizei count, const GLfloat* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms3f.SetUniformValue(
- mCurrentProgram,
- location,
- Vector3( v[3*i], v[3*i+1], v[3*i+2] ) ) )
+ if(!mProgramUniforms3f.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Vector3(v[3 * i], v[3 * i + 1], v[3 * i + 2])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform3i(GLint location, GLint x, GLint y, GLint z) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform3iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z) + "," + ToString(w);
+ AddUniformCallToTraceStack(location, params);
- if( ! mProgramUniforms4f.SetUniformValue( mCurrentProgram,
- location,
- Vector4( x, y, z, w ) ) )
+ if(!mProgramUniforms4f.SetUniformValue(mCurrentProgram,
+ location,
+ Vector4(x, y, z, w)))
{
mGetErrorResult = GL_INVALID_OPERATION;
}
inline void Uniform4fv(GLint location, GLsizei count, const GLfloat* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniforms4f.SetUniformValue(
- mCurrentProgram,
- location,
- Vector4( v[4*i], v[4*i+1], v[4*i+2], v[4*i+3] ) ) )
+ if(!mProgramUniforms4f.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Vector4(v[4 * i], v[4 * i + 1], v[4 * i + 2], v[4 * i + 3])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) override
{
- std::string params = ToString( x ) + "," + ToString( y ) + "," + ToString( z ) + "," + ToString( w );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(x) + "," + ToString(y) + "," + ToString(z) + "," + ToString(w);
+ AddUniformCallToTraceStack(location, params);
}
inline void Uniform4iv(GLint location, GLsizei count, const GLint* v) override
{
- std::string params = ToString( v );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(v);
+ AddUniformCallToTraceStack(location, params);
}
inline void UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
}
inline void UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniformsMat3.SetUniformValue(
- mCurrentProgram,
- location,
- Matrix3( value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8] ) ) )
+ if(!mProgramUniformsMat3.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Matrix3(value[0], value[1], value[2], value[3], value[4], value[5], value[6], value[7], value[8])))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) override
{
- std::string params = ToString( value );
- AddUniformCallToTraceStack( location, params );
+ std::string params = ToString(value);
+ AddUniformCallToTraceStack(location, params);
- for( int i = 0; i < count; ++i )
+ for(int i = 0; i < count; ++i)
{
- if( ! mProgramUniformsMat4.SetUniformValue(
- mCurrentProgram,
- location,
- Matrix( value ) ) )
+ if(!mProgramUniformsMat4.SetUniformValue(
+ mCurrentProgram,
+ location,
+ Matrix(value)))
{
mGetErrorResult = GL_INVALID_OPERATION;
break;
inline void Viewport(GLint x, GLint y, GLsizei width, GLsizei height) override
{
std::string commaString(", ");
- std::string params( std::to_string(x) + commaString + std::to_string(y) + commaString + std::to_string(width) + commaString + std::to_string(height) );
+ std::string params(std::to_string(x) + commaString + std::to_string(y) + commaString + std::to_string(width) + commaString + std::to_string(height));
mViewportTrace.PushCall("Viewport", params);
}
{
}
- inline GLint GetFragDataLocation(GLuint program, const GLchar *name) override
+ inline GLint GetFragDataLocation(GLuint program, const GLchar* name) override
{
return -1;
}
}
private:
-
- inline void AddUniformCallToTraceStack( GLint location, std::string& value )
- {
- std::string name = "<not found>";
- bool matched = false;
+ inline void AddUniformCallToTraceStack(GLint location, std::string& value)
+ {
+ std::string name = "<not found>";
+ bool matched = false;
UniformIDMap& map = mUniforms[mCurrentProgram];
- for (UniformIDMap::iterator it=map.begin(); it!=map.end(); ++it)
+ for(UniformIDMap::iterator it = map.begin(); it != map.end(); ++it)
{
- if( it->second == location )
+ if(it->second == location)
{
- name = it->first;
+ name = it->first;
matched = true;
break;
}
}
- if ( matched )
+ if(matched)
{
- mSetUniformTrace.PushCall( name, value );
+ mSetUniformTrace.PushCall(name, value);
}
}
-
public: // TEST FUNCTIONS
- inline void SetCompileStatus( GLuint value ) { mCompileStatus = value; }
- inline void SetLinkStatus( GLuint value ) { mLinkStatus = value; }
- inline void SetGetAttribLocationResult( int result) { mGetAttribLocationResult = result; }
- inline void SetGetErrorResult( GLenum result) { mGetErrorResult = result; }
- inline void SetGetStringResult( GLubyte* result) { mGetStringResult = result; }
- inline void SetIsBufferResult( GLboolean result) { mIsBufferResult = result; }
- inline void SetIsEnabledResult( GLboolean result) { mIsEnabledResult = result; }
- inline void SetIsFramebufferResult( GLboolean result) { mIsFramebufferResult = result; }
- inline void SetIsProgramResult( GLboolean result) { mIsProgramResult = result; }
- inline void SetIsRenderbufferResult( GLboolean result) { mIsRenderbufferResult = result; }
- inline void SetIsShaderResult( GLboolean result) { mIsShaderResult = result; }
- inline void SetIsTextureResult( GLboolean result) { mIsTextureResult = result; }
- inline void SetCheckFramebufferStatusResult( GLenum result) { mCheckFramebufferStatusResult = result; }
- inline void SetNumBinaryFormats( GLint numFormats ) { mNumBinaryFormats = numFormats; }
- inline void SetBinaryFormats( GLint binaryFormats ) { mBinaryFormats = binaryFormats; }
- inline void SetProgramBinaryLength( GLint length ) { mProgramBinaryLength = length; }
+ inline void SetCompileStatus(GLuint value)
+ {
+ mCompileStatus = value;
+ }
+ inline void SetLinkStatus(GLuint value)
+ {
+ mLinkStatus = value;
+ }
+ inline void SetGetAttribLocationResult(int result)
+ {
+ mGetAttribLocationResult = result;
+ }
+ inline void SetGetErrorResult(GLenum result)
+ {
+ mGetErrorResult = result;
+ }
+ inline void SetGetStringResult(GLubyte* result)
+ {
+ mGetStringResult = result;
+ }
+ inline void SetIsBufferResult(GLboolean result)
+ {
+ mIsBufferResult = result;
+ }
+ inline void SetIsEnabledResult(GLboolean result)
+ {
+ mIsEnabledResult = result;
+ }
+ inline void SetIsFramebufferResult(GLboolean result)
+ {
+ mIsFramebufferResult = result;
+ }
+ inline void SetIsProgramResult(GLboolean result)
+ {
+ mIsProgramResult = result;
+ }
+ inline void SetIsRenderbufferResult(GLboolean result)
+ {
+ mIsRenderbufferResult = result;
+ }
+ inline void SetIsShaderResult(GLboolean result)
+ {
+ mIsShaderResult = result;
+ }
+ inline void SetIsTextureResult(GLboolean result)
+ {
+ mIsTextureResult = result;
+ }
+ inline void SetCheckFramebufferStatusResult(GLenum result)
+ {
+ mCheckFramebufferStatusResult = result;
+ }
+ inline void SetNumBinaryFormats(GLint numFormats)
+ {
+ mNumBinaryFormats = numFormats;
+ }
+ inline void SetBinaryFormats(GLint binaryFormats)
+ {
+ mBinaryFormats = binaryFormats;
+ }
+ inline void SetProgramBinaryLength(GLint length)
+ {
+ mProgramBinaryLength = length;
+ }
inline bool GetVertexAttribArrayState(GLuint index)
{
- if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
+ if(index >= MAX_ATTRIBUTE_CACHE_SIZE)
{
// out of range
return false;
}
- return mVertexAttribArrayState[ index ];
+ return mVertexAttribArrayState[index];
+ }
+ inline void ClearVertexAttribArrayChanged()
+ {
+ mVertexAttribArrayChanged = false;
+ }
+ inline bool GetVertexAttribArrayChanged()
+ {
+ return mVertexAttribArrayChanged;
}
- inline void ClearVertexAttribArrayChanged() { mVertexAttribArrayChanged = false; }
- inline bool GetVertexAttribArrayChanged() { return mVertexAttribArrayChanged; }
//Methods for CullFace verification
- inline void EnableCullFaceCallTrace(bool enable) { mCullFaceTrace.Enable(enable); }
- inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); }
- inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; }
+ inline void EnableCullFaceCallTrace(bool enable)
+ {
+ mCullFaceTrace.Enable(enable);
+ }
+ inline void ResetCullFaceCallStack()
+ {
+ mCullFaceTrace.Reset();
+ }
+ inline TraceCallStack& GetCullFaceTrace()
+ {
+ return mCullFaceTrace;
+ }
//Methods for Enable/Disable call verification
- inline void EnableEnableDisableCallTrace(bool enable) { mEnableDisableTrace.Enable(enable); }
- inline void ResetEnableDisableCallStack() { mEnableDisableTrace.Reset(); }
- inline TraceCallStack& GetEnableDisableTrace() { return mEnableDisableTrace; }
+ inline void EnableEnableDisableCallTrace(bool enable)
+ {
+ mEnableDisableTrace.Enable(enable);
+ }
+ inline void ResetEnableDisableCallStack()
+ {
+ mEnableDisableTrace.Reset();
+ }
+ inline TraceCallStack& GetEnableDisableTrace()
+ {
+ return mEnableDisableTrace;
+ }
//Methods for Shader verification
- inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); }
- inline void ResetShaderCallStack() { mShaderTrace.Reset(); }
- inline TraceCallStack& GetShaderTrace() { return mShaderTrace; }
+ inline void EnableShaderCallTrace(bool enable)
+ {
+ mShaderTrace.Enable(enable);
+ }
+ inline void ResetShaderCallStack()
+ {
+ mShaderTrace.Reset();
+ }
+ inline TraceCallStack& GetShaderTrace()
+ {
+ return mShaderTrace;
+ }
//Methods for Texture verification
- inline void EnableTextureCallTrace(bool enable) { mTextureTrace.Enable(enable); }
- inline void ResetTextureCallStack() { mTextureTrace.Reset(); }
- inline TraceCallStack& GetTextureTrace() { return mTextureTrace; }
+ inline void EnableTextureCallTrace(bool enable)
+ {
+ mTextureTrace.Enable(enable);
+ }
+ inline void ResetTextureCallStack()
+ {
+ mTextureTrace.Reset();
+ }
+ inline TraceCallStack& GetTextureTrace()
+ {
+ return mTextureTrace;
+ }
//Methods for Texture verification
- inline void EnableTexParameterCallTrace(bool enable) { mTexParamaterTrace.Enable(enable); }
- inline void ResetTexParameterCallStack() { mTexParamaterTrace.Reset(); }
- inline TraceCallStack& GetTexParameterTrace() { return mTexParamaterTrace; }
+ inline void EnableTexParameterCallTrace(bool enable)
+ {
+ mTexParamaterTrace.Enable(enable);
+ }
+ inline void ResetTexParameterCallStack()
+ {
+ mTexParamaterTrace.Reset();
+ }
+ inline TraceCallStack& GetTexParameterTrace()
+ {
+ return mTexParamaterTrace;
+ }
//Methods for Draw verification
- inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); }
- inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
- inline TraceCallStack& GetDrawTrace() { return mDrawTrace; }
+ inline void EnableDrawCallTrace(bool enable)
+ {
+ mDrawTrace.Enable(enable);
+ }
+ inline void ResetDrawCallStack()
+ {
+ mDrawTrace.Reset();
+ }
+ inline TraceCallStack& GetDrawTrace()
+ {
+ return mDrawTrace;
+ }
//Methods for Depth function verification
- inline void EnableDepthFunctionCallTrace(bool enable) { mDepthFunctionTrace.Enable(enable); }
- inline void ResetDepthFunctionCallStack() { mDepthFunctionTrace.Reset(); }
- inline TraceCallStack& GetDepthFunctionTrace() { return mDepthFunctionTrace; }
+ inline void EnableDepthFunctionCallTrace(bool enable)
+ {
+ mDepthFunctionTrace.Enable(enable);
+ }
+ inline void ResetDepthFunctionCallStack()
+ {
+ mDepthFunctionTrace.Reset();
+ }
+ inline TraceCallStack& GetDepthFunctionTrace()
+ {
+ return mDepthFunctionTrace;
+ }
//Methods for Stencil function verification
- inline void EnableStencilFunctionCallTrace(bool enable) { mStencilFunctionTrace.Enable(enable); }
- inline void ResetStencilFunctionCallStack() { mStencilFunctionTrace.Reset(); }
- inline TraceCallStack& GetStencilFunctionTrace() { return mStencilFunctionTrace; }
+ inline void EnableStencilFunctionCallTrace(bool enable)
+ {
+ mStencilFunctionTrace.Enable(enable);
+ }
+ inline void ResetStencilFunctionCallStack()
+ {
+ mStencilFunctionTrace.Reset();
+ }
+ inline TraceCallStack& GetStencilFunctionTrace()
+ {
+ return mStencilFunctionTrace;
+ }
//Methods for Scissor verification
- inline void EnableScissorCallTrace(bool enable) { mScissorTrace.Enable(enable); }
- inline void ResetScissorCallStack() { mScissorTrace.Reset(); }
- inline TraceCallStack& GetScissorTrace() { return mScissorTrace; }
+ inline void EnableScissorCallTrace(bool enable)
+ {
+ mScissorTrace.Enable(enable);
+ }
+ inline void ResetScissorCallStack()
+ {
+ mScissorTrace.Reset();
+ }
+ inline TraceCallStack& GetScissorTrace()
+ {
+ return mScissorTrace;
+ }
//Methods for Uniform function verification
- inline void EnableSetUniformCallTrace(bool enable) { mSetUniformTrace.Enable(enable); }
- inline void ResetSetUniformCallStack() { mSetUniformTrace.Reset(); }
- inline TraceCallStack& GetSetUniformTrace() { return mSetUniformTrace; }
+ inline void EnableSetUniformCallTrace(bool enable)
+ {
+ mSetUniformTrace.Enable(enable);
+ }
+ inline void ResetSetUniformCallStack()
+ {
+ mSetUniformTrace.Reset();
+ }
+ inline TraceCallStack& GetSetUniformTrace()
+ {
+ return mSetUniformTrace;
+ }
//Methods for Viewport verification
- inline void EnableViewportCallTrace(bool enable) { mViewportTrace.Enable(enable); }
- inline void ResetViewportCallStack() { mViewportTrace.Reset(); }
- inline TraceCallStack& GetViewportTrace() { return mViewportTrace; }
+ inline void EnableViewportCallTrace(bool enable)
+ {
+ mViewportTrace.Enable(enable);
+ }
+ inline void ResetViewportCallStack()
+ {
+ mViewportTrace.Reset();
+ }
+ inline TraceCallStack& GetViewportTrace()
+ {
+ return mViewportTrace;
+ }
- template <typename T>
- inline bool GetUniformValue( const char* name, T& value ) const
+ template<typename T>
+ inline bool GetUniformValue(const char* name, T& value) const
{
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
// found one matching uniform name, lets check the value...
GLuint programId = program_it->first;
- GLint uniformId = uniform_it->second;
+ GLint uniformId = uniform_it->second;
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
- return mProgramUniforms.GetUniformValue( programId, uniformId, value );
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(value);
+ return mProgramUniforms.GetUniformValue(programId, uniformId, value);
}
}
return false;
}
-
- template <typename T>
- inline bool CheckUniformValue( const char* name, const T& value ) const
+ template<typename T>
+ inline bool CheckUniformValue(const char* name, const T& value) const
{
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
// found one matching uniform name, lets check the value...
GLuint programId = program_it->first;
- GLint uniformId = uniform_it->second;
+ GLint uniformId = uniform_it->second;
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
- if( mProgramUniforms.CheckUniformValue( programId, uniformId, value ) )
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(value);
+ if(mProgramUniforms.CheckUniformValue(programId, uniformId, value))
{
// the value matches
return true;
}
}
- fprintf(stderr, "Not found, printing possible values:\n" );
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ fprintf(stderr, "Not found, printing possible values:\n");
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
// found one matching uniform name, lets check the value...
GLuint programId = program_it->first;
- GLint uniformId = uniform_it->second;
+ GLint uniformId = uniform_it->second;
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( value );
- T origValue;
- if ( mProgramUniforms.GetUniformValue(programId, uniformId, origValue) )
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(value);
+ T origValue;
+ if(mProgramUniforms.GetUniformValue(programId, uniformId, origValue))
{
std::stringstream out;
out << uniform_it->first << ": " << origValue;
- fprintf(stderr, "%s\n", out.str().c_str() );
+ fprintf(stderr, "%s\n", out.str().c_str());
}
}
}
return false;
}
- template <typename T>
- inline bool GetUniformValue( GLuint programId, GLuint uniformId, T& outValue) const
+ template<typename T>
+ inline bool GetUniformValue(GLuint programId, GLuint uniformId, T& outValue) const
{
- const ProgramUniformValue<T> &mProgramUniforms = GetProgramUniformsForType( outValue );
- return mProgramUniforms.GetUniformValue( programId, uniformId, outValue );
+ const ProgramUniformValue<T>& mProgramUniforms = GetProgramUniformsForType(outValue);
+ return mProgramUniforms.GetUniformValue(programId, uniformId, outValue);
}
- inline bool GetUniformIds( const char* name, GLuint& programId, GLuint& uniformId ) const
+ inline bool GetUniformIds(const char* name, GLuint& programId, GLuint& uniformId) const
{
- for( ProgramUniformMap::const_iterator program_it = mUniforms.begin();
- program_it != mUniforms.end();
- ++program_it )
+ for(ProgramUniformMap::const_iterator program_it = mUniforms.begin();
+ program_it != mUniforms.end();
+ ++program_it)
{
- const UniformIDMap &uniformIDs = program_it->second;
+ const UniformIDMap& uniformIDs = program_it->second;
- UniformIDMap::const_iterator uniform_it = uniformIDs.find( name );
- if( uniform_it != uniformIDs.end() )
+ UniformIDMap::const_iterator uniform_it = uniformIDs.find(name);
+ if(uniform_it != uniformIDs.end())
{
programId = program_it->first;
uniformId = uniform_it->second;
struct ScissorParams
{
- GLint x;
- GLint y;
+ GLint x;
+ GLint y;
GLsizei width;
GLsizei height;
- ScissorParams() : x( 0 ), y( 0 ), width( 0 ), height( 0 ) { }
+ ScissorParams()
+ : x(0),
+ y(0),
+ width(0),
+ height(0)
+ {
+ }
};
// Methods to check scissor tests
- inline const ScissorParams& GetScissorParams() const { return mScissorParams; }
+ inline const ScissorParams& GetScissorParams() const
+ {
+ return mScissorParams;
+ }
struct ColorMaskParams
{
GLboolean blue;
GLboolean alpha;
- ColorMaskParams() : red( true ), green( true ), blue( true ), alpha( true ) { }
+ ColorMaskParams()
+ : red(true),
+ green(true),
+ blue(true),
+ alpha(true)
+ {
+ }
};
- inline bool GetProgramBinaryCalled() const { return mGetProgramBinaryCalled; }
+ inline bool GetProgramBinaryCalled() const
+ {
+ return mGetProgramBinaryCalled;
+ }
- inline unsigned int GetClearCountCalled() const { return mClearCount; }
+ inline unsigned int GetClearCountCalled() const
+ {
+ return mClearCount;
+ }
- inline const ColorMaskParams& GetColorMaskParams() const { return mColorMaskParams; }
+ inline const ColorMaskParams& GetColorMaskParams() const
+ {
+ return mColorMaskParams;
+ }
- typedef std::vector<size_t> BufferDataCalls;
- inline const BufferDataCalls& GetBufferDataCalls() const { return mBufferDataCalls; }
- inline void ResetBufferDataCalls() { mBufferDataCalls.clear(); }
+ typedef std::vector<size_t> BufferDataCalls;
+ inline const BufferDataCalls& GetBufferDataCalls() const
+ {
+ return mBufferDataCalls;
+ }
+ inline void ResetBufferDataCalls()
+ {
+ mBufferDataCalls.clear();
+ }
- typedef std::vector<size_t> BufferSubDataCalls;
- inline const BufferSubDataCalls& GetBufferSubDataCalls() const { return mBufferSubDataCalls; }
- inline void ResetBufferSubDataCalls() { mBufferSubDataCalls.clear(); }
+ typedef std::vector<size_t> BufferSubDataCalls;
+ inline const BufferSubDataCalls& GetBufferSubDataCalls() const
+ {
+ return mBufferSubDataCalls;
+ }
+ inline void ResetBufferSubDataCalls()
+ {
+ mBufferSubDataCalls.clear();
+ }
private:
- GLuint mCurrentProgram;
- GLuint mCompileStatus;
- BufferDataCalls mBufferDataCalls;
- BufferSubDataCalls mBufferSubDataCalls;
- GLuint mLinkStatus;
- GLint mNumberOfActiveUniforms;
- GLint mGetAttribLocationResult;
- GLenum mGetErrorResult;
- GLubyte* mGetStringResult;
- GLboolean mIsBufferResult;
- GLboolean mIsEnabledResult;
- GLboolean mIsFramebufferResult;
- GLboolean mIsProgramResult;
- GLboolean mIsRenderbufferResult;
- GLboolean mIsShaderResult;
- GLboolean mIsTextureResult;
- GLenum mActiveTextureUnit;
- GLenum mCheckFramebufferStatusResult;
- GLint mFramebufferStatus;
- GLenum mFramebufferDepthAttached;
- GLenum mFramebufferStencilAttached;
- GLuint mFramebufferColorAttachmentCount;
- GLuint mFrameBufferColorStatus;
- GLint mNumBinaryFormats;
- GLint mBinaryFormats;
- GLint mProgramBinaryLength;
- bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE];
- bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed
- bool mGetProgramBinaryCalled;
- typedef std::map< GLuint, std::string> ShaderSourceMap;
- ShaderSourceMap mShaderSources;
- GLuint mLastShaderCompiled;
- GLbitfield mLastClearBitMask;
- Vector4 mLastClearColor;
- unsigned int mClearCount;
+ GLuint mCurrentProgram;
+ GLuint mCompileStatus;
+ BufferDataCalls mBufferDataCalls;
+ BufferSubDataCalls mBufferSubDataCalls;
+ GLuint mLinkStatus;
+ GLint mNumberOfActiveUniforms;
+ GLint mGetAttribLocationResult;
+ GLenum mGetErrorResult;
+ GLubyte* mGetStringResult;
+ GLboolean mIsBufferResult;
+ GLboolean mIsEnabledResult;
+ GLboolean mIsFramebufferResult;
+ GLboolean mIsProgramResult;
+ GLboolean mIsRenderbufferResult;
+ GLboolean mIsShaderResult;
+ GLboolean mIsTextureResult;
+ GLenum mActiveTextureUnit;
+ GLenum mCheckFramebufferStatusResult;
+ GLint mFramebufferStatus;
+ GLenum mFramebufferDepthAttached;
+ GLenum mFramebufferStencilAttached;
+ GLuint mFramebufferColorAttachmentCount;
+ GLuint mFrameBufferColorStatus;
+ GLint mNumBinaryFormats;
+ GLint mBinaryFormats;
+ GLint mProgramBinaryLength;
+ bool mVertexAttribArrayState[MAX_ATTRIBUTE_CACHE_SIZE];
+ bool mVertexAttribArrayChanged; // whether the vertex attrib array has been changed
+ bool mGetProgramBinaryCalled;
+ typedef std::map<GLuint, std::string> ShaderSourceMap;
+ ShaderSourceMap mShaderSources;
+ GLuint mLastShaderCompiled;
+ GLbitfield mLastClearBitMask;
+ Vector4 mLastClearColor;
+ unsigned int mClearCount;
Vector4 mLastBlendColor;
GLenum mLastBlendEquationRgb;
GLboolean mLastDepthMask;
// Data for manipulating the IDs returned by GenTextures
- GLuint mLastAutoTextureIdUsed;
- GLuint mNumGeneratedTextures;
+ GLuint mLastAutoTextureIdUsed;
+ GLuint mNumGeneratedTextures;
std::vector<GLuint> mNextTextureIds;
std::vector<GLuint> mDeletedTextureIds;
std::vector<GLuint> mBoundTextures;
std::vector<GLuint> mBoundTextures;
};
- ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ];
+ ActiveTextureType mActiveTextures[MIN_TEXTURE_UNIT_LIMIT];
TraceCallStack mCullFaceTrace;
TraceCallStack mEnableDisableTrace;
TraceCallStack mViewportTrace;
// Shaders & Uniforms
- GLuint mLastShaderIdUsed;
- GLuint mLastProgramIdUsed;
- GLuint mLastUniformIdUsed;
- typedef std::map< std::string, GLint > UniformIDMap;
- typedef std::map< GLuint, UniformIDMap > ProgramUniformMap;
- ProgramUniformMap mUniforms;
+ GLuint mLastShaderIdUsed;
+ GLuint mLastProgramIdUsed;
+ GLuint mLastUniformIdUsed;
+ typedef std::map<std::string, GLint> UniformIDMap;
+ typedef std::map<GLuint, UniformIDMap> ProgramUniformMap;
+ ProgramUniformMap mUniforms;
- template <typename T>
- struct ProgramUniformValue : public std::map< GLuint, std::map< GLint, T > >
+ template<typename T>
+ struct ProgramUniformValue : public std::map<GLuint, std::map<GLint, T> >
{
public:
- typedef std::map< GLint, T > UniformValueMap;
- typedef std::map< GLuint, UniformValueMap > Map;
+ typedef std::map<GLint, T> UniformValueMap;
+ typedef std::map<GLuint, UniformValueMap> Map;
- bool SetUniformValue( GLuint program, GLuint uniform, const T& value )
+ bool SetUniformValue(GLuint program, GLuint uniform, const T& value)
{
- if( program == 0 )
+ if(program == 0)
{
return false;
}
- typename Map::iterator it = Map::find( program );
- if( it == Map::end() )
+ typename Map::iterator it = Map::find(program);
+ if(it == Map::end())
{
// if its the first uniform for this program add it
- std::pair< typename Map::iterator, bool > result =
- Map::insert( typename Map::value_type( program, UniformValueMap() ) );
+ std::pair<typename Map::iterator, bool> result =
+ Map::insert(typename Map::value_type(program, UniformValueMap()));
it = result.first;
}
UniformValueMap& uniforms = it->second;
- uniforms[uniform] = value;
+ uniforms[uniform] = value;
return true;
}
- bool CheckUniformValue( GLuint program, GLuint uniform, const T& value ) const
+ bool CheckUniformValue(GLuint program, GLuint uniform, const T& value) const
{
T uniformValue;
- if ( GetUniformValue( program, uniform, uniformValue ) )
+ if(GetUniformValue(program, uniform, uniformValue))
{
return CompareType<T>(value, uniformValue, Math::MACHINE_EPSILON_10);
}
return false;
}
- bool GetUniformValue( GLuint program, GLuint uniform, T& value ) const
+ bool GetUniformValue(GLuint program, GLuint uniform, T& value) const
{
- if( program == 0 )
+ if(program == 0)
{
return false;
}
- typename Map::const_iterator it = Map::find( program );
- if( it == Map::end() )
+ typename Map::const_iterator it = Map::find(program);
+ if(it == Map::end())
{
// Uniform values always initialised as 0
value = GetZero();
return true;
}
- const UniformValueMap& uniforms = it->second;
- typename UniformValueMap::const_iterator it2 = uniforms.find( uniform );
- if( it2 == uniforms.end() )
+ const UniformValueMap& uniforms = it->second;
+ typename UniformValueMap::const_iterator it2 = uniforms.find(uniform);
+ if(it2 == uniforms.end())
{
// Uniform values always initialised as 0
value = GetZero();
T GetZero() const;
};
- ProgramUniformValue<int> mProgramUniforms1i;
- ProgramUniformValue<float> mProgramUniforms1f;
+ ProgramUniformValue<int> mProgramUniforms1i;
+ ProgramUniformValue<float> mProgramUniforms1f;
ProgramUniformValue<Vector2> mProgramUniforms2f;
ProgramUniformValue<Vector3> mProgramUniforms3f;
ProgramUniformValue<Vector4> mProgramUniforms4f;
- ProgramUniformValue<Matrix> mProgramUniformsMat4;
+ ProgramUniformValue<Matrix> mProgramUniformsMat4;
ProgramUniformValue<Matrix3> mProgramUniformsMat3;
- inline const ProgramUniformValue<int>& GetProgramUniformsForType( const int ) const
+ inline const ProgramUniformValue<int>& GetProgramUniformsForType(const int) const
{
return mProgramUniforms1i;
}
- inline const ProgramUniformValue<float>& GetProgramUniformsForType( const float ) const
+ inline const ProgramUniformValue<float>& GetProgramUniformsForType(const float) const
{
return mProgramUniforms1f;
}
- inline const ProgramUniformValue<Vector2>& GetProgramUniformsForType( const Vector2& ) const
+ inline const ProgramUniformValue<Vector2>& GetProgramUniformsForType(const Vector2&) const
{
return mProgramUniforms2f;
}
- inline const ProgramUniformValue<Vector3>& GetProgramUniformsForType( const Vector3& ) const
+ inline const ProgramUniformValue<Vector3>& GetProgramUniformsForType(const Vector3&) const
{
return mProgramUniforms3f;
}
- inline const ProgramUniformValue<Vector4>& GetProgramUniformsForType( const Vector4& ) const
+ inline const ProgramUniformValue<Vector4>& GetProgramUniformsForType(const Vector4&) const
{
return mProgramUniforms4f;
}
- inline const ProgramUniformValue<Matrix>& GetProgramUniformsForType( const Matrix& ) const
+ inline const ProgramUniformValue<Matrix>& GetProgramUniformsForType(const Matrix&) const
{
return mProgramUniformsMat4;
}
- inline const ProgramUniformValue<Matrix3>& GetProgramUniformsForType( const Matrix3& ) const
+ inline const ProgramUniformValue<Matrix3>& GetProgramUniformsForType(const Matrix3&) const
{
return mProgramUniformsMat3;
}
inline void SetVertexAttribArray(GLuint index, bool state)
{
- if( index >= MAX_ATTRIBUTE_CACHE_SIZE )
+ if(index >= MAX_ATTRIBUTE_CACHE_SIZE)
{
// out of range
return;
}
- mVertexAttribArrayState[ index ] = state;
- mVertexAttribArrayChanged = true;
+ mVertexAttribArrayState[index] = state;
+ mVertexAttribArrayChanged = true;
}
- ScissorParams mScissorParams;
+ ScissorParams mScissorParams;
ColorMaskParams mColorMaskParams;
};
-template <>
+template<>
inline int TestGlAbstraction::ProgramUniformValue<int>::GetZero() const
{
return 0;
}
-template <>
+template<>
inline float TestGlAbstraction::ProgramUniformValue<float>::GetZero() const
{
return 0.0f;
}
-template <>
+template<>
inline Vector2 TestGlAbstraction::ProgramUniformValue<Vector2>::GetZero() const
{
return Vector2::ZERO;
}
-template <>
+template<>
inline Vector3 TestGlAbstraction::ProgramUniformValue<Vector3>::GetZero() const
{
return Vector3::ZERO;
}
-template <>
+template<>
inline Vector4 TestGlAbstraction::ProgramUniformValue<Vector4>::GetZero() const
{
return Vector4::ZERO;
}
-template <>
+template<>
inline Matrix TestGlAbstraction::ProgramUniformValue<Matrix>::GetZero() const
{
return Matrix();
}
-template <>
+template<>
inline Matrix3 TestGlAbstraction::ProgramUniformValue<Matrix3>::GetZero() const
{
- return Matrix3( Matrix() );
+ return Matrix3(Matrix());
}
} // namespace Dali
bool BlendEnabled(const Dali::TraceCallStack& callStack);
bool BlendDisabled(const Dali::TraceCallStack& callStack);
-
#endif // TEST_GL_ABSTRACTION_H
namespace Dali
{
-
/**
* Class to emulate the GL context helper
*/
-class DALI_CORE_API TestGlContextHelperAbstraction: public Integration::GlContextHelperAbstraction
+class DALI_CORE_API TestGlContextHelperAbstraction : public Integration::GlContextHelperAbstraction
{
public:
/**
* Constructor
*/
- TestGlContextHelperAbstraction() {};
+ TestGlContextHelperAbstraction(){};
/**
* Destructor
*/
- ~TestGlContextHelperAbstraction() override {};
+ ~TestGlContextHelperAbstraction() override{};
/**
* @brief Switch to the surfaceless GL context
*/
- void MakeSurfacelessContextCurrent() override {};
+ void MakeSurfacelessContextCurrent() override{};
/**
* @brief Clear the GL context
*/
- void MakeContextNull() override {};
+ void MakeContextNull() override{};
/**
* @brief Wait until all GL rendering calls for the current GL context are executed
*/
- void WaitClient() override {};
+ void WaitClient() override{};
private:
-
- TestGlContextHelperAbstraction( const TestGlContextHelperAbstraction& ); ///< Undefined
- TestGlContextHelperAbstraction& operator=( const TestGlContextHelperAbstraction& ); ///< Undefined
+ TestGlContextHelperAbstraction(const TestGlContextHelperAbstraction&); ///< Undefined
+ TestGlContextHelperAbstraction& operator=(const TestGlContextHelperAbstraction&); ///< Undefined
};
-} // Dali
+} // namespace Dali
#endif // TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
namespace Dali
{
-
TestSyncObject::TestSyncObject(TraceCallStack& trace)
: synced(false),
mTrace(trace)
return synced;
}
-
-
TestGlSyncAbstraction::TestGlSyncAbstraction()
{
Initialize();
*/
TestGlSyncAbstraction::~TestGlSyncAbstraction()
{
- for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
+ for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter)
{
delete *iter;
}
* Create a sync object
* @return the sync object
*/
-Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( )
+Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject()
{
mTrace.PushCall("CreateSyncObject", ""); // Trace the method
TestSyncObject* syncObject = new TestSyncObject(mTrace);
- mSyncObjects.push_back( syncObject );
+ mSyncObjects.push_back(syncObject);
return syncObject;
}
* Destroy a sync object
* @param[in] syncObject The object to destroy
*/
-void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
+void TestGlSyncAbstraction::DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject)
{
std::stringstream out;
out << syncObject;
mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method
- for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
+ for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter)
{
- if( *iter == syncObject )
+ if(*iter == syncObject)
{
delete *iter;
mSyncObjects.erase(iter);
}
}
-
-Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( )
+Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject()
{
- if( !mSyncObjects.empty() )
+ if(!mSyncObjects.empty())
{
return mSyncObjects.back();
}
* @param[in]
* @param[in] sync The sync value to set
*/
-void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync )
+void TestGlSyncAbstraction::SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync)
{
TestSyncObject* testSyncObject = static_cast<TestSyncObject*>(syncObject);
- testSyncObject->synced = sync;
+ testSyncObject->synced = sync;
}
/**
* Turn trace on
*/
-void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); }
+void TestGlSyncAbstraction::EnableTrace(bool enable)
+{
+ mTrace.Enable(enable);
+}
/**
* Reset the trace callstack
*/
-void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); }
+void TestGlSyncAbstraction::ResetTrace()
+{
+ mTrace.Reset();
+}
/**
* Get the trace object (allows test case to find methods on it)
*/
-TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; }
+TraceCallStack& TestGlSyncAbstraction::GetTrace()
+{
+ return mTrace;
+}
int32_t TestGlSyncAbstraction::GetNumberOfSyncObjects()
{
- return static_cast<int32_t>( mSyncObjects.size() );
+ return static_cast<int32_t>(mSyncObjects.size());
}
-
-} // Dali
+} // namespace Dali
#define TEST_GL_SYNC_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// EXTERNAL INCLUDES
+#include <map>
#include <sstream>
#include <string>
-#include <map>
// INTERNAL INCLUDES
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-sync-abstraction.h>
+
#include "test-trace-call-stack.h"
namespace Dali
{
-
class DALI_CORE_API TestSyncObject : public Integration::GlSyncAbstraction::SyncObject
{
public:
TestSyncObject(TraceCallStack& trace);
~TestSyncObject() override;
- bool IsSynced() override;
- bool synced;
+ bool IsSynced() override;
+ bool synced;
TraceCallStack& mTrace;
};
/**
* Class to emulate the GL sync functions with tracing
*/
-class DALI_CORE_API TestGlSyncAbstraction: public Integration::GlSyncAbstraction
+class DALI_CORE_API TestGlSyncAbstraction : public Integration::GlSyncAbstraction
{
public:
/**
* Create a sync object
* @return the sync object
*/
- Integration::GlSyncAbstraction::SyncObject* CreateSyncObject( ) override;
+ Integration::GlSyncAbstraction::SyncObject* CreateSyncObject() override;
/**
* Destroy a sync object
* @param[in] syncObject The object to destroy
*/
- void DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject ) override;
-
+ void DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject) override;
public: // TEST FUNCTIONS
- Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject( );
+ Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject();
/**
* Test method to trigger the object sync behaviour.
* @param[in]
* @param[in] sync The sync value to set
*/
- void SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync );
+ void SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync);
/**
* Turn trace on
int32_t GetNumberOfSyncObjects();
private:
+ TestGlSyncAbstraction(const TestGlSyncAbstraction&); ///< Undefined
+ TestGlSyncAbstraction& operator=(const TestGlSyncAbstraction&); ///< Undefined
- TestGlSyncAbstraction( const TestGlSyncAbstraction& ); ///< Undefined
- TestGlSyncAbstraction& operator=( const TestGlSyncAbstraction& ); ///< Undefined
-
- typedef std::vector<TestSyncObject*> SyncContainer;
- typedef SyncContainer::iterator SyncIter;
- SyncContainer mSyncObjects; ///< The sync objects
- TraceCallStack mTrace; ///< the trace call stack for testing
+ typedef std::vector<TestSyncObject*> SyncContainer;
+ typedef SyncContainer::iterator SyncIter;
+ SyncContainer mSyncObjects; ///< The sync objects
+ TraceCallStack mTrace; ///< the trace call stack for testing
};
-} // Dali
+} // namespace Dali
#endif // TEST_GL_SYNC_ABSTRACTION_H
*/
#include "test-harness.h"
+
+#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <testcase.h>
#include <unistd.h>
-#include <vector>
-#include <map>
+
#include <cstring>
-#include <testcase.h>
-#include <fcntl.h>
+#include <map>
+#include <vector>
namespace TestHarness
{
-
typedef std::map<int32_t, TestCase> RunningTestCases;
const char* basename(const char* path)
{
- const char* ptr=path;
- const char* slash=NULL;
- for( ; *ptr != '\0' ; ++ptr )
+ const char* ptr = path;
+ const char* slash = NULL;
+ for(; *ptr != '\0'; ++ptr)
{
- if(*ptr == '/') slash=ptr;
+ if(*ptr == '/') slash = ptr;
}
if(slash != NULL) ++slash;
return slash;
open("/dev/null", O_RDWR); // Redirect file descriptor number 2 (i.e. stderr) to /dev/null
}
-int32_t RunTestCase( struct ::testcase_s& testCase )
+int32_t RunTestCase(struct ::testcase_s& testCase)
{
int32_t result = EXIT_STATUS_TESTCASE_FAILED;
-// dont want to catch exception as we want to be able to get
-// gdb stack trace from the first error
-// by default tests should all always pass with no exceptions
- if( testCase.startup )
+ // dont want to catch exception as we want to be able to get
+ // gdb stack trace from the first error
+ // by default tests should all always pass with no exceptions
+ if(testCase.startup)
{
testCase.startup();
}
{
result = testCase.function();
}
- catch( const char* )
+ catch(const char*)
{
// just catch test fail exception, return is already set to EXIT_STATUS_TESTCASE_FAILED
}
- if( testCase.cleanup )
+ if(testCase.cleanup)
{
testCase.cleanup();
}
return result;
}
-
-int32_t RunTestCaseInChildProcess( struct ::testcase_s& testCase, bool suppressOutput )
+int32_t RunTestCaseInChildProcess(struct ::testcase_s& testCase, bool suppressOutput)
{
int32_t testResult = EXIT_STATUS_TESTCASE_FAILED;
int32_t pid = fork();
- if( pid == 0 ) // Child process
+ if(pid == 0) // Child process
{
- if( suppressOutput )
+ if(suppressOutput)
{
SuppressLogOutput();
}
else
{
printf("\n");
- for(int32_t i=0; i<80; ++i) printf("#");
+ for(int32_t i = 0; i < 80; ++i) printf("#");
printf("\nTC: %s\n", testCase.name);
fflush(stdout);
}
- int32_t status = RunTestCase( testCase );
+ int32_t status = RunTestCase(testCase);
- if( ! suppressOutput )
+ if(!suppressOutput)
{
fflush(stdout);
fflush(stderr);
fclose(stdout);
fclose(stderr);
}
- exit( status );
+ exit(status);
}
else if(pid == -1)
{
}
else // Parent process
{
- int32_t status = 0;
+ int32_t status = 0;
int32_t childPid = waitpid(pid, &status, 0);
- if( childPid == -1 )
+ if(childPid == -1)
{
perror("waitpid");
exit(EXIT_STATUS_WAITPID_FAILED);
}
- if( WIFEXITED(status) )
+ if(WIFEXITED(status))
{
- if( childPid > 0 )
+ if(childPid > 0)
{
testResult = WEXITSTATUS(status);
- if( testResult )
+ if(testResult)
{
printf("Test case %s failed: %d\n", testCase.name, testResult);
}
}
}
- else if(WIFSIGNALED(status) )
+ else if(WIFSIGNALED(status))
{
int32_t signal = WTERMSIG(status);
- testResult = EXIT_STATUS_TESTCASE_ABORTED;
- if( signal == SIGABRT )
+ testResult = EXIT_STATUS_TESTCASE_ABORTED;
+ if(signal == SIGABRT)
{
- printf("Test case %s failed: test case asserted\n", testCase.name );
+ printf("Test case %s failed: test case asserted\n", testCase.name);
}
else
{
return testResult;
}
-void OutputStatistics( const char* processName, int32_t numPasses, int32_t numFailures )
+void OutputStatistics(const char* processName, int32_t numPasses, int32_t numFailures)
{
- FILE* fp=fopen("summary.xml", "a");
- if( fp != NULL )
+ FILE* fp = fopen("summary.xml", "a");
+ if(fp != NULL)
{
- fprintf( fp,
- " <suite name=\"%s\">\n"
- " <total_case>%d</total_case>\n"
- " <pass_case>%d</pass_case>\n"
- " <pass_rate>%5.2f</pass_rate>\n"
- " <fail_case>%d</fail_case>\n"
- " <fail_rate>%5.2f</fail_rate>\n"
- " <block_case>0</block_case>\n"
- " <block_rate>0.00</block_rate>\n"
- " <na_case>0</na_case>\n"
- " <na_rate>0.00</na_rate>\n"
- " </suite>\n",
- basename(processName),
- numPasses+numFailures,
- numPasses,
- (float)numPasses/(numPasses+numFailures),
- numFailures,
- (float)numFailures/(numPasses+numFailures) );
+ fprintf(fp,
+ " <suite name=\"%s\">\n"
+ " <total_case>%d</total_case>\n"
+ " <pass_case>%d</pass_case>\n"
+ " <pass_rate>%5.2f</pass_rate>\n"
+ " <fail_case>%d</fail_case>\n"
+ " <fail_rate>%5.2f</fail_rate>\n"
+ " <block_case>0</block_case>\n"
+ " <block_rate>0.00</block_rate>\n"
+ " <na_case>0</na_case>\n"
+ " <na_rate>0.00</na_rate>\n"
+ " </suite>\n",
+ basename(processName),
+ numPasses + numFailures,
+ numPasses,
+ (float)numPasses / (numPasses + numFailures),
+ numFailures,
+ (float)numFailures / (numPasses + numFailures));
fclose(fp);
}
}
-int32_t RunAll( const char* processName, ::testcase tc_array[] )
+int32_t RunAll(const char* processName, ::testcase tc_array[])
{
int32_t numFailures = 0;
- int32_t numPasses = 0;
+ int32_t numPasses = 0;
// Run test cases in child process( to kill output/handle signals ), but run serially.
- for( uint32_t i=0; tc_array[i].name; i++)
+ for(uint32_t i = 0; tc_array[i].name; i++)
{
- int32_t result = RunTestCaseInChildProcess( tc_array[i], false );
- if( result == 0 )
+ int32_t result = RunTestCaseInChildProcess(tc_array[i], false);
+ if(result == 0)
{
numPasses++;
}
}
}
- OutputStatistics( processName, numPasses, numFailures);
+ OutputStatistics(processName, numPasses, numFailures);
return numFailures;
}
// Constantly runs up to MAX_NUM_CHILDREN processes
-int32_t RunAllInParallel( const char* processName, ::testcase tc_array[], bool reRunFailed)
+int32_t RunAllInParallel(const char* processName, ::testcase tc_array[], bool reRunFailed)
{
int32_t numFailures = 0;
- int32_t numPasses = 0;
+ int32_t numPasses = 0;
- RunningTestCases children;
+ RunningTestCases children;
std::vector<int32_t> failedTestCases;
// Fork up to MAX_NUM_CHILDREN processes, then
// wait. As soon as a proc completes, fork the next.
- int32_t nextTestCase = 0;
+ int32_t nextTestCase = 0;
int32_t numRunningChildren = 0;
- while( tc_array[nextTestCase].name || numRunningChildren > 0)
+ while(tc_array[nextTestCase].name || numRunningChildren > 0)
{
// Create more children (up to the max number or til the end of the array)
- while( numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name )
+ while(numRunningChildren < MAX_NUM_CHILDREN && tc_array[nextTestCase].name)
{
int32_t pid = fork();
- if( pid == 0 ) // Child process
+ if(pid == 0) // Child process
{
SuppressLogOutput();
- exit( RunTestCase( tc_array[nextTestCase] ) );
+ exit(RunTestCase(tc_array[nextTestCase]));
}
else if(pid == -1)
{
// Wait for the next child to finish
- int32_t status=0;
+ int32_t status = 0;
int32_t childPid = waitpid(-1, &status, 0);
- if( childPid == -1 )
+ if(childPid == -1)
{
perror("waitpid");
exit(EXIT_STATUS_WAITPID_FAILED);
}
- if( WIFEXITED(status) )
+ if(WIFEXITED(status))
{
- if( childPid > 0 )
+ if(childPid > 0)
{
int32_t testResult = WEXITSTATUS(status);
- if( testResult )
+ if(testResult)
{
printf("Test case %s failed: %d\n", children[childPid].testCaseName, testResult);
failedTestCases.push_back(children[childPid].testCase);
}
}
- else if( WIFSIGNALED(status) || WIFSTOPPED(status))
+ else if(WIFSIGNALED(status) || WIFSTOPPED(status))
{
- status = WIFSIGNALED(status)?WTERMSIG(status):WSTOPSIG(status);
+ status = WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status);
- if( childPid > 0 )
+ if(childPid > 0)
{
RunningTestCases::iterator iter = children.find(childPid);
- if( iter != children.end() )
+ if(iter != children.end())
{
printf("Test case %s exited with signal %s\n", iter->second.testCaseName, strsignal(status));
failedTestCases.push_back(iter->second.testCase);
}
}
- OutputStatistics( processName, numPasses, numFailures );
+ OutputStatistics(processName, numPasses, numFailures);
- if( reRunFailed )
+ if(reRunFailed)
{
- for( uint32_t i=0; i<failedTestCases.size(); i++)
+ for(uint32_t i = 0; i < failedTestCases.size(); i++)
{
- char* testCaseStrapline;
- int32_t numChars = asprintf(&testCaseStrapline, "Test case %s", tc_array[failedTestCases[i]].name );
+ char* testCaseStrapline;
+ int32_t numChars = asprintf(&testCaseStrapline, "Test case %s", tc_array[failedTestCases[i]].name);
printf("\n%s\n", testCaseStrapline);
- for(int32_t j=0; j<numChars; j++)
+ for(int32_t j = 0; j < numChars; j++)
{
printf("=");
}
printf("\n");
- RunTestCaseInChildProcess( tc_array[failedTestCases[i] ], false );
+ RunTestCaseInChildProcess(tc_array[failedTestCases[i]], false);
}
}
return numFailures;
}
-
-
int32_t FindAndRunTestCase(::testcase tc_array[], const char* testCaseName)
{
int32_t result = EXIT_STATUS_TESTCASE_NOT_FOUND;
- for( int32_t i = 0; tc_array[i].name; i++ )
+ for(int32_t i = 0; tc_array[i].name; i++)
{
- if( !strcmp(testCaseName, tc_array[i].name) )
+ if(!strcmp(testCaseName, tc_array[i].name))
{
- return RunTestCase( tc_array[i] );
+ return RunTestCase(tc_array[i]);
}
}
void Usage(const char* program)
{
- printf("Usage: \n"
- " %s <testcase name>\t\t Execute a test case\n"
- " %s \t\t Execute all test cases in parallel\n"
- " %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n"
- " %s -s\t\t Execute all test cases serially\n",
- program, program, program, program);
+ printf(
+ "Usage: \n"
+ " %s <testcase name>\t\t Execute a test case\n"
+ " %s \t\t Execute all test cases in parallel\n"
+ " %s -r\t\t Execute all test cases in parallel, rerunning failed test cases\n"
+ " %s -s\t\t Execute all test cases serially\n",
+ program,
+ program,
+ program,
+ program);
}
-} // namespace
+} // namespace TestHarness
#define TEST_HARNESS_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <stdio.h>
#include <testcase.h>
+
#include <cstdint>
namespace TestHarness
{
-
enum ExitStatus
{
- EXIT_STATUS_TESTCASE_SUCCEEDED, // 0
- EXIT_STATUS_TESTCASE_FAILED, // 1
- EXIT_STATUS_TESTCASE_ABORTED, // 2
- EXIT_STATUS_FORK_FAILED, // 3
- EXIT_STATUS_WAITPID_FAILED, // 4
- EXIT_STATUS_BAD_ARGUMENT, // 5
- EXIT_STATUS_TESTCASE_NOT_FOUND // 6
+ EXIT_STATUS_TESTCASE_SUCCEEDED, // 0
+ EXIT_STATUS_TESTCASE_FAILED, // 1
+ EXIT_STATUS_TESTCASE_ABORTED, // 2
+ EXIT_STATUS_FORK_FAILED, // 3
+ EXIT_STATUS_WAITPID_FAILED, // 4
+ EXIT_STATUS_BAD_ARGUMENT, // 5
+ EXIT_STATUS_TESTCASE_NOT_FOUND // 6
};
const int32_t MAX_NUM_CHILDREN(16);
struct TestCase
{
- int32_t testCase;
+ int32_t testCase;
const char* testCaseName;
TestCase()
}
TestCase& operator=(const TestCase& rhs)
{
- testCase = rhs.testCase;
+ testCase = rhs.testCase;
testCaseName = rhs.testCaseName;
return *this;
-
}
};
* Run a test case
* @param[in] testCase The Testkit-lite test case to run
*/
-int32_t RunTestCase( struct testcase_s& testCase );
+int32_t RunTestCase(struct testcase_s& testCase);
/**
* Run all test cases in parallel
* @param[in] tc_array The array of auto-generated testkit-lite test cases
* @return 0 on success
*/
-int32_t RunAll( const char* processName, testcase tc_array[] );
+int32_t RunAll(const char* processName, testcase tc_array[]);
/**
* Find the named test case in the given array, and run it
#define TEST_INTRUSIVE_PTR_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
namespace Dali
{
-
-template <typename T>
+template<typename T>
struct UtcCoverageIntrusivePtr
{
typedef IntrusivePtr<T> (*Creator)();
- void Check( Creator creator)
+ void Check(Creator creator)
{
IntrusivePtr<T> a = creator();
IntrusivePtr<T> b = creator();
- DALI_TEST_CHECK( a.Get() );
+ DALI_TEST_CHECK(a.Get());
a.Reset();
DALI_TEST_CHECK(a);
a.Reset();
-
};
-
};
-} // Dali
+} // namespace Dali
#endif // TEST_INTRUSIVE_PTR_H
-
-
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-
#include "test-application.h"
-#include "test-native-image.h"
+#include "test-native-image.h"
namespace Dali
{
-
TestNativeImagePointer TestNativeImage::New(uint32_t width, uint32_t height)
{
return new TestNativeImage(width, height);
}
TestNativeImage::TestNativeImage(uint32_t width, uint32_t height)
-: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0),createResult(true)
+: mWidth(width),
+ mHeight(height),
+ mExtensionCreateCalls(0),
+ mExtensionDestroyCalls(0),
+ mTargetTextureCalls(0),
+ createResult(true)
{
}
{
}
-} // namespace dali
+} // namespace Dali
#define TEST_NATIVE_IMAGE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// INTERNAL INCLUDES
#include <dali/public-api/images/native-image-interface.h>
+
#include <dali/integration-api/gl-defines.h>
namespace Dali
public:
static TestNativeImagePointer New(uint32_t width, uint32_t height);
- inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
- inline virtual bool CreateResource() { ++mExtensionCreateCalls; return createResult;};
- inline virtual void DestroyResource() { ++mExtensionDestroyCalls; };
- inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return mTargetTextureError;};
- inline virtual void PrepareTexture() {};
- inline virtual uint32_t GetWidth() const {return mWidth;};
- inline virtual uint32_t GetHeight() const {return mHeight;};
- inline virtual bool RequiresBlending() const {return true;};
- inline virtual int GetTextureTarget() const {return GL_TEXTURE_EXTERNAL_OES;};
- inline virtual const char* GetCustomFragmentPrefix() const {return "#extension GL_OES_EGL_image_external:require\n";};
- inline const char* GetCustomSamplerTypename() const override { return "samplerExternalOES"; };
+ inline void SetGlExtensionCreateResult(bool result)
+ {
+ createResult = result;
+ }
+ inline virtual bool CreateResource()
+ {
+ ++mExtensionCreateCalls;
+ return createResult;
+ };
+ inline virtual void DestroyResource()
+ {
+ ++mExtensionDestroyCalls;
+ };
+ inline virtual GLenum TargetTexture()
+ {
+ ++mTargetTextureCalls;
+ return mTargetTextureError;
+ };
+ inline virtual void PrepareTexture(){};
+ inline virtual uint32_t GetWidth() const
+ {
+ return mWidth;
+ };
+ inline virtual uint32_t GetHeight() const
+ {
+ return mHeight;
+ };
+ inline virtual bool RequiresBlending() const
+ {
+ return true;
+ };
+ inline virtual int GetTextureTarget() const
+ {
+ return GL_TEXTURE_EXTERNAL_OES;
+ };
+ inline virtual const char* GetCustomFragmentPrefix() const
+ {
+ return "#extension GL_OES_EGL_image_external:require\n";
+ };
+ inline const char* GetCustomSamplerTypename() const override
+ {
+ return "samplerExternalOES";
+ };
- inline Any GetNativeImageHandle() const override { return nullptr; };
- inline bool SourceChanged() const override { return false; };
+ inline Any GetNativeImageHandle() const override
+ {
+ return nullptr;
+ };
+ inline bool SourceChanged() const override
+ {
+ return false;
+ };
- inline virtual Dali::NativeImageInterface::Extension* GetExtension() {return nullptr;}
+ inline virtual Dali::NativeImageInterface::Extension* GetExtension()
+ {
+ return nullptr;
+ }
private:
TestNativeImage(uint32_t width, uint32_t height);
uint32_t mWidth;
uint32_t mHeight;
+
public:
- int32_t mExtensionCreateCalls;
- int32_t mExtensionDestroyCalls;
- int32_t mTargetTextureCalls;
- uint32_t mTargetTextureError=0u;
- bool createResult;
+ int32_t mExtensionCreateCalls;
+ int32_t mExtensionDestroyCalls;
+ int32_t mTargetTextureCalls;
+ uint32_t mTargetTextureError = 0u;
+ bool createResult;
};
-
-
-} // Dali
+} // namespace Dali
#endif // TEST_NATIVE_IMAGE_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include "test-platform-abstraction.h"
-#include "dali-test-suite-utils.h"
+
#include <dali/integration-api/bitmap.h>
+#include "dali-test-suite-utils.h"
+
namespace Dali
{
-
TestPlatformAbstraction::TestPlatformAbstraction()
: mTrace(),
- mIsLoadingResult( false ),
+ mIsLoadingResult(false),
mClosestSize(),
mLoadFileResult(),
- mSaveFileResult( false ),
+ mSaveFileResult(false),
mSynchronouslyLoadedResource(),
mTimerId(0),
mCallbackFunction(nullptr)
{
}
-ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection )
+ImageDimensions TestPlatformAbstraction::GetClosestImageSize(const std::string& filename,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection)
{
- ImageDimensions closestSize = ImageDimensions( mClosestSize );
+ ImageDimensions closestSize = ImageDimensions(mClosestSize);
mTrace.PushCall("GetClosestImageSize", "");
return closestSize;
}
-ImageDimensions TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection )
+ImageDimensions TestPlatformAbstraction::GetClosestImageSize(Integration::ResourcePointer resourceBuffer,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection)
{
- ImageDimensions closestSize = ImageDimensions( mClosestSize );
+ ImageDimensions closestSize = ImageDimensions(mClosestSize);
mTrace.PushCall("GetClosestImageSize", "");
return closestSize;
}
-Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath )
+Integration::ResourcePointer TestPlatformAbstraction::LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath)
{
mTrace.PushCall("LoadResourceSynchronously", "");
return mSynchronouslyLoadedResource;
}
-Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size )
+Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer(const Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size)
{
mTrace.PushCall("DecodeBuffer", "");
return mDecodedBitmap;
}
-bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
+bool TestPlatformAbstraction::LoadShaderBinaryFile(const std::string& filename, Dali::Vector<unsigned char>& buffer) const
{
mTrace.PushCall("LoadShaderBinaryFile", "");
- if( mLoadFileResult.loadResult )
+ if(mLoadFileResult.loadResult)
{
buffer = mLoadFileResult.buffer;
}
{
mTrace.Reset();
mTrace.Enable(true);
- mIsLoadingResult=false;
+ mIsLoadingResult = false;
mSynchronouslyLoadedResource.Reset();
mDecodedBitmap.Reset();
}
{
switch(func)
{
- case LoadResourceSynchronouslyFunc: return mTrace.FindMethod("LoadResourceSynchronously");
- case LoadShaderBinaryFileFunc: return mTrace.FindMethod("LoadShaderBinaryFile");
- case SaveShaderBinaryFileFunc: return mTrace.FindMethod("SaveShaderBinaryFile");
+ case LoadResourceSynchronouslyFunc:
+ return mTrace.FindMethod("LoadResourceSynchronously");
+ case LoadShaderBinaryFileFunc:
+ return mTrace.FindMethod("LoadShaderBinaryFile");
+ case SaveShaderBinaryFileFunc:
+ return mTrace.FindMethod("SaveShaderBinaryFile");
}
return false;
}
mDecodedBitmap.Reset();
}
-void TestPlatformAbstraction::SetClosestImageSize( const Vector2& size )
+void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
{
- mClosestSize = ImageDimensions( static_cast<uint32_t>( size.x ), static_cast<uint32_t>( size.y ) );
+ mClosestSize = ImageDimensions(static_cast<uint32_t>(size.x), static_cast<uint32_t>(size.y));
}
-void TestPlatformAbstraction::SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer )
+void TestPlatformAbstraction::SetLoadFileResult(bool result, Dali::Vector<unsigned char>& buffer)
{
mLoadFileResult.loadResult = result;
- if( result )
+ if(result)
{
mLoadFileResult.buffer = buffer;
}
}
-void TestPlatformAbstraction::SetSaveFileResult( bool result )
+void TestPlatformAbstraction::SetSaveFileResult(bool result)
{
mSaveFileResult = result;
}
-void TestPlatformAbstraction::SetSynchronouslyLoadedResource( Integration::ResourcePointer resource )
+void TestPlatformAbstraction::SetSynchronouslyLoadedResource(Integration::ResourcePointer resource)
{
mSynchronouslyLoadedResource = resource;
}
-void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap )
+void TestPlatformAbstraction::SetDecodedBitmap(Integration::BitmapPtr bitmap)
{
mDecodedBitmap = bitmap;
}
-uint32_t TestPlatformAbstraction::StartTimer( uint32_t milliseconds, CallbackBase* callback )
+uint32_t TestPlatformAbstraction::StartTimer(uint32_t milliseconds, CallbackBase* callback)
{
mCallbackFunction = callback;
mTimerId++;
void TestPlatformAbstraction::TriggerTimer()
{
- if (mCallbackFunction != nullptr)
+ if(mCallbackFunction != nullptr)
{
- CallbackBase::Execute( *mCallbackFunction );
+ CallbackBase::Execute(*mCallbackFunction);
}
}
-void TestPlatformAbstraction::CancelTimer ( uint32_t timerId )
+void TestPlatformAbstraction::CancelTimer(uint32_t timerId)
{
mCallbackFunction = nullptr;
}
#define DALI_TEST_PLATFORM_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// EXTERNAL INCLUDES
#include <stdint.h>
+
#include <cstring>
#include <string>
#include <vector>
namespace Dali
{
-
/**
* Concrete implementation of the platform abstraction class.
*/
class DALI_CORE_API TestPlatformAbstraction : public Dali::Integration::PlatformAbstraction
{
-
public:
-
/**
* Constructor
*/
/**
* @copydoc PlatformAbstraction::GetClosestImageSize()
*/
- ImageDimensions GetClosestImageSize( const std::string& filename,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection ) override;
+ ImageDimensions GetClosestImageSize(const std::string& filename,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection) override;
/**
* @copydoc PlatformAbstraction::GetClosestImageSize()
*/
- ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
- ImageDimensions size,
- FittingMode::Type fittingMode,
- SamplingMode::Type samplingMode,
- bool orientationCorrection ) override;
+ ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ SamplingMode::Type samplingMode,
+ bool orientationCorrection) override;
/**
* @copydoc PlatformAbstraction::LoadResourceSynchronously()
*/
- Integration::ResourcePointer LoadImageSynchronously( const Integration::BitmapResourceType& resourceType, const std::string& resourcePath ) override;
+ Integration::ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& resourceType, const std::string& resourcePath) override;
/**
* @copydoc PlatformAbstraction::DecodeBuffer()
*/
- Integration::BitmapPtr DecodeBuffer( const Dali::Integration::BitmapResourceType& resourceType, uint8_t * buffer, size_t size ) override;
+ Integration::BitmapPtr DecodeBuffer(const Dali::Integration::BitmapResourceType& resourceType, uint8_t* buffer, size_t size) override;
/**
* @copydoc PlatformAbstraction::LoadShaderBinaryFile()
*/
- bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const override;
+ bool LoadShaderBinaryFile(const std::string& filename, Dali::Vector<unsigned char>& buffer) const override;
/**
* @copydoc PlatformAbstraction::SaveShaderBinaryFile()
*/
- virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const override { return true; }
+ virtual bool SaveShaderBinaryFile(const std::string& filename, const unsigned char* buffer, unsigned int numBytes) const override
+ {
+ return true;
+ }
/**
* @copydoc PlatformAbstraction::StartTimer()
*/
- uint32_t StartTimer( uint32_t milliseconds, CallbackBase* callback ) override;
+ uint32_t StartTimer(uint32_t milliseconds, CallbackBase* callback) override;
/*
* @copydoc PlatformAbstraction::CancelTimer()
*/
- void CancelTimer ( uint32_t timerId ) override;
+ void CancelTimer(uint32_t timerId) override;
public: // TEST FUNCTIONS
-
// Enumeration of Platform Abstraction methods
typedef enum
{
/** Call this every test */
void Initialize();
- inline void EnableTrace(bool enable) { mTrace.Enable(enable); }
- inline void ResetTrace() { mTrace.Reset(); }
- inline TraceCallStack& GetTrace() { return mTrace; }
+ inline void EnableTrace(bool enable)
+ {
+ mTrace.Enable(enable);
+ }
+ inline void ResetTrace()
+ {
+ mTrace.Reset();
+ }
+ inline TraceCallStack& GetTrace()
+ {
+ return mTrace;
+ }
/**
* @brief Checks if a platform function was called
* @brief Sets the value returned by GetClosestImageSize.
* @param[in] size The size that should be returned.
*/
- void SetClosestImageSize( const Vector2& size );
+ void SetClosestImageSize(const Vector2& size);
/**
* @brief Sets the result return by LoadFile.
* @param[in] result The value that LoadFile should return.
* @param[in] buffer The buffer of the loaded file.
*/
- void SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer );
+ void SetLoadFileResult(bool result, Dali::Vector<unsigned char>& buffer);
/**
* @brief Sets the SaveFile result
* @param[in] result The value that SaveFile should return
*/
- void SetSaveFileResult( bool result );
+ void SetSaveFileResult(bool result);
/**
* @brief Sets the resource loaded by LoadResourceSynchronously
* @param[in] resource The loaded resource
*/
- void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource );
+ void SetSynchronouslyLoadedResource(Integration::ResourcePointer resource);
/**
* @brief Sets the bitmap returned by DecodeBuffer()
* @param[in] bitmap The decoded bitmap
*/
- void SetDecodedBitmap( Integration::BitmapPtr bitmap );
+ void SetDecodedBitmap(Integration::BitmapPtr bitmap);
/**
* @brief Triggers the previously stored callback function
void TriggerTimer();
private:
-
- TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined
- TestPlatformAbstraction& operator=( const TestPlatformAbstraction& ); ///< Undefined
+ TestPlatformAbstraction(const TestPlatformAbstraction&); ///< Undefined
+ TestPlatformAbstraction& operator=(const TestPlatformAbstraction&); ///< Undefined
private:
-
struct LoadFileResult
{
inline LoadFileResult()
: loadResult(false)
{
-
}
- bool loadResult;
- Dali::Vector< unsigned char> buffer;
+ bool loadResult;
+ Dali::Vector<unsigned char> buffer;
};
- mutable TraceCallStack mTrace;
- bool mIsLoadingResult;
- ImageDimensions mClosestSize;
+ mutable TraceCallStack mTrace;
+ bool mIsLoadingResult;
+ ImageDimensions mClosestSize;
- LoadFileResult mLoadFileResult;
- bool mSaveFileResult;
+ LoadFileResult mLoadFileResult;
+ bool mSaveFileResult;
- Integration::ResourcePointer mSynchronouslyLoadedResource;
- Integration::BitmapPtr mDecodedBitmap;
+ Integration::ResourcePointer mSynchronouslyLoadedResource;
+ Integration::BitmapPtr mDecodedBitmap;
- uint32_t mTimerId;
- CallbackBase* mCallbackFunction;
+ uint32_t mTimerId;
+ CallbackBase* mCallbackFunction;
};
-} // Dali
+} // namespace Dali
#endif /* DALI_TEST_PLATFORM_ABSTRACTION_H */
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
TestRenderController::TestRenderController()
{
Initialize();
{
}
-void TestRenderController::RequestUpdate( bool forceUpdate )
+void TestRenderController::RequestUpdate(bool forceUpdate)
{
mRequestUpdateCalled = true;
}
-void TestRenderController::RequestProcessEventsOnIdle( bool forceProcess )
+void TestRenderController::RequestProcessEventsOnIdle(bool forceProcess)
{
mRequestProcessEventsOnIdleCalled = true;
}
{
switch(func)
{
- case RequestUpdateFunc: return mRequestUpdateCalled;
- case RequestProcessEventsOnIdleFunc: return mRequestProcessEventsOnIdleCalled;
+ case RequestUpdateFunc:
+ return mRequestUpdateCalled;
+ case RequestProcessEventsOnIdleFunc:
+ return mRequestProcessEventsOnIdleCalled;
}
return false;
void TestRenderController::Initialize()
{
- mRequestUpdateCalled = false;
+ mRequestUpdateCalled = false;
mRequestProcessEventsOnIdleCalled = false;
}
-
-} // namespace dali
+} // namespace Dali
#define TEST_RENDER_CONTROLLER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
#include <dali/integration-api/render-controller.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
-
class DALI_CORE_API TestRenderController : public Dali::Integration::RenderController
{
public:
TestRenderController();
~TestRenderController() override;
- void RequestUpdate( bool forceUpdate ) override;
- void RequestProcessEventsOnIdle( bool forceProcess ) override;
+ void RequestUpdate(bool forceUpdate) override;
+ void RequestProcessEventsOnIdle(bool forceProcess) override;
typedef enum
{
bool WasCalled(TestRenderControllerFuncEnum func);
void Initialize();
-
private:
bool mRequestUpdateCalled;
bool mRequestProcessEventsOnIdleCalled;
};
-} // Dali
+} // namespace Dali
#endif // TEST_RENDER_CONTROLLER_H
*/
struct TouchEventFunctorConsumeSetter
{
- TouchEventFunctorConsumeSetter( bool& consume )
- : mConsume( consume )
+ TouchEventFunctorConsumeSetter(bool& consume)
+ : mConsume(consume)
{
}
};
#endif // TEST_TOUCH_EVENT_UTILS_H
-
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#include "test-trace-call-stack.h"
+
#include <sstream>
namespace Dali
{
-
std::string ToString(int x)
{
std::stringstream out;
/**
* Constructor
*/
-TraceCallStack::TraceCallStack() : mTraceActive(false) { }
+TraceCallStack::TraceCallStack()
+: mTraceActive(false)
+{
+}
/**
* Destructor
*/
-TraceCallStack::~TraceCallStack() { }
+TraceCallStack::~TraceCallStack()
+{
+}
/**
* Turn on / off tracing
*/
-void TraceCallStack::Enable(bool enable) { mTraceActive = enable; }
+void TraceCallStack::Enable(bool enable)
+{
+ mTraceActive = enable;
+}
-bool TraceCallStack::IsEnabled() { return mTraceActive; }
+bool TraceCallStack::IsEnabled()
+{
+ return mTraceActive;
+}
/**
* Push a call onto the stack if the trace is active
if(mTraceActive)
{
FunctionCall stackFrame(method, params);
- mCallStack.push_back( stackFrame );
+ mCallStack.push_back(stackFrame);
}
}
if(mTraceActive)
{
FunctionCall stackFrame(method, params, altParams);
- mCallStack.push_back( stackFrame );
+ mCallStack.push_back(stackFrame);
}
}
bool TraceCallStack::FindMethod(std::string method) const
{
bool found = false;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
found = true;
break;
return found;
}
-bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params ) const
+bool TraceCallStack::FindMethodAndGetParameters(std::string method, std::string& params) const
{
bool found = false;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
- found = true;
+ found = true;
params = mCallStack[i].paramList;
break;
}
int TraceCallStack::CountMethod(std::string method) const
{
int numCalls = 0;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
numCalls++;
}
*/
bool TraceCallStack::FindMethodAndParams(std::string method, std::string params) const
{
- return FindIndexFromMethodAndParams( method, params ) > -1;
+ return FindIndexFromMethodAndParams(method, params) > -1;
}
bool TraceCallStack::FindMethodAndParams(std::string method, const NamedParams& params) const
{
- return FindIndexFromMethodAndParams( method, params ) > -1;
+ return FindIndexFromMethodAndParams(method, params) > -1;
}
-bool TraceCallStack::FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const
+bool TraceCallStack::FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const
{
- for( size_t i = startIndex; i < mCallStack.size(); ++i )
+ for(size_t i = startIndex; i < mCallStack.size(); ++i)
{
- if( ( mCallStack[i].method.compare( method ) == 0 ) && ( mCallStack[i].paramList.compare( params ) == 0 ) )
+ if((mCallStack[i].method.compare(method) == 0) && (mCallStack[i].paramList.compare(params) == 0))
{
startIndex = i;
return true;
int32_t TraceCallStack::FindIndexFromMethodAndParams(std::string method, std::string params) const
{
int32_t index = -1;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params) )
+ if(0 == mCallStack[i].method.compare(method) && 0 == mCallStack[i].paramList.compare(params))
{
- index = static_cast<int32_t>( i );
+ index = static_cast<int32_t>(i);
break;
}
}
int TraceCallStack::FindIndexFromMethodAndParams(std::string method, const TraceCallStack::NamedParams& params) const
{
int32_t index = -1;
- for( size_t i=0; i < mCallStack.size(); i++ )
+ for(size_t i = 0; i < mCallStack.size(); i++)
{
- if( 0 == mCallStack[i].method.compare(method) )
+ if(0 == mCallStack[i].method.compare(method))
{
// Test each of the passed in parameters:
bool match = true;
- for( NamedParams::const_iterator iter = params.begin() ; iter != params.end() ; ++iter )
+ for(NamedParams::const_iterator iter = params.begin(); iter != params.end(); ++iter)
{
NamedParams::const_iterator paramIter = mCallStack[i].namedParams.find(iter->first);
- if( paramIter == params.end() || paramIter->second.compare(iter->second) != 0 )
+ if(paramIter == params.end() || paramIter->second.compare(iter->second) != 0)
{
match = false;
break;
}
}
- if( match == true )
+ if(match == true)
{
- index = static_cast<int32_t>( i );
+ index = static_cast<int32_t>(i);
break;
}
}
return index;
}
-
/**
* Test if the given method and parameters are at a given index in the stack
* @param[in] index Index in the call stack
*/
bool TraceCallStack::TestMethodAndParams(int index, std::string method, std::string params) const
{
- return ( 0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params) );
+ return (0 == mCallStack[index].method.compare(method) && 0 == mCallStack[index].paramList.compare(params));
}
/**
mCallStack.clear();
}
-
} // namespace Dali
#define TEST_TRACE_CALL_STACK_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <string>
-#include <vector>
#include <map>
#include <sstream>
+#include <string>
+#include <vector>
namespace Dali
{
-
template<typename T>
std::string ToString(const T& x)
{
class TraceCallStack
{
public:
-
/// Typedef for passing and storing named parameters
- typedef std::map< std::string, std::string > NamedParams;
+ typedef std::map<std::string, std::string> NamedParams;
/**
* Constructor
* @param[out] params of the method
* @return true if the method was in the stack
*/
- bool FindMethodAndGetParameters(std::string method, std::string& params ) const;
+ bool FindMethodAndGetParameters(std::string method, std::string& params) const;
/**
* Count how many times a method was called
* calls can search for methods occuring after this one.
* @return True if the method was in the stack
*/
- bool FindMethodAndParamsFromStartIndex( std::string method, std::string params, size_t& startIndex ) const;
+ bool FindMethodAndParamsFromStartIndex(std::string method, std::string params, size_t& startIndex) const;
/**
* Search for a method in the stack with the given parameter list
std::string GetTraceString()
{
std::stringstream traceStream;
- std::size_t functionCount = mCallStack.size();
- for( std::size_t i = 0; i < functionCount; ++i )
+ std::size_t functionCount = mCallStack.size();
+ for(std::size_t i = 0; i < functionCount; ++i)
{
- Dali::TraceCallStack::FunctionCall functionCall = mCallStack[ i ];
+ Dali::TraceCallStack::FunctionCall functionCall = mCallStack[i];
traceStream << "StackTrace: Index:" << i << ", Function:" << functionCall.method << ", ParamList:" << functionCall.paramList << std::endl;
}
std::string method;
std::string paramList;
NamedParams namedParams;
- FunctionCall( const std::string& aMethod, const std::string& aParamList )
- : method( aMethod ), paramList( aParamList )
+ FunctionCall(const std::string& aMethod, const std::string& aParamList)
+ : method(aMethod),
+ paramList(aParamList)
{
}
- FunctionCall( const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams )
- : method( aMethod ), paramList( aParamList ), namedParams( altParams )
+ FunctionCall(const std::string& aMethod, const std::string& aParamList, const NamedParams& altParams)
+ : method(aMethod),
+ paramList(aParamList),
+ namedParams(altParams)
{
}
};
- std::vector< FunctionCall > mCallStack; ///< The call stack
+ std::vector<FunctionCall> mCallStack; ///< The call stack
};
-} // namespace dali
+} // namespace Dali
#endif // TEST_TRACE_CALL_STACK_H
-#include <string.h>
#include <getopt.h>
#include <stdlib.h>
+#include <string.h>
#include <test-harness.h>
+
#include "tct-dali-core.h"
-int main(int argc, char * const argv[])
+int main(int argc, char* const argv[])
{
int result = TestHarness::EXIT_STATUS_BAD_ARGUMENT;
const char* optString = "sf";
- bool optRerunFailed(true);
- bool optRunSerially(false);
+ bool optRerunFailed(true);
+ bool optRunSerially(false);
int nextOpt = 0;
do
{
- nextOpt = getopt( argc, argv, optString );
+ nextOpt = getopt(argc, argv, optString);
switch(nextOpt)
{
case 'f':
exit(TestHarness::EXIT_STATUS_BAD_ARGUMENT);
break;
}
- } while( nextOpt != -1 );
+ } while(nextOpt != -1);
- if( optind == argc ) // no testcase name in argument list
+ if(optind == argc) // no testcase name in argument list
{
- if( optRunSerially )
+ if(optRunSerially)
{
- result = TestHarness::RunAll( argv[0], tc_array );
+ result = TestHarness::RunAll(argv[0], tc_array);
}
else
{
- result = TestHarness::RunAllInParallel( argv[0], tc_array, optRerunFailed );
+ result = TestHarness::RunAllInParallel(argv[0], tc_array, optRerunFailed);
}
}
else
*
*/
-#include <cstring>
-#include <dali/devel-api/addons/addon-base.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/addons/addon-base.h>
+
+#include <cstring>
static const std::string DUMMY_ADDON_NAME = "SampleAddOn";
-int StringLen( const char* str )
+int StringLen(const char* str)
{
- return strlen( str );
+ return strlen(str);
}
-int DoSum( int a, int b )
+int DoSum(int a, int b)
{
- return a+b;
+ return a + b;
}
class TestDummyAddOn : public Dali::AddOns::AddOnBase
{
public:
-
- void GetAddOnInfo( Dali::AddOnInfo& info ) override
+ void GetAddOnInfo(Dali::AddOnInfo& info) override
{
- info.type = Dali::AddOnType::GENERIC;
- info.name = "SampleAddOn";
- info.version = Dali::DALI_ADDON_VERSION( 1, 0, 0 );
- info.next = nullptr;
- tet_printf( "SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str());
+ info.type = Dali::AddOnType::GENERIC;
+ info.name = "SampleAddOn";
+ info.version = Dali::DALI_ADDON_VERSION(1, 0, 0);
+ info.next = nullptr;
+ tet_printf("SampleAddOn: GetAddOnInfo() : name = %s\n", info.name.c_str());
}
/**
Dali::AddOns::DispatchTable* GetGlobalDispatchTable() override
{
static Dali::AddOns::DispatchTable dispatchTable{};
- if( dispatchTable.Empty() )
+ if(dispatchTable.Empty())
{
- dispatchTable["DoSum"] = DoSum;
- dispatchTable["StringLen"] = StringLen;
+ dispatchTable["DoSum"] = DoSum;
+ dispatchTable["StringLen"] = StringLen;
}
return &dispatchTable;
}
}
};
-REGISTER_ADDON_CLASS( TestDummyAddOn );
+REGISTER_ADDON_CLASS(TestDummyAddOn);
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "assert.h"
-#include <dali/public-api/dali-core.h>
-#include <string>
-#include <cfloat> // For FLT_MAX
+#include <dali-test-suite-utils.h>
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/debug.h>
-#include <dali-test-suite-utils.h>
+#include <dali/integration-api/events/hover-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
+#include <cfloat> // For FLT_MAX
+#include <string>
+
+#include "assert.h"
+
//& set: DaliActor
using std::string;
using namespace Dali;
-
void utc_dali_actor_startup(void)
{
test_return_value = TET_UNDEF;
namespace
{
-bool gTouchCallBackCalled=false;
-bool gTouchCallBackCalled2=false;
-bool gTouchCallBackCalled3=false;
+bool gTouchCallBackCalled = false;
+bool gTouchCallBackCalled2 = false;
+bool gTouchCallBackCalled3 = false;
-bool gHoverCallBackCalled=false;
+bool gHoverCallBackCalled = false;
static bool gTestConstraintCalled;
struct TestConstraint
{
- void operator()( Vector4& color, const PropertyInputContainer& /* inputs */ )
+ void operator()(Vector4& color, const PropertyInputContainer& /* inputs */)
{
gTestConstraintCalled = true;
}
{
}
- void operator()( T& current, const PropertyInputContainer& /* inputs */ )
+ void operator()(T& current, const PropertyInputContainer& /* inputs */)
{
mResultRef = mValue;
}
unsigned int& mResultRef;
- unsigned int mValue;
+ unsigned int mValue;
};
-
static bool TestTouchCallback(Actor, const TouchEvent&)
{
gTouchCallBackCalled = true;
static void ResetTouchCallbacks()
{
- gTouchCallBackCalled = false;
+ gTouchCallBackCalled = false;
gTouchCallBackCalled2 = false;
gTouchCallBackCalled3 = false;
}
}
// validation stuff for onstage & offstage signals
-static std::vector< std::string > gActorNamesOnOffScene;
-static int gOnSceneCallBackCalled;
-void OnSceneCallback( Actor actor )
+static std::vector<std::string> gActorNamesOnOffScene;
+static int gOnSceneCallBackCalled;
+void OnSceneCallback(Actor actor)
{
++gOnSceneCallBackCalled;
- gActorNamesOnOffScene.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == true );
+ gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == true);
}
static int gOffSceneCallBackCalled;
-void OffSceneCallback( Actor actor )
+void OffSceneCallback(Actor actor)
{
++gOffSceneCallBackCalled;
- gActorNamesOnOffScene.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) == false );
+ gActorNamesOnOffScene.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) == false);
}
struct PositionComponentConstraint
{
- PositionComponentConstraint(){}
+ PositionComponentConstraint()
+ {
+ }
- void operator()( Vector3& pos, const PropertyInputContainer& inputs )
+ void operator()(Vector3& pos, const PropertyInputContainer& inputs)
{
const Matrix& m = inputs[0]->GetMatrix();
- Vector3 scale;
- Quaternion rot;
+ Vector3 scale;
+ Quaternion rot;
m.GetTransformComponents(pos, rot, scale);
}
};
struct OrientationComponentConstraint
{
- OrientationComponentConstraint(){}
+ OrientationComponentConstraint()
+ {
+ }
- void operator()( Quaternion& orientation, const PropertyInputContainer& inputs )
+ void operator()(Quaternion& orientation, const PropertyInputContainer& inputs)
{
const Quaternion& parentOrientation = inputs[0]->GetQuaternion();
- Vector3 pos, scale;
- Quaternion rot;
+ Vector3 pos, scale;
+ Quaternion rot;
orientation = parentOrientation;
}
};
// OnRelayout
-static bool gOnRelayoutCallBackCalled = false;
-static std::vector< std::string > gActorNamesRelayout;
+static bool gOnRelayoutCallBackCalled = false;
+static std::vector<std::string> gActorNamesRelayout;
-void OnRelayoutCallback( Actor actor )
+void OnRelayoutCallback(Actor actor)
{
gOnRelayoutCallBackCalled = true;
- gActorNamesRelayout.push_back( actor.GetProperty< std::string >( Actor::Property::NAME ) );
+ gActorNamesRelayout.push_back(actor.GetProperty<std::string>(Actor::Property::NAME));
}
struct VisibilityChangedFunctorData
{
VisibilityChangedFunctorData()
: actor(),
- visible( false ),
- type( DevelActor::VisibilityChange::SELF ),
- called( false )
+ visible(false),
+ type(DevelActor::VisibilityChange::SELF),
+ called(false)
{
}
{
actor.Reset();
visible = false;
- type = DevelActor::VisibilityChange::SELF;
- called = false;
+ type = DevelActor::VisibilityChange::SELF;
+ called = false;
}
- void Check( bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char * location )
+ void Check(bool compareCalled, Actor compareActor, bool compareVisible, DevelActor::VisibilityChange::Type compareType, const char* location)
{
- DALI_TEST_EQUALS( called, compareCalled, TEST_INNER_LOCATION( location ) );
- DALI_TEST_EQUALS( actor, compareActor, TEST_INNER_LOCATION( location ) );
- DALI_TEST_EQUALS( visible, compareVisible, TEST_INNER_LOCATION( location ) );
- DALI_TEST_EQUALS( (int)type, (int)compareType, TEST_INNER_LOCATION( location ) );
+ DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
+ DALI_TEST_EQUALS(actor, compareActor, TEST_INNER_LOCATION(location));
+ DALI_TEST_EQUALS(visible, compareVisible, TEST_INNER_LOCATION(location));
+ DALI_TEST_EQUALS((int)type, (int)compareType, TEST_INNER_LOCATION(location));
}
- void Check( bool compareCalled, const std::string& location )
+ void Check(bool compareCalled, const std::string& location)
{
- DALI_TEST_EQUALS( called, compareCalled, TEST_INNER_LOCATION( location ) );
+ DALI_TEST_EQUALS(called, compareCalled, TEST_INNER_LOCATION(location));
}
- Actor actor;
- bool visible;
+ Actor actor;
+ bool visible;
DevelActor::VisibilityChange::Type type;
- bool called;
+ bool called;
};
struct VisibilityChangedFunctor
{
- VisibilityChangedFunctor( VisibilityChangedFunctorData& dataVar ) : data( dataVar ) { }
+ VisibilityChangedFunctor(VisibilityChangedFunctorData& dataVar)
+ : data(dataVar)
+ {
+ }
- void operator()( Actor actor, bool visible, DevelActor::VisibilityChange::Type type )
+ void operator()(Actor actor, bool visible, DevelActor::VisibilityChange::Type type)
{
- data.actor = actor;
+ data.actor = actor;
data.visible = visible;
- data.type = type;
- data.called = true;
+ data.type = type;
+ data.called = true;
}
VisibilityChangedFunctorData& data;
};
-
struct VisibilityChangedVoidFunctor
{
VisibilityChangedVoidFunctor(bool& signalCalled)
- : mSignalCalled( signalCalled )
- { }
+ : mSignalCalled(signalCalled)
+ {
+ }
void operator()()
{
- mSignalCalled = true;
+ mSignalCalled = true;
}
bool& mSignalCalled;
struct ChildOrderChangedFunctor
{
ChildOrderChangedFunctor(bool& signalCalled, Actor& actor)
- : mSignalCalled( signalCalled ),
- mActor( actor )
- { }
+ : mSignalCalled(signalCalled),
+ mActor(actor)
+ {
+ }
- void operator()( Actor actor )
+ void operator()(Actor actor)
{
- mSignalCalled = true;
- mActor = actor;
+ mSignalCalled = true;
+ mActor = actor;
}
- bool& mSignalCalled;
+ bool& mSignalCalled;
Actor& mActor;
};
struct CulledPropertyNotificationFunctor
{
- CulledPropertyNotificationFunctor( bool& signalCalled, PropertyNotification& propertyNotification )
- : mSignalCalled( signalCalled ),
- mPropertyNotification( propertyNotification )
- { }
+ CulledPropertyNotificationFunctor(bool& signalCalled, PropertyNotification& propertyNotification)
+ : mSignalCalled(signalCalled),
+ mPropertyNotification(propertyNotification)
+ {
+ }
- void operator()( PropertyNotification& source )
+ void operator()(PropertyNotification& source)
{
- mSignalCalled = true;
+ mSignalCalled = true;
mPropertyNotification = source;
}
- bool& mSignalCalled;
+ bool& mSignalCalled;
PropertyNotification& mPropertyNotification;
};
} // anonymous namespace
-
//& purpose: Testing New API
int UtcDaliActorNew(void)
{
TestApplication application;
tet_infoline("Testing Dali::Actor::DownCast()");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
BaseHandle object(actor);
- Actor actor2 = Actor::DownCast(object);
+ Actor actor2 = Actor::DownCast(object);
DALI_TEST_CHECK(actor2);
END_TEST;
}
tet_infoline("Testing Dali::Actor::DownCast()");
BaseHandle unInitializedObject;
- Actor actor = Actor::DownCast(unInitializedObject);
+ Actor actor = Actor::DownCast(unInitializedObject);
DALI_TEST_CHECK(!actor);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
- int id = actor.GetProperty< int >( Actor::Property::ID );
+ int id = actor.GetProperty<int>(Actor::Property::ID);
- Actor moved = std::move( actor);
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION );
- DALI_TEST_CHECK( !actor );
+ Actor moved = std::move(actor);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
+ DALI_TEST_CHECK(!actor);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
- int id = actor.GetProperty< int >( Actor::Property::ID );
+ int id = actor.GetProperty<int>(Actor::Property::ID);
Actor moved;
- moved = std::move( actor);
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION );
- DALI_TEST_CHECK( !actor );
+ moved = std::move(actor);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
+ DALI_TEST_CHECK(!actor);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_CHECK(actor.GetProperty< std::string >( Actor::Property::NAME ).empty());
+ DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME).empty());
END_TEST;
}
TestApplication application;
string str("ActorName");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::NAME,str);
- DALI_TEST_CHECK(actor.GetProperty< std::string >( Actor::Property::NAME ) == str);
+ actor.SetProperty(Actor::Property::NAME, str);
+ DALI_TEST_CHECK(actor.GetProperty<std::string>(Actor::Property::NAME) == str);
END_TEST;
}
tet_infoline("Testing Dali::Actor::UtcDaliActo.GetProperty< int >( Actor::Property::ID )");
TestApplication application;
- Actor first = Actor::New();
+ Actor first = Actor::New();
Actor second = Actor::New();
- Actor third = Actor::New();
+ Actor third = Actor::New();
- DALI_TEST_CHECK(first.GetProperty< int >( Actor::Property::ID ) != second.GetProperty< int >( Actor::Property::ID ));
- DALI_TEST_CHECK(second.GetProperty< int >( Actor::Property::ID ) != third.GetProperty< int >( Actor::Property::ID ));
+ DALI_TEST_CHECK(first.GetProperty<int>(Actor::Property::ID) != second.GetProperty<int>(Actor::Property::ID));
+ DALI_TEST_CHECK(second.GetProperty<int>(Actor::Property::ID) != third.GetProperty<int>(Actor::Property::ID));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK(!actor.GetProperty< bool >( Actor::Property::IS_ROOT ));
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_ROOT));
// get the root layer
- actor = application.GetScene().GetLayer( 0 );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::IS_ROOT ) );
+ actor = application.GetScene().GetLayer(0);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_ROOT));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
// get the root layer
- actor = application.GetScene().GetLayer( 0 );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ actor = application.GetScene().GetLayer(0);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::IS_LAYER ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::IS_LAYER));
// get the root layer
- actor = application.GetScene().GetLayer( 0 );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::IS_LAYER ) );
+ actor = application.GetScene().GetLayer(0);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::IS_LAYER));
END_TEST;
}
DALI_TEST_CHECK(layer);
// get the root layers layer
- actor = application.GetScene().GetLayer( 0 );
- DALI_TEST_CHECK( actor.GetLayer() );
+ actor = application.GetScene().GetLayer(0);
+ DALI_TEST_CHECK(actor.GetLayer());
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- Actor child = Actor::New();
+ Actor child = Actor::New();
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
parent.Add(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
Actor parent2 = Actor::New();
- parent2.Add( child );
+ parent2.Add(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
// try Adding to same parent again, works
- parent2.Add( child );
- DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
+ parent2.Add(child);
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
// try reparenting an orphaned child
{
Actor temporaryParent = Actor::New();
- temporaryParent.Add( child );
- DALI_TEST_EQUALS( parent2.GetChildCount(), 0u, TEST_LOCATION );
+ temporaryParent.Add(child);
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 0u, TEST_LOCATION);
}
// temporaryParent has now died, reparent the orphaned child
- parent2.Add( child );
- DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
+ parent2.Add(child);
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
END_TEST;
}
Actor child = Actor::New();
Actor parent2 = Actor::New();
- parent2.Add( child );
+ parent2.Add(child);
// try illegal Add
try
{
- parent2.Add( parent2 );
- tet_printf("Assertion test failed - no Exception\n" );
+ parent2.Add(parent2);
+ tet_printf("Assertion test failed - no Exception\n");
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "this != &child", TEST_LOCATION);
- DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
// try reparenting root
try
{
- parent2.Add( application.GetScene().GetLayer( 0 ) );
- tet_printf("Assertion test failed - no Exception\n" );
+ parent2.Add(application.GetScene().GetLayer(0));
+ tet_printf("Assertion test failed - no Exception\n");
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "!child.IsRoot()", TEST_LOCATION);
- DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
Actor empty;
- parent2.Add( empty );
- tet_printf("Assertion test failed - no Exception\n" );
+ parent2.Add(empty);
+ tet_printf("Assertion test failed - no Exception\n");
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
- DALI_TEST_EQUALS( parent2.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent2.GetChildCount(), 1u, TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
TestApplication application;
Actor parent = Actor::New();
- Actor child = Actor::New();
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
+ Actor child = Actor::New();
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
parent.Add(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
parent.Remove(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
// remove again, no problem
parent.Remove(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
// add child back
parent.Add(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
// try Remove self, its a no-op
- parent.Remove( parent );
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
+ parent.Remove(parent);
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
// try Remove empty
try
{
Actor empty;
- parent.Remove( empty );
- tet_printf("Assertion test failed - no Exception\n" );
+ parent.Remove(empty);
+ tet_printf("Assertion test failed - no Exception\n");
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
END_TEST;
TestApplication application;
Actor parent = Actor::New();
- Actor child = Actor::New();
+ Actor child = Actor::New();
Actor random = Actor::New();
- application.GetScene().Add( parent );
+ application.GetScene().Add(parent);
DALI_TEST_CHECK(parent.GetChildCount() == 0);
DALI_TEST_CHECK(parent.GetChildCount() == 1);
- application.GetScene().Remove( parent );
+ application.GetScene().Remove(parent);
DALI_TEST_CHECK(parent.GetChildCount() == 1);
END_TEST;
TestApplication application;
Actor parent = Actor::New();
- Actor child = Actor::New();
+ Actor child = Actor::New();
DALI_TEST_CHECK(parent.GetChildCount() == 0);
TestApplication application;
Actor parent = Actor::New();
- Actor child = Actor::New();
+ Actor child = Actor::New();
parent.Add(child);
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- float startValue(1.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
+ float startValue(1.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
- actor.SetProperty( index, 5.0f );
+ actor.SetProperty(index, 5.0f);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( actor.GetProperty<float>(index) == 5.0f );
+ DALI_TEST_CHECK(actor.GetProperty<float>(index) == 5.0f);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- float startValue(5.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
+ float startValue(5.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( actor.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<float>(index) == startValue);
- actor.SetProperty( index, int(1) );
+ actor.SetProperty(index, int(1));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( actor.GetProperty<float>(index) == 1.0f );
+ DALI_TEST_CHECK(actor.GetProperty<float>(index) == 1.0f);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- int startValue(5);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( actor.GetProperty<int>(index) == startValue );
+ int startValue(5);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( actor.GetProperty<int>(index) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<int>(index) == startValue);
- actor.SetProperty( index, float(1.5) );
+ actor.SetProperty(index, float(1.5));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( actor.GetProperty<int>(index) == 1 );
+ DALI_TEST_CHECK(actor.GetProperty<int>(index) == 1);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, vector );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.1f, 0.2f, 0.3f ) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.1f, 0.2f, 0.3f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
- actor.SetProperty( Actor::Property::PARENT_ORIGIN_X, vector.x );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN_X, vector.x);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN_Y, vector.y );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN_Y, vector.y);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN_Z, vector.z );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN_Z, vector.z);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, vector );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN));
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
- actor.SetProperty( Actor::Property::ANCHOR_POINT, vector );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, Vector3( 0.1f, 0.2f, 0.3f ) );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.1f, 0.2f, 0.3f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
- actor.SetProperty( Actor::Property::ANCHOR_POINT_X, vector.x );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT_X, vector.x);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT_Y, vector.y );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT_Y, vector.y);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT_Z, vector.z );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT_Z, vector.z);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
- actor.SetProperty( Actor::Property::ANCHOR_POINT, vector);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT));
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 0.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE, Vector2( vector.x, vector.y ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
// Immediately retrieve the size after setting
- Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
// Flush the queue and render once
application.SendNotification();
application.Render();
// Check the size in the new frame
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
// Check async behaviour
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
// Change the resize policy and check whether the size stays the same
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// Set a new size after resize policy is changed and check the new size
- actor.SetProperty( Actor::Property::SIZE, Vector3( 0.1f, 0.2f, 0.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.0f));
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
// Change the resize policy again and check whether the new size stays the same
- actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
// Set another new size after resize policy is changed and check the new size
- actor.SetProperty( Actor::Property::SIZE, Vector3( 50.0f, 60.0f, 0.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector3(50.0f, 60.0f, 0.0f));
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, Vector3( 50.0f, 60.0f, 0.0f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, Vector3(50.0f, 60.0f, 0.0f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE, Vector3( vector.x, vector.y, vector.z ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector3(vector.x, vector.y, vector.z));
// Immediately check the size after setting
- Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the size in the new frame
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 0.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE,Vector2(vector.x, vector.y));
+ actor.SetProperty(Actor::Property::SIZE, Vector2(vector.x, vector.y));
// Immediately check the size after setting
- Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the size in the new frame
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE,vector);
+ actor.SetProperty(Actor::Property::SIZE, vector);
// Immediately check the size after setting
- Vector3 currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ Vector3 currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, vector, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the size in the new frame
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- application.GetScene().Add( actor );
- actor.SetProperty( Actor::Property::SIZE, Vector3( 0.1f, 0.2f, 0.3f ) );
+ application.GetScene().Add(actor);
+ actor.SetProperty(Actor::Property::SIZE, Vector3(0.1f, 0.2f, 0.3f));
// Immediately check the size after setting
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.3f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the size in the new frame
- DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), TEST_LOCATION);
- currentSize = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, Vector3( 0.1f, 0.2f, 0.3f ), Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, Vector3(0.1f, 0.2f, 0.3f), Math::MACHINE_EPSILON_0, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
+ actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
// Immediately check the width after setting
- float sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
- DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ float sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
+ DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the width in the new frame
- DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
- sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
- DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
+ DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
+ actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
// Immediately check the height after setting
- float sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
- DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ float sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
+ DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the height in the new frame
- DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
- sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
- DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
+ DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
+ actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
// Immediately check the depth after setting
- float sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
- DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ float sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
+ DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the depth in the new frame
- DALI_TEST_EQUALS( vector.depth, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.depth, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, TEST_LOCATION);
- sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
- DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
+ DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// Change the resize policy and check whether the size stays the same
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
- sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
- DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
+ DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
- DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
+ DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
- DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
+ DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// Change the resize policy again and check whether the size stays the same
- actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
+ actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
- sizeWidth = actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >();
- DALI_TEST_EQUALS( sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeWidth = actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>();
+ DALI_TEST_EQUALS(sizeWidth, vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- sizeHeight = actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >();
- DALI_TEST_EQUALS( sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeHeight = actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>();
+ DALI_TEST_EQUALS(sizeHeight, vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- sizeDepth = actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >();
- DALI_TEST_EQUALS( sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ sizeDepth = actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>();
+ DALI_TEST_EQUALS(sizeDepth, vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- application.GetScene().Add( actor );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
- Vector3 vector( 100.0f, 200.0f, 400.0f );
- DALI_TEST_CHECK( vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ) );
+ Vector3 vector(100.0f, 200.0f, 400.0f);
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_WIDTH ).Get< float >(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_WIDTH, vector.width);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_WIDTH).Get<float>(), vector.width, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_HEIGHT ).Get< float >(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_HEIGHT, vector.height);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_HEIGHT).Get<float>(), vector.height, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_DEPTH ).Get< float >(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_DEPTH, vector.depth);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_DEPTH).Get<float>(), vector.depth, Math::MACHINE_EPSILON_0, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
// Check the width in the new frame
- DALI_TEST_EQUALS( vector.width, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.height, actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.width, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.height, actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliActorGetCurrentSize(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 20.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE,vector);
+ actor.SetProperty(Actor::Property::SIZE, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
- Vector3 vector( 0.0f, 0.0f, 0.0f );
+ Actor actor = Actor::New();
+ Vector3 vector(0.0f, 0.0f, 0.0f);
- DALI_TEST_CHECK( actor.GetNaturalSize() == vector );
+ DALI_TEST_CHECK(actor.GetNaturalSize() == vector);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 20.0f);
DALI_TEST_CHECK(vector != actor.GetTargetSize());
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
- actor.SetProperty( Actor::Property::SIZE,vector);
+ actor.SetProperty(Actor::Property::SIZE, vector);
DALI_TEST_CHECK(vector == actor.GetTargetSize());
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
// flush the queue and render once
application.SendNotification();
application.Render();
DALI_TEST_CHECK(vector == actor.GetTargetSize());
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
// Animation
// Build the animation
- const float durationSeconds = 2.0f;
- Animation animation = Animation::New( durationSeconds );
- const Vector3 targetValue( 10.0f, 20.0f, 30.0f );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
+ const float durationSeconds = 2.0f;
+ Animation animation = Animation::New(durationSeconds);
+ const Vector3 targetValue(10.0f, 20.0f, 30.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
- DALI_TEST_CHECK( actor.GetTargetSize() == vector );
+ DALI_TEST_CHECK(actor.GetTargetSize() == vector);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( static_cast<unsigned int>( durationSeconds * 1000.0f ) );
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f));
- DALI_TEST_CHECK( actor.GetTargetSize() == targetValue );
+ DALI_TEST_CHECK(actor.GetTargetSize() == targetValue);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
- actor.SetProperty( Actor::Property::SIZE,Vector3{ 1.0f, 1.0f, 1.0f });
+ actor.SetProperty(Actor::Property::POSITION, Vector3(2.0f, 2.0f, 16.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector3{1.0f, 1.0f, 1.0f});
application.SendNotification();
application.Render();
- auto expectedExtent = Rect<>{ -0.5f, -0.5f, 1.0f, 1.0f };
- auto actualExtent = DevelActor::CalculateScreenExtents( actor );
- DALI_TEST_EQUALS( expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
- DALI_TEST_EQUALS( expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+ auto expectedExtent = Rect<>{-0.5f, -0.5f, 1.0f, 1.0f};
+ auto actualExtent = DevelActor::CalculateScreenExtents(actor);
+ DALI_TEST_EQUALS(expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
// Set to random to start off with
- actor.SetProperty( Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 0.0f));
Vector3 vector(100.0f, 100.0f, 0.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION, Vector2(vector.x, vector.y));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(vector.x, vector.y));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- application.GetScene().Add( actor );
- actor.SetProperty( Actor::Property::POSITION, Vector3( 0.1f, 0.2f, 0.3f ) );
+ application.GetScene().Add(actor);
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.1f, 0.2f, 0.3f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION_X, 1.0f );
- actor.SetProperty( Actor::Property::POSITION_Y, 1.1f );
- actor.SetProperty( Actor::Property::POSITION_Z, 1.2f );
+ actor.SetProperty(Actor::Property::POSITION_X, 1.0f);
+ actor.SetProperty(Actor::Property::POSITION_Y, 1.1f);
+ actor.SetProperty(Actor::Property::POSITION_Z, 1.2f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector3( 1.0f, 1.1f, 1.2f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(1.0f, 1.1f, 1.2f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
- actor.TranslateBy( Vector3( 0.1f, 0.1f, 0.1f ) );
+ actor.TranslateBy(Vector3(0.1f, 0.1f, 0.1f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector3( 1.1f, 1.2f, 1.3f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(1.1f, 1.2f, 1.3f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Math::MACHINE_EPSILON_10000, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
// Set to random to start off with
- actor.SetProperty( Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
Vector3 vector(100.0f, 100.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(vector.x, vector.y, vector.z));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
END_TEST;
}
Actor actor = Actor::New();
// Set to random to start off with
- actor.SetProperty( Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(120.0f, 120.0f, 120.0f));
Vector3 vector(100.0f, 100.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION, vector);
+ actor.SetProperty(Actor::Property::POSITION, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
END_TEST;
}
Vector3 vector(100.0f, 0.0f, 0.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION_X, 100.0f);
+ actor.SetProperty(Actor::Property::POSITION_X, 100.0f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
END_TEST;
}
Vector3 vector(0.0f, 100.0f, 0.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION_Y, 100.0f);
+ actor.SetProperty(Actor::Property::POSITION_Y, 100.0f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
END_TEST;
}
Vector3 vector(0.0f, 0.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION_Z, 100.0f);
+ actor.SetProperty(Actor::Property::POSITION_Z, 100.0f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION_X, vector.x );
- DALI_TEST_EQUALS( vector.x, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::POSITION_X, vector.x);
+ DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION_Y, vector.y );
- DALI_TEST_EQUALS( vector.y, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::POSITION_Y, vector.y);
+ DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< float >( Actor::Property::POSITION_Y ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Y), TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION_Z, vector.z );
- DALI_TEST_EQUALS( vector.z, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::POSITION_Z, vector.z);
+ DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< float >( Actor::Property::POSITION_Z ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::POSITION_Z), TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 vector(100.0f, 100.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- actor.SetProperty( Actor::Property::POSITION, vector);
+ actor.SetProperty(Actor::Property::POSITION, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
actor.TranslateBy(vector);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector*2.0f == actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
+ DALI_TEST_CHECK(vector * 2.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 setVector(100.0f, 100.0f, 0.0f);
- actor.SetProperty( Actor::Property::POSITION, setVector);
+ actor.SetProperty(Actor::Property::POSITION, setVector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) == setVector);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) == setVector);
END_TEST;
}
{
TestApplication application;
- Actor parent = Actor::New();
- Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::POSITION, parentPosition );
- parent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- parent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- application.GetScene().Add( parent );
+ Actor parent = Actor::New();
+ Vector3 parentPosition(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::POSITION, parentPosition);
+ parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- Vector3 childPosition( 6.0f, 6.0f, 6.0f );
- child.SetProperty( Actor::Property::POSITION, childPosition );
- parent.Add( child );
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ Vector3 childPosition(6.0f, 6.0f, 6.0f);
+ child.SetProperty(Actor::Property::POSITION, childPosition);
+ parent.Add(child);
// The actors should not have a world position yet
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
// The actors should have a world position now
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Actor::SetInheritPosition");
TestApplication application;
- Actor parent = Actor::New();
- Vector3 parentPosition( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::POSITION, parentPosition );
- parent.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- parent.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- application.GetScene().Add( parent );
+ Actor parent = Actor::New();
+ Vector3 parentPosition(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::POSITION, parentPosition);
+ parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- child.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- Vector3 childPosition( 10.0f, 11.0f, 12.0f );
- child.SetProperty( Actor::Property::POSITION, childPosition );
- parent.Add( child );
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ Vector3 childPosition(10.0f, 11.0f, 12.0f);
+ child.SetProperty(Actor::Property::POSITION, childPosition);
+ parent.Add(child);
// The actors should not have a world position yet
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3::ZERO, TEST_LOCATION);
// first test default, which is to inherit position
- DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
application.SendNotification();
application.Render(0); // should only really call Update as Render is not required to update scene
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childPosition, TEST_LOCATION);
//Change child position
- Vector3 childOffset( -1.0f, 1.0f, 0.0f );
- child.SetProperty( Actor::Property::POSITION, childOffset );
+ Vector3 childOffset(-1.0f, 1.0f, 0.0f);
+ child.SetProperty(Actor::Property::POSITION, childOffset);
// Use local position as world postion
- child.SetProperty( Actor::Property::INHERIT_POSITION, false );
- DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), false, TEST_LOCATION );
+ child.SetProperty(Actor::Property::INHERIT_POSITION, false);
+ DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), false, TEST_LOCATION);
application.SendNotification();
application.Render(0); // should only really call Update as Render is not required to update scene
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childOffset, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), childOffset, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), childOffset, TEST_LOCATION);
//Change back to inherit position from parent
- child.SetProperty( Actor::Property::INHERIT_POSITION, true );
- DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_POSITION ), true, TEST_LOCATION );
+ child.SetProperty(Actor::Property::INHERIT_POSITION, true);
+ DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_POSITION), true, TEST_LOCATION);
application.SendNotification();
application.Render(0); // should only really call Update as Render is not required to update scene
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), childOffset, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), parentPosition + childOffset, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), childOffset, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), parentPosition + childOffset, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- Actor child = Actor::New();
- parent.Add( child );
- application.GetScene().Add( parent );
+ Actor child = Actor::New();
+ parent.Add(child);
+ application.GetScene().Add(parent);
- DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- parent.SetProperty( Actor::Property::OPACITY, 0.1f );
+ parent.SetProperty(Actor::Property::OPACITY, 0.1f);
- DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.0f, 0.0001f, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( parent.GetProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::WORLD_COLOR ).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty( Actor::Property::COLOR_ALPHA ).Get<float>(), 1.f, 0.0001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 0.1f, 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::WORLD_COLOR).Get<Vector4>(), Vector4(1.f, 1.f, 1.f, 0.1f), 0.0001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty(Actor::Property::COLOR_ALPHA).Get<float>(), 1.f, 0.0001f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- Actor actor = Actor::New();
+ Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, rotation);
+ actor.SetProperty(Actor::Property::ORIENTATION, rotation);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Radian angle( 0.785f );
+ Radian angle(0.785f);
Vector3 axis(1.0f, 1.0f, 0.0f);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( angle, axis ) );
- Quaternion rotation( angle, axis );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
+ Quaternion rotation(angle, axis);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
- application.GetScene().Add( actor );
- actor.RotateBy( Degree( 360 ), axis);
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ application.GetScene().Add(actor);
+ actor.RotateBy(Degree(360), axis);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) ) );
- Quaternion result( Radian( 0 ), Vector3( 1.0f, 0.0f, 0.0f ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(0), Vector3(1.0f, 0.0f, 0.0f)));
+ Quaternion result(Radian(0), Vector3(1.0f, 0.0f, 0.0f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( result, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(result, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( angle, axis ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(angle, axis));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
{
TestApplication application;
- Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- Actor actor = Actor::New();
+ Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, rotation );
- DALI_TEST_EQUALS(rotation, actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ actor.SetProperty(Actor::Property::ORIENTATION, rotation);
+ DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(rotation, actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Radian angle( M_PI * 0.25f );
- actor.RotateBy(( angle ), Vector3::ZAXIS);
+ Radian angle(M_PI * 0.25f);
+ actor.RotateBy((angle), Vector3::ZAXIS);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(Quaternion( angle, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(Quaternion(angle, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- actor.RotateBy( angle, Vector3::ZAXIS);
+ actor.RotateBy(angle, Vector3::ZAXIS);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
- Radian angle( M_PI * 0.25f );
+ Radian angle(M_PI * 0.25f);
Quaternion rotation(angle, Vector3::ZAXIS);
actor.RotateBy(rotation);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
actor.RotateBy(rotation);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(Quaternion(angle * 2.0f, Vector3::ZAXIS), actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorGetCurrentOrientation(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- actor.SetProperty( Actor::Property::ORIENTATION, rotation );
+ actor.SetProperty(Actor::Property::ORIENTATION, rotation);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rotation, actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Actor::GetCurrentWorldRotation");
TestApplication application;
- Actor parent = Actor::New();
- Radian rotationAngle( Degree(90.0f) );
- Quaternion rotation( rotationAngle, Vector3::YAXIS );
- parent.SetProperty( Actor::Property::ORIENTATION, rotation );
- application.GetScene().Add( parent );
+ Actor parent = Actor::New();
+ Radian rotationAngle(Degree(90.0f));
+ Quaternion rotation(rotationAngle, Vector3::YAXIS);
+ parent.SetProperty(Actor::Property::ORIENTATION, rotation);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::ORIENTATION, rotation );
- parent.Add( child );
+ child.SetProperty(Actor::Property::ORIENTATION, rotation);
+ parent.Add(child);
// The actors should not have a world rotation yet
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), 0.001, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, 0.001, TEST_LOCATION);
// The actors should have a world rotation now
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle * 2.0f, Vector3::YAXIS ), 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle * 2.0f, Vector3::YAXIS), 0.001, TEST_LOCATION);
// turn off child rotation inheritance
- child.SetProperty( Actor::Property::INHERIT_ORIENTATION, false );
- DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_ORIENTATION ), false, TEST_LOCATION );
+ child.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
+ DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
application.SendNotification();
application.Render(0);
// The actors should have a world rotation now
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion( rotationAngle, Vector3::YAXIS ), 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), rotation, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion(rotationAngle, Vector3::YAXIS), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), rotation, 0.001, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
- actor.SetProperty( Actor::Property::SCALE,0.25f);
+ actor.SetProperty(Actor::Property::SCALE, 0.25f);
Vector3 scale(10.0f, 10.0f, 10.0f);
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
- actor.SetProperty( Actor::Property::SCALE,scale.x);
+ actor.SetProperty(Actor::Property::SCALE, scale.x);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
END_TEST;
}
int UtcDaliActorSetScale02(void)
{
TestApplication application;
- Vector3 scale(10.0f, 10.0f, 10.0f);
+ Vector3 scale(10.0f, 10.0f, 10.0f);
Actor actor = Actor::New();
// Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
- actor.SetProperty( Actor::Property::SCALE, Vector3( 12.0f, 1.0f, 2.0f ) );
+ actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
- actor.SetProperty( Actor::Property::SCALE, Vector3( scale.x, scale.y, scale.z ) );
+ actor.SetProperty(Actor::Property::SCALE, Vector3(scale.x, scale.y, scale.z));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
// add to stage and test
- application.GetScene().Add( actor );
- actor.SetProperty( Actor::Property::SCALE, Vector3( 2.0f, 2.0f, 2.0f ) );
+ application.GetScene().Add(actor);
+ actor.SetProperty(Actor::Property::SCALE, Vector3(2.0f, 2.0f, 2.0f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector3( 2.0f, 2.0f, 2.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(2.0f, 2.0f, 2.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), 0.001, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
int UtcDaliActorSetScale03(void)
{
TestApplication application;
- Vector3 scale(10.0f, 10.0f, 10.0f);
+ Vector3 scale(10.0f, 10.0f, 10.0f);
Actor actor = Actor::New();
// Set to random value first -.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) asserts if called before SetScale()
- actor.SetProperty( Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
+ actor.SetProperty(Actor::Property::SCALE, Vector3(12.0f, 1.0f, 2.0f));
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) != scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) != scale);
- actor.SetProperty( Actor::Property::SCALE,scale);
+ actor.SetProperty(Actor::Property::SCALE, scale);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
END_TEST;
}
Actor actor = Actor::New();
Vector3 vector(0.7f, 0.8f, 0.9f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
- actor.SetProperty( Actor::Property::SCALE_X, vector.x );
- DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SCALE_X, vector.x);
+ DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.x, actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.x, actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), TEST_LOCATION);
- actor.SetProperty( Actor::Property::SCALE_Y, vector.y );
- DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SCALE_Y, vector.y);
+ DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.y, actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.y, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), TEST_LOCATION);
- actor.SetProperty( Actor::Property::SCALE_Z, vector.z );
- DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SCALE_Z, vector.z);
+ DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.z, actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.z, actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), TEST_LOCATION);
- DALI_TEST_EQUALS( vector, actor.GetProperty< Vector3 >( Actor::Property::SCALE ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector, actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector, actor.GetProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), TEST_LOCATION);
END_TEST;
}
int UtcDaliActorScaleBy(void)
{
TestApplication application;
- Actor actor = Actor::New();
- Vector3 vector(100.0f, 100.0f, 100.0f);
+ Actor actor = Actor::New();
+ Vector3 vector(100.0f, 100.0f, 100.0f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
- actor.SetProperty( Actor::Property::SCALE,vector);
+ actor.SetProperty(Actor::Property::SCALE, vector);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector == actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
+ DALI_TEST_CHECK(vector == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
actor.ScaleBy(vector);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(vector*100.0f == actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
+ DALI_TEST_CHECK(vector * 100.0f == actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
END_TEST;
}
int UtcDaliActorGetCurrentScale(void)
{
TestApplication application;
- Vector3 scale(12.0f, 1.0f, 2.0f);
+ Vector3 scale(12.0f, 1.0f, 2.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SCALE,scale);
+ actor.SetProperty(Actor::Property::SCALE, scale);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ) == scale);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE) == scale);
END_TEST;
}
{
TestApplication application;
- Actor parent = Actor::New();
- Vector3 parentScale( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::SCALE, parentScale );
- application.GetScene().Add( parent );
+ Actor parent = Actor::New();
+ Vector3 parentScale(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::SCALE, parentScale);
+ application.GetScene().Add(parent);
- Actor child = Actor::New();
- Vector3 childScale( 2.0f, 2.0f, 2.0f );
- child.SetProperty( Actor::Property::SCALE, childScale );
- parent.Add( child );
+ Actor child = Actor::New();
+ Vector3 childScale(2.0f, 2.0f, 2.0f);
+ child.SetProperty(Actor::Property::SCALE, childScale);
+ parent.Add(child);
// The actors should not have a scale yet
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// The actors should not have a world scale yet
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), Vector3::ONE, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), parentScale, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), childScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::SCALE), parentScale, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::SCALE), childScale, TEST_LOCATION);
// The actors should have a world scale now
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale * childScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Actor::SetInheritScale");
TestApplication application;
- Actor parent = Actor::New();
- Vector3 parentScale( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::SCALE, parentScale );
- application.GetScene().Add( parent );
+ Actor parent = Actor::New();
+ Vector3 parentScale(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::SCALE, parentScale);
+ application.GetScene().Add(parent);
- Actor child = Actor::New();
- Vector3 childScale( 2.0f, 2.0f, 2.0f );
- child.SetProperty( Actor::Property::SCALE, childScale );
- parent.Add( child );
+ Actor child = Actor::New();
+ Vector3 childScale(2.0f, 2.0f, 2.0f);
+ child.SetProperty(Actor::Property::SCALE, childScale);
+ parent.Add(child);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), parentScale * childScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), parentScale * childScale, TEST_LOCATION);
- child.SetProperty( Actor::Property::INHERIT_SCALE, false );
- DALI_TEST_EQUALS( child.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), false, TEST_LOCATION );
+ child.SetProperty(Actor::Property::INHERIT_SCALE, false);
+ DALI_TEST_EQUALS(child.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_SCALE ), childScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE), childScale, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
- actor.SetProperty( Actor::Property::VISIBLE,true);
+ actor.SetProperty(Actor::Property::VISIBLE, true);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
// put actor on stage
- application.GetScene().Add( actor );
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ application.GetScene().Add(actor);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
END_TEST;
}
Actor actor = Actor::New();
// initial opacity is 1
- DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 1.0f, TEST_LOCATION);
- actor.SetProperty( Actor::Property::OPACITY, 0.4f);
+ actor.SetProperty(Actor::Property::OPACITY, 0.4f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.4f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.4f, TEST_LOCATION);
// change opacity, actor is on stage to change is not immediate
- actor.SetProperty( Actor::Property::OPACITY, actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) + 0.1f );
+ actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) + 0.1f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
// put actor on stage
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// change opacity, actor is on stage to change is not immediate
- actor.SetProperty( Actor::Property::OPACITY, 0.9f );
- DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.5f, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::OPACITY, 0.9f);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.5f, TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.9f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.9f, TEST_LOCATION);
// change opacity, actor is on stage to change is not immediate
- actor.SetProperty( Actor::Property::OPACITY, actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) - 0.9f );
+ actor.SetProperty(Actor::Property::OPACITY, actor.GetCurrentProperty<float>(Actor::Property::OPACITY) - 0.9f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.0f, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) != 0.5f);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) != 0.5f);
- actor.SetProperty( Actor::Property::OPACITY,0.5f);
+ actor.SetProperty(Actor::Property::OPACITY, 0.5f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(actor.GetCurrentProperty< float >( Actor::Property::OPACITY ) == 0.5f);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<float>(Actor::Property::OPACITY) == 0.5f);
END_TEST;
}
int UtcDaliActorSetSensitive(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
- bool sensitive = !actor.GetProperty< bool >( Actor::Property::SENSITIVE );
+ bool sensitive = !actor.GetProperty<bool>(Actor::Property::SENSITIVE);
- actor.SetProperty( Actor::Property::SENSITIVE,sensitive);
+ actor.SetProperty(Actor::Property::SENSITIVE, sensitive);
- DALI_TEST_CHECK(sensitive == actor.GetProperty< bool >( Actor::Property::SENSITIVE ));
+ DALI_TEST_CHECK(sensitive == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
END_TEST;
}
int UtcDaliActorIsSensitive(void)
{
TestApplication application;
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SENSITIVE,false);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SENSITIVE, false);
- DALI_TEST_CHECK(false == actor.GetProperty< bool >( Actor::Property::SENSITIVE ));
+ DALI_TEST_CHECK(false == actor.GetProperty<bool>(Actor::Property::SENSITIVE));
END_TEST;
}
int UtcDaliActorSetColor(void)
{
TestApplication application;
- Actor actor = Actor::New();
- Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
+ Actor actor = Actor::New();
+ Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
- DALI_TEST_CHECK(color != actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
+ DALI_TEST_CHECK(color != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
- actor.SetProperty( Actor::Property::COLOR,color);
+ actor.SetProperty(Actor::Property::COLOR, color);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(color == actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
+ DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
- actor.SetProperty( Actor::Property::COLOR, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ) + Vector4( -0.4f, -0.5f, -0.6f, -0.4f ) );
+ actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(-0.4f, -0.5f, -0.6f, -0.4f));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( Vector4( 0.6f, 0.5f, 0.4f, 0.1f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector4(0.6f, 0.5f, 0.4f, 0.1f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
- application.GetScene().Add( actor );
- actor.SetProperty( Actor::Property::COLOR, color );
+ application.GetScene().Add(actor);
+ actor.SetProperty(Actor::Property::COLOR, color);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( color, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+ DALI_TEST_EQUALS(color, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ) + Vector4( 1.1f, 1.1f, 1.1f, 1.1f ) );
+ actor.SetProperty(Actor::Property::COLOR, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR) + Vector4(1.1f, 1.1f, 1.1f, 1.1f));
// flush the queue and render once
application.SendNotification();
application.Render();
// Actor color is not clamped
- DALI_TEST_EQUALS( Vector4( 2.1f, 2.1f, 2.1f, 1.6f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector4(2.1f, 2.1f, 2.1f, 1.6f), actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
// world color is clamped
- DALI_TEST_EQUALS( Vector4( 1.0f, 1.0f, 1.0f, 1.0f ), actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector4(1.0f, 1.0f, 1.0f, 1.0f), actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR, color );
- DALI_TEST_EQUALS( color, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR, color);
+ DALI_TEST_EQUALS(color, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
- Vector3 newColor( 1.0f, 0.0f, 0.0f );
- actor.SetProperty( Actor::Property::COLOR, newColor );
- DALI_TEST_EQUALS( Vector4( newColor.r, newColor.g, newColor.b, 1.0f ), actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+ Vector3 newColor(1.0f, 0.0f, 0.0f);
+ actor.SetProperty(Actor::Property::COLOR, newColor);
+ DALI_TEST_EQUALS(Vector4(newColor.r, newColor.g, newColor.b, 1.0f), actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
END_TEST;
}
Actor actor = Actor::New();
Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
- DALI_TEST_CHECK(vector != actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
+ DALI_TEST_CHECK(vector != actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
- actor.SetProperty( Actor::Property::COLOR_RED, vector.r );
- DALI_TEST_EQUALS( vector.r, actor.GetProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_RED, vector.r);
+ DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.r, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.r, actor.GetProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.r, actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.r, actor.GetProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.r, actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_GREEN, vector.g );
- DALI_TEST_EQUALS( vector.g, actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_GREEN, vector.g);
+ DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.g, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.g, actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.g, actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.g, actor.GetProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.g, actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_BLUE, vector.b );
- DALI_TEST_EQUALS( vector.b, actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_BLUE, vector.b);
+ DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.b, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.b, actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.b, actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), TEST_LOCATION );
-
+ DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.b, actor.GetProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.b, actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_ALPHA, vector.a );
- DALI_TEST_EQUALS( vector.a, actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_ALPHA, vector.a);
+ DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( vector.a, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, TEST_LOCATION );
- DALI_TEST_EQUALS( vector.a, actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.a, actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), TEST_LOCATION );
-
- DALI_TEST_EQUALS( vector, actor.GetProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
- DALI_TEST_EQUALS( vector, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), TEST_LOCATION );
+ DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.a, actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.a, actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), TEST_LOCATION);
- actor.SetProperty( Actor::Property::OPACITY, 0.2f );
+ DALI_TEST_EQUALS(vector, actor.GetProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), TEST_LOCATION);
+ actor.SetProperty(Actor::Property::OPACITY, 0.2f);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( 0.2f, actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.2f, actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliActorGetCurrentColor(void)
{
TestApplication application;
- Actor actor = Actor::New();
- Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
+ Actor actor = Actor::New();
+ Vector4 color(1.0f, 1.0f, 1.0f, 0.5f);
- actor.SetProperty( Actor::Property::COLOR,color);
+ actor.SetProperty(Actor::Property::COLOR, color);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK(color == actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
+ DALI_TEST_CHECK(color == actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
END_TEST;
}
tet_infoline("Actor::GetCurrentWorldColor");
TestApplication application;
- Actor parent = Actor::New();
- Vector4 parentColor( 1.0f, 0.5f, 0.0f, 0.8f );
- parent.SetProperty( Actor::Property::COLOR, parentColor );
- application.GetScene().Add( parent );
+ Actor parent = Actor::New();
+ Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
+ parent.SetProperty(Actor::Property::COLOR, parentColor);
+ application.GetScene().Add(parent);
- Actor child = Actor::New();
- Vector4 childColor( 0.5f, 0.6f, 0.5f, 1.0f );
- child.SetProperty( Actor::Property::COLOR, childColor );
- parent.Add( child );
+ Actor child = Actor::New();
+ Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
+ child.SetProperty(Actor::Property::COLOR, childColor);
+ parent.Add(child);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// verify the default color mode
- DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION );
+ DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, child.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
// The actors should not have a world color yet
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Color::WHITE, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), parentColor, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::COLOR), parentColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
// The actors should have a world color now
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), parentColor, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), Vector4( childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), Vector4(childColor.r, childColor.g, childColor.b, childColor.a * parentColor.a), TEST_LOCATION);
// use own color
- child.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
+ child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), childColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), childColor, TEST_LOCATION);
// use parent color
- child.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
+ child.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), parentColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), parentColor, TEST_LOCATION);
// use parent alpha
- child.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
+ child.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
application.SendNotification();
application.Render(0);
- Vector4 expectedColor( childColor );
+ Vector4 expectedColor(childColor);
expectedColor.a *= parentColor.a;
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), childColor, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ), expectedColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::COLOR), childColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR), expectedColor, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Actor::SetColorMode");
TestApplication application;
- Actor actor = Actor::New();
- Actor child = Actor::New();
- actor.Add( child );
+ Actor actor = Actor::New();
+ Actor child = Actor::New();
+ actor.Add(child);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
- DALI_TEST_EQUALS( USE_OWN_COLOR, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
+ DALI_TEST_EQUALS(USE_OWN_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
- DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
+ DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
- DALI_TEST_EQUALS( USE_PARENT_COLOR, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
+ DALI_TEST_EQUALS(USE_PARENT_COLOR, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
- DALI_TEST_EQUALS( USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
+ DALI_TEST_EQUALS(USE_OWN_MULTIPLY_PARENT_ALPHA, actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), TEST_LOCATION);
END_TEST;
}
int UtcDaliActorScreenToLocal(void)
{
TestApplication application;
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::POSITION, Vector2(10.0f, 10.0f));
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
application.GetScene().Add(actor);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, 50.0f, 50.0f) );
+ DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, 50.0f, 50.0f));
DALI_TEST_EQUALS(localX, 40.0f, 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(localY, 40.0f, 0.01f, TEST_LOCATION);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED,false);
- DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == false);
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED,true);
- DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == true);
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == true);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ) == false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED) == false);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true );
- DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) == true);
+ actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == true);
- actor.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, false );
- DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) == false);
+ actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_CHECK(actor.GetProperty< bool >( Actor::Property::KEYBOARD_FOCUSABLE ) == false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) == false);
END_TEST;
}
Actor actor = Actor::New();
- Constraint constraint = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraint() );
+ Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraint());
constraint.Apply();
actor.RemoveConstraints();
- DALI_TEST_CHECK( gTestConstraintCalled == false );
+ DALI_TEST_CHECK(gTestConstraintCalled == false);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
constraint.Apply();
// flush the queue and render once
actor.RemoveConstraints();
- DALI_TEST_CHECK( gTestConstraintCalled == true );
+ DALI_TEST_CHECK(gTestConstraintCalled == true);
END_TEST;
}
unsigned int result1 = 0u;
unsigned int result2 = 0u;
- unsigned constraint1Tag = 1u;
- Constraint constraint1 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1) );
- constraint1.SetTag( constraint1Tag );
+ unsigned constraint1Tag = 1u;
+ Constraint constraint1 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result1, 1));
+ constraint1.SetTag(constraint1Tag);
constraint1.Apply();
- unsigned constraint2Tag = 2u;
- Constraint constraint2 = Constraint::New<Vector4>( actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2) );
- constraint2.SetTag( constraint2Tag );
+ unsigned constraint2Tag = 2u;
+ Constraint constraint2 = Constraint::New<Vector4>(actor, Actor::Property::COLOR, TestConstraintRef<Vector4>(result2, 2));
+ constraint2.SetTag(constraint2Tag);
constraint2.Apply();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
// 2. Remove Constraint1 and test...
result1 = 0;
result2 = 0;
actor.RemoveConstraints(constraint1Tag);
// make color property dirty, which will trigger constraints to be reapplied.
- actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
+ actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
- DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
+ DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
// 3. Re-Apply Constraint1 and test...
result1 = 0;
result2 = 0;
constraint1.Apply();
// make color property dirty, which will trigger constraints to be reapplied.
- actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
+ actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( result2, 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(result2, 2u, TEST_LOCATION);
// 2. Remove Constraint2 and test...
result1 = 0;
result2 = 0;
actor.RemoveConstraints(constraint2Tag);
// make color property dirty, which will trigger constraints to be reapplied.
- actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
+ actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( result1, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
+ DALI_TEST_EQUALS(result1, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
// 2. Remove Constraint1 as well and test...
result1 = 0;
result2 = 0;
actor.RemoveConstraints(constraint1Tag);
// make color property dirty, which will trigger constraints to be reapplied.
- actor.SetProperty( Actor::Property::COLOR, Color::WHITE );
+ actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( result1, 0u, TEST_LOCATION ); ///< constraint 1 should not apply now.
- DALI_TEST_EQUALS( result2, 0u, TEST_LOCATION ); ///< constraint 2 should not apply now.
+ DALI_TEST_EQUALS(result1, 0u, TEST_LOCATION); ///< constraint 1 should not apply now.
+ DALI_TEST_EQUALS(result2, 0u, TEST_LOCATION); ///< constraint 2 should not apply now.
END_TEST;
}
// get the root layer
Actor actor = application.GetScene().GetRootLayer();
- DALI_TEST_CHECK( gTouchCallBackCalled == false );
+ DALI_TEST_CHECK(gTouchCallBackCalled == false);
application.SendNotification();
application.Render();
// connect to its touch signal
- actor.TouchedSignal().Connect( TestTouchCallback );
+ actor.TouchedSignal().Connect(TestTouchCallback);
// simulate a touch event in the middle of the screen
- Vector2 touchPoint( application.GetScene().GetSize() * 0.5 );
+ Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
- application.ProcessEvent( touchEvent );
+ touchEvent.AddPoint(point);
+ application.ProcessEvent(touchEvent);
- DALI_TEST_CHECK( gTouchCallBackCalled == true );
+ DALI_TEST_CHECK(gTouchCallBackCalled == true);
END_TEST;
}
// get the root layer
Actor actor = application.GetScene().GetRootLayer();
- DALI_TEST_CHECK( gHoverCallBackCalled == false );
+ DALI_TEST_CHECK(gHoverCallBackCalled == false);
application.SendNotification();
application.Render();
// connect to its hover signal
- actor.HoveredSignal().Connect( TestCallback3 );
+ actor.HoveredSignal().Connect(TestCallback3);
// simulate a hover event in the middle of the screen
- Vector2 touchPoint( application.GetScene().GetSize() * 0.5 );
+ Vector2 touchPoint(application.GetScene().GetSize() * 0.5);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::MOTION );
- point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::MOTION);
+ point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
Dali::Integration::HoverEvent hoverEvent;
- hoverEvent.AddPoint( point );
- application.ProcessEvent( hoverEvent );
+ hoverEvent.AddPoint(point);
+ application.ProcessEvent(hoverEvent);
- DALI_TEST_CHECK( gHoverCallBackCalled == true );
+ DALI_TEST_CHECK(gHoverCallBackCalled == true);
END_TEST;
}
gActorNamesOnOffScene.clear();
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::NAME, "parent" );
- parent.OnSceneSignal().Connect( OnSceneCallback );
- parent.OffSceneSignal().Connect( OffSceneCallback );
+ parent.SetProperty(Actor::Property::NAME, "parent");
+ parent.OnSceneSignal().Connect(OnSceneCallback);
+ parent.OffSceneSignal().Connect(OffSceneCallback);
// sanity check
- DALI_TEST_CHECK( gOnSceneCallBackCalled == 0 );
- DALI_TEST_CHECK( gOffSceneCallBackCalled == 0 );
+ DALI_TEST_CHECK(gOnSceneCallBackCalled == 0);
+ DALI_TEST_CHECK(gOffSceneCallBackCalled == 0);
// add parent to the scene
- application.GetScene().Add( parent );
+ application.GetScene().Add(parent);
// onstage emitted, offstage not
- DALI_TEST_EQUALS( gOnSceneCallBackCalled, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( gOffSceneCallBackCalled, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
// test adding a child, should get onstage emitted
// clean test data
gActorNamesOnOffScene.clear();
Actor child = Actor::New();
- child.SetProperty( Actor::Property::NAME, "child" );
- child.OnSceneSignal().Connect( OnSceneCallback );
- child.OffSceneSignal().Connect( OffSceneCallback );
- parent.Add( child ); // add child
+ child.SetProperty(Actor::Property::NAME, "child");
+ child.OnSceneSignal().Connect(OnSceneCallback);
+ child.OffSceneSignal().Connect(OffSceneCallback);
+ parent.Add(child); // add child
// onscene emitted, offscene not
- DALI_TEST_EQUALS( gOnSceneCallBackCalled, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( gOffSceneCallBackCalled, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnSceneCallBackCalled, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
// test removing parent from the scene
// clean test data
gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
gActorNamesOnOffScene.clear();
- application.GetScene().Remove( parent );
+ application.GetScene().Remove(parent);
// onscene not emitted, offscene is
- DALI_TEST_EQUALS( gOnSceneCallBackCalled, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( gOffSceneCallBackCalled, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(gOffSceneCallBackCalled, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[1], TEST_LOCATION);
// test adding parent back to the scene
// clean test data
gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
gActorNamesOnOffScene.clear();
- application.GetScene().Add( parent );
+ application.GetScene().Add(parent);
// onscene emitted, offscene not
- DALI_TEST_EQUALS( gOnSceneCallBackCalled, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( gOffSceneCallBackCalled, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnSceneCallBackCalled, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(gOffSceneCallBackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("child", gActorNamesOnOffScene[1], TEST_LOCATION);
// test removing child
// clean test data
gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
gActorNamesOnOffScene.clear();
- parent.Remove( child );
+ parent.Remove(child);
// onscene not emitted, offscene is
- DALI_TEST_EQUALS( gOnSceneCallBackCalled, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( gOffSceneCallBackCalled, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( "child", gActorNamesOnOffScene[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS("child", gActorNamesOnOffScene[0], TEST_LOCATION);
// test removing parent
// clean test data
gOnSceneCallBackCalled = gOffSceneCallBackCalled = 0;
gActorNamesOnOffScene.clear();
- application.GetScene().Remove( parent );
+ application.GetScene().Remove(parent);
// onscene not emitted, offscene is
- DALI_TEST_EQUALS( gOnSceneCallBackCalled, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( gOffSceneCallBackCalled, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( "parent", gActorNamesOnOffScene[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnSceneCallBackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(gOffSceneCallBackCalled, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS("parent", gActorNamesOnOffScene[0], TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::NAME, "parent" );
- Actor first = Actor::New();
- first .SetProperty( Actor::Property::NAME, "first" );
+ parent.SetProperty(Actor::Property::NAME, "parent");
+ Actor first = Actor::New();
+ first.SetProperty(Actor::Property::NAME, "first");
Actor second = Actor::New();
- second.SetProperty( Actor::Property::NAME, "second" );
+ second.SetProperty(Actor::Property::NAME, "second");
parent.Add(first);
first.Add(second);
- Actor found = parent.FindChildByName( "foo" );
- DALI_TEST_CHECK( !found );
+ Actor found = parent.FindChildByName("foo");
+ DALI_TEST_CHECK(!found);
- found = parent.FindChildByName( "parent" );
- DALI_TEST_CHECK( found == parent );
+ found = parent.FindChildByName("parent");
+ DALI_TEST_CHECK(found == parent);
- found = parent.FindChildByName( "first" );
- DALI_TEST_CHECK( found == first );
+ found = parent.FindChildByName("first");
+ DALI_TEST_CHECK(found == first);
- found = parent.FindChildByName( "second" );
- DALI_TEST_CHECK( found == second );
+ found = parent.FindChildByName("second");
+ DALI_TEST_CHECK(found == second);
END_TEST;
}
parent.Add(first);
first.Add(second);
- Actor found = parent.FindChildById( 100000 );
- DALI_TEST_CHECK( !found );
+ Actor found = parent.FindChildById(100000);
+ DALI_TEST_CHECK(!found);
- found = parent.FindChildById( parent.GetProperty< int >( Actor::Property::ID ) );
- DALI_TEST_CHECK( found == parent );
+ found = parent.FindChildById(parent.GetProperty<int>(Actor::Property::ID));
+ DALI_TEST_CHECK(found == parent);
- found = parent.FindChildById( first.GetProperty< int >( Actor::Property::ID ) );
- DALI_TEST_CHECK( found == first );
+ found = parent.FindChildById(first.GetProperty<int>(Actor::Property::ID));
+ DALI_TEST_CHECK(found == first);
- found = parent.FindChildById( second.GetProperty< int >( Actor::Property::ID ) );
- DALI_TEST_CHECK( found == second );
+ found = parent.FindChildById(second.GetProperty<int>(Actor::Property::ID));
+ DALI_TEST_CHECK(found == second);
END_TEST;
}
struct HitTestData
{
public:
- HitTestData( const Vector3& scale, const Vector2& touchPoint, bool result )
- : mScale( scale ),
- mTouchPoint( touchPoint ),
- mResult( result )
- {}
+ HitTestData(const Vector3& scale, const Vector2& touchPoint, bool result)
+ : mScale(scale),
+ mTouchPoint(touchPoint),
+ mResult(result)
+ {
+ }
Vector3 mScale;
Vector2 mTouchPoint;
- bool mResult;
+ bool mResult;
};
TestApplication application;
// Fill a vector with different hit tests.
struct HitTestData* hitTestData[] = {
// scale touch point result
- new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 289.f, 400.f ), true ), // touch point close to the right edge (inside)
- new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), false ), // touch point close to the right edge (outside)
- new HitTestData( Vector3( 110.f, 100.f, 1.f ), Vector2( 291.f, 400.f ), true ), // same point as above with a wider scale. Should be inside.
- new HitTestData( Vector3( 100.f, 100.f, 1.f ), Vector2( 200.f, 451.f ), false ), // touch point close to the down edge (outside)
- new HitTestData( Vector3( 100.f, 110.f, 1.f ), Vector2( 200.f, 451.f ), true ), // same point as above with a wider scale. Should be inside.
+ new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(289.f, 400.f), true), // touch point close to the right edge (inside)
+ new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(291.f, 400.f), false), // touch point close to the right edge (outside)
+ new HitTestData(Vector3(110.f, 100.f, 1.f), Vector2(291.f, 400.f), true), // same point as above with a wider scale. Should be inside.
+ new HitTestData(Vector3(100.f, 100.f, 1.f), Vector2(200.f, 451.f), false), // touch point close to the down edge (outside)
+ new HitTestData(Vector3(100.f, 110.f, 1.f), Vector2(200.f, 451.f), true), // same point as above with a wider scale. Should be inside.
NULL,
};
// get the root layer
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
ResetTouchCallbacks();
unsigned int index = 0;
- while( NULL != hitTestData[index] )
+ while(NULL != hitTestData[index])
{
- actor.SetProperty( Actor::Property::SIZE, Vector2( 1.f, 1.f ) );
- actor.SetProperty( Actor::Property::SCALE, Vector3( hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(1.f, 1.f));
+ actor.SetProperty(Actor::Property::SCALE, Vector3(hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z));
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( !gTouchCallBackCalled );
+ DALI_TEST_CHECK(!gTouchCallBackCalled);
// connect to its touch signal
actor.TouchedSignal().Connect(TestTouchCallback);
Dali::Integration::Point point;
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y ) );
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y));
Dali::Integration::TouchEvent event;
- event.AddPoint( point );
+ event.AddPoint(point);
// flush the queue and render once
application.SendNotification();
application.Render();
- application.ProcessEvent( event );
+ application.ProcessEvent(event);
- DALI_TEST_CHECK( gTouchCallBackCalled == hitTestData[index]->mResult );
+ DALI_TEST_CHECK(gTouchCallBackCalled == hitTestData[index]->mResult);
- if( gTouchCallBackCalled != hitTestData[index]->mResult )
+ if(gTouchCallBackCalled != hitTestData[index]->mResult)
tet_printf("Test failed:\nScale %f %f %f\nTouchPoint %f, %f\nResult %d\n",
- hitTestData[index]->mScale.x, hitTestData[index]->mScale.y, hitTestData[index]->mScale.z,
- hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y,
- hitTestData[index]->mResult );
+ hitTestData[index]->mScale.x,
+ hitTestData[index]->mScale.y,
+ hitTestData[index]->mScale.z,
+ hitTestData[index]->mTouchPoint.x,
+ hitTestData[index]->mTouchPoint.y,
+ hitTestData[index]->mResult);
ResetTouchCallbacks();
++index;
application.SendNotification();
application.Render(1);
- DALI_TEST_CHECK( DrawMode::NORMAL == a.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) ); // Ensure overlay is off by default
+ DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Ensure overlay is off by default
- a.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+ a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
application.SendNotification();
application.Render(1);
- DALI_TEST_CHECK( DrawMode::OVERLAY_2D == a.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) ); // Check Actor is overlay
+ DALI_TEST_CHECK(DrawMode::OVERLAY_2D == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is overlay
- a.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
+ a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
application.SendNotification();
application.Render(1);
- DALI_TEST_CHECK( DrawMode::NORMAL == a.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) ); // Check Actor is normal
+ DALI_TEST_CHECK(DrawMode::NORMAL == a.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE)); // Check Actor is normal
END_TEST;
}
application.Render(1);
std::vector<GLuint> ids;
- ids.push_back( 8 ); // first rendered actor
- ids.push_back( 9 ); // second rendered actor
- ids.push_back( 10 ); // third rendered actor
- application.GetGlAbstraction().SetNextTextureIds( ids );
+ ids.push_back(8); // first rendered actor
+ ids.push_back(9); // second rendered actor
+ ids.push_back(10); // third rendered actor
+ application.GetGlAbstraction().SetNextTextureIds(ids);
Texture imageA = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
Texture imageB = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
Texture imageC = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16);
- Actor a = CreateRenderableActor( imageA );
- Actor b = CreateRenderableActor( imageB );
- Actor c = CreateRenderableActor( imageC );
+ Actor a = CreateRenderableActor(imageA);
+ Actor b = CreateRenderableActor(imageB);
+ Actor c = CreateRenderableActor(imageC);
application.SendNotification();
application.Render(1);
application.Render(1);
// Should be 3 textures changes.
- const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
+ const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
typedef std::vector<GLuint>::size_type TextureSize;
- DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>( 3 ), TEST_LOCATION );
- if( boundTextures.size() == 3 )
+ DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
+ if(boundTextures.size() == 3)
{
- DALI_TEST_CHECK( boundTextures[0] == 8u );
- DALI_TEST_CHECK( boundTextures[1] == 9u );
- DALI_TEST_CHECK( boundTextures[2] == 10u );
+ DALI_TEST_CHECK(boundTextures[0] == 8u);
+ DALI_TEST_CHECK(boundTextures[1] == 9u);
+ DALI_TEST_CHECK(boundTextures[2] == 10u);
}
// Now texture ids have been set, we can monitor their render order.
// b (9)
// c (10)
// a (8)
- a.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
+ a.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
application.GetGlAbstraction().ClearBoundTextures();
application.SendNotification();
application.Render(1);
// Should be 3 texture changes.
- DALI_TEST_EQUALS( boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION );
- if( boundTextures.size() == 3 )
+ DALI_TEST_EQUALS(boundTextures.size(), static_cast<TextureSize>(3), TEST_LOCATION);
+ if(boundTextures.size() == 3)
{
- DALI_TEST_CHECK( boundTextures[0] == 9u );
- DALI_TEST_CHECK( boundTextures[1] == 10u );
- DALI_TEST_CHECK( boundTextures[2] == 8u );
+ DALI_TEST_CHECK(boundTextures[0] == 9u);
+ DALI_TEST_CHECK(boundTextures[1] == 10u);
+ DALI_TEST_CHECK(boundTextures[2] == 8u);
}
END_TEST;
}
tet_infoline(" UtcDaliActorGetCurrentWorldMatrix");
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
- Radian rotationAngle(Degree(85.0f));
+ parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ Vector3 parentPosition(10.0f, 20.0f, 30.0f);
+ Radian rotationAngle(Degree(85.0f));
Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
- Vector3 parentScale( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::POSITION, parentPosition );
- parent.SetProperty( Actor::Property::ORIENTATION, parentRotation );
- parent.SetProperty( Actor::Property::SCALE, parentScale );
- application.GetScene().Add( parent );
+ Vector3 parentScale(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::POSITION, parentPosition);
+ parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
+ parent.SetProperty(Actor::Property::SCALE, parentScale);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- Vector3 childPosition( 0.0f, 0.0f, 100.0f );
- Radian childRotationAngle(Degree(23.0f));
- Quaternion childRotation( childRotationAngle, Vector3::YAXIS );
- Vector3 childScale( 2.0f, 2.0f, 2.0f );
- child.SetProperty( Actor::Property::POSITION, childPosition );
- child.SetProperty( Actor::Property::ORIENTATION, childRotation );
- child.SetProperty( Actor::Property::SCALE, childScale );
- parent.Add( child );
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Vector3 childPosition(0.0f, 0.0f, 100.0f);
+ Radian childRotationAngle(Degree(23.0f));
+ Quaternion childRotation(childRotationAngle, Vector3::YAXIS);
+ Vector3 childScale(2.0f, 2.0f, 2.0f);
+ child.SetProperty(Actor::Property::POSITION, childPosition);
+ child.SetProperty(Actor::Property::ORIENTATION, childRotation);
+ child.SetProperty(Actor::Property::SCALE, childScale);
+ parent.Add(child);
application.SendNotification();
application.Render(0);
parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
Matrix childMatrix(false);
- childMatrix.SetTransformComponents( childScale, childRotation, childPosition );
+ childMatrix.SetTransformComponents(childScale, childRotation, childPosition);
//Child matrix should be the composition of child and parent
Matrix childWorldMatrix(false);
- Matrix::Multiply( childWorldMatrix, childMatrix, parentMatrix);
+ Matrix::Multiply(childWorldMatrix, childMatrix, parentMatrix);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), parentMatrix, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), childWorldMatrix, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), childWorldMatrix, 0.001, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliActorConstrainedToWorldMatrix(void)
{
TestApplication application;
tet_infoline(" UtcDaliActorConstrainedToWorldMatrix");
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
- Radian rotationAngle(Degree(85.0f));
+ parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ Vector3 parentPosition(10.0f, 20.0f, 30.0f);
+ Radian rotationAngle(Degree(85.0f));
Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
- Vector3 parentScale( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::POSITION, parentPosition );
- parent.SetProperty( Actor::Property::ORIENTATION, parentRotation );
- parent.SetProperty( Actor::Property::SCALE, parentScale );
- application.GetScene().Add( parent );
+ Vector3 parentScale(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::POSITION, parentPosition);
+ parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
+ parent.SetProperty(Actor::Property::SCALE, parentScale);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- Constraint posConstraint = Constraint::New<Vector3>( child, Actor::Property::POSITION, PositionComponentConstraint() );
- posConstraint.AddSource( Source( parent, Actor::Property::WORLD_MATRIX ) );
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Constraint posConstraint = Constraint::New<Vector3>(child, Actor::Property::POSITION, PositionComponentConstraint());
+ posConstraint.AddSource(Source(parent, Actor::Property::WORLD_MATRIX));
posConstraint.Apply();
- application.GetScene().Add( child );
+ application.GetScene().Add(child);
application.SendNotification();
application.Render(0);
Matrix parentMatrix(false);
parentMatrix.SetTransformComponents(parentScale, parentRotation, parentPosition);
- DALI_TEST_EQUALS( parent.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX ), parentMatrix, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), parent.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX), parentMatrix, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Vector3>(Actor::Property::POSITION), parent.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001, TEST_LOCATION);
END_TEST;
}
tet_infoline(" UtcDaliActorConstrainedToOrientation");
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- Vector3 parentPosition( 10.0f, 20.0f, 30.0f);
- Radian rotationAngle(Degree(85.0f));
+ parent.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ Vector3 parentPosition(10.0f, 20.0f, 30.0f);
+ Radian rotationAngle(Degree(85.0f));
Quaternion parentRotation(rotationAngle, Vector3::ZAXIS);
- Vector3 parentScale( 1.0f, 2.0f, 3.0f );
- parent.SetProperty( Actor::Property::POSITION, parentPosition );
- parent.SetProperty( Actor::Property::ORIENTATION, parentRotation );
- parent.SetProperty( Actor::Property::SCALE, parentScale );
- application.GetScene().Add( parent );
+ Vector3 parentScale(1.0f, 2.0f, 3.0f);
+ parent.SetProperty(Actor::Property::POSITION, parentPosition);
+ parent.SetProperty(Actor::Property::ORIENTATION, parentRotation);
+ parent.SetProperty(Actor::Property::SCALE, parentScale);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- Constraint posConstraint = Constraint::New<Quaternion>( child, Actor::Property::ORIENTATION, OrientationComponentConstraint() );
- posConstraint.AddSource( Source( parent, Actor::Property::ORIENTATION ) );
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Constraint posConstraint = Constraint::New<Quaternion>(child, Actor::Property::ORIENTATION, OrientationComponentConstraint());
+ posConstraint.AddSource(Source(parent, Actor::Property::ORIENTATION));
posConstraint.Apply();
- application.GetScene().Add( child );
+ application.GetScene().Add(child);
application.SendNotification();
application.Render(0);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( child.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), parent.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), parent.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), 0.001, TEST_LOCATION);
END_TEST;
}
tet_infoline(" UtcDaliActorConstrainedToOpacity");
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::OPACITY, 0.7f );
- application.GetScene().Add( parent );
+ parent.SetProperty(Actor::Property::OPACITY, 0.7f);
+ application.GetScene().Add(parent);
- Actor child = Actor::New();
- Constraint opacityConstraint = Constraint::New<float>( child, Actor::Property::OPACITY, EqualToConstraint() );
- opacityConstraint.AddSource( Source( parent, Actor::Property::OPACITY ) );
+ Actor child = Actor::New();
+ Constraint opacityConstraint = Constraint::New<float>(child, Actor::Property::OPACITY, EqualToConstraint());
+ opacityConstraint.AddSource(Source(parent, Actor::Property::OPACITY));
opacityConstraint.Apply();
- application.GetScene().Add( child );
+ application.GetScene().Add(child);
application.SendNotification();
application.Render(0);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( child.GetCurrentProperty< float >( Actor::Property::OPACITY ), parent.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
- parent.SetProperty( Actor::Property::OPACITY, 0.3f );
+ parent.SetProperty(Actor::Property::OPACITY, 0.3f);
application.SendNotification();
application.Render(0);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( child.GetCurrentProperty< float >( Actor::Property::OPACITY ), parent.GetCurrentProperty< float >( Actor::Property::OPACITY ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.GetCurrentProperty<float>(Actor::Property::OPACITY), parent.GetCurrentProperty<float>(Actor::Property::OPACITY), 0.001f, TEST_LOCATION);
END_TEST;
}
tet_infoline(" UtcDaliActorUnparent");
Actor parent = Actor::New();
- application.GetScene().Add( parent );
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
- DALI_TEST_CHECK( !child.GetParent() );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
+ DALI_TEST_CHECK(!child.GetParent());
// Test that calling Unparent with no parent is a NOOP
child.Unparent();
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
- DALI_TEST_CHECK( !child.GetParent() );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
+ DALI_TEST_CHECK(!child.GetParent());
// Test that Unparent works
- parent.Add( child );
+ parent.Add(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
- DALI_TEST_CHECK( parent == child.GetParent() );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
+ DALI_TEST_CHECK(parent == child.GetParent());
child.Unparent();
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
- DALI_TEST_CHECK( !child.GetParent() );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
+ DALI_TEST_CHECK(!child.GetParent());
// Test that UnparentAndReset works
- parent.Add( child );
+ parent.Add(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 1u, TEST_LOCATION );
- DALI_TEST_CHECK( parent == child.GetParent() );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 1u, TEST_LOCATION);
+ DALI_TEST_CHECK(parent == child.GetParent());
- UnparentAndReset( child );
+ UnparentAndReset(child);
- DALI_TEST_EQUALS( parent.GetChildCount(), 0u, TEST_LOCATION );
- DALI_TEST_CHECK( !child );
+ DALI_TEST_EQUALS(parent.GetChildCount(), 0u, TEST_LOCATION);
+ DALI_TEST_CHECK(!child);
// Test that UnparentAndReset is a NOOP with empty handle
- UnparentAndReset( child );
+ UnparentAndReset(child);
- DALI_TEST_CHECK( !child );
+ DALI_TEST_CHECK(!child);
END_TEST;
}
tet_infoline(" UtcDaliActorGetChildAt");
Actor parent = Actor::New();
- application.GetScene().Add( parent );
+ application.GetScene().Add(parent);
Actor child0 = Actor::New();
- parent.Add( child0 );
+ parent.Add(child0);
Actor child1 = Actor::New();
- parent.Add( child1 );
+ parent.Add(child1);
Actor child2 = Actor::New();
- parent.Add( child2 );
+ parent.Add(child2);
- DALI_TEST_EQUALS( parent.GetChildAt( 0 ), child0, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetChildAt( 1 ), child1, TEST_LOCATION );
- DALI_TEST_EQUALS( parent.GetChildAt( 2 ), child2, TEST_LOCATION );
+ DALI_TEST_EQUALS(parent.GetChildAt(0), child0, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetChildAt(1), child1, TEST_LOCATION);
+ DALI_TEST_EQUALS(parent.GetChildAt(2), child2, TEST_LOCATION);
END_TEST;
}
tet_infoline(" UtcDaliActorSetGetOverlay");
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::DRAW_MODE,DrawMode::OVERLAY_2D );
- DALI_TEST_CHECK( parent.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ) == DrawMode::OVERLAY_2D );
+ parent.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
+ DALI_TEST_CHECK(parent.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE) == DrawMode::OVERLAY_2D);
END_TEST;
}
-
int UtcDaliActorCreateDestroy(void)
{
Actor* actor = new Actor;
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
delete actor;
END_TEST;
}
{
struct PropertyStringIndex
{
- const char * const name;
+ const char* const name;
const Property::Index index;
- const Property::Type type;
+ const Property::Type type;
};
const PropertyStringIndex PROPERTY_TABLE[] =
-{
- { "parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3 },
- { "parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT },
- { "parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT },
- { "parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT },
- { "anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3 },
- { "anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT },
- { "anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT },
- { "anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT },
- { "size", Actor::Property::SIZE, Property::VECTOR3 },
- { "sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT },
- { "sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT },
- { "sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT },
- { "position", Actor::Property::POSITION, Property::VECTOR3 },
- { "positionX", Actor::Property::POSITION_X, Property::FLOAT },
- { "positionY", Actor::Property::POSITION_Y, Property::FLOAT },
- { "positionZ", Actor::Property::POSITION_Z, Property::FLOAT },
- { "worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3 },
- { "worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT },
- { "worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT },
- { "worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT },
- { "orientation", Actor::Property::ORIENTATION, Property::ROTATION },
- { "worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION },
- { "scale", Actor::Property::SCALE, Property::VECTOR3 },
- { "scaleX", Actor::Property::SCALE_X, Property::FLOAT },
- { "scaleY", Actor::Property::SCALE_Y, Property::FLOAT },
- { "scaleZ", Actor::Property::SCALE_Z, Property::FLOAT },
- { "worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3 },
- { "visible", Actor::Property::VISIBLE, Property::BOOLEAN },
- { "color", Actor::Property::COLOR, Property::VECTOR4 },
- { "colorRed", Actor::Property::COLOR_RED, Property::FLOAT },
- { "colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT },
- { "colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT },
- { "colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT },
- { "worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4 },
- { "worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX },
- { "name", Actor::Property::NAME, Property::STRING },
- { "sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN },
- { "leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN },
- { "inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN },
- { "inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN },
- { "colorMode", Actor::Property::COLOR_MODE, Property::INTEGER },
- { "drawMode", Actor::Property::DRAW_MODE, Property::INTEGER },
- { "sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3 },
- { "widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING },
- { "heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING },
- { "sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER },
- { "widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN },
- { "heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN },
- { "padding", Actor::Property::PADDING, Property::VECTOR4 },
- { "minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2 },
- { "maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2 },
- { "inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN },
- { "clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING },
- { "opacity", Actor::Property::OPACITY, Property::FLOAT },
+ {
+ {"parentOrigin", Actor::Property::PARENT_ORIGIN, Property::VECTOR3},
+ {"parentOriginX", Actor::Property::PARENT_ORIGIN_X, Property::FLOAT},
+ {"parentOriginY", Actor::Property::PARENT_ORIGIN_Y, Property::FLOAT},
+ {"parentOriginZ", Actor::Property::PARENT_ORIGIN_Z, Property::FLOAT},
+ {"anchorPoint", Actor::Property::ANCHOR_POINT, Property::VECTOR3},
+ {"anchorPointX", Actor::Property::ANCHOR_POINT_X, Property::FLOAT},
+ {"anchorPointY", Actor::Property::ANCHOR_POINT_Y, Property::FLOAT},
+ {"anchorPointZ", Actor::Property::ANCHOR_POINT_Z, Property::FLOAT},
+ {"size", Actor::Property::SIZE, Property::VECTOR3},
+ {"sizeWidth", Actor::Property::SIZE_WIDTH, Property::FLOAT},
+ {"sizeHeight", Actor::Property::SIZE_HEIGHT, Property::FLOAT},
+ {"sizeDepth", Actor::Property::SIZE_DEPTH, Property::FLOAT},
+ {"position", Actor::Property::POSITION, Property::VECTOR3},
+ {"positionX", Actor::Property::POSITION_X, Property::FLOAT},
+ {"positionY", Actor::Property::POSITION_Y, Property::FLOAT},
+ {"positionZ", Actor::Property::POSITION_Z, Property::FLOAT},
+ {"worldPosition", Actor::Property::WORLD_POSITION, Property::VECTOR3},
+ {"worldPositionX", Actor::Property::WORLD_POSITION_X, Property::FLOAT},
+ {"worldPositionY", Actor::Property::WORLD_POSITION_Y, Property::FLOAT},
+ {"worldPositionZ", Actor::Property::WORLD_POSITION_Z, Property::FLOAT},
+ {"orientation", Actor::Property::ORIENTATION, Property::ROTATION},
+ {"worldOrientation", Actor::Property::WORLD_ORIENTATION, Property::ROTATION},
+ {"scale", Actor::Property::SCALE, Property::VECTOR3},
+ {"scaleX", Actor::Property::SCALE_X, Property::FLOAT},
+ {"scaleY", Actor::Property::SCALE_Y, Property::FLOAT},
+ {"scaleZ", Actor::Property::SCALE_Z, Property::FLOAT},
+ {"worldScale", Actor::Property::WORLD_SCALE, Property::VECTOR3},
+ {"visible", Actor::Property::VISIBLE, Property::BOOLEAN},
+ {"color", Actor::Property::COLOR, Property::VECTOR4},
+ {"colorRed", Actor::Property::COLOR_RED, Property::FLOAT},
+ {"colorGreen", Actor::Property::COLOR_GREEN, Property::FLOAT},
+ {"colorBlue", Actor::Property::COLOR_BLUE, Property::FLOAT},
+ {"colorAlpha", Actor::Property::COLOR_ALPHA, Property::FLOAT},
+ {"worldColor", Actor::Property::WORLD_COLOR, Property::VECTOR4},
+ {"worldMatrix", Actor::Property::WORLD_MATRIX, Property::MATRIX},
+ {"name", Actor::Property::NAME, Property::STRING},
+ {"sensitive", Actor::Property::SENSITIVE, Property::BOOLEAN},
+ {"leaveRequired", Actor::Property::LEAVE_REQUIRED, Property::BOOLEAN},
+ {"inheritOrientation", Actor::Property::INHERIT_ORIENTATION, Property::BOOLEAN},
+ {"inheritScale", Actor::Property::INHERIT_SCALE, Property::BOOLEAN},
+ {"colorMode", Actor::Property::COLOR_MODE, Property::INTEGER},
+ {"drawMode", Actor::Property::DRAW_MODE, Property::INTEGER},
+ {"sizeModeFactor", Actor::Property::SIZE_MODE_FACTOR, Property::VECTOR3},
+ {"widthResizePolicy", Actor::Property::WIDTH_RESIZE_POLICY, Property::STRING},
+ {"heightResizePolicy", Actor::Property::HEIGHT_RESIZE_POLICY, Property::STRING},
+ {"sizeScalePolicy", Actor::Property::SIZE_SCALE_POLICY, Property::INTEGER},
+ {"widthForHeight", Actor::Property::WIDTH_FOR_HEIGHT, Property::BOOLEAN},
+ {"heightForWidth", Actor::Property::HEIGHT_FOR_WIDTH, Property::BOOLEAN},
+ {"padding", Actor::Property::PADDING, Property::VECTOR4},
+ {"minimumSize", Actor::Property::MINIMUM_SIZE, Property::VECTOR2},
+ {"maximumSize", Actor::Property::MAXIMUM_SIZE, Property::VECTOR2},
+ {"inheritPosition", Actor::Property::INHERIT_POSITION, Property::BOOLEAN},
+ {"clippingMode", Actor::Property::CLIPPING_MODE, Property::STRING},
+ {"opacity", Actor::Property::OPACITY, Property::FLOAT},
};
-const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
+const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
} // unnamed namespace
int UtcDaliActorProperties(void)
Actor actor = Actor::New();
- for ( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
{
- tet_printf( "Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index );
- DALI_TEST_EQUALS( actor.GetPropertyName( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].name, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetPropertyIndex( PROPERTY_TABLE[i].name ), PROPERTY_TABLE[i].index, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetPropertyType( PROPERTY_TABLE[i].index ), PROPERTY_TABLE[i].type, TEST_LOCATION );
+ tet_printf("Checking %s == %d\n", PROPERTY_TABLE[i].name, PROPERTY_TABLE[i].index);
+ DALI_TEST_EQUALS(actor.GetPropertyName(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].name, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
}
END_TEST;
}
Actor actor = Actor::New();
// Defaults
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), "USE_NATURAL_SIZE", TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), "USE_NATURAL_SIZE", TEST_LOCATION);
// Set resize policy for all dimensions
- actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
- for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
+ actor.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
+ for(unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i)
{
- DALI_TEST_EQUALS( actor.GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetResizePolicy(static_cast<Dimension::Type>(1 << i)), ResizePolicy::USE_NATURAL_SIZE, TEST_LOCATION);
}
// Set individual dimensions
- const char* const widthPolicy = "FILL_TO_PARENT";
+ const char* const widthPolicy = "FILL_TO_PARENT";
const char* const heightPolicy = "FIXED";
- actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy );
- actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy );
+ actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicy);
+ actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicy);
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_RESIZE_POLICY ).Get< std::string >(), widthPolicy, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_RESIZE_POLICY ).Get< std::string >(), heightPolicy, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_RESIZE_POLICY).Get<std::string>(), widthPolicy, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_RESIZE_POLICY).Get<std::string>(), heightPolicy, TEST_LOCATION);
// Set individual dimensions using enums
- ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
+ ResizePolicy::Type widthPolicyEnum = ResizePolicy::USE_ASSIGNED_SIZE;
ResizePolicy::Type heightPolicyEnum = ResizePolicy::SIZE_RELATIVE_TO_PARENT;
- actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum );
- actor.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum );
+ actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, widthPolicyEnum);
+ actor.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, heightPolicyEnum);
- DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::WIDTH ) ), static_cast< int >( widthPolicyEnum ), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast< int >( actor.GetResizePolicy( Dimension::HEIGHT ) ), static_cast< int >( heightPolicyEnum ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::WIDTH)), static_cast<int>(widthPolicyEnum), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<int>(actor.GetResizePolicy(Dimension::HEIGHT)), static_cast<int>(heightPolicyEnum), TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Defaults
- DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), SizeScalePolicy::USE_SIZE_SET, TEST_LOCATION);
SizeScalePolicy::Type policy = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
- actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy );
- DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), policy, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy);
+ DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy, TEST_LOCATION);
// Set
const SizeScalePolicy::Type policy1 = SizeScalePolicy::FIT_WITH_ASPECT_RATIO;
const SizeScalePolicy::Type policy2 = SizeScalePolicy::FILL_WITH_ASPECT_RATIO;
- actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy1 );
- DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), policy1, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy1);
+ DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy1, TEST_LOCATION);
- actor.SetProperty( Actor::Property::SIZE_SCALE_POLICY, policy2 );
- DALI_TEST_EQUALS( actor.GetProperty< SizeScalePolicy::Type >( Actor::Property::SIZE_SCALE_POLICY ), policy2, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_SCALE_POLICY, policy2);
+ DALI_TEST_EQUALS(actor.GetProperty<SizeScalePolicy::Type>(Actor::Property::SIZE_SCALE_POLICY), policy2, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Defaults
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ), Vector3( 1.0f, 1.0f, 1.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), Vector3(1.0f, 1.0f, 1.0f), TEST_LOCATION);
- Vector3 sizeMode( 1.0f, 2.0f, 3.0f );
- actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE_MODE_FACTOR ), sizeMode, TEST_LOCATION );
+ Vector3 sizeMode(1.0f, 2.0f, 3.0f);
+ actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE_MODE_FACTOR), sizeMode, TEST_LOCATION);
// Set
- Vector3 sizeMode1( 2.0f, 3.0f, 4.0f );
+ Vector3 sizeMode1(2.0f, 3.0f, 4.0f);
- actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, sizeMode1 );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::SIZE_MODE_FACTOR ).Get< Vector3 >(), sizeMode1, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, sizeMode1);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE_MODE_FACTOR).Get<Vector3>(), sizeMode1, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Defaults
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), false, TEST_LOCATION);
// Set
- actor.SetProperty( Actor::Property::WIDTH_FOR_HEIGHT, true );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), true, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::WIDTH_FOR_HEIGHT, true);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), true, TEST_LOCATION);
- actor.SetProperty( Actor::Property::HEIGHT_FOR_WIDTH, true );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::HEIGHT_FOR_WIDTH ).Get< bool >(), true, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::HEIGHT_FOR_WIDTH, true);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::HEIGHT_FOR_WIDTH).Get<bool>(), true, TEST_LOCATION);
// Test setting another resize policy
- actor.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FIXED" );
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::WIDTH_FOR_HEIGHT ).Get< bool >(), false, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FIXED");
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::WIDTH_FOR_HEIGHT).Get<bool>(), false, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Data
- Vector4 padding( 1.0f, 2.0f, 3.0f, 4.0f );
+ Vector4 padding(1.0f, 2.0f, 3.0f, 4.0f);
// PADDING
- actor.SetProperty( Actor::Property::PADDING, padding );
- Vector4 paddingResult = actor.GetProperty( Actor::Property::PADDING ).Get< Vector4 >();
+ actor.SetProperty(Actor::Property::PADDING, padding);
+ Vector4 paddingResult = actor.GetProperty(Actor::Property::PADDING).Get<Vector4>();
- DALI_TEST_EQUALS( paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS(paddingResult, padding, Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Data
- Vector2 minSize( 1.0f, 2.0f );
+ Vector2 minSize(1.0f, 2.0f);
- actor.SetProperty( Actor::Property::MINIMUM_SIZE, minSize );
- Vector2 resultMin = actor.GetProperty( Actor::Property::MINIMUM_SIZE ).Get< Vector2 >();
+ actor.SetProperty(Actor::Property::MINIMUM_SIZE, minSize);
+ Vector2 resultMin = actor.GetProperty(Actor::Property::MINIMUM_SIZE).Get<Vector2>();
- DALI_TEST_EQUALS( resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS(resultMin, minSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- Vector2 maxSize( 3.0f, 4.0f );
+ Vector2 maxSize(3.0f, 4.0f);
- actor.SetProperty( Actor::Property::MAXIMUM_SIZE, maxSize );
- Vector2 resultMax = actor.GetProperty( Actor::Property::MAXIMUM_SIZE ).Get< Vector2 >();
+ actor.SetProperty(Actor::Property::MAXIMUM_SIZE, maxSize);
+ Vector2 resultMax = actor.GetProperty(Actor::Property::MAXIMUM_SIZE).Get<Vector2>();
- DALI_TEST_EQUALS( resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ DALI_TEST_EQUALS(resultMax, maxSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetHeightForWidth( 1.0f ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetHeightForWidth(1.0f), 1.0f, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetWidthForHeight( 1.0f ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetWidthForHeight(1.0f), 1.0f, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Add actor to stage
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 0.0f, TEST_LOCATION);
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 0.0f ) );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 0.0f));
// Flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetRelayoutSize( Dimension::WIDTH ), 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRelayoutSize(Dimension::WIDTH), 1.0f, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
Padding padding;
- padding = actor.GetProperty<Vector4>( Actor::Property::PADDING );
+ padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
- DALI_TEST_EQUALS( padding.left, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( padding.right, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( padding.bottom, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( padding.top, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(padding.left, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(padding.right, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(padding.bottom, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(padding.top, 0.0f, TEST_LOCATION);
- Padding padding2( 1.0f, 2.0f, 3.0f, 4.0f );
- actor.SetProperty( Actor::Property::PADDING, padding2 );
+ Padding padding2(1.0f, 2.0f, 3.0f, 4.0f);
+ actor.SetProperty(Actor::Property::PADDING, padding2);
- padding = actor.GetProperty<Vector4>( Actor::Property::PADDING );
+ padding = actor.GetProperty<Vector4>(Actor::Property::PADDING);
- DALI_TEST_EQUALS( padding.left, padding2.left, TEST_LOCATION );
- DALI_TEST_EQUALS( padding.right, padding2.right, TEST_LOCATION );
- DALI_TEST_EQUALS( padding.bottom, padding2.bottom, TEST_LOCATION );
- DALI_TEST_EQUALS( padding.top, padding2.top, TEST_LOCATION );
+ DALI_TEST_EQUALS(padding.left, padding2.left, TEST_LOCATION);
+ DALI_TEST_EQUALS(padding.right, padding2.right, TEST_LOCATION);
+ DALI_TEST_EQUALS(padding.bottom, padding2.bottom, TEST_LOCATION);
+ DALI_TEST_EQUALS(padding.top, padding2.top, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE );
+ Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
- DALI_TEST_EQUALS( size.width, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(size.width, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(size.height, 0.0f, TEST_LOCATION);
- Vector2 size2( 1.0f, 2.0f );
- actor.SetProperty( Actor::Property::MINIMUM_SIZE, size2 );
+ Vector2 size2(1.0f, 2.0f);
+ actor.SetProperty(Actor::Property::MINIMUM_SIZE, size2);
- size = actor.GetProperty< Vector2 >( Actor::Property::MINIMUM_SIZE );
+ size = actor.GetProperty<Vector2>(Actor::Property::MINIMUM_SIZE);
- DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
+ DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Vector2 size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE );
+ Vector2 size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
- DALI_TEST_EQUALS( size.width, FLT_MAX, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, FLT_MAX, TEST_LOCATION );
+ DALI_TEST_EQUALS(size.width, FLT_MAX, TEST_LOCATION);
+ DALI_TEST_EQUALS(size.height, FLT_MAX, TEST_LOCATION);
- Vector2 size2( 1.0f, 2.0f );
- actor.SetProperty( Actor::Property::MAXIMUM_SIZE, size2 );
+ Vector2 size2(1.0f, 2.0f);
+ actor.SetProperty(Actor::Property::MAXIMUM_SIZE, size2);
- size = actor.GetProperty< Vector2 >( Actor::Property::MAXIMUM_SIZE );
+ size = actor.GetProperty<Vector2>(Actor::Property::MAXIMUM_SIZE);
- DALI_TEST_EQUALS( size.width, size2.width, TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, size2.height, TEST_LOCATION );
+ DALI_TEST_EQUALS(size.width, size2.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(size.height, size2.height, TEST_LOCATION);
END_TEST;
}
gActorNamesRelayout.clear();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::NAME, "actor" );
- actor.OnRelayoutSignal().Connect( OnRelayoutCallback );
+ actor.SetProperty(Actor::Property::NAME, "actor");
+ actor.OnRelayoutSignal().Connect(OnRelayoutCallback);
// Sanity check
- DALI_TEST_CHECK( ! gOnRelayoutCallBackCalled );
+ DALI_TEST_CHECK(!gOnRelayoutCallBackCalled);
// Add actor to stage
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 2.0 ) );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 2.0));
// Flush the queue and render once
application.SendNotification();
application.Render();
// OnRelayout emitted
- DALI_TEST_EQUALS( gOnRelayoutCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( "actor", gActorNamesRelayout[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(gOnRelayoutCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS("actor", gActorNamesRelayout[0], TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Testing Dali::Actor::GetHierarchyDepth()");
-
/* Build tree of actors:
*
* Depth
*
* GetHierarchyDepth should return 1 for A, 2 for B and C, and 3 for D, E and F.
*/
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorF = Actor::New();
//Test that root actor has depth equal 0
- DALI_TEST_EQUALS( 0, stage.GetRootLayer().GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, stage.GetRootLayer().GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
//Test actors return depth -1 when not connected to the tree
- DALI_TEST_EQUALS( -1, actorA.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorC.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorF.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
+ DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
//Create the hierarchy
- stage.Add( actorA );
- actorA.Add( actorB );
- actorA.Add( actorC );
- actorB.Add( actorD );
- actorB.Add( actorE );
- actorC.Add( actorF );
+ stage.Add(actorA);
+ actorA.Add(actorB);
+ actorA.Add(actorC);
+ actorB.Add(actorD);
+ actorB.Add(actorE);
+ actorC.Add(actorF);
//Test actors return correct depth
- DALI_TEST_EQUALS( 1, actorA.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( 2, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( 2, actorC.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( 3, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( 3, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( 3, actorF.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(2, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(2, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(3, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(3, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(3, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
//Removing actorB from the hierarchy. actorB, actorD and actorE should now have depth equal -1
- actorA.Remove( actorB );
+ actorA.Remove(actorB);
- DALI_TEST_EQUALS( -1, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
+ DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
//Removing actorA from the stage. All actors should have depth equal -1
- stage.Remove( actorA );
+ stage.Remove(actorA);
- DALI_TEST_EQUALS( -1, actorA.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorB.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorC.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorD.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorE.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, actorF.GetProperty< int >( Actor::Property::HIERARCHY_DEPTH ), TEST_LOCATION );
+ DALI_TEST_EQUALS(-1, actorA.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorB.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorC.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorD.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorE.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, actorF.GetProperty<int>(Actor::Property::HIERARCHY_DEPTH), TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_LEFT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_LEFT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_LEFT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_CENTER" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_CENTER");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_CENTER, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "TOP_RIGHT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "TOP_RIGHT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_LEFT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_LEFT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "CENTER_RIGHT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "CENTER_RIGHT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_LEFT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_CENTER");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "BOTTOM_RIGHT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
// Invalid should not change anything
- actor.SetProperty( Actor::Property::ANCHOR_POINT, "INVALID_ARG" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, "INVALID_ARG");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_LEFT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_LEFT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_CENTER" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_CENTER");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "TOP_RIGHT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "TOP_RIGHT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_LEFT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_LEFT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_LEFT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_LEFT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::CENTER_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "CENTER_RIGHT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::CENTER_RIGHT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_LEFT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_LEFT, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_CENTER");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_CENTER, TEST_LOCATION);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "BOTTOM_RIGHT");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
// Invalid should not change anything
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, "INVALID_ARG" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, "INVALID_ARG");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::BOTTOM_RIGHT, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_COLOR" );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_COLOR, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_COLOR");
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, "USE_PARENT_COLOR" );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, "USE_PARENT_COLOR");
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR" );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_COLOR");
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA" );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, "USE_OWN_MULTIPLY_PARENT_ALPHA");
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
// Invalid should not change anything
- actor.SetProperty( Actor::Property::COLOR_MODE, "INVALID_ARG" );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, "INVALID_ARG");
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::DRAW_MODE, "NORMAL" );
- DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::NORMAL, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::DRAW_MODE, "NORMAL");
+ DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
- actor.SetProperty( Actor::Property::DRAW_MODE, "OVERLAY_2D" );
- DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::DRAW_MODE, "OVERLAY_2D");
+ DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
// Invalid should not change anything
- actor.SetProperty( Actor::Property::DRAW_MODE, "INVALID_ARG" );
- DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::DRAW_MODE, "INVALID_ARG");
+ DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_COLOR );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_COLOR, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_COLOR);
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_COLOR, TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_PARENT_COLOR );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_PARENT_COLOR);
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_COLOR);
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_COLOR, TEST_LOCATION);
- actor.SetProperty( Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA );
- DALI_TEST_EQUALS( actor.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::COLOR_MODE, USE_OWN_MULTIPLY_PARENT_ALPHA);
+ DALI_TEST_EQUALS(actor.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_OWN_MULTIPLY_PARENT_ALPHA, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::NORMAL );
- DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::NORMAL, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::NORMAL);
+ DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::NORMAL, TEST_LOCATION);
- actor.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
- DALI_TEST_EQUALS( actor.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
+ DALI_TEST_EQUALS(actor.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- actor.AddRenderer( renderer );
- DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+ actor.AddRenderer(renderer);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Actor::AddRenderer");
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Renderer renderer;
// try illegal Add
try
{
- actor.AddRenderer( renderer );
- tet_printf("Assertion test failed - no Exception\n" );
+ actor.AddRenderer(renderer);
+ tet_printf("Assertion test failed - no Exception\n");
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "Renderer handle is empty", TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
int UtcDaliActorAddRendererN02(void)
{
- tet_infoline( "UtcDaliActorAddRendererN02" );
+ tet_infoline("UtcDaliActorAddRendererN02");
- Actor actor;
+ Actor actor;
Renderer renderer;
{
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ renderer = Renderer::New(geometry, shader);
actor = Actor::New();
}
// try illegal AddRenderer
try
{
- actor.AddRenderer( renderer );
- tet_printf( "Assertion test failed - no Exception\n" );
- tet_result( TET_FAIL );
+ actor.AddRenderer(renderer);
+ tet_printf("Assertion test failed - no Exception\n");
+ tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "EventThreadServices::IsCoreRunning()", TEST_LOCATION);
}
catch(...)
{
- tet_printf( "Assertion test failed - wrong Exception\n" );
- tet_result( TET_FAIL );
+ tet_printf("Assertion test failed - wrong Exception\n");
+ tet_result(TET_FAIL);
}
END_TEST;
application.Render(0);
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
application.SendNotification();
try
{
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
tet_result(TET_PASS);
}
catch(...)
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
{
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- actor.AddRenderer( renderer );
- DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+ actor.AddRenderer(renderer);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
application.SendNotification();
application.Render();
{
Renderer renderer = actor.GetRendererAt(0);
actor.RemoveRenderer(renderer);
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
application.SendNotification();
application.Render();
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
actor.RemoveRenderer(0);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
// Shut down whilst holding onto the renderer handle.
END_TEST;
}
-
int UtcDaliActorRemoveRendererN(void)
{
tet_infoline("Testing Actor::RemoveRenderer");
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 0u, TEST_LOCATION);
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- actor.AddRenderer( renderer );
- DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
+ actor.AddRenderer(renderer);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
actor.RemoveRenderer(10);
- DALI_TEST_EQUALS( actor.GetRendererAt(0), renderer, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetRendererAt(0), renderer, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
END_TEST;
}
// Clipping test helper functions:
-Actor CreateActorWithContent( uint32_t width, uint32_t height)
+Actor CreateActorWithContent(uint32_t width, uint32_t height)
{
- Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- Actor actor = CreateRenderableActor( image );
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ Actor actor = CreateRenderableActor(image);
// Setup dimensions and position so actor is not skipped by culling.
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- actor.SetProperty( Actor::Property::SIZE, Vector2( width, height ) );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(width, height));
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
return actor;
}
Actor CreateActorWithContent16x16()
{
- return CreateActorWithContent( 16, 16 );
+ return CreateActorWithContent(16, 16);
}
-void GenerateTrace( TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace )
+void GenerateTrace(TestApplication& application, TraceCallStack& enabledDisableTrace, TraceCallStack& stencilTrace)
{
enabledDisableTrace.Reset();
stencilTrace.Reset();
- enabledDisableTrace.Enable( true );
- stencilTrace.Enable( true );
+ enabledDisableTrace.Enable(true);
+ stencilTrace.Enable(true);
application.SendNotification();
application.Render();
- enabledDisableTrace.Enable( false );
- stencilTrace.Enable( false );
+ enabledDisableTrace.Enable(false);
+ stencilTrace.Enable(false);
}
-void CheckColorMask( TestGlAbstraction& glAbstraction, bool maskValue )
+void CheckColorMask(TestGlAbstraction& glAbstraction, bool maskValue)
{
const TestGlAbstraction::ColorMaskParams& colorMaskParams = glAbstraction.GetColorMaskParams();
- DALI_TEST_EQUALS<bool>( colorMaskParams.red, maskValue, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.green, maskValue, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.blue, maskValue, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, maskValue, TEST_LOCATION );
+ DALI_TEST_EQUALS<bool>(colorMaskParams.red, maskValue, TEST_LOCATION);
+ DALI_TEST_EQUALS<bool>(colorMaskParams.green, maskValue, TEST_LOCATION);
+ DALI_TEST_EQUALS<bool>(colorMaskParams.blue, maskValue, TEST_LOCATION);
+ DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, maskValue, TEST_LOCATION);
}
int UtcDaliActorPropertyClippingP(void)
{
// This test checks the clippingMode property.
- tet_infoline( "Testing Actor::Property::ClippingMode: P" );
+ tet_infoline("Testing Actor::Property::ClippingMode: P");
TestApplication application;
Actor actor = Actor::New();
// Check default clippingEnabled value.
- Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
+ Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
- int value = 0;
- bool getValueResult = getValue.Get( value );
- DALI_TEST_CHECK( getValueResult );
+ int value = 0;
+ bool getValueResult = getValue.Get(value);
+ DALI_TEST_CHECK(getValueResult);
- if( getValueResult )
+ if(getValueResult)
{
- DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
}
// Check setting the property to the stencil mode.
- actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+ actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
// Check the new value was set.
- getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
- getValueResult = getValue.Get( value );
- DALI_TEST_CHECK( getValueResult );
+ getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
+ getValueResult = getValue.Get(value);
+ DALI_TEST_CHECK(getValueResult);
- if( getValueResult )
+ if(getValueResult)
{
- DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_CHILDREN, TEST_LOCATION);
}
// Check setting the property to the scissor mode.
- actor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
+ actor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
// Check the new value was set.
- getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
- getValueResult = getValue.Get( value );
- DALI_TEST_CHECK( getValueResult );
+ getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
+ getValueResult = getValue.Get(value);
+ DALI_TEST_CHECK(getValueResult);
- if( getValueResult )
+ if(getValueResult)
{
- DALI_TEST_EQUALS<int>( value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(value, ClippingMode::CLIP_TO_BOUNDING_BOX, TEST_LOCATION);
}
END_TEST;
}
int UtcDaliActorPropertyClippingN(void)
{
// Negative test case for Clipping.
- tet_infoline( "Testing Actor::Property::ClippingMode: N" );
+ tet_infoline("Testing Actor::Property::ClippingMode: N");
TestApplication application;
Actor actor = Actor::New();
// Check default clippingEnabled value.
- Property::Value getValue( actor.GetProperty( Actor::Property::CLIPPING_MODE ) );
+ Property::Value getValue(actor.GetProperty(Actor::Property::CLIPPING_MODE));
- int value = 0;
- bool getValueResult = getValue.Get( value );
- DALI_TEST_CHECK( getValueResult );
+ int value = 0;
+ bool getValueResult = getValue.Get(value);
+ DALI_TEST_CHECK(getValueResult);
- if( getValueResult )
+ if(getValueResult)
{
- DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
}
// Check setting an invalid property value won't change the current property value.
- actor.SetProperty( Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY" );
+ actor.SetProperty(Actor::Property::CLIPPING_MODE, "INVALID_PROPERTY");
- getValue = actor.GetProperty( Actor::Property::CLIPPING_MODE );
- getValueResult = getValue.Get( value );
- DALI_TEST_CHECK( getValueResult );
+ getValue = actor.GetProperty(Actor::Property::CLIPPING_MODE);
+ getValueResult = getValue.Get(value);
+ DALI_TEST_CHECK(getValueResult);
- if( getValueResult )
+ if(getValueResult)
{
- DALI_TEST_EQUALS<int>( value, ClippingMode::DISABLED, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(value, ClippingMode::DISABLED, TEST_LOCATION);
}
END_TEST;
int UtcDaliActorPropertyClippingActor(void)
{
// This test checks that an actor is correctly setup for clipping.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor" );
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor");
TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- size_t startIndex = 0u;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ size_t startIndex = 0u;
// Create a clipping actor.
Actor actorDepth1Clip = CreateActorWithContent16x16();
- actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- application.GetScene().Add( actorDepth1Clip );
+ actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ application.GetScene().Add(actorDepth1Clip);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, stencilTrace );
+ GenerateTrace(application, enabledDisableTrace, stencilTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check the stencil buffer was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
// Check the stencil buffer was cleared.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
// Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
END_TEST;
}
int UtcDaliActorPropertyClippingActorEnableThenDisable(void)
{
// This test checks that an actor is correctly setup for clipping and then correctly setup when clipping is disabled
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable" );
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN actor enable and then disable");
TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- size_t startIndex = 0u;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ size_t startIndex = 0u;
// Create a clipping actor.
Actor actorDepth1Clip = CreateActorWithContent16x16();
- actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- application.GetScene().Add( actorDepth1Clip );
+ actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ application.GetScene().Add(actorDepth1Clip);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, stencilTrace );
+ GenerateTrace(application, enabledDisableTrace, stencilTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check the stencil buffer was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
// Check the stencil buffer was cleared.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
// Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) );
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex));
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
// Now disable the clipping
- actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
+ actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, stencilTrace );
+ GenerateTrace(application, enabledDisableTrace, stencilTrace);
// Check the stencil buffer was disabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Disable", "2960" ) ); // 2960 is GL_STENCIL_TEST
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Disable", "2960")); // 2960 is GL_STENCIL_TEST
// Ensure all values in stencil-mask are set to 1.
startIndex = 0u;
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "255", startIndex ) );
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "255", startIndex));
END_TEST;
}
{
// This test checks that a hierarchy of actors are clipped correctly by
// writing to and reading from the correct bit-planes of the stencil buffer.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children" );
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN nested children");
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
// Create a clipping actor.
Actor actorDepth1Clip = CreateActorWithContent16x16();
- actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- application.GetScene().Add( actorDepth1Clip );
+ actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ application.GetScene().Add(actorDepth1Clip);
// Create a child actor.
Actor childDepth2 = CreateActorWithContent16x16();
- actorDepth1Clip.Add( childDepth2 );
+ actorDepth1Clip.Add(childDepth2);
// Create another clipping actor.
Actor childDepth2Clip = CreateActorWithContent16x16();
- childDepth2Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- childDepth2.Add( childDepth2Clip );
+ childDepth2Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ childDepth2.Add(childDepth2Clip);
// Create another 2 child actors. We do this so 2 nodes will have the same clipping ID.
// This tests the sort algorithm.
Actor childDepth3 = CreateActorWithContent16x16();
- childDepth2Clip.Add( childDepth3 );
+ childDepth2Clip.Add(childDepth3);
Actor childDepth4 = CreateActorWithContent16x16();
- childDepth3.Add( childDepth4 );
+ childDepth3.Add(childDepth4);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, stencilTrace );
+ GenerateTrace(application, enabledDisableTrace, stencilTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check the stencil buffer was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
// Perform the test twice, once for 2D layer, and once for 3D.
- for( unsigned int i = 0u ; i < 2u; ++i )
+ for(unsigned int i = 0u; i < 2u; ++i)
{
size_t startIndex = 0u;
// Check the stencil buffer was cleared.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "ClearStencil", "0", startIndex ) );
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("ClearStencil", "0", startIndex));
// Check the correct setup was done to write to the first bit-plane (only) of the stencil buffer.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 0", startIndex ) ); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "1", startIndex ) ); // Write to the first bit-plane
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 0", startIndex)); // 514 is GL_EQUAL, But testing no bit-planes for the first clipping node.
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "1", startIndex)); // Write to the first bit-plane
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
// Check the correct setup was done to test against first bit-plane (only) of the stencil buffer.
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 1, 255", startIndex ) ); // 514 is GL_EQUAL
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 1, 255", startIndex)); // 514 is GL_EQUAL
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
// Check we are set up to write to the second bitplane of the stencil buffer (only).
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 1", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilMask", "3", startIndex ) ); // Write to second (and previous) bit-planes
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7681, 7681", startIndex ) ); // GL_KEEP, GL_REPLACE, GL_REPLACE
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 1", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilMask", "3", startIndex)); // Write to second (and previous) bit-planes
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7681, 7681", startIndex)); // GL_KEEP, GL_REPLACE, GL_REPLACE
// Check we are set up to test against both the first and second bit-planes of the stencil buffer.
// (Both must be set to pass the check).
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilFunc", "514, 3, 255", startIndex ) ); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
- DALI_TEST_CHECK( stencilTrace.FindMethodAndParamsFromStartIndex( "StencilOp", "7680, 7680, 7680", startIndex ) ); // GL_KEEP, GL_KEEP, GL_KEEP
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilFunc", "514, 3, 255", startIndex)); // 514 is GL_EQUAL, Test both bit-planes 1 & 2
+ DALI_TEST_CHECK(stencilTrace.FindMethodAndParamsFromStartIndex("StencilOp", "7680, 7680, 7680", startIndex)); // GL_KEEP, GL_KEEP, GL_KEEP
// If we are on the first loop, set the layer to 3D and loop to perform the test again.
- if( i == 0u )
+ if(i == 0u)
{
- application.GetScene().GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
- GenerateTrace( application, enabledDisableTrace, stencilTrace );
+ application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
+ GenerateTrace(application, enabledDisableTrace, stencilTrace);
}
}
int UtcDaliActorPropertyClippingActorDrawOrder(void)
{
// This test checks that a hierarchy of actors are drawn in the correct order when clipping is enabled.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order" );
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_CHILDREN draw order");
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
/* We create a small tree of actors as follows:
The correct draw order is "ABCDE" (the same as if clipping was not enabled).
*/
Actor actors[5];
- for( int i = 0; i < 5; ++i )
+ for(int i = 0; i < 5; ++i)
{
- Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u );
- Actor actor = CreateRenderableActor( image );
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u);
+ Actor actor = CreateRenderableActor(image);
// Setup dimensions and position so actor is not skipped by culling.
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 16.0f, 16.0f ) );
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(16.0f, 16.0f));
- if( i == 0 )
+ if(i == 0)
{
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
}
else
{
float b = i > 2 ? 1.0f : -1.0f;
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3( 0.5 + ( 0.2f * b ), 0.8f, 0.8f ) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5 + (0.2f * b), 0.8f, 0.8f));
}
actors[i] = actor;
}
// Enable clipping on the actor at the top of the left branch.
- actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+ actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
// Build the scene graph.
- application.GetScene().Add( actors[0] );
+ application.GetScene().Add(actors[0]);
// Left branch:
- actors[0].Add( actors[1] );
- actors[1].Add( actors[2] );
+ actors[0].Add(actors[1]);
+ actors[1].Add(actors[2]);
// Right branch:
- actors[0].Add( actors[3] );
- actors[3].Add( actors[4] );
+ actors[0].Add(actors[3]);
+ actors[3].Add(actors[4]);
// Gather the call trace.
enabledDisableTrace.Reset();
- enabledDisableTrace.Enable( true );
+ enabledDisableTrace.Enable(true);
application.SendNotification();
application.Render();
- enabledDisableTrace.Enable( false );
+ enabledDisableTrace.Enable(false);
/* Check stencil is enabled and disabled again (as right-hand branch of tree is drawn).
Incorrect enable call trace: StackTrace: Index:0, Function:Enable, ParamList:3042 StackTrace: Index:1, Function:Enable, ParamList:2960
*/
size_t startIndex = 0u;
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "3042", startIndex ) );
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "2960", startIndex ) ); // 2960 is GL_STENCIL_TEST
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) );
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "3042", startIndex));
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex)); // 2960 is GL_STENCIL_TEST
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex));
// Swap the clipping actor from top of left branch to top of right branch.
- actors[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED );
- actors[3].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
+ actors[1].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::DISABLED);
+ actors[3].SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
// Gather the call trace.
enabledDisableTrace.Reset();
- enabledDisableTrace.Enable( true );
+ enabledDisableTrace.Enable(true);
application.SendNotification();
application.Render();
- enabledDisableTrace.Enable( false );
+ enabledDisableTrace.Enable(false);
// Check stencil is enabled but NOT disabled again (as right-hand branch of tree is drawn).
// This proves the draw order has remained the same.
startIndex = 0u;
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Enable", "2960", startIndex ) );
- DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParamsFromStartIndex( "Disable", "2960", startIndex ) );
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParamsFromStartIndex("Enable", "2960", startIndex));
+ DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParamsFromStartIndex("Disable", "2960", startIndex));
END_TEST;
}
int UtcDaliActorPropertyScissorClippingActor(void)
{
// This test checks that an actor is correctly setup for clipping.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor" );
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor");
TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
- const Vector2 imageSize( 16.0f, 16.0f );
+ const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ const Vector2 imageSize(16.0f, 16.0f);
// Create a clipping actor.
Actor clippingActorA = CreateActorWithContent16x16();
// Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
// We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
- clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
- clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
- clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
- application.GetScene().Add( clippingActorA );
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
+ clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+ application.GetScene().Add(clippingActorA);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, scissorTrace );
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check scissor test was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
// Check the scissor was set, and the coordinates are correct.
std::stringstream compareParametersString;
compareParametersString << "0, 0, " << imageSize.x << ", " << imageSize.y;
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with 0, 0, 16, 16
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 0, 0, 16, 16
- clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
- clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT );
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_RIGHT);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, scissorTrace );
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
// Check the scissor was set, and the coordinates are correct.
- compareParametersString.str( std::string() );
+ compareParametersString.str(std::string());
compareParametersString.clear();
- compareParametersString << ( stageSize.x - imageSize.x ) << ", " << ( stageSize.y - imageSize.y ) << ", " << imageSize.x << ", " << imageSize.y;
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with 464, 784, 16, 16
+ compareParametersString << (stageSize.x - imageSize.x) << ", " << (stageSize.y - imageSize.y) << ", " << imageSize.x << ", " << imageSize.y;
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with 464, 784, 16, 16
END_TEST;
}
int UtcDaliActorPropertyScissorClippingActorSiblings(void)
{
// This test checks that an actor is correctly setup for clipping.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings" );
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actors which are siblings");
TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
-
- const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
- const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f };
- const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f };
+ const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
+ const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
// Create a clipping actors.
- Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height );
- Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height );
+ Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
+ Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
- clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
- clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
+ clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
- clippingActorA.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, -200.0f, 0.0f ));
- clippingActorB.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
+ clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
+ clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- application.GetScene().Add( clippingActorA );
- application.GetScene().Add( clippingActorB );
+ application.GetScene().Add(clippingActorA);
+ application.GetScene().Add(clippingActorB);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, scissorTrace );
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check scissor test was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
// Check the scissor was set, and the coordinates are correct.
std::stringstream compareParametersString;
- std::string clipA( "0, 500, 480, 200" );
- std::string clipB( "0, 380, 480, 40" );
+ std::string clipA("0, 500, 480, 200");
+ std::string clipB("0, 380, 480, 40");
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) );
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) );
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
END_TEST;
}
int UtcDaliActorPropertyScissorClippingActorNested01(void)
{
// This test checks that an actor is correctly setup for clipping.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" );
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
- const Vector2 imageSize( 16.0f, 16.0f );
+ const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ const Vector2 imageSize(16.0f, 16.0f);
/* Create a nest of 2 scissors to test nesting (intersecting clips).
Actor clippingActorA = CreateActorWithContent16x16();
// Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
// We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
- clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
- application.GetScene().Add( clippingActorA );
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+ application.GetScene().Add(clippingActorA);
// Create a child clipping actor.
Actor clippingActorB = CreateActorWithContent16x16();
- clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
- clippingActorA.Add( clippingActorB );
+ clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+ clippingActorA.Add(clippingActorB);
// positionModifiers is an array of positions to position B around.
// expect is an array of expected scissor clip coordinate results.
- const Vector2 positionModifiers[4] = { Vector2( 1.0f, 1.0f ), Vector2( -1.0f, 1.0f ), Vector2( -1.0f, -1.0f ), Vector2( 1.0f, -1.0f ) };
- const Vector4 expect[4] = { Vector4( 240, 392, 8, 8 ), Vector4( 232, 392, 8, 8 ), Vector4( 232, 400, 8, 8 ), Vector4( 240, 400, 8, 8 ) };
+ const Vector2 positionModifiers[4] = {Vector2(1.0f, 1.0f), Vector2(-1.0f, 1.0f), Vector2(-1.0f, -1.0f), Vector2(1.0f, -1.0f)};
+ const Vector4 expect[4] = {Vector4(240, 392, 8, 8), Vector4(232, 392, 8, 8), Vector4(232, 400, 8, 8), Vector4(240, 400, 8, 8)};
// Loop through each overlap combination.
- for( unsigned int test = 0u; test < 4u; ++test )
+ for(unsigned int test = 0u; test < 4u; ++test)
{
// Position the child clipping actor so it intersects with the 1st clipping actor. This changes each loop.
- const Vector2 position = ( imageSize / 2.0f ) * positionModifiers[test];
- clippingActorB.SetProperty( Actor::Property::POSITION, Vector2( position.x, position.y ));
+ const Vector2 position = (imageSize / 2.0f) * positionModifiers[test];
+ clippingActorB.SetProperty(Actor::Property::POSITION, Vector2(position.x, position.y));
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, scissorTrace );
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check scissor test was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
// Check the scissor was set, and the coordinates are correct.
- const Vector4& expectResults( expect[test] );
+ const Vector4& expectResults(expect[test]);
std::stringstream compareParametersString;
compareParametersString << expectResults.x << ", " << expectResults.y << ", " << expectResults.z << ", " << expectResults.w;
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", compareParametersString.str() ) ); // Compare with the expected result
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", compareParametersString.str())); // Compare with the expected result
}
END_TEST;
int UtcDaliActorPropertyScissorClippingActorNested02(void)
{
// This test checks that an actor is correctly setup for clipping.
- tet_infoline( "Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested" );
+ tet_infoline("Testing Actor::Property::ClippingMode: CLIP_TO_BOUNDING_BOX actor nested");
TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
/* Create a nest of 2 scissors and siblings of the parent.
B E
*/
- const Vector2 stageSize( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
- const Vector2 sizeA{ stageSize.width, stageSize.height * 0.25f };
- const Vector2 sizeB{ stageSize.width, stageSize.height * 0.05f };
- const Vector2 sizeC{ stageSize.width, stageSize.height * 0.25f };
- const Vector2 sizeD{ stageSize.width, stageSize.height * 0.25f };
- const Vector2 sizeE{ stageSize.width, stageSize.height * 0.05f };
+ const Vector2 stageSize(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
+ const Vector2 sizeA{stageSize.width, stageSize.height * 0.25f};
+ const Vector2 sizeB{stageSize.width, stageSize.height * 0.05f};
+ const Vector2 sizeC{stageSize.width, stageSize.height * 0.25f};
+ const Vector2 sizeD{stageSize.width, stageSize.height * 0.25f};
+ const Vector2 sizeE{stageSize.width, stageSize.height * 0.05f};
// Create a clipping actors.
- Actor clippingActorA = CreateActorWithContent( sizeA.width, sizeA.height );
- Actor clippingActorB = CreateActorWithContent( sizeB.width, sizeB.height );
- Actor clippingActorC = CreateActorWithContent( sizeC.width, sizeC.height );
- Actor clippingActorD = CreateActorWithContent( sizeD.width, sizeD.height );
- Actor clippingActorE = CreateActorWithContent( sizeE.width, sizeE.height );
-
- clippingActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- clippingActorA.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
-
- clippingActorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- clippingActorB.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
-
- clippingActorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- clippingActorC.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
-
- clippingActorD.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorD.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- clippingActorD.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
-
- clippingActorE.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT );
- clippingActorE.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
-
- clippingActorA.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, -200.0f, 0.0f ));
- clippingActorB.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
- clippingActorC.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 100.0f, 0.0f ));
- clippingActorD.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
- clippingActorE.SetProperty( Actor::Property::POSITION, Vector3( 0.0f, 0.0f, 0.0f ));
-
- application.GetScene().Add( clippingActorA );
- clippingActorA.Add( clippingActorB );
- application.GetScene().Add( clippingActorC );
- application.GetScene().Add( clippingActorD );
- clippingActorD.Add( clippingActorE );
+ Actor clippingActorA = CreateActorWithContent(sizeA.width, sizeA.height);
+ Actor clippingActorB = CreateActorWithContent(sizeB.width, sizeB.height);
+ Actor clippingActorC = CreateActorWithContent(sizeC.width, sizeC.height);
+ Actor clippingActorD = CreateActorWithContent(sizeD.width, sizeD.height);
+ Actor clippingActorE = CreateActorWithContent(sizeE.width, sizeE.height);
+
+ clippingActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ clippingActorA.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+
+ clippingActorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ clippingActorB.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+
+ clippingActorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ clippingActorC.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+
+ clippingActorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ clippingActorD.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+
+ clippingActorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_LEFT);
+ clippingActorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+
+ clippingActorA.SetProperty(Actor::Property::POSITION, Vector3(0.0f, -200.0f, 0.0f));
+ clippingActorB.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ clippingActorC.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 100.0f, 0.0f));
+ clippingActorD.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ clippingActorE.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+
+ application.GetScene().Add(clippingActorA);
+ clippingActorA.Add(clippingActorB);
+ application.GetScene().Add(clippingActorC);
+ application.GetScene().Add(clippingActorD);
+ clippingActorD.Add(clippingActorE);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, scissorTrace );
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check scissor test was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
// Check the scissor was set, and the coordinates are correct.
- std::string clipA( "0, 500, 480, 200" );
- std::string clipB( "0, 580, 480, 40" );
- std::string clipC( "0, 200, 480, 200" );
- std::string clipD( "0, 300, 480, 200" );
+ std::string clipA("0, 500, 480, 200");
+ std::string clipB("0, 580, 480, 40");
+ std::string clipC("0, 200, 480, 200");
+ std::string clipD("0, 300, 480, 200");
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipA ) );
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipB ) );
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipC ) );
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", clipD ) );
- DALI_TEST_CHECK( scissorTrace.CountMethod( "Scissor" ) == 4 ); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipA));
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipB));
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipC));
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", clipD));
+ DALI_TEST_CHECK(scissorTrace.CountMethod("Scissor") == 4); // Scissor rect should not be changed in clippingActorE case. So count should be 4.
END_TEST;
}
int UtcDaliActorPropertyClippingActorWithRendererOverride(void)
{
// This test checks that an actor with clipping will be ignored if overridden by the Renderer properties.
- tet_infoline( "Testing Actor::Property::CLIPPING_MODE actor with renderer override" );
+ tet_infoline("Testing Actor::Property::CLIPPING_MODE actor with renderer override");
TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& stencilTrace = glAbstraction.GetStencilFunctionTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
// Create a clipping actor.
Actor actorDepth1Clip = CreateActorWithContent16x16();
- actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- application.GetScene().Add( actorDepth1Clip );
+ actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ application.GetScene().Add(actorDepth1Clip);
// Turn the RenderMode to just "COLOR" at the Renderer level to ignore the clippingMode.
- actorDepth1Clip.GetRendererAt( 0 ).SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
+ actorDepth1Clip.GetRendererAt(0).SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, stencilTrace );
+ GenerateTrace(application, enabledDisableTrace, stencilTrace);
// Check we are writing to the color buffer.
- CheckColorMask( glAbstraction, true );
+ CheckColorMask(glAbstraction, true);
// Check the stencil buffer was not enabled.
- DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "2960" ) ); // 2960 is GL_STENCIL_TEST
+ DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "2960")); // 2960 is GL_STENCIL_TEST
// Check stencil functions are not called.
- DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilFunc" ) );
- DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilMask" ) );
- DALI_TEST_CHECK( !stencilTrace.FindMethod( "StencilOp" ) );
+ DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilFunc"));
+ DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilMask"));
+ DALI_TEST_CHECK(!stencilTrace.FindMethod("StencilOp"));
// Check that scissor clipping is overriden by the renderer properties.
TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
- actorDepth1Clip.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX );
+ actorDepth1Clip.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
// Gather the call trace.
- GenerateTrace( application, enabledDisableTrace, scissorTrace );
+ GenerateTrace(application, enabledDisableTrace, scissorTrace);
// Check the stencil buffer was not enabled.
- DALI_TEST_CHECK( !enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+ DALI_TEST_CHECK(!enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
- DALI_TEST_CHECK( !scissorTrace.FindMethod( "StencilFunc" ) );
+ DALI_TEST_CHECK(!scissorTrace.FindMethod("StencilFunc"));
END_TEST;
}
int UtcDaliGetPropertyN(void)
{
- tet_infoline( "Testing Actor::GetProperty returns a non valid value if property index is out of range" );
+ tet_infoline("Testing Actor::GetProperty returns a non valid value if property index is out of range");
TestApplication application;
Actor actor = Actor::New();
unsigned int propertyCount = actor.GetPropertyCount();
- DALI_TEST_EQUALS( actor.GetProperty( Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Property::Index(propertyCount)).GetType(), Property::NONE, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorRaiseLower(void)
{
- tet_infoline( "UtcDaliActor Raise and Lower test\n" );
+ tet_infoline("UtcDaliActor Raise and Lower test\n");
TestApplication application;
- Debug::Filter::SetGlobalLogLevel( Debug::Verbose );
+ Debug::Filter::SetGlobalLogLevel(Debug::Verbose);
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorC = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- stage.Add( actorA );
- stage.Add( actorB );
- stage.Add( actorC );
+ stage.Add(actorA);
+ stage.Add(actorB);
+ stage.Add(actorC);
ResetTouchCallbacks();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Testing Raising of Actor\n" );
+ tet_printf("Testing Raising of Actor\n");
- int preActorOrder( 0 );
- int postActorOrder( 0 );
+ int preActorOrder(0);
+ int postActorOrder(0);
- Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
- value.Get( preActorOrder );
+ Property::Value value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
+ value.Get(preActorOrder);
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.Raise();
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
// Ensure sort order is calculated before next touch event
application.SendNotification();
- value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
- value.Get( postActorOrder );
+ value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
+ value.Get(postActorOrder);
- tet_printf( "Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
+ tet_printf("Raised ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true , TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Testing Lowering of Actor\n" );
+ tet_printf("Testing Lowering of Actor\n");
- value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
- value.Get( preActorOrder );
+ value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
+ value.Get(preActorOrder);
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.Lower();
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
application.SendNotification(); // ensure sort order calculated before next touch event
- value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER );
- value.Get( postActorOrder );
+ value = actorB.GetProperty(Dali::DevelActor::Property::SIBLING_ORDER);
+ value.Get(postActorOrder);
- tet_printf( "Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder );
+ tet_printf("Lowered ActorB from (%d) to (%d) \n", preActorOrder, postActorOrder);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false , TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- Debug::Filter::SetGlobalLogLevel( Debug::NoLogging );
+ Debug::Filter::SetGlobalLogLevel(Debug::NoLogging);
END_TEST;
}
int UtcDaliActorRaiseToTopLowerToBottom(void)
{
- tet_infoline( "UtcDaliActorRaiseToTop and LowerToBottom test \n" );
+ tet_infoline("UtcDaliActorRaiseToTop and LowerToBottom test \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
// Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
// enables checking of which actor the uniform is assigned too
Shader shaderA = CreateShader();
- shaderA.RegisterProperty( "uRendererColor",1.f);
+ shaderA.RegisterProperty("uRendererColor", 1.f);
Shader shaderB = CreateShader();
- shaderB.RegisterProperty( "uRendererColor", 2.f );
+ shaderB.RegisterProperty("uRendererColor", 2.f);
Shader shaderC = CreateShader();
- shaderC.RegisterProperty( "uRendererColor", 3.f );
+ shaderC.RegisterProperty("uRendererColor", 3.f);
Geometry geometry = CreateQuadGeometry();
Renderer rendererC = Renderer::New(geometry, shaderC);
actorC.AddRenderer(rendererC);
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- stage.Add( actorA );
- stage.Add( actorB );
- stage.Add( actorC );
+ stage.Add(actorA);
+ stage.Add(actorB);
+ stage.Add(actorC);
ResetTouchCallbacks();
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
// Set up gl abstraction trace so can query the set uniform order
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
application.SendNotification();
application.Render();
- tet_printf( "Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str() );
-
+ tet_printf("Trace Output:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- bool CBA = ( indexC > indexB) && ( indexB > indexA );
+ bool CBA = (indexC > indexB) && (indexB > indexA);
- DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "RaiseToTop ActorA\n" );
+ tet_printf("RaiseToTop ActorA\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorA.RaiseToTop();
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
application.SendNotification(); // ensure sorting order is calculated before next touch event
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
glAbstraction.ResetSetUniformCallStack();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
application.SendNotification();
application.Render();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- tet_infoline( "Testing A above C and B at bottom\n" );
- bool ACB = ( indexA > indexC) && ( indexC > indexB );
+ tet_infoline("Testing A above C and B at bottom\n");
+ bool ACB = (indexA > indexC) && (indexC > indexB);
- DALI_TEST_EQUALS( ACB, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(ACB, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "RaiseToTop ActorB\n" );
+ tet_printf("RaiseToTop ActorB\n");
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.RaiseToTop();
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
application.SendNotification(); // Ensure sort order is calculated before next touch event
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
glAbstraction.ResetSetUniformCallStack();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
application.SendNotification();
application.Render();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- tet_infoline( "Testing B above A and C at bottom\n" );
- bool BAC = ( indexB > indexA ) && ( indexA > indexC );
+ tet_infoline("Testing B above A and C at bottom\n");
+ bool BAC = (indexB > indexA) && (indexA > indexC);
- DALI_TEST_EQUALS( BAC, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(BAC, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "LowerToBottom ActorA then ActorB leaving Actor C at Top\n" );
+ tet_printf("LowerToBottom ActorA then ActorB leaving Actor C at Top\n");
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorA.LowerToBottom();
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
application.SendNotification();
application.Render();
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.LowerToBottom();
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
glAbstraction.ResetSetUniformCallStack();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
application.SendNotification();
application.Render();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- tet_infoline( "Testing C above A and B at bottom\n" );
- bool CAB = ( indexC > indexA ) && ( indexA > indexB );
+ tet_infoline("Testing C above A and B at bottom\n");
+ bool CAB = (indexC > indexA) && (indexA > indexB);
- DALI_TEST_EQUALS( CAB, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(CAB, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
int UtcDaliActorRaiseAbove(void)
{
- tet_infoline( "UtcDaliActor RaiseToAbove test \n" );
+ tet_infoline("UtcDaliActor RaiseToAbove test \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorC = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- stage.Add( actorA );
- stage.Add( actorB );
- stage.Add( actorC );
+ stage.Add(actorA);
+ stage.Add(actorB);
+ stage.Add(actorC);
ResetTouchCallbacks();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Raise actor B Above Actor C\n" );
+ tet_printf("Raise actor B Above Actor C\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorB.RaiseAbove( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorB.RaiseAbove(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Raise actor A Above Actor B\n" );
+ tet_printf("Raise actor A Above Actor B\n");
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.RaiseAbove( actorB );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.RaiseAbove(actorB);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
- application.ProcessEvent( touchEvent ); // process a touch event on ordered actors.
+ application.ProcessEvent(touchEvent); // process a touch event on ordered actors.
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
int UtcDaliActorLowerBelow(void)
{
- tet_infoline( "UtcDaliActor LowerBelow test \n" );
+ tet_infoline("UtcDaliActor LowerBelow test \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
// Set up renderers to add to Actors, float value 1, 2, 3 assigned to each
// enables checking of which actor the uniform is assigned too
Shader shaderA = CreateShader();
- shaderA.RegisterProperty( "uRendererColor",1.f);
+ shaderA.RegisterProperty("uRendererColor", 1.f);
Shader shaderB = CreateShader();
- shaderB.RegisterProperty( "uRendererColor", 2.f );
+ shaderB.RegisterProperty("uRendererColor", 2.f);
Shader shaderC = CreateShader();
- shaderC.RegisterProperty( "uRendererColor", 3.f );
+ shaderC.RegisterProperty("uRendererColor", 3.f);
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Renderer rendererC = Renderer::New(geometry, shaderC);
actorC.AddRenderer(rendererC);
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
Actor container = Actor::New();
- container.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- container.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- stage.Add( container );
+ container.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ container.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
+ stage.Add(container);
- container.Add( actorA );
- container.Add( actorB );
- container.Add( actorC );
+ container.Add(actorA);
+ container.Add(actorB);
+ container.Add(actorC);
ResetTouchCallbacks();
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( container ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(container).Connect(&application, f);
// Set up gl abstraction trace so can query the set uniform order
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- int indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- int indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- int indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ int indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ int indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ int indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- tet_infoline( "Testing C above B and A at bottom\n" );
- bool CBA = ( indexC > indexB) && ( indexB > indexA );
+ tet_infoline("Testing C above B and A at bottom\n");
+ bool CBA = (indexC > indexB) && (indexB > indexA);
- DALI_TEST_EQUALS( CBA, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(CBA, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- tet_infoline( "UtcDaliActor Test Set up completed \n" );
+ tet_infoline("UtcDaliActor Test Set up completed \n");
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n" );
+ tet_printf("Lower actor C below Actor B ( actor B and A on same level due to insertion order) so C is below both \n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorC.LowerBelow( actorB );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorC.LowerBelow(actorB);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent ); // touch event
+ application.ProcessEvent(touchEvent); // touch event
glAbstraction.ResetSetUniformCallStack();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
application.SendNotification();
application.Render();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- tet_infoline( "Testing render order is A, C, B" );
- DALI_TEST_EQUALS( indexC > indexA, true, TEST_LOCATION );
- DALI_TEST_EQUALS( indexB > indexC, true, TEST_LOCATION );
+ tet_infoline("Testing render order is A, C, B");
+ DALI_TEST_EQUALS(indexC > indexA, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(indexB > indexC, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Lower actor C below Actor A leaving B on top\n" );
+ tet_printf("Lower actor C below Actor A leaving B on top\n");
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorC.LowerBelow( actorA );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorC, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorC.LowerBelow(actorA);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorC, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
glAbstraction.ResetSetUniformCallStack();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
application.Render();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION );
- DALI_TEST_EQUALS( indexB > indexA, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(indexB > indexA, true, TEST_LOCATION);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Lower actor B below Actor C leaving A on top\n" );
+ tet_printf("Lower actor B below Actor C leaving A on top\n");
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorB.LowerBelow( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorB, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorB.LowerBelow(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorB, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
glAbstraction.ResetSetUniformCallStack();
glSetUniformStack = glAbstraction.GetSetUniformTrace();
application.Render();
- tet_printf( "Trace:%s \n", glSetUniformStack.GetTraceString().c_str() );
+ tet_printf("Trace:%s \n", glSetUniformStack.GetTraceString().c_str());
// Test order of uniforms in stack
- indexC = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "3" );
- indexB = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "2" );
- indexA = glSetUniformStack.FindIndexFromMethodAndParams( "uRendererColor", "1" );
+ indexC = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "3");
+ indexB = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "2");
+ indexA = glSetUniformStack.FindIndexFromMethodAndParams("uRendererColor", "1");
- DALI_TEST_EQUALS( indexC > indexB, true, TEST_LOCATION );
- DALI_TEST_EQUALS( indexA > indexC, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(indexC > indexB, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(indexA > indexC, true, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliActorRaiseAboveDifferentParentsN(void)
{
- tet_infoline( "UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n" );
+ tet_infoline("UtcDaliActor RaiseToAbove test with actor and target actor having different parents \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor parentA = Actor::New();
Actor parentB = Actor::New();
- parentA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- parentA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
- parentB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- parentB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ parentA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ parentA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
+ parentB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ parentB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- parentA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- parentA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ parentA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ parentA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- parentB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- parentB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ parentB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ parentB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- stage.Add( parentA );
- stage.Add( parentB );
+ stage.Add(parentA);
+ stage.Add(parentB);
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorC = Actor::New();
- parentA.Add( actorA );
- parentA.Add( actorB );
+ parentA.Add(actorA);
+ parentA.Add(actorB);
- tet_printf( "Actor C added to different parent from A and B \n" );
- parentB.Add( actorC );
+ tet_printf("Actor C added to different parent from A and B \n");
+ parentB.Add(actorC);
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
ResetTouchCallbacks();
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- tet_printf( "Raise actor A Above Actor C which have different parents\n" );
+ tet_printf("Raise actor A Above Actor C which have different parents\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.RaiseAbove( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.RaiseAbove(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
- application.ProcessEvent( touchEvent ); // touch event
+ application.ProcessEvent(touchEvent); // touch event
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
int UtcDaliActorRaiseLowerWhenUnparentedTargetN(void)
{
- tet_infoline( "UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n" );
+ tet_infoline("UtcDaliActor Test raiseAbove and lowerBelow api when target Actor has no parent \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorC = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
ResetTouchCallbacks();
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- tet_printf( "Raise actor A Above Actor C which have no parents\n" );
+ tet_printf("Raise actor A Above Actor C which have no parents\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.RaiseAbove( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.RaiseAbove(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+ tet_printf("Not parented so RaiseAbove should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- stage.Add ( actorB );
- tet_printf( "Lower actor A below Actor C when only A is not on stage \n" );
+ stage.Add(actorB);
+ tet_printf("Lower actor A below Actor C when only A is not on stage \n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.LowerBelow( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.LowerBelow(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Actor A not parented so LowerBelow should show no effect\n" );
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ tet_printf("Actor A not parented so LowerBelow should show no effect\n");
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- tet_printf( "Adding Actor A to stage, will be on top\n" );
+ tet_printf("Adding Actor A to stage, will be on top\n");
- stage.Add ( actorA );
+ stage.Add(actorA);
application.SendNotification();
application.Render();
- tet_printf( "Raise actor B Above Actor C when only B has a parent\n" );
+ tet_printf("Raise actor B Above Actor C when only B has a parent\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorB.RaiseAbove( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorB.RaiseAbove(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "C not parented so RaiseAbove should show no effect\n" );
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ tet_printf("C not parented so RaiseAbove should show no effect\n");
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- tet_printf( "Lower actor A below Actor C when only A has a parent\n" );
+ tet_printf("Lower actor A below Actor C when only A has a parent\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.LowerBelow( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.LowerBelow(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "C not parented so LowerBelow should show no effect\n" );
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ tet_printf("C not parented so LowerBelow should show no effect\n");
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- stage.Add ( actorC );
+ stage.Add(actorC);
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.RaiseAbove( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.RaiseAbove(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
// Ensure sorting happens at end of Core::ProcessEvents() before next touch
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Raise actor A Above Actor C, now both have same parent \n" );
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ tet_printf("Raise actor A Above Actor C, now both have same parent \n");
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorTestAllAPIwhenActorNotParented(void)
{
- tet_infoline( "UtcDaliActor Test all raise/lower api when actor has no parent \n" );
+ tet_infoline("UtcDaliActor Test all raise/lower api when actor has no parent \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorC = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
ResetTouchCallbacks();
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- stage.Add ( actorA );
- tet_printf( "Raise actor B Above Actor C but B not parented\n" );
+ stage.Add(actorA);
+ tet_printf("Raise actor B Above Actor C but B not parented\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.Raise();
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+ tet_printf("Not parented so RaiseAbove should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
- tet_printf( "Raise actor B Above Actor C but B not parented\n" );
+ tet_printf("Raise actor B Above Actor C but B not parented\n");
ResetTouchCallbacks();
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorC.Lower();
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Sort actor tree before next touch event
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Not parented so RaiseAbove should show no effect\n" );
+ tet_printf("Not parented so RaiseAbove should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- tet_printf( "Lower actor C below B but C not parented\n" );
+ tet_printf("Lower actor C below B but C not parented\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.Lower();
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Sort actor tree before next touch event
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Not parented so Lower should show no effect\n" );
+ tet_printf("Not parented so Lower should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- tet_printf( "Raise actor B to top\n" );
+ tet_printf("Raise actor B to top\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorB.RaiseToTop();
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
// Sort actor tree before next touch event
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Not parented so RaiseToTop should show no effect\n" );
+ tet_printf("Not parented so RaiseToTop should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- tet_printf( "Add ActorB to stage so only Actor C not parented\n" );
+ tet_printf("Add ActorB to stage so only Actor C not parented\n");
- stage.Add ( actorB );
+ stage.Add(actorB);
- tet_printf( "Lower actor C to Bottom, B stays at top\n" );
+ tet_printf("Lower actor C to Bottom, B stays at top\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
actorC.LowerToBottom();
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_printf( "Not parented so LowerToBottom should show no effect\n" );
+ tet_printf("Not parented so LowerToBottom should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
ResetTouchCallbacks();
END_TEST;
}
-
int UtcDaliActorRaiseAboveActorAndTargetTheSameN(void)
{
- tet_infoline( "UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n" );
+ tet_infoline("UtcDaliActor RaiseToAbove and test with actor provided as target resulting in a no operation \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
Actor actorB = Actor::New();
Actor actorC = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- actorA.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorA.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorA.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorA.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorB.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorB.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorB.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorB.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- actorC.SetProperty( Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT" );
- actorC.SetProperty( Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT" );
+ actorC.SetProperty(Actor::Property::WIDTH_RESIZE_POLICY, "FILL_TO_PARENT");
+ actorC.SetProperty(Actor::Property::HEIGHT_RESIZE_POLICY, "FILL_TO_PARENT");
- stage.Add( actorA );
- stage.Add( actorB );
- stage.Add( actorC );
+ stage.Add(actorA);
+ stage.Add(actorB);
+ stage.Add(actorC);
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchedSignal().Connect( TestTouchCallback );
- actorB.TouchedSignal().Connect( TestTouchCallback2 );
- actorC.TouchedSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect(TestTouchCallback);
+ actorB.TouchedSignal().Connect(TestTouchCallback2);
+ actorC.TouchedSignal().Connect(TestTouchCallback3);
ResetTouchCallbacks();
// Connect ChildOrderChangedSignal
- bool orderChangedSignal( false );
- Actor orderChangedActor;
- ChildOrderChangedFunctor f( orderChangedSignal, orderChangedActor );
- DevelActor::ChildOrderChangedSignal( stage.GetRootLayer() ).Connect( &application, f ) ;
+ bool orderChangedSignal(false);
+ Actor orderChangedActor;
+ ChildOrderChangedFunctor f(orderChangedSignal, orderChangedActor);
+ DevelActor::ChildOrderChangedSignal(stage.GetRootLayer()).Connect(&application, f);
application.SendNotification();
application.Render();
Dali::Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.f, 10.f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.f, 10.f));
Dali::Integration::TouchEvent touchEvent;
- touchEvent.AddPoint( point );
+ touchEvent.AddPoint(point);
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
- tet_infoline( "Raise actor A Above Actor A which is the same actor!!\n" );
+ tet_infoline("Raise actor A Above Actor A which is the same actor!!\n");
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.RaiseAbove( actorA );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.RaiseAbove(actorA);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_infoline( "No target is source Actor so RaiseAbove should show no effect\n" );
+ tet_infoline("No target is source Actor so RaiseAbove should show no effect\n");
- DALI_TEST_EQUALS( gTouchCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, true , TEST_LOCATION );
+ DALI_TEST_EQUALS(gTouchCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, true, TEST_LOCATION);
ResetTouchCallbacks();
orderChangedSignal = false;
- DALI_TEST_EQUALS( orderChangedSignal, false, TEST_LOCATION );
- actorA.RaiseAbove( actorC );
- DALI_TEST_EQUALS( orderChangedSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( orderChangedActor, actorA, TEST_LOCATION );
+ DALI_TEST_EQUALS(orderChangedSignal, false, TEST_LOCATION);
+ actorA.RaiseAbove(actorC);
+ DALI_TEST_EQUALS(orderChangedSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(orderChangedActor, actorA, TEST_LOCATION);
application.SendNotification();
application.Render();
- application.ProcessEvent( touchEvent );
+ application.ProcessEvent(touchEvent);
- tet_infoline( "Raise actor A Above Actor C which will now be successful \n" );
- DALI_TEST_EQUALS( gTouchCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled2, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gTouchCallBackCalled3, false , TEST_LOCATION );
+ tet_infoline("Raise actor A Above Actor C which will now be successful \n");
+ DALI_TEST_EQUALS(gTouchCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled2, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gTouchCallBackCalled3, false, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorGetScreenPosition(void)
{
- tet_infoline( "UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Get screen coordinates of Actor \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
- Vector2 size2( 10.0f, 20.0f );
- actorA.SetProperty( Actor::Property::SIZE, size2 );
+ Vector2 size2(10.0f, 20.0f);
+ actorA.SetProperty(Actor::Property::SIZE, size2);
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Center Anchor Point and 0,0 position \n");
- stage.Add( actorA );
+ stage.Add(actorA);
application.SendNotification();
application.Render();
- Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position %f %f \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
- tet_infoline( "UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Top Left Anchor Point and 0,0 position \n");
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
- tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 0,0 position \n");
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
- tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,0 position \n");
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 30.0, 0.0 ));
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 0.0));
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 0.0 \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
- tet_infoline( "UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Bottom right Anchor Point and 30,420 position \n");
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 30.0, 420.0 ));
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 420.0));
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- DALI_TEST_EQUALS( actorScreenPosition.x, 30lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 420lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 30lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 420lu, TEST_LOCATION);
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y);
- tet_infoline( "UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n" );
+ tet_infoline("UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n");
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 30.0, 30.0 ));
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(30.0, 30.0));
Actor actorB = Actor::New();
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorB.SetProperty( Actor::Property::SIZE, size2 );
- actorB.SetProperty( Actor::Property::POSITION, Vector2( 10.f, 10.f ));
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorB.SetProperty(Actor::Property::SIZE, size2);
+ actorB.SetProperty(Actor::Property::POSITION, Vector2(10.f, 10.f));
+ actorA.Add(actorB);
- actorA.SetProperty( Actor::Property::SCALE, 2.0f );
+ actorA.SetProperty(Actor::Property::SCALE, 2.0f);
application.SendNotification();
application.Render();
- actorScreenPosition = actorB.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorScreenPosition = actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- DALI_TEST_EQUALS( actorScreenPosition.x, 50lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 50lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 50lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 50lu, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorGetScreenPositionAfterScaling(void)
{
- tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n" );
+ tet_infoline("UtcDaliActorGetScreenPositionAfterScaling Get screen coordinates of Actor \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
- Vector2 size2( 10.0f, 20.0f );
- actorA.SetProperty( Actor::Property::SIZE, size2 );
- actorA.SetProperty( Actor::Property::SCALE, 1.5f );
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ Vector2 size2(10.0f, 20.0f);
+ actorA.SetProperty(Actor::Property::SIZE, size2);
+ actorA.SetProperty(Actor::Property::SCALE, 1.5f);
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPositionAfterScaling TopRight Anchor Point, scale 1.5f and 0,0 position \n");
- stage.Add( actorA );
+ stage.Add(actorA);
application.SendNotification();
application.Render();
- Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 0lu , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0lu , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 0lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0lu, TEST_LOCATION);
- tet_infoline( "UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n" );
+ tet_infoline("UtcDaliActorGetScreenPositionAfterScaling BOTTOM_RIGHT Anchor Point, scale 1.5f and 0,0 position \n");
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x , 0.0f , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorGetScreenPositionWithDifferentParentOrigin(void)
{
- tet_infoline( "UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n" );
+ tet_infoline("UtcDaliActorGetScreenPositionWithDifferentParentOrigin Changes parent origin which should not effect result \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- Vector2 size2( 10.0f, 20.0f );
- actorA.SetProperty( Actor::Property::SIZE, size2 );
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Vector2 size2(10.0f, 20.0f);
+ actorA.SetProperty(Actor::Property::SIZE, size2);
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( " TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+ tet_infoline(" TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
- stage.Add( actorA );
+ stage.Add(actorA);
application.SendNotification();
application.Render();
- Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 240.0f , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 400.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 240.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 400.0f, TEST_LOCATION);
- tet_infoline( " BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n" );
+ tet_infoline(" BOTTOM_RIGHT Anchor Point, ParentOrigin::TOP_RIGHT and 0,0 position \n");
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT ParentOrigin::TOP_RIGHT \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x , 480.0f , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 0.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 480.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 0.0f, TEST_LOCATION);
END_TEST;
END_TEST;
int UtcDaliActorGetScreenPositionWithChildActors(void)
{
- tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n" );
+ tet_infoline("UtcDaliActorGetScreenPositionWithChildActors Check screen position with a tree of actors \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
- tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+ tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- Vector2 size1( 10.0f, 20.0f );
- actorA.SetProperty( Actor::Property::SIZE, size1 );
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Vector2 size1(10.0f, 20.0f);
+ actorA.SetProperty(Actor::Property::SIZE, size1);
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+ tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
Actor parentActorA = Actor::New();
- parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- Vector2 size2( 30.0f, 60.0f );
- parentActorA.SetProperty( Actor::Property::SIZE, size2 );
- parentActorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Vector2 size2(30.0f, 60.0f);
+ parentActorA.SetProperty(Actor::Property::SIZE, size2);
+ parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
+ tet_infoline("Add child 1 to Parent 1 and check screen position \n");
- stage.Add( parentActorA );
- parentActorA.Add ( actorA );
+ stage.Add(parentActorA);
+ parentActorA.Add(actorA);
application.SendNotification();
application.Render();
- Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 255.0f , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 430.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 255.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 430.0f, TEST_LOCATION);
- tet_infoline( "Test 2\n");
+ tet_infoline("Test 2\n");
- tet_infoline( "change parent anchor point and parent origin then check screen position \n" );
+ tet_infoline("change parent anchor point and parent origin then check screen position \n");
- parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
- parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+ parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
+ parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
application.SendNotification();
application.Render();
- actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::BOTTOM_LEFT ParentOrigin::TOP_LEFT \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 15.0f , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, -30.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 15.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, -30.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorGetScreenPositionWithChildActors02(void)
{
- tet_infoline( "UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n" );
+ tet_infoline("UtcDaliActorGetScreenPositionWithChildActors02 Check screen position with a tree of actors \n");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
- tet_infoline( "Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+ tet_infoline("Create Child Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- Vector2 size1( 10.0f, 20.0f );
- actorA.SetProperty( Actor::Property::SIZE, size1 );
- actorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Vector2 size1(10.0f, 20.0f);
+ actorA.SetProperty(Actor::Property::SIZE, size1);
+ actorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n" );
+ tet_infoline("Create Parent Actor 1 TOP_LEFT Anchor Point, ParentOrigin::CENTER and 0,0 position \n");
Actor parentActorA = Actor::New();
- parentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- parentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- Vector2 size2( 30.0f, 60.0f );
- parentActorA.SetProperty( Actor::Property::SIZE, size2 );
- parentActorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ parentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ parentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ Vector2 size2(30.0f, 60.0f);
+ parentActorA.SetProperty(Actor::Property::SIZE, size2);
+ parentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n" );
+ tet_infoline("Create Grand Parent Actor 1 BOTTOM_LEFT Anchor Point, ParentOrigin::BOTTOM_LEFT and 0,0 position \n");
Actor grandParentActorA = Actor::New();
- grandParentActorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
- grandParentActorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
- Vector2 size3( 60.0f, 120.0f );
- grandParentActorA.SetProperty( Actor::Property::SIZE, size3 );
- grandParentActorA.SetProperty( Actor::Property::POSITION, Vector2( 0.f, 0.f ));
+ grandParentActorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
+ grandParentActorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
+ Vector2 size3(60.0f, 120.0f);
+ grandParentActorA.SetProperty(Actor::Property::SIZE, size3);
+ grandParentActorA.SetProperty(Actor::Property::POSITION, Vector2(0.f, 0.f));
- tet_infoline( "Add Parent 1 to Grand Parent 1 \n" );
+ tet_infoline("Add Parent 1 to Grand Parent 1 \n");
- stage.Add( grandParentActorA );
- grandParentActorA.Add ( parentActorA );
+ stage.Add(grandParentActorA);
+ grandParentActorA.Add(parentActorA);
- tet_infoline( "Add child 1 to Parent 1 and check screen position \n" );
+ tet_infoline("Add child 1 to Parent 1 and check screen position \n");
- parentActorA.Add ( actorA );
+ parentActorA.Add(actorA);
application.SendNotification();
application.Render();
- Vector3 actorWorldPosition = actorA.GetProperty( Actor::Property::WORLD_POSITION ).Get< Vector3 >();
- Vector2 actorScreenPosition = actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >();
+ Vector3 actorWorldPosition = actorA.GetProperty(Actor::Property::WORLD_POSITION).Get<Vector3>();
+ Vector2 actorScreenPosition = actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>();
- tet_printf( "Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y );
- tet_printf( "Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y );
+ tet_printf("Actor World Position ( %f %f ) AnchorPoint::TOP_LEFT ParentOrigin::CENTER \n", actorWorldPosition.x, actorWorldPosition.y);
+ tet_printf("Actor Screen Position ( %f %f ) \n", actorScreenPosition.x, actorScreenPosition.y);
- DALI_TEST_EQUALS( actorScreenPosition.x, 45.0f , TEST_LOCATION );
- DALI_TEST_EQUALS( actorScreenPosition.y, 770.0f , TEST_LOCATION );
+ DALI_TEST_EQUALS(actorScreenPosition.x, 45.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorScreenPosition.y, 770.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse(void)
{
- tet_infoline( "UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point" );
+ tet_infoline("UtcDaliActorGetScreenPositionPositionUsesAnchorPointFalse Check screen position where the position does not use the anchor point");
TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ Integration::Scene stage(application.GetScene());
- tet_infoline( "Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
+ tet_infoline("Create an actor with AnchorPoint::TOP_LEFT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actorA.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- actorA.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 20.0f ) );
- stage.Add( actorA );
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actorA.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ actorA.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 20.0f));
+ stage.Add(actorA);
- tet_infoline( "Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
+ tet_infoline("Create an Actor with AnchorPoint::BOTTOM_RIGHT, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
Actor actorB = Actor::New();
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actorB.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- Vector2 actorBSize( 30.0f, 60.0f );
- actorB.SetProperty( Actor::Property::SIZE, actorBSize );
- stage.Add( actorB );
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actorB.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ Vector2 actorBSize(30.0f, 60.0f);
+ actorB.SetProperty(Actor::Property::SIZE, actorBSize);
+ stage.Add(actorB);
- tet_infoline( "Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false" );
+ tet_infoline("Create an actor with AnchorPoint::CENTER, ParentOrigin::CENTER and 0,0 position, POSITION_USES_ANCHOR false");
Actor actorC = Actor::New();
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actorC.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- Vector2 actorCSize( 60.0f, 120.0f );
- actorC.SetProperty( Actor::Property::SIZE, actorCSize );
- stage.Add( actorC );
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actorC.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ Vector2 actorCSize(60.0f, 120.0f);
+ actorC.SetProperty(Actor::Property::SIZE, actorCSize);
+ stage.Add(actorC);
application.SendNotification();
application.Render();
- tet_infoline( "Despite differing sizes and anchor-points, the screen position for all actors is the same");
+ tet_infoline("Despite differing sizes and anchor-points, the screen position for all actors is the same");
- Vector2 center( stage.GetSize() * 0.5f );
+ Vector2 center(stage.GetSize() * 0.5f);
- DALI_TEST_EQUALS( actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
- DALI_TEST_EQUALS( actorB.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
- DALI_TEST_EQUALS( actorC.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center, TEST_LOCATION );
+ DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center, TEST_LOCATION);
- tet_infoline( "Add scale to all actors" );
+ tet_infoline("Add scale to all actors");
- actorA.SetProperty( Actor::Property::SCALE, 2.0f );
- actorB.SetProperty( Actor::Property::SCALE, 2.0f );
- actorC.SetProperty( Actor::Property::SCALE, 2.0f );
+ actorA.SetProperty(Actor::Property::SCALE, 2.0f);
+ actorB.SetProperty(Actor::Property::SCALE, 2.0f);
+ actorC.SetProperty(Actor::Property::SCALE, 2.0f);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actorA.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center /* TOP_LEFT Anchor */, TEST_LOCATION );
- DALI_TEST_EQUALS( actorB.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION );
- DALI_TEST_EQUALS( actorC.GetProperty( Actor::Property::SCREEN_POSITION).Get< Vector2 >(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actorA.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center /* TOP_LEFT Anchor */, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorB.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorBSize /* BOTTOM_RIGHT Anchor */, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorC.GetProperty(Actor::Property::SCREEN_POSITION).Get<Vector2>(), center - actorCSize * 0.5f /* CENTER Anchor*/, TEST_LOCATION);
END_TEST;
}
int utcDaliActorPositionUsesAnchorPoint(void)
{
TestApplication application;
- tet_infoline( "Check default behaviour\n" );
+ tet_infoline("Check default behaviour\n");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- tet_infoline( "Check that the world position is in the center\n" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ tet_infoline("Check that the world position is in the center\n");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Set the position uses anchor point property to false\n" );
- actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
+ tet_infoline("Set the position uses anchor point property to false\n");
+ actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
application.SendNotification();
application.Render();
- tet_infoline( "Check that the world position has changed appropriately\n" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+ tet_infoline("Check that the world position has changed appropriately\n");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
END_TEST;
}
int utcDaliActorPositionUsesAnchorPointCheckScale(void)
{
TestApplication application;
- tet_infoline( "Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+ tet_infoline("Check that the scale is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::SCALE, 2.0f );
- actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::SCALE, 2.0f);
+ actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- tet_infoline( "Check the world position is the same as it would be without a scale\n" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+ tet_infoline("Check the world position is the same as it would be without a scale\n");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 100.0f, 100.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(100.0f, 100.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
END_TEST;
}
int utcDaliActorPositionUsesAnchorPointCheckRotation(void)
{
TestApplication application;
- tet_infoline( "Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+ tet_infoline("Check that the rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 90.0f), Vector3::ZAXIS ) );
- actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
+ actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- tet_infoline( "Check the world position is the same as it would be without a rotation\n" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+ tet_infoline("Check the world position is the same as it would be without a rotation\n");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-50.0f, 50.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 150.0f, 50.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(150.0f, 50.0f, 0.0f), TEST_LOCATION);
END_TEST;
}
int utcDaliActorPositionUsesAnchorPointCheckScaleAndRotation(void)
{
TestApplication application;
- tet_infoline( "Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+ tet_infoline("Check that the scale and rotation is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Degree( 90.0f), Vector3::ZAXIS ) );
- actor.SetProperty( Actor::Property::SCALE, 2.0f );
- actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Degree(90.0f), Vector3::ZAXIS));
+ actor.SetProperty(Actor::Property::SCALE, 2.0f);
+ actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- tet_infoline( "Check the world position is the same as it would be without a scale and rotation\n" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 50.0f, 50.0f, 0.0f ), TEST_LOCATION );
+ tet_infoline("Check the world position is the same as it would be without a scale and rotation\n");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(50.0f, 50.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ tet_infoline("Change the Anchor Point to TOP_LEFT and ensure the world position changes accordingly");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( -100.0f, 100.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(-100.0f, 100.0f, 0.0f), TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure the world position changes accordingly");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), Vector3(200.0f, 0.0f, 0.0f), TEST_LOCATION);
END_TEST;
}
int utcDaliActorPositionUsesAnchorPointOnlyInheritPosition(void)
{
TestApplication application;
- tet_infoline( "Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n" );
+ tet_infoline("Check that if not inheriting scale and position, then the position is adjusted appropriately when setting the positionUsesAnchorPoint to false\n");
Actor parent = Actor::New();
- application.GetScene().Add( parent );
- Vector2 stageSize( application.GetScene().GetSize() );
+ application.GetScene().Add(parent);
+ Vector2 stageSize(application.GetScene().GetSize());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::INHERIT_SCALE, false );
- actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false );
- actor.SetProperty( Actor::Property::POSITION_USES_ANCHOR_POINT, false );
- parent.Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
+ actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
+ actor.SetProperty(Actor::Property::POSITION_USES_ANCHOR_POINT, false);
+ parent.Add(actor);
application.SendNotification();
application.Render();
- const Vector3 expectedWorldPosition( -stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f );
+ const Vector3 expectedWorldPosition(-stageSize.width * 0.5f + 50.0f, -stageSize.height * 0.5f + 50.0f, 0.0f);
- tet_infoline( "Check the world position is in the right place\n" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
+ tet_infoline("Check the world position is in the right place\n");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+ tet_infoline("Change the Anchor Point to TOP_LEFT and ensure world position hasn't changed");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
- tet_infoline( "Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT );
+ tet_infoline("Change the Anchor Point to BOTTOM_RIGHT and ensure world position hasn't changed");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), expectedWorldPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), expectedWorldPosition, TEST_LOCATION);
END_TEST;
}
int utcDaliActorVisibilityChangeSignalSelf(void)
{
TestApplication application;
- tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" );
+ tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
Actor actor = Actor::New();
VisibilityChangedFunctorData data;
- DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) );
+ DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
- actor.SetProperty( Actor::Property::VISIBLE, false );
+ actor.SetProperty(Actor::Property::VISIBLE, false);
- data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
+ data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
- tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" );
+ tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
data.Reset();
- actor.SetProperty( Actor::Property::VISIBLE, false );
- data.Check( false /* not called */, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ data.Check(false /* not called */, TEST_LOCATION);
- tet_infoline( "Change the visibility using properties, ensure called" );
+ tet_infoline("Change the visibility using properties, ensure called");
data.Reset();
- actor.SetProperty( Actor::Property::VISIBLE, true );
- data.Check( true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ data.Check(true /* called */, actor, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
- tet_infoline( "Set the visibility to current using properties, ensure not called" );
+ tet_infoline("Set the visibility to current using properties, ensure not called");
data.Reset();
- actor.SetProperty( Actor::Property::VISIBLE, true );
- data.Check( false /* not called */, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ data.Check(false /* not called */, TEST_LOCATION);
END_TEST;
}
int utcDaliActorVisibilityChangeSignalChildren(void)
{
TestApplication application;
- tet_infoline( "Check that the visibility change signal is called for the children when the visibility changes for the parent" );
+ tet_infoline("Check that the visibility change signal is called for the children when the visibility changes for the parent");
Actor parent = Actor::New();
- Actor child = Actor::New();
- parent.Add( child );
+ Actor child = Actor::New();
+ parent.Add(child);
Actor grandChild = Actor::New();
- child.Add( grandChild );
+ child.Add(grandChild);
VisibilityChangedFunctorData parentData;
VisibilityChangedFunctorData childData;
VisibilityChangedFunctorData grandChildData;
- tet_infoline( "Only connect the child and grandchild, ensure they are called and not the parent" );
- DevelActor::VisibilityChangedSignal( child ).Connect( &application, VisibilityChangedFunctor( childData ) );
- DevelActor::VisibilityChangedSignal( grandChild ).Connect( &application, VisibilityChangedFunctor( grandChildData ) );
+ tet_infoline("Only connect the child and grandchild, ensure they are called and not the parent");
+ DevelActor::VisibilityChangedSignal(child).Connect(&application, VisibilityChangedFunctor(childData));
+ DevelActor::VisibilityChangedSignal(grandChild).Connect(&application, VisibilityChangedFunctor(grandChildData));
- parent.SetProperty( Actor::Property::VISIBLE, false );
- parentData.Check( false /* not called */, TEST_LOCATION );
- childData.Check( true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
- grandChildData.Check( true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
+ parent.SetProperty(Actor::Property::VISIBLE, false);
+ parentData.Check(false /* not called */, TEST_LOCATION);
+ childData.Check(true /* called */, child, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
+ grandChildData.Check(true /* called */, grandChild, false /* not visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
- tet_infoline( "Connect to the parent's signal as well and ensure all three are called" );
+ tet_infoline("Connect to the parent's signal as well and ensure all three are called");
parentData.Reset();
childData.Reset();
grandChildData.Reset();
- DevelActor::VisibilityChangedSignal( parent ).Connect( &application, VisibilityChangedFunctor( parentData ) );
+ DevelActor::VisibilityChangedSignal(parent).Connect(&application, VisibilityChangedFunctor(parentData));
- parent.SetProperty( Actor::Property::VISIBLE, true );
- parentData.Check( true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
- childData.Check( true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
- grandChildData.Check( true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION );
+ parent.SetProperty(Actor::Property::VISIBLE, true);
+ parentData.Check(true /* called */, parent, true /* visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
+ childData.Check(true /* called */, child, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
+ grandChildData.Check(true /* called */, grandChild, true /* visible */, DevelActor::VisibilityChange::PARENT, TEST_LOCATION);
- tet_infoline( "Ensure none of the functors are called if we attempt to change the visibility to what it already is at" );
+ tet_infoline("Ensure none of the functors are called if we attempt to change the visibility to what it already is at");
parentData.Reset();
childData.Reset();
grandChildData.Reset();
- parent.SetProperty( Actor::Property::VISIBLE, true );
- parentData.Check( false /* not called */, TEST_LOCATION );
- childData.Check( false /* not called */, TEST_LOCATION );
- grandChildData.Check( false /* not called */, TEST_LOCATION );
+ parent.SetProperty(Actor::Property::VISIBLE, true);
+ parentData.Check(false /* not called */, TEST_LOCATION);
+ childData.Check(false /* not called */, TEST_LOCATION);
+ grandChildData.Check(false /* not called */, TEST_LOCATION);
END_TEST;
}
int utcDaliActorVisibilityChangeSignalAfterAnimation(void)
{
TestApplication application;
- tet_infoline( "Check that the visibility change signal is emitted when the visibility changes when an animation starts" );
+ tet_infoline("Check that the visibility change signal is emitted when the visibility changes when an animation starts");
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
VisibilityChangedFunctorData data;
- DevelActor::VisibilityChangedSignal( actor ).Connect( &application, VisibilityChangedFunctor( data ) );
+ DevelActor::VisibilityChangedSignal(actor).Connect(&application, VisibilityChangedFunctor(data));
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( actor, Actor::Property::VISIBLE ), false );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::VISIBLE), false);
- data.Check( false, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ data.Check(false, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
- tet_infoline( "Play the animation and check the property value" );
+ tet_infoline("Play the animation and check the property value");
animation.Play();
- data.Check( true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
+ data.Check(true /* called */, actor, false /* not visible */, DevelActor::VisibilityChange::SELF, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
- tet_infoline( "Animation not currently finished, so the current visibility should still be true" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ tet_infoline("Animation not currently finished, so the current visibility should still be true");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
END_TEST;
}
-
int utcDaliActorVisibilityChangeSignalByName(void)
{
TestApplication application;
- tet_infoline( "Check that the visibility change signal is called when the visibility changes for the actor itself" );
+ tet_infoline("Check that the visibility change signal is called when the visibility changes for the actor itself");
Actor actor = Actor::New();
- bool signalCalled=false;
- actor.ConnectSignal( &application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled) );
- DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
- actor.SetProperty( Actor::Property::VISIBLE, false );
- DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
+ bool signalCalled = false;
+ actor.ConnectSignal(&application, "visibilityChanged", VisibilityChangedVoidFunctor(signalCalled));
+ DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
- tet_infoline( "Ensure functor is not called if we attempt to change the visibility to what it already is at" );
+ tet_infoline("Ensure functor is not called if we attempt to change the visibility to what it already is at");
signalCalled = false;
- actor.SetProperty( Actor::Property::VISIBLE, false );
- DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
- tet_infoline( "Change the visibility using properties, ensure called" );
- actor.SetProperty( Actor::Property::VISIBLE, true );
- DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
+ tet_infoline("Change the visibility using properties, ensure called");
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
- tet_infoline( "Set the visibility to current using properties, ensure not called" );
+ tet_infoline("Set the visibility to current using properties, ensure not called");
signalCalled = false;
- actor.SetProperty( Actor::Property::VISIBLE, true );
- DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
END_TEST;
}
-
-static void LayoutDirectionChanged( Actor actor, LayoutDirection::Type type )
+static void LayoutDirectionChanged(Actor actor, LayoutDirection::Type type)
{
gLayoutDirectionType = type;
}
int UtcDaliActorLayoutDirectionProperty(void)
{
TestApplication application;
- tet_infoline( "Check layout direction property" );
+ tet_infoline("Check layout direction property");
Actor actor0 = Actor::New();
- DALI_TEST_EQUALS( actor0.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- application.GetScene().Add( actor0 );
+ DALI_TEST_EQUALS(actor0.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ application.GetScene().Add(actor0);
application.SendNotification();
application.Render();
Actor actor1 = Actor::New();
- DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor2 = Actor::New();
- DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor3 = Actor::New();
- DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor4 = Actor::New();
- DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor5 = Actor::New();
- DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor6 = Actor::New();
- DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor7 = Actor::New();
- DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor8 = Actor::New();
- DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
Actor actor9 = Actor::New();
- DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
- actor1.Add( actor2 );
+ actor1.Add(actor2);
gLayoutDirectionType = LayoutDirection::LEFT_TO_RIGHT;
- actor2.LayoutDirectionChangedSignal().Connect( LayoutDirectionChanged );
+ actor2.LayoutDirectionChangedSignal().Connect(LayoutDirectionChanged);
- DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
- actor1.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
- DALI_TEST_EQUALS( actor1.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
+ actor1.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
+ DALI_TEST_EQUALS(actor1.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
- DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(gLayoutDirectionType, LayoutDirection::RIGHT_TO_LEFT, TEST_LOCATION);
- actor1.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true );
- actor0.Add( actor1 );
- DALI_TEST_EQUALS( actor1.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor2.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ actor1.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
+ actor0.Add(actor1);
+ DALI_TEST_EQUALS(actor1.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor2.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
- application.GetScene().Add( actor3 );
- actor3.Add( actor4 );
- actor4.Add( actor5 );
- actor5.Add( actor6 );
- actor5.Add( actor7 );
- actor7.Add( actor8 );
- actor8.Add( actor9 );
- actor3.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
- actor5.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
+ application.GetScene().Add(actor3);
+ actor3.Add(actor4);
+ actor4.Add(actor5);
+ actor5.Add(actor6);
+ actor5.Add(actor7);
+ actor7.Add(actor8);
+ actor8.Add(actor9);
+ actor3.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
+ actor5.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
- DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), true, TEST_LOCATION );
- actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, false );
- DALI_TEST_EQUALS( actor8.GetProperty< bool >( Actor::Property::INHERIT_LAYOUT_DIRECTION ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), true, TEST_LOCATION);
+ actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, false);
+ DALI_TEST_EQUALS(actor8.GetProperty<bool>(Actor::Property::INHERIT_LAYOUT_DIRECTION), false, TEST_LOCATION);
- actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
+ actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
- DALI_TEST_EQUALS( actor3.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor4.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor5.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor6.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor3.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor4.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor5.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor6.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
- actor8.SetProperty( Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT" );
- DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+ actor8.SetProperty(Actor::Property::LAYOUT_DIRECTION, "RIGHT_TO_LEFT");
+ DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
- actor7.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
- DALI_TEST_EQUALS( actor7.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+ actor7.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
+ DALI_TEST_EQUALS(actor7.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::RIGHT_TO_LEFT), TEST_LOCATION);
- actor8.SetProperty( Actor::Property::INHERIT_LAYOUT_DIRECTION, true );
- DALI_TEST_EQUALS( actor8.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor9.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+ actor8.SetProperty(Actor::Property::INHERIT_LAYOUT_DIRECTION, true);
+ DALI_TEST_EQUALS(actor8.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor9.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
END_TEST;
}
-
struct LayoutDirectionFunctor
{
LayoutDirectionFunctor(bool& signalCalled)
- : mSignalCalled( signalCalled )
+ : mSignalCalled(signalCalled)
{
}
LayoutDirectionFunctor(const LayoutDirectionFunctor& rhs)
- : mSignalCalled( rhs.mSignalCalled )
+ : mSignalCalled(rhs.mSignalCalled)
{
}
int UtcDaliActorLayoutDirectionSignal(void)
{
TestApplication application;
- tet_infoline( "Check changing layout direction property sends a signal" );
+ tet_infoline("Check changing layout direction property sends a signal");
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetProperty< int >( Actor::Property::LAYOUT_DIRECTION ), static_cast< int >( LayoutDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
- application.GetScene().Add( actor );
- bool signalCalled = false;
+ DALI_TEST_EQUALS(actor.GetProperty<int>(Actor::Property::LAYOUT_DIRECTION), static_cast<int>(LayoutDirection::LEFT_TO_RIGHT), TEST_LOCATION);
+ application.GetScene().Add(actor);
+ bool signalCalled = false;
LayoutDirectionFunctor layoutDirectionFunctor(signalCalled);
- actor.ConnectSignal( &application, "layoutDirectionChanged", layoutDirectionFunctor );
- DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
+ actor.ConnectSignal(&application, "layoutDirectionChanged", layoutDirectionFunctor);
+ DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
// Test that writing the same value doesn't send a signal
- actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT );
- DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::LEFT_TO_RIGHT);
+ DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
// Test that writing a different value sends the signal
signalCalled = false;
- actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
- DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
+ DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
signalCalled = false;
- actor.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
- DALI_TEST_EQUALS( signalCalled, false, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT);
+ DALI_TEST_EQUALS(signalCalled, false, TEST_LOCATION);
END_TEST;
}
struct ChildAddedSignalCheck
{
- ChildAddedSignalCheck( bool& signalReceived, Actor& childHandle )
- : mSignalReceived( signalReceived ),
- mChildHandle( childHandle )
+ ChildAddedSignalCheck(bool& signalReceived, Actor& childHandle)
+ : mSignalReceived(signalReceived),
+ mChildHandle(childHandle)
{
}
- void operator() ( Actor childHandle )
+ void operator()(Actor childHandle)
{
mSignalReceived = true;
- mChildHandle = childHandle;
+ mChildHandle = childHandle;
}
- void operator() ()
+ void operator()()
{
mSignalReceived = true;
- mChildHandle = Actor();
+ mChildHandle = Actor();
}
- bool& mSignalReceived;
+ bool& mSignalReceived;
Actor& mChildHandle;
};
int UtcDaliChildAddedSignalP1(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool signalReceived=false;
+ bool signalReceived = false;
Actor childActor;
- ChildAddedSignalCheck signal( signalReceived, childActor );
- DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ ChildAddedSignalCheck signal(signalReceived, childActor);
+ DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
auto actorA = Actor::New();
- stage.Add( actorA );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
+ stage.Add(actorA);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
signalReceived = false;
auto actorB = Actor::New();
- stage.Add( actorB );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION );
+ stage.Add(actorB);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliChildAddedSignalP2(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool signalReceived=false;
+ bool signalReceived = false;
Actor childActor;
- ChildAddedSignalCheck signal( signalReceived, childActor );
- tet_infoline( "Connect to childAdded signal by name" );
+ ChildAddedSignalCheck signal(signalReceived, childActor);
+ tet_infoline("Connect to childAdded signal by name");
- stage.GetRootLayer().ConnectSignal( &application, "childAdded", signal );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ stage.GetRootLayer().ConnectSignal(&application, "childAdded", signal);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
auto actorA = Actor::New();
- stage.Add( actorA );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
+ stage.Add(actorA);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
// Can't test which actor was added; signal signature is void() when connecting via name.
signalReceived = false;
auto actorB = Actor::New();
- stage.Add( actorB );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
+ stage.Add(actorB);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliChildAddedSignalN(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool signalReceived=false;
+ bool signalReceived = false;
Actor childActor;
- ChildAddedSignalCheck signal( signalReceived, childActor );
- DevelActor::ChildAddedSignal( stage.GetRootLayer() ).Connect( &application, signal );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ ChildAddedSignalCheck signal(signalReceived, childActor);
+ DevelActor::ChildAddedSignal(stage.GetRootLayer()).Connect(&application, signal);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
auto actorA = Actor::New();
- stage.Add( actorA );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
+ stage.Add(actorA);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
signalReceived = false;
auto actorB = Actor::New();
- actorA.Add( actorB );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ actorA.Add(actorB);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
END_TEST;
}
-
struct ChildRemovedSignalCheck
{
- ChildRemovedSignalCheck( bool& signalReceived, Actor& childHandle )
- : mSignalReceived( signalReceived ),
- mChildHandle( childHandle )
+ ChildRemovedSignalCheck(bool& signalReceived, Actor& childHandle)
+ : mSignalReceived(signalReceived),
+ mChildHandle(childHandle)
{
}
- void operator() ( Actor childHandle )
+ void operator()(Actor childHandle)
{
mSignalReceived = true;
- mChildHandle = childHandle;
+ mChildHandle = childHandle;
}
- void operator() ()
+ void operator()()
{
mSignalReceived = true;
}
- bool& mSignalReceived;
+ bool& mSignalReceived;
Actor& mChildHandle;
};
int UtcDaliChildRemovedSignalP1(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool signalReceived=false;
+ bool signalReceived = false;
Actor childActor;
- ChildRemovedSignalCheck signal( signalReceived, childActor );
- DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ ChildRemovedSignalCheck signal(signalReceived, childActor);
+ DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
auto actorA = Actor::New();
- stage.Add( actorA );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
- DALI_TEST_CHECK( !childActor );
+ stage.Add(actorA);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
+ DALI_TEST_CHECK(!childActor);
- stage.Remove( actorA );
- DALI_TEST_EQUALS( childActor, actorA, TEST_LOCATION );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
+ stage.Remove(actorA);
+ DALI_TEST_EQUALS(childActor, actorA, TEST_LOCATION);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
signalReceived = false;
- auto actorB = Actor::New();
- stage.Add( actorB );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ auto actorB = Actor::New();
+ stage.Add(actorB);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
- stage.Remove( actorB );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor, actorB, TEST_LOCATION );
+ stage.Remove(actorB);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor, actorB, TEST_LOCATION);
END_TEST;
}
int UtcDaliChildRemovedSignalP2(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool signalReceived=false;
+ bool signalReceived = false;
Actor childActor;
- ChildAddedSignalCheck signal( signalReceived, childActor );
- tet_infoline( "Connect to childRemoved signal by name" );
+ ChildAddedSignalCheck signal(signalReceived, childActor);
+ tet_infoline("Connect to childRemoved signal by name");
- stage.GetRootLayer().ConnectSignal( &application, "childRemoved", signal );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ stage.GetRootLayer().ConnectSignal(&application, "childRemoved", signal);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
auto actorA = Actor::New();
- stage.Add( actorA );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ stage.Add(actorA);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
- stage.Remove( actorA );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
+ stage.Remove(actorA);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
signalReceived = false;
- auto actorB = Actor::New();
- stage.Add( actorB );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ auto actorB = Actor::New();
+ stage.Add(actorB);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
- stage.Remove( actorB );
- DALI_TEST_EQUALS( signalReceived, true, TEST_LOCATION );
+ stage.Remove(actorB);
+ DALI_TEST_EQUALS(signalReceived, true, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliChildRemovedSignalN(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool signalReceived=false;
+ bool signalReceived = false;
Actor childActor;
- ChildRemovedSignalCheck signal( signalReceived, childActor );
- DevelActor::ChildRemovedSignal( stage.GetRootLayer() ).Connect( &application, signal );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ ChildRemovedSignalCheck signal(signalReceived, childActor);
+ DevelActor::ChildRemovedSignal(stage.GetRootLayer()).Connect(&application, signal);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
auto actorA = Actor::New();
- stage.Add( actorA );
+ stage.Add(actorA);
auto actorB = Actor::New();
- actorA.Add( actorB );
+ actorA.Add(actorB);
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
- DALI_TEST_CHECK( ! childActor );
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
+ DALI_TEST_CHECK(!childActor);
- actorA.Remove( actorB );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ actorA.Remove(actorB);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliChildMovedSignalP(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- bool addedASignalReceived = false;
- bool removedASignalReceived = false;
- bool addedBSignalReceived = false;
- bool removedBSignalReceived = false;
+ bool addedASignalReceived = false;
+ bool removedASignalReceived = false;
+ bool addedBSignalReceived = false;
+ bool removedBSignalReceived = false;
Actor childActor;
auto actorA = Actor::New();
auto actorB = Actor::New();
- stage.Add( actorA );
- stage.Add( actorB );
+ stage.Add(actorA);
+ stage.Add(actorB);
- ChildAddedSignalCheck addedSignalA( addedASignalReceived, childActor );
- ChildRemovedSignalCheck removedSignalA( removedASignalReceived, childActor );
- ChildAddedSignalCheck addedSignalB( addedBSignalReceived, childActor );
- ChildRemovedSignalCheck removedSignalB( removedBSignalReceived, childActor );
+ ChildAddedSignalCheck addedSignalA(addedASignalReceived, childActor);
+ ChildRemovedSignalCheck removedSignalA(removedASignalReceived, childActor);
+ ChildAddedSignalCheck addedSignalB(addedBSignalReceived, childActor);
+ ChildRemovedSignalCheck removedSignalB(removedBSignalReceived, childActor);
- DevelActor::ChildAddedSignal( actorA ).Connect( &application, addedSignalA );
- DevelActor::ChildRemovedSignal( actorA ).Connect( &application, removedSignalA );
- DevelActor::ChildAddedSignal( actorB ).Connect( &application, addedSignalB );
- DevelActor::ChildRemovedSignal( actorB ).Connect( &application, removedSignalB );
+ DevelActor::ChildAddedSignal(actorA).Connect(&application, addedSignalA);
+ DevelActor::ChildRemovedSignal(actorA).Connect(&application, removedSignalA);
+ DevelActor::ChildAddedSignal(actorB).Connect(&application, addedSignalB);
+ DevelActor::ChildRemovedSignal(actorB).Connect(&application, removedSignalB);
- DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
// Create a child of A
auto child = Actor::New();
- actorA.Add( child );
+ actorA.Add(child);
- DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor, child, TEST_LOCATION );
+ DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor, child, TEST_LOCATION);
// Move child to B:
addedASignalReceived = false;
removedASignalReceived = false;
removedBSignalReceived = false;
- actorB.Add( child ); // Expect this child to be re-parented
- DALI_TEST_EQUALS( addedASignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( removedASignalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( addedBSignalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( removedBSignalReceived, false, TEST_LOCATION );
+ actorB.Add(child); // Expect this child to be re-parented
+ DALI_TEST_EQUALS(addedASignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedASignalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(addedBSignalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedBSignalReceived, false, TEST_LOCATION);
// Move child back to A:
addedASignalReceived = false;
removedASignalReceived = false;
removedBSignalReceived = false;
- actorA.Add( child ); // Expect this child to be re-parented
- DALI_TEST_EQUALS( addedASignalReceived, true, TEST_LOCATION );
- DALI_TEST_EQUALS( removedASignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( addedBSignalReceived, false, TEST_LOCATION );
- DALI_TEST_EQUALS( removedBSignalReceived, true, TEST_LOCATION );
-
+ actorA.Add(child); // Expect this child to be re-parented
+ DALI_TEST_EQUALS(addedASignalReceived, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedASignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(addedBSignalReceived, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(removedBSignalReceived, true, TEST_LOCATION);
END_TEST;
}
int utcDaliActorCulled(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- tet_infoline( "Check that the actor is culled if the actor is out of the screen" );
+ tet_infoline("Check that the actor is culled if the actor is out of the screen");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
- stage.Add( actor );
+ stage.Add(actor);
application.SendNotification();
- application.Render( 0 );
+ application.Render(0);
- DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::CULLED ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), false, TEST_LOCATION);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::CULLED, LessThanCondition( 0.5f ) );
- notification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::CULLED, LessThanCondition(0.5f));
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
// Connect NotifySignal
- bool propertyNotificationSignal( false );
- PropertyNotification source;
- CulledPropertyNotificationFunctor f( propertyNotificationSignal, source );
- notification.NotifySignal().Connect( &application, f ) ;
+ bool propertyNotificationSignal(false);
+ PropertyNotification source;
+ CulledPropertyNotificationFunctor f(propertyNotificationSignal, source);
+ notification.NotifySignal().Connect(&application, f);
- actor.SetProperty( Actor::Property::POSITION, Vector2( 1000.0f, 1000.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(1000.0f, 1000.0f));
application.SendNotification();
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::CULLED ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::CULLED), true, TEST_LOCATION);
- DALI_TEST_EQUALS( propertyNotificationSignal, true, TEST_LOCATION );
- DALI_TEST_EQUALS( source.GetTargetProperty(), static_cast< int >( Actor::Property::CULLED ), TEST_LOCATION );
- DALI_TEST_EQUALS( source.GetTarget().GetProperty< bool >( source.GetTargetProperty() ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(propertyNotificationSignal, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.GetTargetProperty(), static_cast<int>(Actor::Property::CULLED), TEST_LOCATION);
+ DALI_TEST_EQUALS(source.GetTarget().GetProperty<bool>(source.GetTargetProperty()), true, TEST_LOCATION);
END_TEST;
}
int utcDaliEnsureRenderWhenRemovingLastRenderableActor(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- tet_infoline( "Ensure we clear the screen when the last actor is removed" );
+ tet_infoline("Ensure we clear the screen when the last actor is removed");
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- stage.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ stage.Add(actor);
application.SendNotification();
application.Render();
- auto& glAbstraction = application.GetGlAbstraction();
+ auto& glAbstraction = application.GetGlAbstraction();
const auto clearCountBefore = glAbstraction.GetClearCountCalled();
actor.Unparent();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
END_TEST;
}
int utcDaliEnsureRenderWhenMakingLastActorInvisible(void)
{
TestApplication application;
- auto stage = application.GetScene();
+ auto stage = application.GetScene();
- tet_infoline( "Ensure we clear the screen when the last actor is made invisible" );
+ tet_infoline("Ensure we clear the screen when the last actor is made invisible");
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- stage.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ stage.Add(actor);
application.SendNotification();
application.Render();
- auto& glAbstraction = application.GetGlAbstraction();
+ auto& glAbstraction = application.GetGlAbstraction();
const auto clearCountBefore = glAbstraction.GetClearCountCalled();
- actor.SetProperty( Actor::Property::VISIBLE, false );
+ actor.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
END_TEST;
}
int utcDaliActorGetSizeAfterAnimation(void)
{
TestApplication application;
- tet_infoline( "Check the actor size before / after an animation is finished" );
+ tet_infoline("Check the actor size before / after an animation is finished");
- Vector3 actorSize( 100.0f, 100.0f, 0.0f );
+ Vector3 actorSize(100.0f, 100.0f, 0.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, actorSize );
- actor.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
+ actor.SetResizePolicy(ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS);
+ application.GetScene().Add(actor);
// Size should be updated without rendering.
- Vector3 size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ Vector3 size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
application.SendNotification();
application.Render();
// Size and current size should be updated.
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( actorSize.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorSize.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorSize.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
-
- Vector3 currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( actorSize.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorSize.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorSize.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
+
+ Vector3 currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorSize.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
// Set size again
- actorSize = Vector3( 200.0f, 200.0f, 0.0f );
- actor.SetProperty( Actor::Property::SIZE, actorSize );
+ actorSize = Vector3(200.0f, 200.0f, 0.0f);
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- Vector3 targetValue( 10.0f, 20.0f, 0.0f );
+ Vector3 targetValue(10.0f, 20.0f, 0.0f);
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetValue );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetValue);
animation.Play();
// Size should be updated without rendering.
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
targetValue.width = 50.0f;
animation.Clear();
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetValue.width );
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetValue.width);
animation.Play();
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
targetValue.height = 70.0f;
animation.Clear();
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetValue.height );
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetValue.height);
animation.Play();
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- Vector3 offset( 10.0f, 20.0f, 0.0f );
+ Vector3 offset(10.0f, 20.0f, 0.0f);
animation.Clear();
- animation.AnimateBy( Property( actor, Actor::Property::SIZE ), offset );
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE), offset);
animation.Play();
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
targetValue += offset;
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
offset.width = 20.0f;
animation.Clear();
- animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), offset.width );
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), offset.width);
animation.Play();
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
targetValue.width += offset.width;
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
offset.height = 10.0f;
animation.Clear();
- animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), offset.height );
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), offset.height);
animation.Play();
application.SendNotification();
- application.Render( 1100 ); // After the animation
+ application.Render(1100); // After the animation
targetValue.height += offset.height;
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.width, actor.GetCurrentProperty< float >( Actor::Property::SIZE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.height, actor.GetCurrentProperty< float >( Actor::Property::SIZE_HEIGHT ), TEST_LOCATION );
- DALI_TEST_EQUALS( targetValue.depth, actor.GetCurrentProperty< float >( Actor::Property::SIZE_DEPTH ), TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.width, actor.GetCurrentProperty<float>(Actor::Property::SIZE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.height, actor.GetCurrentProperty<float>(Actor::Property::SIZE_HEIGHT), TEST_LOCATION);
+ DALI_TEST_EQUALS(targetValue.depth, actor.GetCurrentProperty<float>(Actor::Property::SIZE_DEPTH), TEST_LOCATION);
// Set size again
- actorSize = Vector3( 300.0f, 300.0f, 0.0f );
+ actorSize = Vector3(300.0f, 300.0f, 0.0f);
- actor.SetProperty( Actor::Property::SIZE, actorSize );
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, targetValue, Math::MACHINE_EPSILON_0, TEST_LOCATION);
application.SendNotification();
application.Render();
- size = actor.GetProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ size = actor.GetProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(size, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
- currentSize = actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >();
- DALI_TEST_EQUALS( currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION );
+ currentSize = actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>();
+ DALI_TEST_EQUALS(currentSize, actorSize, Math::MACHINE_EPSILON_0, TEST_LOCATION);
END_TEST;
}
tet_infoline("Check the damaged area");
- const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() );
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
std::vector<Rect<int>> damagedRects;
- Rect<int> clippingRect;
+ Rect<int> clippingRect;
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
tet_infoline("Check uniform update");
- const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() );
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
std::vector<Rect<int>> damagedRects;
- Rect<int> clippingRect;
+ Rect<int> clippingRect;
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
true,
true);
- tet_infoline( "Set/Update property with partial update" );
+ tet_infoline("Set/Update property with partial update");
const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
std::vector<Rect<int>> damagedRects;
- Rect<int> clippingRect;
+ Rect<int> clippingRect;
application.SendNotification();
application.PreRenderWithPartialUpdate(TestApplication::RENDER_FRAME_INTERVAL, nullptr, damagedRects);
application.RenderWithPartialUpdate(damagedRects, clippingRect);
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
- Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
+ Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
actor.SetProperty(Actor::Property::POSITION, Vector3(16.0f, 16.0f, 0.0f));
actor.SetProperty(Actor::Property::SIZE, Vector3(16.0f, 16.0f, 0.0f));
DALI_TEST_EQUALS(clippingRect.width, glScissorParams.width, TEST_LOCATION);
DALI_TEST_EQUALS(clippingRect.height, glScissorParams.height, TEST_LOCATION);
- Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex( SHADER_SHADOW_COLOR_PROPERTY_NAME );
+ Property::Index shadowColorPropertyIndex = actor.GetPropertyIndex(SHADER_SHADOW_COLOR_PROPERTY_NAME);
actor.SetProperty(shadowColorPropertyIndex, Vector4(1.0f, 1.0f, 0.0f, 1.0f));
damagedRects.clear();
tet_infoline("Check the damaged rects with partial update and two actors");
- const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() );
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
Actor actor = CreateRenderableActor();
actor.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 100.0f, 0.0f));
true,
true);
- tet_infoline( "Check the damaged rect with partial update and actor size hint" );
+ tet_infoline("Check the damaged rect with partial update and actor size hint");
- const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() );
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
Actor actor = CreateRenderableActor();
actor.SetProperty(Actor::Property::POSITION, Vector3(75.0f, 150.0f, 0.0f));
}
catch(...)
{
- tet_result(TET_FAIL);
+ tet_result(TET_FAIL);
}
END_TEST;
}
int UtcDaliActorLowerBelowNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Actor arg1;
int UtcDaliActorRaiseAboveNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Actor arg1;
int UtcDaliActorRaiseToTopNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.RaiseToTop();
int UtcDaliActorAddRendererNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Renderer arg1;
int UtcDaliActorTouchedSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.TouchedSignal();
int UtcDaliActorTranslateByNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Vector3 arg1;
int UtcDaliActorFindChildByIdNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
unsigned int arg1 = 0u;
int UtcDaliActorGetRendererAtNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
unsigned int arg1 = 0u;
int UtcDaliActorHoveredSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.HoveredSignal();
int UtcDaliActorLowerToBottomNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.LowerToBottom();
int UtcDaliActorOnSceneSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.OnSceneSignal();
int UtcDaliActorOffSceneSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.OffSceneSignal();
int UtcDaliActorRemoveRendererNegative01(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
unsigned int arg1 = 0u;
int UtcDaliActorRemoveRendererNegative02(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Renderer arg1;
int UtcDaliActorFindChildByNameNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
std::string arg1;
int UtcDaliActorSetResizePolicyNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::ResizePolicy::Type arg1 = ResizePolicy::USE_NATURAL_SIZE;
- Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
- instance.SetResizePolicy(arg1,arg2);
+ Dali::Dimension::Type arg2 = Dimension::ALL_DIMENSIONS;
+ instance.SetResizePolicy(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliActorOnRelayoutSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.OnRelayoutSignal();
int UtcDaliActorWheelEventSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.WheelEventSignal();
int UtcDaliActorGetHeightForWidthNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
float arg1 = 0.0f;
int UtcDaliActorGetWidthForHeightNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
float arg1 = 0.0f;
int UtcDaliActorLayoutDirectionChangedSignalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.LayoutDirectionChangedSignal();
int UtcDaliActorAddNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Actor arg1;
int UtcDaliActorLowerNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.Lower();
int UtcDaliActorRaiseNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.Raise();
int UtcDaliActorRemoveNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Actor arg1;
int UtcDaliActorScaleByNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Vector3 arg1;
int UtcDaliActorGetLayerNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.GetLayer();
int UtcDaliActorRotateByNegative01(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Quaternion arg1;
int UtcDaliActorRotateByNegative02(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
- Dali::Radian arg1;
+ Dali::Radian arg1;
Dali::Vector3 arg2;
- instance.RotateBy(arg1,arg2);
+ instance.RotateBy(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliActorUnparentNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.Unparent();
int UtcDaliActorGetChildAtNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
unsigned int arg1 = 0u;
int UtcDaliActorGetChildCountNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.GetChildCount();
int UtcDaliActorGetTargetSizeNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.GetTargetSize();
int UtcDaliActorScreenToLocalNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
float arg1 = 0.0f;
float arg2 = 0.0f;
float arg3 = 0.0f;
float arg4 = 0.0f;
- instance.ScreenToLocal(arg1,arg2,arg3,arg4);
+ instance.ScreenToLocal(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliActorGetNaturalSizeNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.GetNaturalSize();
int UtcDaliActorGetRelayoutSizeNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Dimension::Type arg1 = Dimension::HEIGHT;
int UtcDaliActorGetResizePolicyNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
Dali::Dimension::Type arg1 = Dimension::ALL_DIMENSIONS;
int UtcDaliActorGetRendererCountNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.GetRendererCount();
int UtcDaliActorGetParentNegative(void)
{
TestApplication application;
- Dali::Actor instance;
+ Dali::Actor instance;
try
{
instance.GetParent();
#include <dali-test-suite-utils.h>
#include <dali/devel-api/common/addon-binder.h>
+
#include "dali-test-suite-utils/test-addon-manager.h"
struct DummyAddOn : public Dali::AddOn::AddOnBinder
{
- DummyAddOn() : Dali::AddOn::AddOnBinder( "SampleAddOn" )
- {}
+ DummyAddOn()
+ : Dali::AddOn::AddOnBinder("SampleAddOn")
+ {
+ }
~DummyAddOn() override = default;
- ADDON_BIND_FUNCTION( DoSum, int(int, int) );
+ ADDON_BIND_FUNCTION(DoSum, int(int, int));
- ADDON_BIND_FUNCTION( StringLen, int() );
+ ADDON_BIND_FUNCTION(StringLen, int());
};
int UtcDaliAddOnBinderP(void)
DummyAddOn addon;
// Test whether library handle is non-null
- DALI_TEST_EQUALS( addon.GetHandle(), (void*)1, TEST_LOCATION );
+ DALI_TEST_EQUALS(addon.GetHandle(), (void*)1, TEST_LOCATION);
// Test whether addon is valid
auto isValid = addon.IsValid();
- DALI_TEST_EQUALS( isValid, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(isValid, true, TEST_LOCATION);
// Test AddOnInfo
const auto& info = addon.GetAddOnInfo();
- DALI_TEST_EQUALS( info.name, "SampleAddOn", TEST_LOCATION );
+ DALI_TEST_EQUALS(info.name, "SampleAddOn", TEST_LOCATION);
delete addOnManager;
// Not supported
using VoidPtr = void*;
- DALI_TEST_EQUALS( VoidPtr(Dali::Integration::AddOnManager::Get()), VoidPtr(nullptr), TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidPtr(Dali::Integration::AddOnManager::Get()), VoidPtr(nullptr), TEST_LOCATION);
DummyAddOn addon{};
// Test whether library handle is non-null
- DALI_TEST_EQUALS( addon.GetHandle(), (void*)0, TEST_LOCATION );
+ DALI_TEST_EQUALS(addon.GetHandle(), (void*)0, TEST_LOCATION);
// Test whether addon is valid
auto isValid = addon.IsValid();
- DALI_TEST_EQUALS( isValid, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(isValid, false, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
-float customAlphaFunction( float progress )
+float customAlphaFunction(float progress)
{
return progress;
}
int UtcDaliAlphaFunctionDefaultConstructorP(void)
{
TestApplication application;
- AlphaFunction alpha;
+ AlphaFunction alpha;
//Should return the default alpha function
- DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
//Check the mode is BUILTIN_FUNCTION
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
END_TEST;
}
TestApplication application;
//Construct the alpha function with a built-in function
- AlphaFunction alpha( AlphaFunction::EASE_IN_OUT);
+ AlphaFunction alpha(AlphaFunction::EASE_IN_OUT);
//Check if the built-in alpha function is EASE_IN_OUT
- DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN_OUT, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN_OUT, TEST_LOCATION);
//Check the mode is BUILTIN_FUNCTION
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
END_TEST;
}
TestApplication application;
//Construct the alpha function with a function pointer
- AlphaFunction alpha( &customAlphaFunction );
+ AlphaFunction alpha(&customAlphaFunction);
//Check that the custom function points to the custom alpha function
- DALI_TEST_EQUALS( alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION);
//Check the mode is CUSTOM_FUNCTION
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
END_TEST;
}
TestApplication application;
//Construct the alpha function with two control points
- Vector2 controlPoint0 = Vector2(0.0f,1.0f);
- Vector2 controlPoint1 = Vector2(1.0f,0.0f);
- AlphaFunction alpha(controlPoint0,controlPoint1);
+ Vector2 controlPoint0 = Vector2(0.0f, 1.0f);
+ Vector2 controlPoint1 = Vector2(1.0f, 0.0f);
+ AlphaFunction alpha(controlPoint0, controlPoint1);
//Check if the control points have the correct value
Vector4 controlPoints = alpha.GetBezierControlPoints();
- DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), controlPoint0, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), controlPoint1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(controlPoints.x, controlPoints.y), controlPoint0, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(controlPoints.z, controlPoints.w), controlPoint1, TEST_LOCATION);
//Check the mode is BEZIER
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
END_TEST;
}
TestApplication application;
//Construct the alpha function with two control points
- Vector2 controlPoint0 = Vector2(-10.0f,1.0f);
- Vector2 controlPoint1 = Vector2(10.0f,0.0f);
- AlphaFunction alpha(controlPoint0,controlPoint1);
+ Vector2 controlPoint0 = Vector2(-10.0f, 1.0f);
+ Vector2 controlPoint1 = Vector2(10.0f, 0.0f);
+ AlphaFunction alpha(controlPoint0, controlPoint1);
//x components of the control points should have been clamped to [0,1] to ensure the curve is monotonic
Vector4 controlPoints = alpha.GetBezierControlPoints();
- DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), Vector2(0.0f,1.0f), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), Vector2(1.0f,0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(controlPoints.x, controlPoints.y), Vector2(0.0f, 1.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(controlPoints.z, controlPoints.w), Vector2(1.0f, 0.0f), TEST_LOCATION);
//Check the mode is BEZIER
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
END_TEST;
}
int UtcDaliAlphaFunctionGetBuiltinFunctionP(void)
{
TestApplication application;
- AlphaFunction alpha( AlphaFunction::EASE_IN);
+ AlphaFunction alpha(AlphaFunction::EASE_IN);
//Check if the builtin alpha function is EASE_IN
- DALI_TEST_EQUALS( alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetBuiltinFunction(), AlphaFunction::EASE_IN, TEST_LOCATION);
//Check the mode is BUILTIN_FUNCTION
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliAlphaFunctionGetCustomFunctionP(void)
{
TestApplication application;
- AlphaFunction alpha( &customAlphaFunction );
+ AlphaFunction alpha(&customAlphaFunction);
//Check that the custom function points to the custom alpha function
- DALI_TEST_EQUALS( alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetCustomFunction(), &customAlphaFunction, TEST_LOCATION);
//Check the mode is CUSTOM_FUNCTION
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Vector2 controlPoint0 = Vector2(0.0f,1.0f);
- Vector2 controlPoint1 = Vector2(1.0f,0.0f);
- AlphaFunction alpha( controlPoint0,controlPoint1 );
+ Vector2 controlPoint0 = Vector2(0.0f, 1.0f);
+ Vector2 controlPoint1 = Vector2(1.0f, 0.0f);
+ AlphaFunction alpha(controlPoint0, controlPoint1);
//Check if the control points have the correct value
Vector4 controlPoints = alpha.GetBezierControlPoints();
- DALI_TEST_EQUALS( Vector2(controlPoints.x,controlPoints.y), controlPoint0, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(controlPoints.z,controlPoints.w), controlPoint1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(controlPoints.x, controlPoints.y), controlPoint0, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(controlPoints.z, controlPoints.w), controlPoint1, TEST_LOCATION);
//Check the mode is BEZIER
- DALI_TEST_EQUALS( alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+ DALI_TEST_EQUALS(alpha.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
END_TEST;
}
TestApplication application;
//Create alpha function using a built-in function
- AlphaFunction alphaBuiltin( AlphaFunction::EASE_IN);
+ AlphaFunction alphaBuiltin(AlphaFunction::EASE_IN);
//Check the mode is BUILTIN_FUNCTION
- DALI_TEST_EQUALS( alphaBuiltin.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(alphaBuiltin.GetMode(), AlphaFunction::BUILTIN_FUNCTION, TEST_LOCATION);
//Create alpha function with pointer to function
- AlphaFunction alphaCustom( &customAlphaFunction );
+ AlphaFunction alphaCustom(&customAlphaFunction);
//Check the mode is CUSTOM_FUNCTION
- DALI_TEST_EQUALS( alphaCustom.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(alphaCustom.GetMode(), AlphaFunction::CUSTOM_FUNCTION, TEST_LOCATION);
//Create alpha function with control points
- Vector2 controlPoint0 = Vector2(0.0f,1.0f);
- Vector2 controlPoint1 = Vector2(1.0f,0.0f);
- AlphaFunction alphaBezier( controlPoint0,controlPoint1 );
+ Vector2 controlPoint0 = Vector2(0.0f, 1.0f);
+ Vector2 controlPoint1 = Vector2(1.0f, 0.0f);
+ AlphaFunction alphaBezier(controlPoint0, controlPoint1);
//Check the mode is BEZIER
- DALI_TEST_EQUALS( alphaBezier.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
+ DALI_TEST_EQUALS(alphaBezier.GetMode(), AlphaFunction::BEZIER, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(0.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(0.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(1.0f);
+ float targetValue(1.0f);
- Vector2 controlPoint0 = Vector2(0.25f,0.5f);
- Vector2 controlPoint1 = Vector2(0.75f,0.5f);
- animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction(controlPoint0,controlPoint1));
+ Vector2 controlPoint0 = Vector2(0.25f, 0.5f);
+ Vector2 controlPoint1 = Vector2(0.75f, 0.5f);
+ animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction(controlPoint0, controlPoint1));
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
application.SendNotification();
float epsilon(0.01f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.271964f, epsilon, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 0.271964f, epsilon, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*40% progress*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*40% progress*/);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.432387f, epsilon, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 0.432387f, epsilon, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*60% progress*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*60% progress*/);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.567613f, epsilon, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 0.567613f, epsilon, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*80% progress*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*80% progress*/);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 0.728037f, epsilon, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 0.728037f, epsilon, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
-
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
void utc_dali_angle_axis_startup(void)
{
test_return_value = TET_PASS;
}
-
-
int UtcDaliAngleAxisNew01(void)
{
TestApplication application;
END_TEST;
}
-
-
int UtcDaliAngleAxisNew02(void)
{
TestApplication application;
- Degree d(75.0f);
+ Degree d(75.0f);
AngleAxis a(d, Vector3::XAXIS);
DALI_TEST_EQUALS(a.angle, Radian(d), 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliAngleAxisNew03(void)
{
TestApplication application;
- Radian r(Math::PI_2);
+ Radian r(Math::PI_2);
AngleAxis a(r, Vector3::ZAXIS);
// AngleAxis stores its angle as a degree, so should only do degree comparison.
{
TestApplication application;
- Radian r(Math::PI_2);
+ Radian r(Math::PI_2);
AngleAxis a(r, Vector3::ZAXIS);
AngleAxis b = a;
{
TestApplication application;
- Radian r( Math::PI_2 );
- AngleAxis a( r, Vector3::ZAXIS );
- AngleAxis b( a );
+ Radian r(Math::PI_2);
+ AngleAxis a(r, Vector3::ZAXIS);
+ AngleAxis b(a);
// AngleAxis stores its angle as a degree, so should only do degree comparison.
- DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Radian r( Math::PI_2 );
- AngleAxis a( r, Vector3::ZAXIS );
- AngleAxis b = std::move( a );
+ Radian r(Math::PI_2);
+ AngleAxis a(r, Vector3::ZAXIS);
+ AngleAxis b = std::move(a);
// AngleAxis stores its angle as a degree, so should only do degree comparison.
- DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Radian r( Math::PI_2 );
- AngleAxis a( r, Vector3::ZAXIS );
+ Radian r(Math::PI_2);
+ AngleAxis a(r, Vector3::ZAXIS);
AngleAxis b;
b = a;
// AngleAxis stores its angle as a degree, so should only do degree comparison.
- DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Radian r( Math::PI_2 );
- AngleAxis a( r, Vector3::ZAXIS );
+ Radian r(Math::PI_2);
+ AngleAxis a(r, Vector3::ZAXIS);
AngleAxis b;
- b = std::move( a );
+ b = std::move(a);
// AngleAxis stores its angle as a degree, so should only do degree comparison.
- DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Radian r(Math::PI_2);
+ Radian r(Math::PI_2);
AngleAxis a(r, Vector3::ZAXIS);
AngleAxis b(a);
*
*/
-#include <iostream>
-#include <algorithm>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/actors/actor-devel.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/animation/animation-devel.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <algorithm>
+#include <iostream>
using std::max;
using namespace Dali;
namespace
{
-
static const float ROTATION_EPSILON = 0.0001f;
-static const float VECTOR4_EPSILON = 0.0001f;
-static const float VECTOR3_EPSILON = 0.0001f;
+static const float VECTOR4_EPSILON = 0.0001f;
+static const float VECTOR3_EPSILON = 0.0001f;
// Functor to test whether a Finish signal is emitted
struct AnimationFinishCheck
void CheckSignalReceived()
{
- if (!mSignalReceived)
+ if(!mSignalReceived)
{
tet_printf("Expected Finish signal was not received\n");
tet_result(TET_FAIL);
void CheckSignalNotReceived()
{
- if (mSignalReceived)
+ if(mSignalReceived)
{
tet_printf("Unexpected Finish signal was received\n");
tet_result(TET_FAIL);
{
AnimationProgressCheck(bool& signalReceived, std::string name = " ")
: mSignalReceived(signalReceived),
- mName( name )
+ mName(name)
{
}
void CheckSignalReceived()
{
- if (!mSignalReceived)
+ if(!mSignalReceived)
{
- tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str() );
+ tet_printf("Expected Progress reached signal was not received %s \n", mName.c_str());
tet_result(TET_FAIL);
}
else
void CheckSignalNotReceived()
{
- if (mSignalReceived)
+ if(mSignalReceived)
{
tet_printf("Unexpected Progress reached signal was received %s \n", mName.c_str());
tet_result(TET_FAIL);
}
}
- bool& mSignalReceived; // owned by individual tests
+ bool& mSignalReceived; // owned by individual tests
std::string mName;
};
-} // anon namespace
+} // namespace
int UtcDaliAnimationConstructorP(void)
{
Animation animation;
- DALI_TEST_CHECK( !animation );
+ DALI_TEST_CHECK(!animation);
END_TEST;
}
{
TestApplication application;
- Animation animation = Animation::New( 1.0f );
+ Animation animation = Animation::New(1.0f);
DALI_TEST_CHECK(animation);
END_TEST;
{
TestApplication application;
- Animation animation = Animation::New( -1.0f );
+ Animation animation = Animation::New(-1.0f);
DALI_TEST_CHECK(animation);
DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
tet_infoline("Testing Dali::Animation::DownCast()");
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
BaseHandle object(animation);
Animation animation2 = Animation::DownCast(object);
DALI_TEST_CHECK(animation2);
- Animation animation3 = DownCast< Animation >(object);
+ Animation animation3 = DownCast<Animation>(object);
DALI_TEST_CHECK(animation3);
END_TEST;
}
BaseHandle unInitializedObject;
- Animation animation1 = Animation::DownCast( unInitializedObject );
- DALI_TEST_CHECK( !animation1 );
+ Animation animation1 = Animation::DownCast(unInitializedObject);
+ DALI_TEST_CHECK(!animation1);
- Animation animation2 = DownCast< Animation >( unInitializedObject );
- DALI_TEST_CHECK( !animation2 );
+ Animation animation2 = DownCast<Animation>(unInitializedObject);
+ DALI_TEST_CHECK(!animation2);
END_TEST;
}
TestApplication application;
// Initialize an object, ref count == 1
- Animation animation = Animation::New( 1.0f );
+ Animation animation = Animation::New(1.0f);
- Animation copy( animation );
- DALI_TEST_CHECK( copy );
+ Animation copy(animation);
+ DALI_TEST_CHECK(copy);
- DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
+ DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
END_TEST;
}
{
TestApplication application;
- Animation animation = Animation::New( 1.0f );
+ Animation animation = Animation::New(1.0f);
Animation copy = animation;
- DALI_TEST_CHECK( copy );
+ DALI_TEST_CHECK(copy);
- DALI_TEST_CHECK( animation == copy );
+ DALI_TEST_CHECK(animation == copy);
- DALI_TEST_CHECK( copy.GetDuration() == animation.GetDuration() );
+ DALI_TEST_CHECK(copy.GetDuration() == animation.GetDuration());
END_TEST;
}
//Animation
- Animation animation = Animation::New( 1.0f );
- DALI_TEST_CHECK( animation );
- DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION );
+ Animation animation = Animation::New(1.0f);
+ DALI_TEST_CHECK(animation);
+ DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
- Animation movedAnimation = std::move( animation );
- DALI_TEST_CHECK( movedAnimation );
- DALI_TEST_EQUALS( 1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION );
- DALI_TEST_CHECK( !animation );
+ Animation movedAnimation = std::move(animation);
+ DALI_TEST_CHECK(movedAnimation);
+ DALI_TEST_EQUALS(1, movedAnimation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.0f, movedAnimation.GetDuration(), 0.001f, TEST_LOCATION);
+ DALI_TEST_CHECK(!animation);
// KeyFrames
KeyFrames keyframes = KeyFrames::New();
- DALI_TEST_CHECK( keyframes );
- DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION );
+ DALI_TEST_CHECK(keyframes);
+ DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
- keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) );
- keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) );
- DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION );
+ keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
+ keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
+ DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
- KeyFrames movedKeyFrames = std::move( keyframes );
- DALI_TEST_CHECK( movedKeyFrames );
- DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION );
- DALI_TEST_CHECK( !keyframes );
+ KeyFrames movedKeyFrames = std::move(keyframes);
+ DALI_TEST_CHECK(movedKeyFrames);
+ DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
+ DALI_TEST_CHECK(!keyframes);
END_TEST;
}
// Animation
- Animation animation = Animation::New( 1.0f );
- DALI_TEST_CHECK( animation );
- DALI_TEST_EQUALS( 1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION );
+ Animation animation = Animation::New(1.0f);
+ DALI_TEST_CHECK(animation);
+ DALI_TEST_EQUALS(1, animation.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.0f, animation.GetDuration(), 0.001f, TEST_LOCATION);
Animation move;
- move = std::move( animation );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.0f, move.GetDuration(), 0.001f, TEST_LOCATION );
- DALI_TEST_CHECK( !animation );
+ move = std::move(animation);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.0f, move.GetDuration(), 0.001f, TEST_LOCATION);
+ DALI_TEST_CHECK(!animation);
// KeyFrames
KeyFrames keyframes = KeyFrames::New();
- DALI_TEST_CHECK( keyframes );
- DALI_TEST_EQUALS( 1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::Type::NONE, keyframes.GetType(), TEST_LOCATION );
+ DALI_TEST_CHECK(keyframes);
+ DALI_TEST_EQUALS(1, keyframes.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::Type::NONE, keyframes.GetType(), TEST_LOCATION);
- keyframes.Add( 0.0f, Vector3( 0.0f, 0.0f, 0.0f ) );
- keyframes.Add( 1.0f, Vector3( 100.0f, 100.0f, 100.0f ) );
- DALI_TEST_EQUALS( Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION );
+ keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
+ keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
+ DALI_TEST_EQUALS(Property::Type::VECTOR3, keyframes.GetType(), TEST_LOCATION);
KeyFrames movedKeyFrames;
- movedKeyFrames = std::move( keyframes );
- DALI_TEST_CHECK( movedKeyFrames );
- DALI_TEST_EQUALS( 1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION );
- DALI_TEST_CHECK( !keyframes );
+ movedKeyFrames = std::move(keyframes);
+ DALI_TEST_CHECK(movedKeyFrames);
+ DALI_TEST_EQUALS(1, movedKeyFrames.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::Type::VECTOR3, movedKeyFrames.GetType(), TEST_LOCATION);
+ DALI_TEST_CHECK(!keyframes);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(2u/*just beyond the animation duration*/);
+ application.Render(2u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Restart the animation, with a different duration
finishCheck.Reset();
- actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
+ actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
durationSeconds = 3.5f;
animation.SetDuration(durationSeconds);
DALI_TEST_EQUALS(animation.GetDuration(), durationSeconds, TEST_LOCATION);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) - 1u/*just less than the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(2u/*just beyond the animation duration*/);
+ application.Render(2u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Animation animation = Animation::New( 1.0f );
- DALI_TEST_EQUALS( animation.GetDuration(), 1.0f, TEST_LOCATION );
+ Animation animation = Animation::New(1.0f);
+ DALI_TEST_EQUALS(animation.GetDuration(), 1.0f, TEST_LOCATION);
- animation.SetDuration( -1.0f );
- DALI_TEST_EQUALS( animation.GetDuration(), 0.0f, TEST_LOCATION );
+ animation.SetDuration(-1.0f);
+ DALI_TEST_EQUALS(animation.GetDuration(), 0.0f, TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
DALI_TEST_CHECK(animation.IsLooping());
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Loop 5 times
float intervalSeconds = 0.25f;
- float progress = 0.0f;
- for (int iterations = 0; iterations < 5;)
+ float progress = 0.0f;
+ for(int iterations = 0; iterations < 5;)
{
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
progress += intervalSeconds;
- DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
- if (progress >= 1.0f)
+ if(progress >= 1.0f)
{
progress = progress - 1.0f;
++iterations;
DALI_TEST_CHECK(!animation.IsLooping());
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
DALI_TEST_CHECK(animation.IsLooping());
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Loop
float intervalSeconds = 3.0f;
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.Render(0);
application.SendNotification();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
finishCheck.Reset();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.SetEndAction(Animation::DISCARD);
DALI_TEST_CHECK(animation.IsLooping());
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
float intervalSeconds = 3.0f;
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
application.SendNotification();
animation.SetLooping(true);
DALI_TEST_CHECK(animation.IsLooping());
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
animation.SetLooping(true);
DALI_TEST_CHECK(animation.IsLooping());
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_CHECK(animation.IsLooping());
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived(); // we never hit play
finishCheck.Reset();
-
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.SetEndAction(Animation::DISCARD);
float intervalSeconds = 3.0f;
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.SetLooping(true);
DALI_TEST_CHECK(animation.IsLooping());
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_CHECK(animation.IsLooping());
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived(); // we never hit play
finishCheck.Reset();
-
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.SetEndAction(Animation::BAKE);
float intervalSeconds = 3.0f;
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f) );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
finishCheck.Reset();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
DALI_TEST_CHECK(1 == animation.GetLoopCount());
// Loop
float intervalSeconds = 3.0f;
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.Render(0);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
animation.SetLoopCount(0);
END_TEST;
}
-
int UtcDaliAnimationGetCurrentLoopP(void)
{
TestApplication application;
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
DALI_TEST_CHECK(0 == animation.GetCurrentLoop());
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// Loop
float intervalSeconds = 3.0f;
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_CHECK(2 == animation.GetCurrentLoop());
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
finishCheck.Reset();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalNotReceived();
DALI_TEST_CHECK(3 == animation.GetCurrentLoop());
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
DALI_TEST_CHECK(animation.GetEndAction() == Animation::BAKE);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Go back to the start
- actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
+ actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Test BakeFinal, animate again, for half the duration
finishCheck.Reset();
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f*0.5f) /*half of the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f) /*half of the animation duration*/);
// Stop the animation early
animation.Stop();
// We did NOT expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( targetPosition * 0.5f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), VECTOR4_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition * 0.5f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), VECTOR4_EPSILON, TEST_LOCATION);
// The position should be same with target position in the next frame
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Go back to the start
- actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
+ actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Test EndAction::Discard, animate again, but don't bake this time
finishCheck.Reset();
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// The position should be discarded in the next frame
application.Render(0);
- DALI_TEST_EQUALS( Vector3::ZERO/*discarded*/, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3::ZERO /*discarded*/, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( Vector3::ZERO, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3::ZERO, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationSetDisconnectActionP(void)
{
- TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
// Default: BakeFinal
{
stage.Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
actor.Unparent();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
// Bake
stage.Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetDisconnectAction( Animation::BAKE );
+ animation.SetDisconnectAction(Animation::BAKE);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
actor.Unparent();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition*0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition * 0.5f, TEST_LOCATION);
}
// Discard
stage.Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetDisconnectAction( Animation::DISCARD );
+ animation.SetDisconnectAction(Animation::DISCARD);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
actor.Unparent();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
}
// Don't play the animation: disconnect action should not be applied
stage.Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
actor.Unparent();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
}
END_TEST;
int UtcDaliAnimationGetDisconnectActionP(void)
{
TestApplication application;
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
DALI_TEST_CHECK(animation.GetDisconnectAction() == Animation::BAKE_FINAL); // default!
animation.SetDisconnectAction(Animation::DISCARD);
{
TestApplication application;
- Animation animation = Animation::New(1.0f);
- AlphaFunction func = animation.GetDefaultAlphaFunction();
+ Animation animation = Animation::New(1.0f);
+ AlphaFunction func = animation.GetDefaultAlphaFunction();
DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
animation.SetDefaultAlphaFunction(AlphaFunction::EASE_IN);
{
TestApplication application;
- Animation animation = Animation::New(1.0f);
- AlphaFunction func = animation.GetDefaultAlphaFunction();
+ Animation animation = Animation::New(1.0f);
+ AlphaFunction func = animation.GetDefaultAlphaFunction();
// Test that the default is linear
DALI_TEST_EQUALS(func.GetBuiltinFunction(), AlphaFunction::DEFAULT, TEST_LOCATION);
float durationSeconds(1.0f);
animation.SetDuration(durationSeconds);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
- animation.SetCurrentProgress( 0.4f );
+ animation.SetCurrentProgress(0.4f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
- DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
//Set the progress to 70%
- animation.SetCurrentProgress( 0.7f );
+ animation.SetCurrentProgress(0.7f);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
- DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
+ DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
- DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
float durationSeconds(1.0f);
animation.SetDuration(durationSeconds);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
//Trying to set the current cursor outside the range [0..1] is ignored
- animation.SetCurrentProgress( -1.0f);
+ animation.SetCurrentProgress(-1.0f);
application.SendNotification();
- DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
- animation.SetCurrentProgress( 100.0f);
+ animation.SetCurrentProgress(100.0f);
application.SendNotification();
- DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
END_TEST;
}
animation.Play();
//Test GetCurrentProgress return 0.0 as the duration is 0.0
- DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
- animation.SetCurrentProgress( 0.5f );
+ animation.SetCurrentProgress(0.5f);
application.SendNotification();
application.Render(static_cast<unsigned int>(100.0f));
//Progress should still be 0.0
- DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
//Set duration
float durationSeconds(1.0f);
animation.SetDuration(durationSeconds);
application.SendNotification();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
- animation.SetCurrentProgress( 0.4f );
+ animation.SetCurrentProgress(0.4f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
//Set the progress to 70%
- animation.SetCurrentProgress( 0.7f );
+ animation.SetCurrentProgress(0.7f);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 80% progress */);
- DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 80% progress */);
+ DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.0f, initialPosition);
- keyframes.Add( 1.0f, targetPosition );
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(0.0f, initialPosition);
+ keyframes.Add(1.0f, targetPosition);
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
//Set speed to be x2
animation.SetSpeedFactor(2.0f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f) + 1u/*just beyond half the duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond half the duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.0f, initialPosition);
- keyframes.Add( 1.0f, targetPosition );
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(0.0f, initialPosition);
+ keyframes.Add(1.0f, targetPosition);
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
tet_printf("Test -1 speed factor. Animation will play in reverse at normal speed\n");
- animation.SetSpeedFactor( -1.0f );
+ animation.SetSpeedFactor(-1.0f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.0f, initialPosition);
- keyframes.Add( 1.0f, targetPosition );
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(0.0f, initialPosition);
+ keyframes.Add(1.0f, targetPosition);
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
tet_printf("Test half speed factor. Animation will take twice the duration\n");
//Set speed to be half of normal speed
- animation.SetSpeedFactor( 0.5f );
+ animation.SetSpeedFactor(0.5f);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*1200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliAnimationSetSpeedFactorP4(void)
{
TestApplication application;
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
const Vector3 initialPosition(0.0f, 0.0f, 0.0f);
const Vector3 targetPosition(100.0f, 100.0f, 100.0f);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.0f, initialPosition);
- keyframes.Add( 1.0f, targetPosition );
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(0.0f, initialPosition);
+ keyframes.Add(1.0f, targetPosition);
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
tet_printf("Set speed to be half of normal speed\n");
tet_printf("SetSpeedFactor(0.5f)\n");
- animation.SetSpeedFactor( 0.5f );
+ animation.SetSpeedFactor(0.5f);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.3f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.3f), TEST_LOCATION);
tet_printf("Reverse direction of animation whilst playing\n");
tet_printf("SetSpeedFactor(-0.5f)\n");
animation.SetSpeedFactor(-0.5f);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 10% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.1f), 0.0001, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.1f), 0.0001, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), initialPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), initialPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( initialPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
/* | reverse */
- { 0.0f, 1.0f, // TimePeriod
- 0.0f, 100.0f, // POS
- {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
- /**/ 30.0f, 40.0f, 50.0f, 60.0f, /* Reverse direction */
- /**/ 50.0f,
- /**/ 40.0f,
- /**/ 30.0f,
- /**/ 70.0f,
- /**/ 60.0f,
- /**/ 50.0f,
+ {0.0f, 1.0f, // TimePeriod
+ 0.0f,
+ 100.0f, // POS
+ {
+ /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
+ /**/ 30.0f,
+ 40.0f,
+ 50.0f,
+ 60.0f, /* Reverse direction */
+ /**/ 50.0f,
+ /**/ 40.0f,
+ /**/ 30.0f,
+ /**/ 70.0f,
+ /**/ 60.0f,
+ /**/ 50.0f,
/**/
- }
- },
+ }},
// ACTOR 1 - Across start of range
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
/* | reverse */
- { 0.2f, 0.5f, // TimePeriod
- 20.0f, 50.0f, // POS
- {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
- /**/ 30.0f, 40.0f, 50.0f, 50.0f, /* Reverse direction @ frame #9 */
- /**/ 50.0f,
- /**/ 40.0f,
- /**/ 30.0f,
- /**/ 50.0f,
- /**/ 50.0f,
- /**/ 50.0f
- }
- },
+ {0.2f, 0.5f, // TimePeriod
+ 20.0f,
+ 50.0f, // POS
+ {/**/ 30.0f, 40.0f, 50.0f, 50.0f, 50.0f, /* Loop */
+ /**/ 30.0f,
+ 40.0f,
+ 50.0f,
+ 50.0f, /* Reverse direction @ frame #9 */
+ /**/ 50.0f,
+ /**/ 40.0f,
+ /**/ 30.0f,
+ /**/ 50.0f,
+ /**/ 50.0f,
+ /**/ 50.0f}},
// ACTOR 2 - Across end of range
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
/* | reverse */
- {/**/ 0.5f, 0.9f, // TimePeriod
- /**/ 50.0f, 90.0f, // POS
- { /**/ 50.0f, 50.0f, 50.0f, 60.0f, 70.0f, /* Loop */
- /**/ 50.0f, 50.0f, 50.0f, 60.0f,/* Reverse direction @ frame #9 */
- /**/ 50.0f,
- /**/ 50.0f,
- /**/ 50.0f, 70.0f,
- /**/ 60.0f,
- /**/ 50.0f,
- }
- },
+ {/**/ 0.5f, 0.9f, // TimePeriod
+ /**/ 50.0f,
+ 90.0f, // POS
+ {
+ /**/ 50.0f,
+ 50.0f,
+ 50.0f,
+ 60.0f,
+ 70.0f, /* Loop */
+ /**/ 50.0f,
+ 50.0f,
+ 50.0f,
+ 60.0f, /* Reverse direction @ frame #9 */
+ /**/ 50.0f,
+ /**/ 50.0f,
+ /**/ 50.0f,
+ 70.0f,
+ /**/ 60.0f,
+ /**/ 50.0f,
+ }},
// ACTOR 3 - Before beginning of range
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
/* | reverse */
- {/**/ 0.1f, 0.25f, // TimePeriod
- /**/ 10.0f, 25.0f, // POS
- { /**/
- /**/ 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f, 25.0f
+ {/**/ 0.1f, 0.25f, // TimePeriod
+ /**/ 10.0f,
+ 25.0f, // POS
+ {
/**/
- }
- },
+ /**/ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f,
+ 25.0f
+ /**/
+ }},
// ACTOR 4 - After end of range
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
/* | reverse */
- {/**/ 0.85f, 1.0f, // TimePeriod
- /**/ 85.0f, 100.0f, // POS
- { /**/
- /**/ 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f, 85.0f
+ {/**/ 0.85f, 1.0f, // TimePeriod
+ /**/ 85.0f,
+ 100.0f, // POS
+ {
/**/
- }
- },
+ /**/ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f,
+ 85.0f
+ /**/
+ }},
// Actor 5 - Middle of range
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
/* | reverse */
- {/**/ 0.4f, 0.65f, // Time Period
- /**/ 40.0f, 65.0f, // Position
- { /**/ 40.0f, 40.0f, 50.0f, 60.0f, 65.0f,
- /**/ 40.0f, 40.0f, 50.0f, 60.0f, // Reverse
- /**/ 50.0f,
- /**/ 40.0f,
- /**/ 40.0f,
- /**/ 65.0f,
- /**/ 60.0f,
- /**/ 50.0f,
- }
- }
- };
-
- const size_t NUM_ENTRIES(sizeof(testData)/sizeof(TestData));
-
- // Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- bool signalReceived(false);
+ {/**/ 0.4f, 0.65f, // Time Period
+ /**/ 40.0f,
+ 65.0f, // Position
+ {
+ /**/ 40.0f,
+ 40.0f,
+ 50.0f,
+ 60.0f,
+ 65.0f,
+ /**/ 40.0f,
+ 40.0f,
+ 50.0f,
+ 60.0f, // Reverse
+ /**/ 50.0f,
+ /**/ 40.0f,
+ /**/ 40.0f,
+ /**/ 65.0f,
+ /**/ 60.0f,
+ /**/ 50.0f,
+ }}};
+
+ const size_t NUM_ENTRIES(sizeof(testData) / sizeof(TestData));
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
std::vector<Dali::Actor> actors;
- for( unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex )
+ for(unsigned int actorIndex = 0; actorIndex < NUM_ENTRIES; ++actorIndex)
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::POSITION, Vector3( testData[actorIndex].startX, 0, 0 ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(testData[actorIndex].startX, 0, 0));
actors.push_back(actor);
application.GetScene().Add(actor);
- if( actorIndex == 0 || actorIndex == NUM_ENTRIES-1 )
+ if(actorIndex == 0 || actorIndex == NUM_ENTRIES - 1)
{
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
- keyframes.Add( testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(testData[actorIndex].startTime, Vector3(testData[actorIndex].startX, 0, 0));
+ keyframes.Add(testData[actorIndex].endTime, Vector3(testData[actorIndex].endX, 0, 0));
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
}
else
{
- animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( testData[actorIndex].endX, 0, 0 ), TimePeriod( testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime) );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(testData[actorIndex].endX, 0, 0), TimePeriod(testData[actorIndex].startTime, testData[actorIndex].endTime - testData[actorIndex].startTime));
}
}
tet_printf("Test half speed factor. Animation will take twice the duration\n");
tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
tet_printf("SetSpeedFactor(0.5f)\n");
- animation.SetSpeedFactor( 0.5f );
- animation.SetPlayRange( Vector2(0.3f, 0.8f) );
+ animation.SetSpeedFactor(0.5f);
+ animation.SetPlayRange(Vector2(0.3f, 0.8f));
animation.SetLooping(true);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(0); // Frame 0 tests initial values
+ application.Render(0); // Frame 0 tests initial values
- for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
+ for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
{
unsigned int actorIndex = 0u;
- for( actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex )
+ for(actorIndex = 0u; actorIndex < NUM_ENTRIES; ++actorIndex)
{
- DALI_TEST_EQUALS( actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION );
- if( ! Equals(actors[actorIndex].GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData[actorIndex].expected[frame]) )
+ DALI_TEST_EQUALS(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame], 0.001, TEST_LOCATION);
+ if(!Equals(actors[actorIndex].GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData[actorIndex].expected[frame]))
{
- tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex );
+ tet_printf("Failed at frame %u, actorIndex %u\n", frame, actorIndex);
}
}
- if( frame == 8 )
+ if(frame == 8)
{
tet_printf("Reverse direction of animation whilst playing after frame 8\n");
tet_printf("SetSpeedFactor(-0.5f)\n");
// ACTOR 0
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
- { 0.0f, 1.0f, // TimePeriod
- 0.0f, 100.0f, // POS
- {/**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
- /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
- /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f,
+ {0.0f, 1.0f, // TimePeriod
+ 0.0f,
+ 100.0f, // POS
+ {
+ /**/ 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, /* Loop */
+ /**/ 30.0f,
+ 40.0f,
+ 50.0f,
+ 60.0f,
+ 70.0f,
+ /**/ 30.0f,
+ 40.0f,
+ 50.0f,
+ 60.0f,
+ 70.0f,
/**/
- }
- };
-
+ }};
// Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- bool signalReceived(false);
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
std::vector<Dali::Actor> actors;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
actors.push_back(actor);
application.GetScene().Add(actor);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
- keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
+ keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
tet_printf("Test half speed factor. Animation will take twice the duration\n");
tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
tet_printf("SetSpeedFactor(0.5f)\n");
tet_printf("SetLoopCount(3)\n");
- animation.SetSpeedFactor( 0.5f );
- animation.SetPlayRange( Vector2(0.3f, 0.8f) );
+ animation.SetSpeedFactor(0.5f);
+ animation.SetPlayRange(Vector2(0.3f, 0.8f));
animation.SetLoopCount(3);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(0); // Frame 0 tests initial values
+ application.Render(0); // Frame 0 tests initial values
- for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
+ for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
{
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
application.Render(200); // 200 ms at half speed corresponds to 0.1 s
- if( frame < NUM_FRAMES-1 )
+ if(frame < NUM_FRAMES - 1)
{
// We didn't expect the animation to finish yet
application.SendNotification();
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 80.0f, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 80.0f, 0.001, TEST_LOCATION);
END_TEST;
}
// ACTOR 0
/*0.0f, 0.1f 0.2f 0.3f 0.4f 0.5f 0.6f 0.7f 0.8f 0.9f 1.0f */
/* |----------PlayRange---------------| */
- { 0.0f, 1.0f, // TimePeriod
- 0.0f, 100.0f, // POS
- {/**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
- /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
- /**/ 80.0f, 70.0f, 60.0f, 50.0f, 40.0f,
- }
- };
-
-
- // Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- bool signalReceived(false);
+ {0.0f, 1.0f, // TimePeriod
+ 0.0f,
+ 100.0f, // POS
+ {
+ /**/ 80.0f,
+ 70.0f,
+ 60.0f,
+ 50.0f,
+ 40.0f,
+ /**/ 80.0f,
+ 70.0f,
+ 60.0f,
+ 50.0f,
+ 40.0f,
+ /**/ 80.0f,
+ 70.0f,
+ 60.0f,
+ 50.0f,
+ 40.0f,
+ }};
+
+ // Build the animation
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
std::vector<Dali::Actor> actors;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::POSITION, Vector3( testData.startX, 0, 0 ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(testData.startX, 0, 0));
actors.push_back(actor);
application.GetScene().Add(actor);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( testData.startTime, Vector3(testData.startX, 0, 0));
- keyframes.Add( testData.endTime, Vector3(testData.endX, 0, 0));
- animation.AnimateBetween( Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
+ keyframes.Add(testData.startTime, Vector3(testData.startX, 0, 0));
+ keyframes.Add(testData.endTime, Vector3(testData.endX, 0, 0));
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, AlphaFunction::LINEAR);
tet_printf("Test reverse half speed factor. Animation will take twice the duration\n");
tet_printf("Set play range to be 0.3 - 0.8 of the duration\n");
tet_printf("SetSpeedFactor(-0.5f)\n");
tet_printf("SetLoopCount(3)\n");
- animation.SetSpeedFactor( -0.5f );
- animation.SetPlayRange( Vector2(0.3f, 0.8f) );
+ animation.SetSpeedFactor(-0.5f);
+ animation.SetPlayRange(Vector2(0.3f, 0.8f));
animation.SetLoopCount(3);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(0); // Frame 0 tests initial values
+ application.Render(0); // Frame 0 tests initial values
- for( unsigned int frame = 0; frame < NUM_FRAMES; ++frame )
+ for(unsigned int frame = 0; frame < NUM_FRAMES; ++frame)
{
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, testData.expected[frame], 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, testData.expected[frame], 0.001, TEST_LOCATION);
application.Render(200); // 200 ms at half speed corresponds to 0.1 s
- if( frame < NUM_FRAMES-1 )
+ if(frame < NUM_FRAMES - 1)
{
// We didn't expect the animation to finish yet
application.SendNotification();
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, 30.0f, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, 30.0f, 0.001, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliAnimationGetSpeedFactorP(void)
{
TestApplication application;
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Build the animation
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
// Set range between 0.4 and 0.8
- animation.SetPlayRange( Vector2( 0.4f, 0.9f ) );
+ animation.SetPlayRange(Vector2(0.4f, 0.9f));
application.SendNotification();
- DALI_TEST_EQUALS( Vector2( 0.4f, 0.9f ), animation.GetPlayRange(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector2(0.4f, 0.9f), animation.GetPlayRange(), TEST_LOCATION);
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
animation.Play();
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 60% progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.6f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 200.0f )/* 80% progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.8f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds*100.0f ) + 1u/*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION);
END_TEST;
}
application.SendNotification();
//PlayRange out of bounds
- animation.SetPlayRange( Vector2(-1.0f,1.0f) );
+ animation.SetPlayRange(Vector2(-1.0f, 1.0f));
application.SendNotification();
- DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
- animation.SetPlayRange( Vector2(0.0f,2.0f) );
+ DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
+ animation.SetPlayRange(Vector2(0.0f, 2.0f));
application.SendNotification();
- DALI_TEST_EQUALS( Vector2(0.0f,1.0f), animation.GetPlayRange(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
//If playRange is not in the correct order it has to be ordered
- animation.SetPlayRange( Vector2(0.8f,0.2f) );
+ animation.SetPlayRange(Vector2(0.8f, 0.2f));
application.SendNotification();
- DALI_TEST_EQUALS( Vector2(0.2f,0.8f), animation.GetPlayRange(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector2(0.2f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Build the animation
- Animation animation = Animation::New( 1.0f );
+ Animation animation = Animation::New(1.0f);
application.SendNotification();
//If PlayRange not specified it should be 0.0-1.0 by default
- DALI_TEST_EQUALS( Vector2( 0.0f,1.0f ), animation.GetPlayRange(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector2(0.0f, 1.0f), animation.GetPlayRange(), TEST_LOCATION);
// Set range between 0.4 and 0.8
- animation.SetPlayRange( Vector2( 0.4f, 0.8f ) );
+ animation.SetPlayRange(Vector2(0.4f, 0.8f));
application.SendNotification();
- DALI_TEST_EQUALS( Vector2( 0.4f, 0.8f ), animation.GetPlayRange(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector2(0.4f, 0.8f), animation.GetPlayRange(), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 basePosition(Vector3::ZERO);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
// Not added to the stage yet!
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetDisconnectAction( Animation::DISCARD );
+ animation.SetDisconnectAction(Animation::DISCARD);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
// Add to the stage
application.GetScene().Add(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
// Remove from the stage
application.GetScene().Remove(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*back to start position as disconnect behaviour is discard*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*back to start position as disconnect behaviour is discard*/, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Add to the stage
application.GetScene().Add(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(80,80,80), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(80, 80, 80), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
-
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 basePosition(Vector3::ZERO);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
// Not added to the stage!
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
// Add to the stage
application.GetScene().Add(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
// Remove from the stage
application.GetScene().Remove(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final*/, TEST_LOCATION);
// Add to the stage
application.GetScene().Add(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition /*bake final removed the */, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition /*bake final removed the */, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 basePosition(Vector3::ZERO);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), basePosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), basePosition, TEST_LOCATION);
// Not added to the stage!
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetDisconnectAction( Animation::BAKE );
+ animation.SetDisconnectAction(Animation::BAKE);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(20,20,20), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(20, 20, 20), TEST_LOCATION);
// Add to the stage
application.GetScene().Add(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40)/*on-stage*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*on-stage*/, TEST_LOCATION);
// Remove from the stage
application.GetScene().Remove(actor); // baked here
application.SendNotification();
// this render is a no-op in this case as animator is disabled while off stage
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(40,40,40) /*baked value*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(40, 40, 40) /*baked value*/, TEST_LOCATION);
// Add back to the stage
application.GetScene().Add(actor);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION );
- application.Render(static_cast<unsigned int>(0.0f) );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
- application.Render(static_cast<unsigned int>(0.0f) );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /* animation restarted at 40,40,40 + 80%*60 */, TEST_LOCATION);
+ application.Render(static_cast<unsigned int>(0.0f));
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
+ application.Render(static_cast<unsigned int>(0.0f));
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
// Remove from the stage
application.GetScene().Remove(actor); // baked here
application.SendNotification();
// this render is a no-op in this case as animator is disabled while off stage
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
- application.Render(static_cast<unsigned int>(0.0f) );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
- application.Render(static_cast<unsigned int>(0.0f) );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) /*baked value*/, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
+ application.Render(static_cast<unsigned int>(0.0f));
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
+ application.Render(static_cast<unsigned int>(0.0f));
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88) /*baked value*/, TEST_LOCATION);
// Add back to the stage
application.GetScene().Add(actor);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(88,88,88) , TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(88, 88, 88), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
// This is a test of the "Fire and Forget" behaviour
// Discard the animation handle!
animation.Reset();
- DALI_TEST_CHECK( !animation );
+ DALI_TEST_CHECK(!animation);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.4f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
// This is a test of the "Fire and Forget" behaviour
// Stop the animation, and Discard the animation handle!
animation.Stop();
animation.Reset();
- DALI_TEST_CHECK( !animation );
+ DALI_TEST_CHECK(!animation);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
// We expect the animation to finish at 20% progress
application.SendNotification();
finishCheck.CheckSignalReceived();
finishCheck.Reset();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// Check that nothing has changed
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// Check that nothing has changed
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
// Check that nothing has changed
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.2f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.2f), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.0f , Vector3(0.0f,0.0f,0.0f ) );
- keyframes.Add( 1.0f , Vector3(100.0f,100.0f,100.0f ) );
+ keyframes.Add(0.0f, Vector3(0.0f, 0.0f, 0.0f));
+ keyframes.Add(1.0f, Vector3(100.0f, 100.0f, 100.0f));
- animation.AnimateBetween( Property( actor, Actor::Property::POSITION), keyframes );
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
// Set range between 0.4 and 0.8
- animation.SetPlayRange( Vector2(0.4f,0.8f) );
+ animation.SetPlayRange(Vector2(0.4f, 0.8f));
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
//Test that setting progress outside the range doesn't work
- animation.SetCurrentProgress( 0.9f );
+ animation.SetCurrentProgress(0.9f);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
- animation.SetCurrentProgress( 0.2f );
+ DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
+ animation.SetCurrentProgress(0.2f);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( animation.GetCurrentProgress(), 0.4f, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.4f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /* 80% progress */);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition * 0.8f, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
-
+ DALI_TEST_EQUALS(targetPosition * 0.8f, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
//Loop inside the range
finishCheck.Reset();
- animation.SetLooping( true );
+ animation.SetLooping(true);
animation.Play();
application.SendNotification();
float intervalSeconds = 0.1f;
- float progress = 0.4f;
- for (int iterations = 0; iterations < 10; ++iterations )
+ float progress = 0.4f;
+ for(int iterations = 0; iterations < 10; ++iterations)
{
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
progress += intervalSeconds;
- if (progress > 0.8f)
+ if(progress > 0.8f)
{
progress = progress - 0.4f;
}
- DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
}
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
-
//Test change range on the fly
- animation.SetPlayRange( Vector2( 0.2f, 0.9f ) );
+ animation.SetPlayRange(Vector2(0.2f, 0.9f));
application.SendNotification();
- for (int iterations = 0; iterations < 10; ++iterations )
+ for(int iterations = 0; iterations < 10; ++iterations)
{
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
progress += intervalSeconds;
- if (progress > 0.9f)
+ if(progress > 0.9f)
{
progress = progress - 0.7f;
}
- DALI_TEST_EQUALS( targetPosition*progress, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition * progress, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.001f, TEST_LOCATION);
}
END_TEST;
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation from 40% progress
- animation.PlayFrom( 0.4f );
+ animation.PlayFrom(0.4f);
// Target value should be updated straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.6f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.6f), TEST_LOCATION);
animation.Play(); // Test that calling play has no effect, when animation is already playing
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), (targetPosition * 0.8f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.8f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
//PlayFrom with an argument outside the range [0..1] will be ignored
animation.PlayFrom(-1.0f);
application.SendNotification();
- DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
animation.PlayFrom(100.0f);
application.SendNotification();
- DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
// Pause the animation
animation.Pause();
application.SendNotification();
// Loop 5 times
- for (int i=0; i<5; ++i)
+ for(int i = 0; i < 5; ++i)
{
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
}
// Keep going
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliAnimationGetStateP(void)
{
TestApplication application;
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
// Start the animation
animation.Play();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
// Pause the animation
animation.Pause();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
application.SendNotification();
application.Render(0.f);
// Loop 5 times
- for (int i=0; i<5; ++i)
+ for(int i = 0; i < 5; ++i)
{
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when paused */, TEST_LOCATION );
- DALI_TEST_EQUALS( animation.GetState(), Animation::PAUSED, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when paused */, TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PAUSED, TEST_LOCATION);
}
// Keep going
finishCheck.Reset();
animation.Play();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( targetPosition, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
- DALI_TEST_EQUALS( animation.GetState(), Animation::STOPPED, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetPosition, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.GetState(), Animation::STOPPED, TEST_LOCATION);
// re-play
finishCheck.Reset();
animation.Play();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f)/*slightly less than the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 490.0f) /*slightly less than the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
// Stop the animation
animation.Stop();
application.SendNotification();
// Loop 5 times
- for (int i=0; i<5; ++i)
+ for(int i = 0; i < 5; ++i)
{
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress when stopped */, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress when stopped */, TEST_LOCATION);
}
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
// Stop the animation
animation.Stop();
Vector3 positionSet(2.0f, 3.0f, 4.0f);
- actor.SetProperty( Actor::Property::POSITION, positionSet );
+ actor.SetProperty(Actor::Property::POSITION, positionSet);
application.SendNotification();
// Loop 5 times
- for (int i=0; i<5; ++i)
+ for(int i = 0; i < 5; ++i)
{
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), positionSet/*Animation should not interfere with this*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), positionSet /*Animation should not interfere with this*/, TEST_LOCATION);
}
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
Vector3 fiftyPercentProgress(targetPosition * 0.5f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress, TEST_LOCATION);
// Clear the animation
animation.Clear();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We don't expect the animation to finish now
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), fiftyPercentProgress/* Still 50% progress since the animator was destroyed */, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), fiftyPercentProgress /* Still 50% progress since the animator was destroyed */, TEST_LOCATION);
// Restart as a scale animation; this should not move the actor's position
finishCheck.Reset();
- actor.SetProperty( Actor::Property::POSITION, Vector3::ZERO );
+ actor.SetProperty(Actor::Property::POSITION, Vector3::ZERO);
Vector3 targetScale(3.0f, 3.0f, 3.0f);
- animation.AnimateTo( Property( actor, Actor::Property::SCALE ), targetScale, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3(2.0f, 2.0f, 2.0f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO/*Check move-animator was destroyed*/, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO /*Check move-animator was destroyed*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
END_TEST;
}
TestApplication application;
// Start the empty animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
Actor actor = Actor::New();
// Register a boolean property
- bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
- Animation animation = Animation::New(durationSeconds);
+ float durationSeconds(2.0f);
+ Animation animation = Animation::New(durationSeconds);
const bool relativeValue(true);
- const bool finalValue( false || relativeValue );
+ const bool finalValue(false || relativeValue);
animation.AnimateBy(Property(actor, index), relativeValue);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< bool >( index ), finalValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(index), finalValue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Repeat with relative value "false" - this should be an NOOP
animation = Animation::New(durationSeconds);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- bool relativeValue(true);
- bool finalValue( false || relativeValue );
+ bool relativeValue(true);
+ bool finalValue(false || relativeValue);
animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_IN);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Repeat with relative value "false" - this should be an NOOP
animation = Animation::New(durationSeconds);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- bool relativeValue(true);
- bool finalValue( false || relativeValue );
- float animatorDurationSeconds(durationSeconds * 0.5f);
- animation.AnimateBy( Property(actor, index),
- relativeValue,
- TimePeriod( animatorDurationSeconds ) );
+ bool relativeValue(true);
+ bool finalValue(false || relativeValue);
+ float animatorDurationSeconds(durationSeconds * 0.5f);
+ animation.AnimateBy(Property(actor, index),
+ relativeValue,
+ TimePeriod(animatorDurationSeconds));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
// We didn't expect the animation to finish yet...
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// ...however we should have reached the final value
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- bool relativeValue(true);
- bool finalValue( false || relativeValue );
- float animatorDurationSeconds(durationSeconds * 0.5f);
- animation.AnimateBy( Property(actor, index),
- relativeValue,
- AlphaFunction::EASE_IN_OUT,
- TimePeriod( animatorDurationSeconds ) );
+ bool relativeValue(true);
+ bool finalValue(false || relativeValue);
+ float animatorDurationSeconds(durationSeconds * 0.5f);
+ animation.AnimateBy(Property(actor, index),
+ relativeValue,
+ AlphaFunction::EASE_IN_OUT,
+ TimePeriod(animatorDurationSeconds));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
// We didn't expect the animation to finish yet...
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// ...however we should have reached the final value
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(50.0f);
- float relativeValue(targetValue - startValue);
+ float targetValue(50.0f);
+ float relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue);
- float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(90.0f);
- float relativeValue(targetValue - startValue);
+ float targetValue(90.0f);
+ float relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
- float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- float current( actor.GetCurrentProperty< float >( index ) );
- DALI_TEST_CHECK( current > ninetyFivePercentProgress );
+ float current(actor.GetCurrentProperty<float>(index));
+ DALI_TEST_CHECK(current > ninetyFivePercentProgress);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(30.0f);
- float relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(30.0f);
- float relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(1);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(50);
- int relativeValue(targetValue - startValue);
+ int targetValue(50);
+ int relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue);
- int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
+ int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), targetValue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(1);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(90);
- int relativeValue(targetValue - startValue);
+ int targetValue(90);
+ int relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
- int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
+ int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- int current( actor.GetCurrentProperty< int >( index ) );
- DALI_TEST_CHECK( current > ninetyFivePercentProgress );
+ int current(actor.GetCurrentProperty<int>(index));
+ DALI_TEST_CHECK(current > ninetyFivePercentProgress);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(10);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(10);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(30);
- int relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ int targetValue(30);
+ int relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(10);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(10);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(30);
- int relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ int targetValue(30);
+ int relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a quaternion property
- const Quaternion startValue( Degree( 90 ), Vector3::XAXIS );
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ const Quaternion startValue(Degree(90), Vector3::XAXIS);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
- Animation animation = Animation::New(durationSeconds);
- const Quaternion relativeValue( Degree( 90 ), Vector3::ZAXIS );
- const Quaternion finalValue( startValue * relativeValue );
+ float durationSeconds(2.0f);
+ Animation animation = Animation::New(durationSeconds);
+ const Quaternion relativeValue(Degree(90), Vector3::ZAXIS);
+ const Quaternion finalValue(startValue * relativeValue);
animation.AnimateBy(Property(actor, index), relativeValue);
- DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == startValue);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
+ DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
application.SendNotification();
- application.Render( 2000 ); // animation complete
+ application.Render(2000); // animation complete
- DALI_TEST_CHECK( actor.GetProperty< Quaternion >(index) == finalValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< Quaternion >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetProperty<Quaternion>(index) == finalValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Quaternion>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(60.0f, 60.0f);
- Vector2 relativeValue(targetValue - startValue);
+ Vector2 targetValue(60.0f, 60.0f);
+ Vector2 relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue);
- Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(100.0f, 100.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(100.0f, 100.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(20.0f, 20.0f);
- Vector2 relativeValue(targetValue - startValue);
+ Vector2 targetValue(20.0f, 20.0f);
+ Vector2 relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
- Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
- DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
+ Vector2 current(actor.GetCurrentProperty<Vector2>(index));
+ DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(30.0f, 30.0f);
- Vector2 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector2 targetValue(30.0f, 30.0f);
+ Vector2 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(5.0f, 5.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(5.0f, 5.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(10.0f, 10.0f);
- Vector2 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector2 targetValue(10.0f, 10.0f);
+ Vector2 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(60.0f, 60.0f, 60.0f);
- Vector3 relativeValue(targetValue - startValue);
+ Vector3 targetValue(60.0f, 60.0f, 60.0f);
+ Vector3 relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue);
- Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(100.0f, 100.0f, 100.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(100.0f, 100.0f, 100.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(20.0f, 20.0f, 20.0f);
- Vector3 relativeValue(targetValue - startValue);
+ Vector3 targetValue(20.0f, 20.0f, 20.0f);
+ Vector3 relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
- Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( index ));
- DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(index));
+ DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
+ DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(30.0f, 30.0f, 30.0f);
- Vector3 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector3 targetValue(30.0f, 30.0f, 30.0f);
+ Vector3 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(5.0f, 5.0f, 5.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(5.0f, 5.0f, 5.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(10.0f, 10.0f, 10.0f);
- Vector3 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector3 targetValue(10.0f, 10.0f, 10.0f);
+ Vector3 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
- Vector4 relativeValue(targetValue - startValue);
+ Vector4 targetValue(60.0f, 60.0f, 60.0f, 60.0f);
+ Vector4 relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue);
- Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(100.0f, 100.0f, 100.0f, 100.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
- Vector4 relativeValue(targetValue - startValue);
+ Vector4 targetValue(20.0f, 20.0f, 20.0f, 20.0f);
+ Vector4 relativeValue(targetValue - startValue);
animation.AnimateBy(Property(actor, index), relativeValue, AlphaFunction::EASE_OUT);
- Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
- DALI_TEST_CHECK( current.x < ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyFivePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyFivePercentProgress.z );
- DALI_TEST_CHECK( current.w < ninetyFivePercentProgress.w );
+ Vector4 current(actor.GetCurrentProperty<Vector4>(index));
+ DALI_TEST_CHECK(current.x < ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyFivePercentProgress.y);
+ DALI_TEST_CHECK(current.z < ninetyFivePercentProgress.z);
+ DALI_TEST_CHECK(current.w < ninetyFivePercentProgress.w);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
- Vector4 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
+ Vector4 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(5.0f, 5.0f, 5.0f, 5.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
- Vector4 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector4 targetValue(10.0f, 10.0f, 10.0f, 10.0f);
+ Vector4 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, index),
relativeValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 startPosition(10.0f, 10.0f, 10.0f);
- actor.SetProperty( Actor::Property::POSITION, startPosition );
+ actor.SetProperty(Actor::Property::POSITION, startPosition);
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(20.0f, 20.0f, 20.0f);
- Vector3 relativePosition(targetPosition - startPosition);
+ Vector3 targetPosition(20.0f, 20.0f, 20.0f);
+ Vector3 relativePosition(targetPosition - startPosition);
animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition);
- Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
+ Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(200.0f, 300.0f, 400.0f);
- Vector3 relativePosition(targetPosition - Vector3::ZERO);
- animation.AnimateBy( Property( actor, Actor::Property::POSITION_X ), relativePosition.x );
- animation.AnimateBy( Property( actor, Actor::Property::POSITION_Y ), relativePosition.y );
- animation.AnimateBy( Property( actor, Actor::Property::POSITION_Z ), relativePosition.z );
+ Vector3 targetPosition(200.0f, 300.0f, 400.0f);
+ Vector3 relativePosition(targetPosition - Vector3::ZERO);
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION_X), relativePosition.x);
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION_Y), relativePosition.y);
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION_Z), relativePosition.z);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 startPosition(10.0f, 10.0f, 10.0f);
- actor.SetProperty( Actor::Property::POSITION, startPosition );
+ actor.SetProperty(Actor::Property::POSITION, startPosition);
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(20.0f, 20.0f, 20.0f);
- Vector3 relativePosition(targetPosition - startPosition);
+ Vector3 targetPosition(20.0f, 20.0f, 20.0f);
+ Vector3 relativePosition(targetPosition - startPosition);
animation.AnimateBy(Property(actor, Actor::Property::POSITION), relativePosition, AlphaFunction::EASE_OUT);
- Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
+ Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
- DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
- DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
+ DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
+ DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 startPosition(10.0f, 10.0f, 10.0f);
- actor.SetProperty( Actor::Property::POSITION, startPosition );
+ actor.SetProperty(Actor::Property::POSITION, startPosition);
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(20.0f, 20.0f, 20.0f);
- Vector3 relativePosition(targetPosition - startPosition);
- float delay = 0.5f;
+ Vector3 targetPosition(20.0f, 20.0f, 20.0f);
+ Vector3 relativePosition(targetPosition - startPosition);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, Actor::Property::POSITION),
relativePosition,
TimePeriod(delay, durationSeconds - delay));
- Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
+ Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Vector3 startPosition(10.0f, 10.0f, 10.0f);
- actor.SetProperty( Actor::Property::POSITION, startPosition );
+ actor.SetProperty(Actor::Property::POSITION, startPosition);
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(20.0f, 20.0f, 20.0f);
- Vector3 relativePosition(targetPosition - startPosition);
- float delay = 0.5f;
+ Vector3 targetPosition(20.0f, 20.0f, 20.0f);
+ Vector3 relativePosition(targetPosition - startPosition);
+ float delay = 0.5f;
animation.AnimateBy(Property(actor, Actor::Property::POSITION),
relativePosition,
AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
- Vector3 ninetyFivePercentProgress(startPosition + relativePosition*0.95f);
+ Vector3 ninetyFivePercentProgress(startPosition + relativePosition * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), startPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), startPosition, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree relativeRotationDegrees(360.0f);
- Radian relativeRotationRadians(relativeRotationDegrees);
- animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ) );
+ Degree relativeRotationDegrees(360.0f);
+ Radian relativeRotationRadians(relativeRotationDegrees);
+ animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS));
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
tet_printf("Testing that rotation angle > 360 performs full rotations\n");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree relativeRotationDegrees(710.0f);
- Radian relativeRotationRadians(relativeRotationDegrees);
+ Degree relativeRotationDegrees(710.0f);
+ Radian relativeRotationRadians(relativeRotationDegrees);
- animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( relativeRotationRadians, Vector3::ZAXIS ) );
+ animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), AngleAxis(relativeRotationRadians, Vector3::ZAXIS));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliAnimationAnimateByActorOrientationP3(void)
{
TestApplication application;
tet_printf("Testing that rotation angle > 360 performs partial rotations when cast to Quaternion\n");
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::ZAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::ZAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree relativeRotationDegrees(730.0f);
- Radian relativeRotationRadians(relativeRotationDegrees);
+ Degree relativeRotationDegrees(730.0f);
+ Radian relativeRotationRadians(relativeRotationDegrees);
- Radian actualRotationRadians( Degree(10.0f) );
+ Radian actualRotationRadians(Degree(10.0f));
- animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::ZAXIS ) );
+ animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.25f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.5f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians * 0.75f, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(actualRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::ZAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliAnimationAnimateByActorOrientationAlphaFunctionP(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree relativeRotationDegrees(360.0f);
- Radian relativeRotationRadians(relativeRotationDegrees);
- animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ), AlphaFunction::EASE_IN );
+ Degree relativeRotationDegrees(360.0f);
+ Radian relativeRotationRadians(relativeRotationDegrees);
+ animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree relativeRotationDegrees(360.0f);
- Radian relativeRotationRadians(relativeRotationDegrees);
- float delay = 0.3f;
- animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), Quaternion( relativeRotationRadians, Vector3::YAXIS ),
- AlphaFunction::EASE_IN, TimePeriod( delay, durationSeconds - delay ) );
+ Degree relativeRotationDegrees(360.0f);
+ Radian relativeRotationRadians(relativeRotationDegrees);
+ float delay = 0.3f;
+ animation.AnimateBy(Property(actor, Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(relativeRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetScale(2.0f, 2.0f, 2.0f);
- Vector3 relativeScale(targetScale - Vector3::ONE);
- animation.AnimateBy( Property( actor, Actor::Property::SCALE ), Vector3( relativeScale.x, relativeScale.y, relativeScale.z ) );
+ Vector3 targetScale(2.0f, 2.0f, 2.0f);
+ Vector3 relativeScale(targetScale - Vector3::ONE);
+ animation.AnimateBy(Property(actor, Actor::Property::SCALE), Vector3(relativeScale.x, relativeScale.y, relativeScale.z));
- Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale*0.99f);
+ Vector3 ninetyNinePercentProgress(Vector3::ONE + relativeScale * 0.99f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
+ actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::EASE_IN );
+ animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The scale should have grown less, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
- DALI_TEST_CHECK( current.x > 1.0f );
- DALI_TEST_CHECK( current.y > 1.0f );
- DALI_TEST_CHECK( current.z > 1.0f );
- DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
+ DALI_TEST_CHECK(current.x > 1.0f);
+ DALI_TEST_CHECK(current.y > 1.0f);
+ DALI_TEST_CHECK(current.z > 1.0f);
+ DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
+ DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
+ actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Repeat with a delay
float delay = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.AnimateBy( Property( actor, Actor::Property::SCALE ), relativeScale, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
+ animation = Animation::New(durationSeconds);
+ animation.AnimateBy(Property(actor, Actor::Property::SCALE), relativeScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetScale(2.0f, 3.0f, 4.0f);
- Vector3 relativeScale(targetScale - Vector3::ONE);
- animation.AnimateBy( Property( actor, Actor::Property::SCALE_X ), relativeScale.x );
- animation.AnimateBy( Property( actor, Actor::Property::SCALE_Y ), relativeScale.y );
- animation.AnimateBy( Property( actor, Actor::Property::SCALE_Z ), relativeScale.z );
+ Vector3 targetScale(2.0f, 3.0f, 4.0f);
+ Vector3 relativeScale(targetScale - Vector3::ONE);
+ animation.AnimateBy(Property(actor, Actor::Property::SCALE_X), relativeScale.x);
+ animation.AnimateBy(Property(actor, Actor::Property::SCALE_Y), relativeScale.y);
+ animation.AnimateBy(Property(actor, Actor::Property::SCALE_Z), relativeScale.z);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
- Vector4 relativeColor( targetColor - Color::WHITE );
- animation.AnimateBy( Property( actor, Actor::Property::COLOR ), relativeColor );
+ Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
+ Vector4 relativeColor(targetColor - Color::WHITE);
+ animation.AnimateBy(Property(actor, Actor::Property::COLOR), relativeColor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetColor( 0.5f, 0.75f, 0.8f, 0.1f );
- Vector4 relativeColor( targetColor - Color::WHITE );
- animation.AnimateBy( Property( actor, Actor::Property::COLOR_RED ), relativeColor.r );
- animation.AnimateBy( Property( actor, Actor::Property::COLOR_GREEN ), relativeColor.g );
- animation.AnimateBy( Property( actor, Actor::Property::COLOR_BLUE ), relativeColor.b );
- animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), relativeColor.a );
+ Vector4 targetColor(0.5f, 0.75f, 0.8f, 0.1f);
+ Vector4 relativeColor(targetColor - Color::WHITE);
+ animation.AnimateBy(Property(actor, Actor::Property::COLOR_RED), relativeColor.r);
+ animation.AnimateBy(Property(actor, Actor::Property::COLOR_GREEN), relativeColor.g);
+ animation.AnimateBy(Property(actor, Actor::Property::COLOR_BLUE), relativeColor.b);
+ animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), relativeColor.a);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetSize( 100.0f, 200.0f, 300.0f );
- Vector3 relativeSize( targetSize - Vector3::ZERO );
- animation.AnimateBy( Property( actor, Actor::Property::SIZE ), relativeSize );
+ Vector3 targetSize(100.0f, 200.0f, 300.0f);
+ Vector3 relativeSize(targetSize - Vector3::ZERO);
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE), relativeSize);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetSize( 100.0f, 200.0f, 300.0f );
- Vector3 relativeSize( targetSize - Vector3::ZERO );
- animation.AnimateBy( Property( actor, Actor::Property::SIZE_WIDTH ), relativeSize.width );
- animation.AnimateBy( Property( actor, Actor::Property::SIZE_HEIGHT ), relativeSize.height );
- animation.AnimateBy( Property( actor, Actor::Property::SIZE_DEPTH ), relativeSize.depth );
+ Vector3 targetSize(100.0f, 200.0f, 300.0f);
+ Vector3 relativeSize(targetSize - Vector3::ZERO);
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE_WIDTH), relativeSize.width);
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE_HEIGHT), relativeSize.height);
+ animation.AnimateBy(Property(actor, Actor::Property::SIZE_DEPTH), relativeSize.depth);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
- actor.SetProperty( Actor::Property::VISIBLE, false );
+ actor.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- bool targetVisibility( true );
- bool relativeVisibility( targetVisibility );
- animation.AnimateBy( Property( actor, Actor::Property::VISIBLE ), relativeVisibility );
+ bool targetVisibility(true);
+ bool relativeVisibility(targetVisibility);
+ animation.AnimateBy(Property(actor, Actor::Property::VISIBLE), relativeVisibility);
- DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::VISIBLE ), targetVisibility, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION ); // Not changed yet
+ DALI_TEST_EQUALS(actor.GetProperty<bool>(Actor::Property::VISIBLE), targetVisibility, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION); // Not changed yet
application.SendNotification();
- application.Render( 1000 ); // 1 second progress
+ application.Render(1000); // 1 second progress
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- const bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ const bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
- Animation animation = Animation::New(durationSeconds);
- const bool targetValue( !startValue );
+ float durationSeconds(2.0f);
+ Animation animation = Animation::New(durationSeconds);
+ const bool targetValue(!startValue);
animation.AnimateTo(Property(actor, index), targetValue);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
// Repeat with target value "false"
animation = Animation::New(durationSeconds);
- const bool finalValue( !targetValue );
+ const bool finalValue(!targetValue);
animation.AnimateTo(Property(actor, index), finalValue);
// Start the animation
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- const bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ const bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
- Animation animation = Animation::New(durationSeconds);
- const bool targetValue( !startValue );
+ float durationSeconds(2.0f);
+ Animation animation = Animation::New(durationSeconds);
+ const bool targetValue(!startValue);
animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
// Repeat with target value "false"
animation = Animation::New(durationSeconds);
- const bool finalValue( !targetValue );
+ const bool finalValue(!targetValue);
animation.AnimateTo(Property(actor, index), finalValue, AlphaFunction::EASE_OUT);
// Start the animation
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == targetValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == targetValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- bool finalValue( !startValue );
- float animatorDurationSeconds(durationSeconds * 0.5f);
- animation.AnimateTo( Property(actor, index),
- finalValue,
- TimePeriod( animatorDurationSeconds ) );
+ bool finalValue(!startValue);
+ float animatorDurationSeconds(durationSeconds * 0.5f);
+ animation.AnimateTo(Property(actor, index),
+ finalValue,
+ TimePeriod(animatorDurationSeconds));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
// We didn't expect the animation to finish yet...
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// ...however we should have reached the final value
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a boolean property
- bool startValue(false);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ bool startValue(false);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_CHECK( actor.GetProperty<bool>(index) == startValue );
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetProperty<bool>(index) == startValue);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- bool finalValue( !startValue );
- float animatorDurationSeconds(durationSeconds * 0.5f);
- animation.AnimateTo( Property(actor, index),
- finalValue,
- AlphaFunction::LINEAR,
- TimePeriod( animatorDurationSeconds ) );
+ bool finalValue(!startValue);
+ float animatorDurationSeconds(durationSeconds * 0.5f);
+ animation.AnimateTo(Property(actor, index),
+ finalValue,
+ AlphaFunction::LINEAR,
+ TimePeriod(animatorDurationSeconds));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*950.0f)/* 95% animator progress */);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 950.0f) /* 95% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == startValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == startValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*50.0f) + 1u/*just beyond the animator duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 50.0f) + 1u /*just beyond the animator duration*/);
// We didn't expect the animation to finish yet...
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// ...however we should have reached the final value
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.SendNotification();
- application.Render(static_cast<unsigned int>(animatorDurationSeconds*1000.0f)/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(animatorDurationSeconds * 1000.0f) /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
application.Render(0);
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( index ) == finalValue );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(index) == finalValue);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(50.0f);
- float relativeValue(targetValue - startValue);
+ float targetValue(50.0f);
+ float relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, "testProperty"), targetValue);
- float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(90.0f);
- float relativeValue(targetValue - startValue);
+ float targetValue(90.0f);
+ float relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
- float ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ float ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- float current( actor.GetCurrentProperty< float >( index ) );
- DALI_TEST_CHECK( current > ninetyFivePercentProgress );
+ float current(actor.GetCurrentProperty<float>(index));
+ DALI_TEST_CHECK(current > ninetyFivePercentProgress);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(30.0f);
- float relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetValue(30.0f);
- float relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(10);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(10);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(50);
- int relativeValue(targetValue - startValue);
+ int targetValue(50);
+ int relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, "testProperty"), targetValue);
- int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
+ int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(10);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(10);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(90);
- int relativeValue(targetValue - startValue);
+ int targetValue(90);
+ int relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
- int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue*0.95f + 0.5f));
+ int ninetyFivePercentProgress(static_cast<int>(startValue + relativeValue * 0.95f + 0.5f));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- int current( actor.GetCurrentProperty< int >( index ) );
- DALI_TEST_CHECK( current > ninetyFivePercentProgress );
+ int current(actor.GetCurrentProperty<int>(index));
+ DALI_TEST_CHECK(current > ninetyFivePercentProgress);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(10);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(10);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(30);
- int relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ int targetValue(30);
+ int relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(10);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(10);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- int targetValue(30);
- int relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ int targetValue(30);
+ int relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), static_cast<int>(startValue+(relativeValue*0.5f)+0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), static_cast<int>(startValue + (relativeValue * 0.5f) + 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(-50.0f, -50.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(-50.0f, -50.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(50.0f, 50.0f);
- Vector2 relativeValue(targetValue - startValue);
+ Vector2 targetValue(50.0f, 50.0f);
+ Vector2 relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue);
- Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(1000.0f, 1000.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(1000.0f, 1000.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(9000.0f, 9000.0f);
- Vector2 relativeValue(targetValue - startValue);
+ Vector2 targetValue(9000.0f, 9000.0f);
+ Vector2 relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, "testProperty"), targetValue, AlphaFunction::EASE_OUT);
- Vector2 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector2 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector2 current( actor.GetCurrentProperty< Vector2 >( index ) );
- DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
+ Vector2 current(actor.GetCurrentProperty<Vector2>(index));
+ DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(-10.0f, 20.0f);
- Vector2 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector2 targetValue(-10.0f, 20.0f);
+ Vector2 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector2 property
- Vector2 startValue(10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector2 startValue(10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector2 targetValue(30.0f, 30.0f);
- Vector2 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector2 targetValue(30.0f, 30.0f);
+ Vector2 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet, but cached value should be the final one
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty<Vector2>( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector2>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(-50.0f, -50.0f, -50.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(-50.0f, -50.0f, -50.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>( index ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(50.0f, 50.0f, 50.0f);
- Vector3 relativeValue(targetValue - startValue);
+ Vector3 targetValue(50.0f, 50.0f, 50.0f);
+ Vector3 relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue);
- Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(1000.0f, 1000.0f, 1000.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
- Vector3 relativeValue(targetValue - startValue);
+ Vector3 targetValue(9000.0f, 9000.0f, 9000.0f);
+ Vector3 relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
- Vector3 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector3 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector3 current( actor.GetCurrentProperty< Vector3 >( index ) );
- DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
- DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(index));
+ DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
+ DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(-10.0f, 20.0f, 100.0f);
- Vector3 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector3 targetValue(-10.0f, 20.0f, 100.0f);
+ Vector3 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(30.0f, 30.0f, 30.0f);
- Vector3 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector3 targetValue(30.0f, 30.0f, 30.0f);
+ Vector3 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, "testProperty"),
targetValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector3 property
- Vector3 startValue(10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector3 startValue(10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetValue(30.0f, 30.0f, 10.0f);
- Vector3 relativeValue(targetValue - startValue);
- float delay = 0.5f;
- animation.AnimateTo(Property(actor, "testProperty", 0),
+ Vector3 targetValue(30.0f, 30.0f, 10.0f);
+ Vector3 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
+ animation.AnimateTo(Property(actor, "testProperty", 0),
30.0f,
AlphaFunction::LINEAR,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(-50.0f, -40.0f, -30.0f, -20.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
- Vector4 relativeValue(targetValue - startValue);
+ Vector4 targetValue(50.0f, 50.0f, 50.0f, 50.0f);
+ Vector4 relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue);
- Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), ninetyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), ninetyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(1000.0f, 1000.0f, 1000.0f, 1000.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
- Vector4 relativeValue(targetValue - startValue);
+ Vector4 targetValue(9000.0f, 9000.0f, 9000.0f, 9000.0f);
+ Vector4 relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index), targetValue, AlphaFunction::EASE_OUT);
- Vector4 ninetyFivePercentProgress(startValue + relativeValue*0.95f);
+ Vector4 ninetyFivePercentProgress(startValue + relativeValue * 0.95f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*950.0f)/* 95% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 950.0f) /* 95% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved more, than with a linear alpha function
- Vector4 current( actor.GetCurrentProperty< Vector4 >( index ) );
- DALI_TEST_CHECK( current.x > ninetyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y > ninetyFivePercentProgress.y );
- DALI_TEST_CHECK( current.z > ninetyFivePercentProgress.z );
- DALI_TEST_CHECK( current.w > ninetyFivePercentProgress.w );
+ Vector4 current(actor.GetCurrentProperty<Vector4>(index));
+ DALI_TEST_CHECK(current.x > ninetyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y > ninetyFivePercentProgress.y);
+ DALI_TEST_CHECK(current.z > ninetyFivePercentProgress.z);
+ DALI_TEST_CHECK(current.w > ninetyFivePercentProgress.w);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*50.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
- Vector4 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector4 targetValue(-10.0f, 20.0f, 100.0f, 100.0f);
+ Vector4 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, VECTOR4_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, VECTOR4_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), VECTOR4_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), VECTOR4_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, VECTOR4_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, VECTOR4_EPSILON, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a Vector4 property
- Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ Vector4 startValue(10.0f, 10.0f, 10.0f, 10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
- Vector4 relativeValue(targetValue - startValue);
- float delay = 0.5f;
+ Vector4 targetValue(30.0f, 30.0f, 30.0f, 30.0f);
+ Vector4 relativeValue(targetValue - startValue);
+ float delay = 0.5f;
animation.AnimateTo(Property(actor, index),
targetValue,
AlphaFunction::LINEAR,
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(index), targetValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
+ Vector3 targetParentOrigin(ParentOrigin::BOTTOM_RIGHT);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN), targetParentOrigin);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).x, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).x, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_X), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetX(1.0f);
+ float targetX(1.0f);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_X), targetX);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).y, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).y, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Y), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetY(1.0f);
+ float targetY(1.0f);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Y), targetY);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.5f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ).z, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN).z, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::PARENT_ORIGIN_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetZ(1.0f);
+ float targetZ(1.0f);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::PARENT_ORIGIN_Z), targetZ);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
+ Vector3 targetAnchorPoint(AnchorPoint::TOP_LEFT);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT), targetAnchorPoint);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.5f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).x, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).x, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_X), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetX(1.0f);
+ float targetX(1.0f);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_X), targetX );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_X), targetX);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.5f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).y, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).y, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Y), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetY(0.0f);
+ float targetY(0.0f);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Y), targetY);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.5f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ).z, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT).z, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::ANCHOR_POINT_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetZ(100.0f);
+ float targetZ(100.0f);
DALI_TEST_ASSERTION(
- {
- animation.AnimateTo( Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ );
- }, "Property is not animatable" );
+ {
+ animation.AnimateTo(Property(actor, Actor::Property::ANCHOR_POINT_Z), targetZ);
+ },
+ "Property is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetSize(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize );
+ Vector3 targetSize(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), 0.0f, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetSize.width, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetSize.height, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetSize.depth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSize.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSize.height, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSize.depth, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The size should have travelled less, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
- DALI_TEST_CHECK( current.x > 0.0f );
- DALI_TEST_CHECK( current.y > 0.0f );
- DALI_TEST_CHECK( current.z > 0.0f );
- DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
+ DALI_TEST_CHECK(current.x > 0.0f);
+ DALI_TEST_CHECK(current.y > 0.0f);
+ DALI_TEST_CHECK(current.z > 0.0f);
+ DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
+ DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Repeat with a delay
float delay = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
+ animation = Animation::New(durationSeconds);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetWidth(10.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE_WIDTH), targetWidth );
+ float targetWidth(10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetWidth);
- float fiftyPercentProgress(startValue + (targetWidth - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetWidth - startValue) * 0.5f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), startValue, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( targetWidth, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_WIDTH ), targetWidth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(targetWidth, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).width, targetWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).width, targetWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetWidth, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetHeight(-10.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight );
+ float targetHeight(-10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetHeight);
- float fiftyPercentProgress(startValue + (targetHeight - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetHeight - startValue) * 0.5f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), startValue, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, targetHeight, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_HEIGHT ), targetHeight, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, targetHeight, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).height, targetHeight, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).height, targetHeight, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetHeight, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetDepth(-10.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SIZE_DEPTH), targetDepth );
+ float targetDepth(-10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_DEPTH), targetDepth);
- float fiftyPercentProgress(startValue + (targetDepth - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetDepth - startValue) * 0.5f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), startValue, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SIZE ), Vector3( 0.0f, 0.0f, targetDepth ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SIZE_DEPTH ), targetDepth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(0.0f, 0.0f, targetDepth), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).depth, targetDepth, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).depth, targetDepth, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetDepth, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetSize(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::SIZE ), targetSize );
+ Vector3 targetSize(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE), targetSize);
Vector3 ninetyNinePercentProgress(targetSize * 0.99f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), ninetyNinePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), ninetyNinePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), targetSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), targetSize, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::EASE_IN );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::EASE_IN );
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::EASE_IN);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The size should have travelled less, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ));
- DALI_TEST_CHECK( current.x > 0.0f );
- DALI_TEST_CHECK( current.y > 0.0f );
- DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE));
+ DALI_TEST_CHECK(current.x > 0.0f);
+ DALI_TEST_CHECK(current.y > 0.0f);
+ DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ZERO);
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ZERO);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
// Repeat with a delay
float delay = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_WIDTH ), targetSize.x, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
- animation.AnimateTo( Property( actor, Actor::Property::SIZE_HEIGHT ), targetSize.y, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
+ animation = Animation::New(durationSeconds);
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_WIDTH), targetSize.x, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
+ animation.AnimateTo(Property(actor, Actor::Property::SIZE_HEIGHT), targetSize.y, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ZERO, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).x, targetSize.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ).y, targetSize.y, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).x, targetSize.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SIZE).y, targetSize.y, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(200.0f, 200.0f, 200.0f);
+ Vector3 targetPosition(200.0f, 200.0f, 200.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), 0.0f, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetX(1.0f);
- animation.AnimateTo( Property(actor, Actor::Property::POSITION_X), targetX );
+ float targetX(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), targetX);
- float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( targetX, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), targetX, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(targetX, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x, targetX, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x, targetX, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetX, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetY(10.0f);
- animation.AnimateTo( Property(actor, Actor::Property::POSITION_Y), targetY );
+ float targetY(10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), targetY);
- float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, targetY, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Y ), targetY, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, targetY, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).y, targetY, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).y, targetY, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetY, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(0.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetZ(-5.0f);
- animation.AnimateTo( Property(actor, Actor::Property::POSITION_Z), targetZ );
+ float targetZ(-5.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_Z), targetZ);
- float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
// Should return the initial properties before play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), startValue, TEST_LOCATION);
// Start the animation
animation.Play();
// Should return the target property after play
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, targetZ ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_Z ), targetZ, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, targetZ), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).z, targetZ, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).z, targetZ, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetZ, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(200.0f, 200.0f, 200.0f);
+ Vector3 targetPosition(200.0f, 200.0f, 200.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::EASE_IN);
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*750.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 750.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The position should have moved less, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ));
- DALI_TEST_CHECK( current.x > Vector3::ZERO.x );
- DALI_TEST_CHECK( current.y > Vector3::ZERO.y );
- DALI_TEST_CHECK( current.z > Vector3::ZERO.z );
- DALI_TEST_CHECK( current.x < seventyFivePercentProgress.x );
- DALI_TEST_CHECK( current.y < seventyFivePercentProgress.y );
- DALI_TEST_CHECK( current.z < seventyFivePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
+ DALI_TEST_CHECK(current.x > Vector3::ZERO.x);
+ DALI_TEST_CHECK(current.y > Vector3::ZERO.y);
+ DALI_TEST_CHECK(current.z > Vector3::ZERO.z);
+ DALI_TEST_CHECK(current.x < seventyFivePercentProgress.x);
+ DALI_TEST_CHECK(current.y < seventyFivePercentProgress.y);
+ DALI_TEST_CHECK(current.z < seventyFivePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(200.0f, 200.0f, 200.0f);
- float delay = 0.5f;
- animation.AnimateTo( Property(actor, Actor::Property::POSITION),
- targetPosition,
- TimePeriod( delay, durationSeconds - delay ) );
+ Vector3 targetPosition(200.0f, 200.0f, 200.0f);
+ float delay = 0.5f;
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION),
+ targetPosition,
+ TimePeriod(delay, durationSeconds - delay));
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetPosition(200.0f, 200.0f, 200.0f);
- float delay = 0.5f;
- animation.AnimateTo( Property(actor, Actor::Property::POSITION),
- targetPosition,
- AlphaFunction::LINEAR,
- TimePeriod( delay, durationSeconds - delay ) );
+ Vector3 targetPosition(200.0f, 200.0f, 200.0f);
+ float delay = 0.5f;
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION),
+ targetPosition,
+ AlphaFunction::LINEAR,
+ TimePeriod(delay, durationSeconds - delay));
Vector3 seventyFivePercentProgress(targetPosition * 0.75f);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.75)/* 7/8 animation progress, 3/4 animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.75) /* 7/8 animation progress, 3/4 animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), seventyFivePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), seventyFivePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f*0.25) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f * 0.25) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree targetRotationDegrees(90.0f);
- Radian targetRotationRadians(targetRotationDegrees);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS) );
+ Degree targetRotationDegrees(90.0f);
+ Radian targetRotationRadians(targetRotationDegrees);
+ animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationRadians, Vector3::YAXIS));
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
- Degree targetRotationDegrees(90.0f);
- Radian targetRotationRadians(targetRotationDegrees);
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ Degree targetRotationDegrees(90.0f);
+ Radian targetRotationRadians(targetRotationDegrees);
Quaternion targetRotation(targetRotationRadians, Vector3::YAXIS);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), targetRotation );
+ animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), targetRotation);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Radian(0.0f), Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree targetRotationDegrees(90.0f);
- Radian targetRotationRadians(targetRotationDegrees);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
+ Degree targetRotationDegrees(90.0f);
+ Radian targetRotationRadians(targetRotationDegrees);
+ animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.25f*0.25f*0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.25f * 0.25f * 0.25f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.5f*0.5f*0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.5f * 0.5f * 0.5f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * 0.75f*0.75f*0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * 0.75f * 0.75f * 0.75f, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree targetRotationDegrees(90.0f);
- Radian targetRotationRadians(targetRotationDegrees);
- float delay(0.1f);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
+ Degree targetRotationDegrees(90.0f);
+ Radian targetRotationRadians(targetRotationDegrees);
+ float delay(0.1f);
+ animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::ANGLE_0, Vector3::YAXIS ) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::ANGLE_0, Vector3::YAXIS));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Dali::ANGLE_0, Vector3::YAXIS ), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Dali::ANGLE_0, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Degree targetRotationDegrees(90.0f);
- Radian targetRotationRadians(targetRotationDegrees);
- float delay(0.1f);
- animation.AnimateTo( Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
+ Degree targetRotationDegrees(90.0f);
+ Radian targetRotationRadians(targetRotationDegrees);
+ float delay(0.1f);
+ animation.AnimateTo(Property(actor, Actor::Property::ORIENTATION), AngleAxis(targetRotationDegrees, Vector3::YAXIS), AlphaFunction::EASE_IN, TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
float progress = max(0.0f, 0.25f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.5f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
progress = max(0.0f, 0.75f - delay) / (1.0f - delay);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians * progress*progress*progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians * progress * progress * progress, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(targetRotationRadians, Vector3::YAXIS), ROTATION_EPSILON, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector3 targetScale(2.0f, 2.0f, 2.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale );
+ Vector3 targetScale(2.0f, 2.0f, 2.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale);
- Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE)*0.99f);
+ Vector3 ninetyNinePercentProgress(Vector3::ONE + (targetScale - Vector3::ONE) * 0.99f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetScale.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetScale.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetScale.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetScale.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetScale.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetScale.z, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), ninetyNinePercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), ninetyNinePercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
+ actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*990.0f)/* 99% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 990.0f) /* 99% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The scale should have grown less, than with a linear alpha function
- Vector3 current(actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ));
- DALI_TEST_CHECK( current.x > 1.0f );
- DALI_TEST_CHECK( current.y > 1.0f );
- DALI_TEST_CHECK( current.z > 1.0f );
- DALI_TEST_CHECK( current.x < ninetyNinePercentProgress.x );
- DALI_TEST_CHECK( current.y < ninetyNinePercentProgress.y );
- DALI_TEST_CHECK( current.z < ninetyNinePercentProgress.z );
+ Vector3 current(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE));
+ DALI_TEST_CHECK(current.x > 1.0f);
+ DALI_TEST_CHECK(current.y > 1.0f);
+ DALI_TEST_CHECK(current.z > 1.0f);
+ DALI_TEST_CHECK(current.x < ninetyNinePercentProgress.x);
+ DALI_TEST_CHECK(current.y < ninetyNinePercentProgress.y);
+ DALI_TEST_CHECK(current.z < ninetyNinePercentProgress.z);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::SCALE,Vector3::ONE);
+ actor.SetProperty(Actor::Property::SCALE, Vector3::ONE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
// Repeat with a delay
float delay = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
+ animation = Animation::New(durationSeconds);
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE), targetScale, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), targetScale, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE), targetScale, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetX(10.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE_X), targetX );
+ float targetX(10.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE_X), targetX);
- float fiftyPercentProgress(startValue + (targetX - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetX - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( targetX, startValue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(targetX, startValue, startValue), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).x, targetX, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), targetX, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).x, targetX, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), targetX, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetY(1000.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE_Y), targetY );
+ float targetY(1000.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), targetY);
- float fiftyPercentProgress(startValue + (targetY - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetY - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, targetY, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, targetY, startValue), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).y, targetY, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), targetY, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).y, targetY, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), targetY, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetZ(-1000.0f);
- animation.AnimateTo( Property(actor, Actor::Property::SCALE_Z), targetZ );
+ float targetZ(-1000.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE_Z), targetZ);
- float fiftyPercentProgress(startValue + (targetZ - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetZ - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::SCALE ), Vector3( startValue, startValue, targetZ ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SCALE), Vector3(startValue, startValue, targetZ), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ).z, targetZ, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_X ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Y ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::SCALE_Z ), targetZ, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::SCALE).z, targetZ, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_X), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Y), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::SCALE_Z), targetZ, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- Vector4 targetColor(Color::RED);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor );
+ Vector4 targetColor(Color::RED);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor);
Vector4 tenPercentProgress(Vector4(1.0f, 0.9f, 0.9f, 1.0f));
Vector4 twentyPercentProgress(Vector4(1.0f, 0.8f, 0.8f, 1.0f));
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetColor.r, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetColor.g, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetColor.b, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetColor.a, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetColor.a, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColor.r, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetColor.g, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetColor.b, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetColor.a, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetColor.a, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), tenPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), tenPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::COLOR,Color::WHITE);
+ actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Repeat with a different (ease-in) alpha function
animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::EASE_IN);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// The color should have changed less, than with a linear alpha function
- Vector4 current(actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ));
- DALI_TEST_CHECK( current.x == 1.0f ); // doesn't change
- DALI_TEST_CHECK( current.y < 1.0f );
- DALI_TEST_CHECK( current.y > tenPercentProgress.y );
- DALI_TEST_CHECK( current.z < 1.0f );
- DALI_TEST_CHECK( current.z > tenPercentProgress.z );
- DALI_TEST_CHECK( current.w == 1.0f ); // doesn't change
+ Vector4 current(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR));
+ DALI_TEST_CHECK(current.x == 1.0f); // doesn't change
+ DALI_TEST_CHECK(current.y < 1.0f);
+ DALI_TEST_CHECK(current.y > tenPercentProgress.y);
+ DALI_TEST_CHECK(current.z < 1.0f);
+ DALI_TEST_CHECK(current.z > tenPercentProgress.z);
+ DALI_TEST_CHECK(current.w == 1.0f); // doesn't change
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
// Reset everything
finishCheck.Reset();
- actor.SetProperty( Actor::Property::COLOR,Color::WHITE);
+ actor.SetProperty(Actor::Property::COLOR, Color::WHITE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::WHITE, TEST_LOCATION);
// Repeat with a shorter animator duration
float animatorDuration = 0.5f;
- animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
+ animation = Animation::New(durationSeconds);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR), targetColor, AlphaFunction::LINEAR, TimePeriod(animatorDuration));
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% animation progress, 20% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% animation progress, 20% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), twentyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), twentyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 50% animation progress, 100% animator progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 50% animation progress, 100% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), targetColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), targetColor, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetRed(0.5f);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR_RED), targetRed );
+ float targetRed(0.5f);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR_RED), targetRed);
- float fiftyPercentProgress(startValue + (targetRed - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetRed - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( targetRed, startValue, startValue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_RED ), targetRed, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(targetRed, startValue, startValue, startValue), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).r, targetRed, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), targetRed, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).r, targetRed, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), targetRed, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetGreen(0.5f);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR_GREEN), targetGreen );
+ float targetGreen(0.5f);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR_GREEN), targetGreen);
- float fiftyPercentProgress(startValue + (targetGreen - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetGreen - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, targetGreen, startValue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_GREEN ), targetGreen, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, targetGreen, startValue, startValue), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).g, targetGreen, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).g, targetGreen, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), targetGreen, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetBlue(0.5f);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR_BLUE), targetBlue );
+ float targetBlue(0.5f);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR_BLUE), targetBlue);
- float fiftyPercentProgress(startValue + (targetBlue - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetBlue - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, targetBlue, startValue ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, targetBlue, startValue), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).b, targetBlue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), targetBlue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).b, targetBlue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), targetBlue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
float startValue(1.0f);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- float targetAlpha(0.5f);
- animation.AnimateTo( Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha );
+ float targetAlpha(0.5f);
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR_ALPHA), targetAlpha);
- float fiftyPercentProgress(startValue + (targetAlpha - startValue)*0.5f);
+ float fiftyPercentProgress(startValue + (targetAlpha - startValue) * 0.5f);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( Actor::Property::COLOR ), Vector4( startValue, startValue, startValue, targetAlpha ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::OPACITY ), targetAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(startValue, startValue, startValue, targetAlpha), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::OPACITY), targetAlpha, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, fiftyPercentProgress, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), fiftyPercentProgress, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, fiftyPercentProgress, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), fiftyPercentProgress, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, targetAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), targetAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, targetAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), targetAlpha, TEST_LOCATION);
END_TEST;
}
DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
- KeyFrames keyFrames2( keyFrames);
- DALI_TEST_CHECK( keyFrames2 );
+ KeyFrames keyFrames2(keyFrames);
+ DALI_TEST_CHECK(keyFrames2);
DALI_TEST_EQUALS(keyFrames2.GetType(), Property::FLOAT, TEST_LOCATION);
KeyFrames keyFrames3 = KeyFrames::New();
keyFrames3.Add(0.6f, true);
- DALI_TEST_CHECK( keyFrames3 );
+ DALI_TEST_CHECK(keyFrames3);
DALI_TEST_EQUALS(keyFrames3.GetType(), Property::BOOLEAN, TEST_LOCATION);
keyFrames3 = keyFrames;
- DALI_TEST_CHECK( keyFrames3 );
+ DALI_TEST_CHECK(keyFrames3);
DALI_TEST_EQUALS(keyFrames3.GetType(), Property::FLOAT, TEST_LOCATION);
END_TEST;
DALI_TEST_EQUALS(keyFrames.GetType(), Property::FLOAT, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- keyFrames.Add(1.9f, false);
- }, "mType == value.GetType()" );
+ {
+ keyFrames.Add(1.9f, false);
+ },
+ "mType == value.GetType()");
END_TEST;
}
DALI_TEST_EQUALS(keyFrames.GetType(), Property::BOOLEAN, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
- }, "mType == value.GetType()" );
+ {
+ keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
+ },
+ "mType == value.GetType()");
END_TEST;
}
DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR2, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
- }, "mType == value.GetType()" );
+ {
+ keyFrames.Add(0.7f, Vector3(1.0f, 1.0f, 1.0f));
+ },
+ "mType == value.GetType()");
END_TEST;
}
DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR3, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- keyFrames.Add(0.7f, 1.0f);
- }, "mType == value.GetType()" );
+ {
+ keyFrames.Add(0.7f, 1.0f);
+ },
+ "mType == value.GetType()");
END_TEST;
}
DALI_TEST_EQUALS(keyFrames.GetType(), Property::VECTOR4, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
- }, "mType == value.GetType()" );
+ {
+ keyFrames.Add(0.7f, Quaternion(Radian(1.717f), Vector3::XAXIS));
+ },
+ "mType == value.GetType()");
END_TEST;
}
DALI_TEST_EQUALS(keyFrames.GetType(), Property::ROTATION, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- keyFrames.Add(0.7f, 1.1f);
- }, "mType == value.GetType()" );
+ {
+ keyFrames.Add(0.7f, 1.1f);
+ },
+ "mType == value.GetType()");
END_TEST;
}
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.8f, 0.7f);
keyFrames.Add(1.0f, 0.9f);
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames);
// Start the animation
animation.Play();
// Final key frame value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.3f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.3f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.25f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.25f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.25f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.8f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.8f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.8f, 0.7f);
keyFrames.Add(1.0f, 0.9f);
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR_ALPHA), keyFrames, Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.1f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 10% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 10% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.36f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.36f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.36f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.36f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 30% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 30% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.21f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.21f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.21f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.21f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 40% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 40% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.0f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*400.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 400.0f) /* 80% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.7f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.7f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 90% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 90% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.76f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.76f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.76f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.76f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.9f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.9f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
AngleAxis aa(Degree(90), Vector3::XAXIS);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.8f, false);
keyFrames.Add(1.0f, true);
- animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames );
+ animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames);
// Start the animation
animation.Play();
// Final key frame value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
AngleAxis aa(Degree(90), Vector3::XAXIS);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(1.0f, true);
//Cubic interpolation for boolean values should be ignored
- animation.AnimateBetween( Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::VISIBLE), keyFrames, Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
AngleAxis aa(Degree(90), Vector3::XAXIS);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
Quaternion start(Radian(aa.angle), aa.axis);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
- animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
+ animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
// Start the animation
animation.Play();
// Final key frame value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< Quaternion >( Actor::Property::ORIENTATION ), Quaternion( Degree( 60 ), Vector3::ZAXIS ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Quaternion>(Actor::Property::ORIENTATION), Quaternion(Degree(60), Vector3::ZAXIS), TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
application.SendNotification();
- Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
+ Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
AngleAxis aa(Degree(90), Vector3::XAXIS);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
application.SendNotification();
application.Render(0);
application.GetScene().Add(actor);
Quaternion start(Radian(aa.angle), aa.axis);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, AngleAxis(Degree(120), Vector3::XAXIS));
keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
- animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames );
+ animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f) );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
// We did expect the animation to finish
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
AngleAxis aa(Degree(90), Vector3::XAXIS);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
Quaternion start(Radian(aa.angle), aa.axis);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, AngleAxis(Degree(60), Vector3::ZAXIS));
//Cubic interpolation should be ignored for quaternions
- animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)+1);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1);
application.SendNotification();
- Quaternion check( Radian(Degree(60)), Vector3::ZAXIS );
+ Quaternion check(Radian(Degree(60)), Vector3::ZAXIS);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
AngleAxis aa(Degree(90), Vector3::XAXIS);
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(aa.angle, aa.axis));
application.SendNotification();
application.Render(0);
application.GetScene().Add(actor);
Quaternion start(Radian(aa.angle), aa.axis);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), start, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), start, 0.001f, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(1.0f, AngleAxis(Degree(120), Vector3::YAXIS));
//Cubic interpolation should be ignored for quaternions
- animation.AnimateBetween( Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::ORIENTATION), keyFrames, Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
Quaternion check(Radian(Degree(60)), Vector3::XAXIS);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(90)), Vector3::XAXIS );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(90)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(120)), Vector3::XAXIS );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(120)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f ) );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(101.5)), Vector3(0.5f, 0.5f, 0.0f));
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- check = Quaternion( Radian(Degree(120)), Vector3::YAXIS );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), check, 0.001f, TEST_LOCATION );
+ check = Quaternion(Radian(Degree(120)), Vector3::YAXIS);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), check, 0.001f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
- float delay = 0.5f;
+ float durationSeconds(1.0f);
+ float delay = 0.5f;
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ) );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
- float delay = 0.5f;
+ float durationSeconds(1.0f);
+ float delay = 0.5f;
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod( delay, durationSeconds - delay ), Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
float delay = 0.5f;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ) );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.5f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.5f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.5f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.5f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.95f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.90f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.80f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.95f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.90f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.80f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
float startValue(1.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::COLOR,Vector4(startValue, startValue, startValue, startValue));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(startValue, startValue, startValue, startValue));
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), startValue, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
- float delay = 0.5f;
+ float durationSeconds(1.0f);
+ float delay = 0.5f;
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.5f, Vector4(0.9f, 0.8f, 0.7f, 0.6f));
keyFrames.Add(1.0f, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
- animation.AnimateBetween( Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod( delay, durationSeconds - delay ), Animation::CUBIC );
+ animation.AnimateBetween(Property(actor, Actor::Property::COLOR), keyFrames, AlphaFunction::LINEAR, TimePeriod(delay, durationSeconds - delay), Animation::CUBIC);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(delay*1000.0f)/* 0% progress */);
+ application.Render(static_cast<unsigned int>(delay * 1000.0f) /* 0% progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.1f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.2f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.3f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.1f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.2f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.3f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 25% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.55f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.525f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.506f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.4875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.55f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.525f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.506f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.4875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 50% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.9f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.8f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.7f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.6f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.9f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.8f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.7f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.6f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) /* 75% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 0.99375f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 0.925f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 0.85625f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 0.7875f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 0.99375f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 0.925f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 0.85625f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 0.7875f, 0.01f, TEST_LOCATION);
- application.Render(static_cast<unsigned int>((durationSeconds - delay)*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>((durationSeconds - delay) * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_RED ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_GREEN ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_BLUE ), 1.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::COLOR_ALPHA ), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_RED), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_GREEN), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_BLUE), 1.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::COLOR_ALPHA), 1.0f, 0.01f, TEST_LOCATION);
// We did expect the animation to finish
application.GetScene().Add(actor);
//Build the path
- Vector3 position0( 30.0, 80.0, 0.0);
- Vector3 position1( 70.0, 120.0, 0.0);
- Vector3 position2( 100.0, 100.0, 0.0);
+ Vector3 position0(30.0, 80.0, 0.0);
+ Vector3 position1(70.0, 120.0, 0.0);
+ Vector3 position2(100.0, 100.0, 0.0);
Dali::Path path = Dali::Path::New();
path.AddPoint(position0);
path.AddPoint(position2);
//Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
- path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+ path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
+ path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
//Control points for second segment
- path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
- path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+ path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
// Build the animation
- float durationSeconds( 1.0f );
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
animation.Animate(actor, path, Vector3::XAXIS);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- Vector3 position, tangent;
+ Vector3 position, tangent;
Quaternion rotation;
- path.Sample( 0.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- path.Sample( 0.25f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.25f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- path.Sample( 0.5f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.5f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- path.Sample( 0.75f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.75f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- path.Sample( 1.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(1.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
application.GetScene().Add(actor);
//Build the path
- Vector3 position0( 30.0, 80.0, 0.0);
- Vector3 position1( 70.0, 120.0, 0.0);
- Vector3 position2( 100.0, 100.0, 0.0);
+ Vector3 position0(30.0, 80.0, 0.0);
+ Vector3 position1(70.0, 120.0, 0.0);
+ Vector3 position2(100.0, 100.0, 0.0);
Dali::Path path = Dali::Path::New();
path.AddPoint(position0);
path.AddPoint(position2);
//Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
- path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+ path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
+ path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
//Control points for second segment
- path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
- path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+ path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
// Build the animation
- float durationSeconds( 1.0f );
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- Vector3 position, tangent;
+ Vector3 position, tangent;
Quaternion rotation;
- path.Sample( 0.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- path.Sample( 0.25f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.25f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- path.Sample( 0.5f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.5f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- path.Sample( 0.75f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.75f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- path.Sample( 1.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(1.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
application.GetScene().Add(actor);
//Build the path
- Vector3 position0( 30.0, 80.0, 0.0);
- Vector3 position1( 70.0, 120.0, 0.0);
- Vector3 position2( 100.0, 100.0, 0.0);
+ Vector3 position0(30.0, 80.0, 0.0);
+ Vector3 position1(70.0, 120.0, 0.0);
+ Vector3 position2(100.0, 100.0, 0.0);
Dali::Path path = Dali::Path::New();
path.AddPoint(position0);
path.AddPoint(position2);
//Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
- path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+ path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
+ path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
//Control points for second segment
- path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
- path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+ path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
// Build the animation
- float durationSeconds( 1.0f );
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
animation.Animate(actor, path, Vector3::XAXIS, TimePeriod(0.0f, 1.0f));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- Vector3 position, tangent;
+ Vector3 position, tangent;
Quaternion rotation;
- path.Sample( 0.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- path.Sample( 0.25f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.25f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- path.Sample( 0.5f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.5f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- path.Sample( 0.75f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.75f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- path.Sample( 1.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(1.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
application.GetScene().Add(actor);
//Build the path
- Vector3 position0( 30.0, 80.0, 0.0);
- Vector3 position1( 70.0, 120.0, 0.0);
- Vector3 position2( 100.0, 100.0, 0.0);
+ Vector3 position0(30.0, 80.0, 0.0);
+ Vector3 position1(70.0, 120.0, 0.0);
+ Vector3 position2(100.0, 100.0, 0.0);
Dali::Path path = Dali::Path::New();
path.AddPoint(position0);
path.AddPoint(position2);
//Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
- path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+ path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
+ path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
//Control points for second segment
- path.AddControlPoint(Vector3( 78.0, 120.0, 0.0));
- path.AddControlPoint(Vector3( 93.0, 104.0, 0.0));
+ path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
// Build the animation
- float durationSeconds( 1.0f );
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
animation.Animate(actor, path, Vector3::XAXIS, AlphaFunction::LINEAR, TimePeriod(0.0f, 1.0f));
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
application.Render(0);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- Vector3 position, tangent;
+ Vector3 position, tangent;
Quaternion rotation;
- path.Sample( 0.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
application.SendNotification();
- path.Sample( 0.25f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.25f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
application.SendNotification();
- path.Sample( 0.5f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.5f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
application.SendNotification();
- path.Sample( 0.75f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(0.75f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)+1/* 100% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1 /* 100% progress */);
application.SendNotification();
- path.Sample( 1.0f, position, tangent );
- rotation = Quaternion( Vector3::XAXIS, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::ORIENTATION ), rotation, TEST_LOCATION );
+ path.Sample(1.0f, position, tangent);
+ rotation = Quaternion(Vector3::XAXIS, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::ORIENTATION), rotation, TEST_LOCATION);
finishCheck.CheckSignalReceived();
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.GetScene().Add(actor);
// Start the animation
- float durationSeconds(10.0f);
+ float durationSeconds(10.0f);
Animation animation = Animation::New(durationSeconds);
- animation.Show(actor, durationSeconds*0.5f);
+ animation.Show(actor, durationSeconds * 0.5f);
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be shown now*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be shown now*/);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.GetScene().Add(actor);
// Start the animation
- float durationSeconds(10.0f);
+ float durationSeconds(10.0f);
Animation animation = Animation::New(durationSeconds);
- animation.Hide(actor, durationSeconds*0.5f);
+ animation.Hide(actor, durationSeconds * 0.5f);
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*490.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * 490.0f));
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*10.0f)/*Should be hidden now*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 10.0f) /*Should be hidden now*/);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
application.GetScene().Add(actor);
// Start Hide animation
- float durationSeconds(10.0f);
+ float durationSeconds(10.0f);
Animation animation = Animation::New(durationSeconds);
- animation.Hide(actor, durationSeconds/*Hide at end*/);
+ animation.Hide(actor, durationSeconds /*Hide at end*/);
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( !actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(!actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
// Start Show animation
animation = Animation::New(durationSeconds);
- animation.Show(actor, durationSeconds/*Show at end*/);
+ animation.Show(actor, durationSeconds /*Show at end*/);
animation.FinishedSignal().Connect(&application, finishCheck);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*1000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_CHECK( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) );
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
END_TEST;
}
KeyFrames* keyFrames = new KeyFrames;
delete keyFrames;
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
TestApplication application;
tet_infoline("Testing Dali::Animation::KeyFramesDownCast()");
- KeyFrames keyFrames = KeyFrames::New();
+ KeyFrames keyFrames = KeyFrames::New();
BaseHandle object(keyFrames);
KeyFrames keyFrames2 = KeyFrames::DownCast(object);
DALI_TEST_CHECK(keyFrames2);
- KeyFrames keyFrames3 = DownCast< KeyFrames >(object);
+ KeyFrames keyFrames3 = DownCast<KeyFrames>(object);
DALI_TEST_CHECK(keyFrames3);
BaseHandle unInitializedObject;
- KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
+ KeyFrames keyFrames4 = KeyFrames::DownCast(unInitializedObject);
DALI_TEST_CHECK(!keyFrames4);
- KeyFrames keyFrames5 = DownCast< KeyFrames >(unInitializedObject);
+ KeyFrames keyFrames5 = DownCast<KeyFrames>(unInitializedObject);
DALI_TEST_CHECK(!keyFrames5);
END_TEST;
}
int UtcDaliAnimationCreateDestroyP(void)
{
TestApplication application;
- Animation* animation = new Animation;
- DALI_TEST_CHECK( animation );
+ Animation* animation = new Animation;
+ DALI_TEST_CHECK(animation);
delete animation;
END_TEST;
}
{
}
- void operator()( Vector3& current, const PropertyInputContainer& /* inputs */)
+ void operator()(Vector3& current, const PropertyInputContainer& /* inputs */)
{
- mApplication.SendNotification(); // Process events
+ mApplication.SendNotification(); // Process events
}
TestApplication& mApplication;
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Build the animation
- Animation animation = Animation::New( 0.0f );
+ Animation animation = Animation::New(0.0f);
- bool signalReceived = false;
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived = false;
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
- Vector3 startValue(1.0f, 1.0f, 1.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
- Constraint constraint = Constraint::New<Vector3>( actor, index, UpdateManagerTestConstraint( application ) );
+ Vector3 startValue(1.0f, 1.0f, 1.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
+ Constraint constraint = Constraint::New<Vector3>(actor, index, UpdateManagerTestConstraint(application));
constraint.Apply();
// Apply animation to actor
- animation.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 100.f, 90.f, 80.f ), AlphaFunction::LINEAR );
- animation.AnimateTo( Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(100.f, 90.f, 80.f), AlphaFunction::LINEAR);
+ animation.AnimateTo(Property(actor, Actor::Property::OPACITY), 0.3f, AlphaFunction::LINEAR);
animation.Play();
application.SendNotification();
- application.UpdateOnly( 16 );
+ application.UpdateOnly(16);
finishCheck.CheckSignalNotReceived();
- application.SendNotification(); // Process events
+ application.SendNotification(); // Process events
finishCheck.CheckSignalReceived();
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Build the animations
- Animation animation1 = Animation::New( 0.0f ); // finishes first frame
- Animation animation2 = Animation::New( 0.02f ); // finishes in 20 ms
+ Animation animation1 = Animation::New(0.0f); // finishes first frame
+ Animation animation2 = Animation::New(0.02f); // finishes in 20 ms
bool signal1Received = false;
- animation1.FinishedSignal().Connect( &application, AnimationFinishCheck( signal1Received ) );
+ animation1.FinishedSignal().Connect(&application, AnimationFinishCheck(signal1Received));
bool signal2Received = false;
- animation2.FinishedSignal().Connect( &application, AnimationFinishCheck( signal2Received ) );
+ animation2.FinishedSignal().Connect(&application, AnimationFinishCheck(signal2Received));
// Apply animations to actor
- animation1.AnimateTo( Property(actor, Actor::Property::POSITION), Vector3( 3.0f, 2.0f, 1.0f ), AlphaFunction::LINEAR );
+ animation1.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(3.0f, 2.0f, 1.0f), AlphaFunction::LINEAR);
animation1.Play();
- animation2.AnimateTo( Property(actor, Actor::Property::SIZE ), Vector3( 10.0f, 20.0f, 30.0f ), AlphaFunction::LINEAR );
+ animation2.AnimateTo(Property(actor, Actor::Property::SIZE), Vector3(10.0f, 20.0f, 30.0f), AlphaFunction::LINEAR);
animation2.Play();
- DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
- DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
application.SendNotification();
- application.UpdateOnly( 10 ); // 10ms progress
+ application.UpdateOnly(10); // 10ms progress
// no notifications yet
- DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
- DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
application.SendNotification();
// first completed
- DALI_TEST_EQUALS( signal1Received, true, TEST_LOCATION );
- DALI_TEST_EQUALS( signal2Received, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(signal1Received, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(signal2Received, false, TEST_LOCATION);
signal1Received = false;
// 1st animation is complete now, do another update with no ProcessEvents in between
- application.UpdateOnly( 20 ); // 20ms progress
+ application.UpdateOnly(20); // 20ms progress
// ProcessEvents
application.SendNotification();
// 2nd should complete now
- DALI_TEST_EQUALS( signal1Received, false, TEST_LOCATION );
- DALI_TEST_EQUALS( signal2Received, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(signal1Received, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(signal2Received, true, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register a float property
- float startValue(10.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ float startValue(10.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<float>(index), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
// Build the animation
- float initialDurationSeconds(1.0f);
- float animatorDelay = 5.0f;
- float animatorDurationSeconds(5.0f);
- float extendedDurationSeconds(animatorDelay+animatorDurationSeconds);
+ float initialDurationSeconds(1.0f);
+ float animatorDelay = 5.0f;
+ float animatorDurationSeconds(5.0f);
+ float extendedDurationSeconds(animatorDelay + animatorDurationSeconds);
Animation animation = Animation::New(initialDurationSeconds);
- float targetValue(30.0f);
- float relativeValue(targetValue - startValue);
+ float targetValue(30.0f);
+ float relativeValue(targetValue - startValue);
animation.AnimateTo(Property(actor, index),
targetValue,
TimePeriod(animatorDelay, animatorDurationSeconds));
// The duration should have been extended
- DALI_TEST_EQUALS( animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetDuration(), extendedDurationSeconds, TEST_LOCATION);
// Start the animation
animation.Play();
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(extendedDurationSeconds*500.0f)/* 50% animation progress, 0% animator progress */);
+ application.Render(static_cast<unsigned int>(extendedDurationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet, but cached value should be the final one
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f)/* 75% animation progress, 50% animator progress */);
+ application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue+(relativeValue*0.5f), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue + (relativeValue * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(extendedDurationSeconds*250.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(extendedDurationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), targetValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), targetValue, TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
int startValue(0u);
- Property::Index index = actor.RegisterProperty("anIndex", startValue);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), startValue, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
+ Property::Index index = actor.RegisterProperty("anIndex", startValue);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), startValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.AnimateTo( Property(actor, index), 20 );
+ animation.AnimateTo(Property(actor, index), 20);
// Start the animation
animation.Play();
// Target value should be retrievable straight away
- DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f)/* 50% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 10, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< int >( index ), 20, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 20, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<int>(index), 20, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), 20, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- Animation animation = Animation::New( 0.0f );
- DALI_TEST_EQUALS( 0.0f, animation.GetDuration(), TEST_LOCATION );
+ Animation animation = Animation::New(0.0f);
+ DALI_TEST_EQUALS(0.0f, animation.GetDuration(), TEST_LOCATION);
// The animation duration should automatically increase depending on the animator time period
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 0.0f, 1.0f ) );
- DALI_TEST_EQUALS( 1.0f, animation.GetDuration(), TEST_LOCATION );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(0.0f, 1.0f));
+ DALI_TEST_EQUALS(1.0f, animation.GetDuration(), TEST_LOCATION);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_Y ), 200.0f, TimePeriod( 10.0f, 1.0f ) );
- DALI_TEST_EQUALS( 11.0f, animation.GetDuration(), TEST_LOCATION );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_Y), 200.0f, TimePeriod(10.0f, 1.0f));
+ DALI_TEST_EQUALS(11.0f, animation.GetDuration(), TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(1);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- // Build the animation
- Animation animation = Animation::New( 2.0f );
- std::string relativeValue = "relative string";
- animation.AnimateBy( Property(actor, index), relativeValue );
- tet_result(TET_FAIL);
- }, "Target value is not animatable" );
+ {
+ // Build the animation
+ Animation animation = Animation::New(2.0f);
+ std::string relativeValue = "relative string";
+ animation.AnimateBy(Property(actor, index), relativeValue);
+ tet_result(TET_FAIL);
+ },
+ "Target value is not animatable");
END_TEST;
}
-
int UtcDaliAnimationAnimateToNonAnimateableTypeN(void)
{
TestApplication application;
Actor actor = Actor::New();
// Register an integer property
- int startValue(1);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- // Build the animation
- Animation animation = Animation::New( 2.0f );
- std::string relativeValue = "relative string";
- animation.AnimateTo( Property(actor, index), relativeValue );
- }, "Target value is not animatable" );
+ {
+ // Build the animation
+ Animation animation = Animation::New(2.0f);
+ std::string relativeValue = "relative string";
+ animation.AnimateTo(Property(actor, index), relativeValue);
+ },
+ "Target value is not animatable");
END_TEST;
}
Actor actor = Actor::New();
// Register an integer property
- int startValue(1);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
+ int startValue(1);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( actor.GetProperty<int>(index), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
DALI_TEST_ASSERTION(
- {
- // Build the animation
- KeyFrames keyFrames = KeyFrames::New();
- keyFrames.Add( 0.0f, std::string("relative string1") );
- keyFrames.Add( 1.0f, std::string("relative string2") );
- // no need to really create the animation as keyframes do the check
- }, "Property type is not animatable" );
+ {
+ // Build the animation
+ KeyFrames keyFrames = KeyFrames::New();
+ keyFrames.Add(0.0f, std::string("relative string1"));
+ keyFrames.Add(1.0f, std::string("relative string2"));
+ // no need to really create the animation as keyframes do the check
+ },
+ "Property type is not animatable");
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
Vector3 initialPosition(0.0f, 0.0f, 0.0f);
- actor.SetProperty( Actor::Property::POSITION, initialPosition );
+ actor.SetProperty(Actor::Property::POSITION, initialPosition);
// Build the animation
Animation animation = Animation::New(2.0f);
//Test GetCurrentProgress return 0.0 as the duration is 0.0
- DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
tet_infoline("Set target position in animation without intiating play");
tet_infoline("Ensure position of actor is still at intial value");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
tet_infoline("Play animation and ensure actor position is now target");
tet_infoline("Ensure position of actor is at target value when aninmation half way");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
- tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
+ tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
application.Render(2000u);
tet_infoline("Ensure position of actor is still at target value when aninmation complete");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPosition.z, TEST_LOCATION);
END_TEST;
}
std::vector<Vector3> targetPositions;
- targetPositions.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
- targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
- targetPositions.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
+ targetPositions.push_back(Vector3(100.0f, 100.0f, 100.0f));
+ targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
+ targetPositions.push_back(Vector3(50.0f, 10.0f, 100.0f));
tet_infoline("Set initial position and set up animation to re-position actor");
Actor actor = Actor::New();
application.GetScene().Add(actor);
Vector3 initialPosition(0.0f, 0.0f, 0.0f);
- actor.SetProperty( Actor::Property::POSITION, initialPosition );
+ actor.SetProperty(Actor::Property::POSITION, initialPosition);
// Build the animation
Animation animation = Animation::New(2.0f);
//Test GetCurrentProgress return 0.0 as the duration is 0.0
- DALI_TEST_EQUALS( 0.0f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3( 0.0f, 0.0f, 0.0f ), actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.0f, animation.GetCurrentProgress(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 0.0f), actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
tet_infoline("Set target position in animation without intiating play");
- for ( unsigned int i = 0; i < targetPositions.size(); i++ )
+ for(unsigned int i = 0; i < targetPositions.size(); i++)
{
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPositions[i], AlphaFunction::LINEAR);
}
tet_infoline("Ensure position of actor is still at intial value");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), initialPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), initialPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), initialPosition.z, TEST_LOCATION);
tet_infoline("Play animation and ensure actor position is now target");
tet_infoline("Ensure position of actor is at target value when aninmation half way");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
- tet_printf( "x position at half way point(%f)\n", actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ).x );
+ tet_printf("x position at half way point(%f)\n", actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION).x);
application.Render(2000u);
tet_infoline("Ensure position of actor is still at target value when aninmation complete");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[2].x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[2].y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[2].z, TEST_LOCATION);
END_TEST;
}
std::vector<Vector3> targetSizes;
std::vector<Vector3> targetPositions;
- targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
- targetSizes.push_back( Vector3( 50.0f, 10.0f, 100.0f ) );
+ targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
+ targetSizes.push_back(Vector3(50.0f, 10.0f, 100.0f));
- targetPositions.push_back( Vector3( 200.0f, 1.0f, 100.0f ) );
+ targetPositions.push_back(Vector3(200.0f, 1.0f, 100.0f));
tet_infoline("Set initial position and set up animation to re-position actor");
Actor actor = Actor::New();
application.GetScene().Add(actor);
- Vector3 initialSize( 10.0f, 10.0f, 10.0f);
+ Vector3 initialSize(10.0f, 10.0f, 10.0f);
Vector3 initialPosition(10.0f, 10.0f, 10.0f);
- actor.SetProperty( Actor::Property::SIZE, initialSize );
- actor.SetProperty( Actor::Property::POSITION, initialPosition );
+ actor.SetProperty(Actor::Property::SIZE, initialSize);
+ actor.SetProperty(Actor::Property::POSITION, initialPosition);
// Build the animation
Animation animation = Animation::New(2.0f);
tet_infoline("Ensure position of actor is still at intial size and position");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialPosition.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialPosition.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialPosition.z, TEST_LOCATION);
tet_infoline("Play animation and ensure actor position and size is now matches targets");
tet_infoline("Ensure position and size of actor is at target value when aninmation playing");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), targetPositions[0].x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Y), targetPositions[0].y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_Z), targetPositions[0].z, TEST_LOCATION);
END_TEST;
}
TestApplication application;
std::vector<Vector3> targetSizes;
- std::vector<float> targetColors;
+ std::vector<float> targetColors;
- targetSizes.push_back( Vector3( 100.0f, 100.0f, 100.0f ) );
- targetSizes.push_back( Vector3( 50.0f, 10.0f, 150.0f ) );
+ targetSizes.push_back(Vector3(100.0f, 100.0f, 100.0f));
+ targetSizes.push_back(Vector3(50.0f, 10.0f, 150.0f));
- targetColors.push_back( 1.0f );
+ targetColors.push_back(1.0f);
tet_infoline("Set initial position and set up animation to re-position actor");
Actor actor = Actor::New();
application.GetScene().Add(actor);
- Vector3 initialSize( 10.0f, 5.0f, 10.0f);
+ Vector3 initialSize(10.0f, 5.0f, 10.0f);
- actor.SetProperty( Actor::Property::SIZE, initialSize );
+ actor.SetProperty(Actor::Property::SIZE, initialSize);
// Build the animation
Animation animation = Animation::New(2.0f);
tet_infoline("Ensure position of actor is still at initial size and position");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), initialSize.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), initialSize.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), initialSize.z, TEST_LOCATION);
tet_infoline("Play animation and ensure actor position and size is now matches targets");
tet_infoline("Ensure position and size of actor is at target value when animation playing");
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_WIDTH), targetSizes[1].x, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_HEIGHT), targetSizes[1].y, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::SIZE_DEPTH), targetSizes[1].z, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), targetColors[0], TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationTimePeriodOrder(void)
{
- tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place" );
+ tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place");
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
//////////////////////////////////////////////////////////////////////////////////
- tet_infoline( "With two AnimateTo calls" );
+ tet_infoline("With two AnimateTo calls");
- Animation animation = Animation::New( 0.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
+ Animation animation = Animation::New(0.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
animation.Play();
- tet_infoline( "The target position should change instantly" );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+ tet_infoline("The target position should change instantly");
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
application.SendNotification();
application.Render(5000); // After the animation is complete
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
//////////////////////////////////////////////////////////////////////////////////
- tet_infoline( "Same animation again but in a different order - should yield the same result" );
+ tet_infoline("Same animation again but in a different order - should yield the same result");
- actor.SetProperty( Actor::Property::POSITION_X, 0.0f );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
- animation = Animation::New( 0.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 1.0f, 1.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f, TimePeriod( 3.0f, 1.0f ) );
+ animation = Animation::New(0.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(1.0f, 1.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f, TimePeriod(3.0f, 1.0f));
animation.Play();
- tet_infoline( "The target position should change instantly" );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+ tet_infoline("The target position should change instantly");
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
application.SendNotification();
application.Render(5000); // After the animation is complete
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 100.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 100.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationTimePeriodOrderSeveralAnimateToCalls(void)
{
- tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls" );
+ tet_infoline("Animate the same property with different time periods and ensure it runs correctly and ends up in the right place with several AnimateTo calls");
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
//////////////////////////////////////////////////////////////////////////////////
- tet_infoline( "" );
+ tet_infoline("");
- Animation animation = Animation::New( 0.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
+ Animation animation = Animation::New(0.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
animation.Play();
- tet_infoline( "The target position should change instantly" );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+ tet_infoline("The target position should change instantly");
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
application.SendNotification();
application.Render(14000); // After the animation is complete
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
//////////////////////////////////////////////////////////////////////////////////
- tet_infoline( "Same animation again but in a different order - should end up at the same point" );
+ tet_infoline("Same animation again but in a different order - should end up at the same point");
- actor.SetProperty( Actor::Property::POSITION_X, 0.0f );
+ actor.SetProperty(Actor::Property::POSITION_X, 0.0f);
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 0.0f, TEST_LOCATION);
- animation = Animation::New( 0.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 200.0f, TimePeriod( 2.0f, 5.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 10.0f, TimePeriod( 10.0f, 2.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 145.0f, TimePeriod( 3.0f, 10.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1000.0f, TimePeriod( 4.0f, 2.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 1.0f, TimePeriod( 3.0f, 4.0f ) );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 109.0f, TimePeriod( 1.0f, 1.0f ) );
+ animation = Animation::New(0.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 200.0f, TimePeriod(2.0f, 5.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 10.0f, TimePeriod(10.0f, 2.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 145.0f, TimePeriod(3.0f, 10.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1000.0f, TimePeriod(4.0f, 2.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 1.0f, TimePeriod(3.0f, 4.0f));
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 109.0f, TimePeriod(1.0f, 1.0f));
animation.Play();
- tet_infoline( "The target position should change instantly" );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+ tet_infoline("The target position should change instantly");
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
application.SendNotification();
application.Render(14000); // After the animation is complete
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 145.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( Actor::Property::POSITION_X ), 145.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(145.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(Actor::Property::POSITION_X), 145.0f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- int startValue(1);
- Actor actor = Actor::New();
- const Property::Index index = actor.RegisterProperty("customProperty", startValue );
+ int startValue(1);
+ Actor actor = Actor::New();
+ const Property::Index index = actor.RegisterProperty("customProperty", startValue);
application.GetScene().Add(actor);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetProperty< int >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.8f, 50);
keyFrames.Add(1.0f, 60);
- animation.AnimateBetween( Property(actor, index ), keyFrames );
+ animation.AnimateBetween(Property(actor, index), keyFrames);
// Start the animation
animation.Play();
// Target value should change to the last key-frame's value straight away
- DALI_TEST_EQUALS( actor.GetProperty< int >( index ), 60, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<int>(index), 60, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Vector2 startValue( 10.0f, 20.0f );
- Actor actor = Actor::New();
- const Property::Index index = actor.RegisterProperty("customProperty", startValue );
+ Vector2 startValue(10.0f, 20.0f);
+ Actor actor = Actor::New();
+ const Property::Index index = actor.RegisterProperty("customProperty", startValue);
application.GetScene().Add(actor);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), startValue, TEST_LOCATION);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
KeyFrames keyFrames = KeyFrames::New();
- keyFrames.Add( 0.0f, Vector2( 0.0f, 5.0f ) );
- keyFrames.Add( 0.2f, Vector2( 30.0f, 25.0f ) );
- keyFrames.Add( 0.4f, Vector2( 40.0f, 35.0f ) );
- keyFrames.Add( 0.6f, Vector2( 50.0f, 45.0f ) );
- keyFrames.Add( 0.8f, Vector2( 60.0f, 55.0f ) );
- keyFrames.Add( 1.0f, Vector2( 70.0f, 65.0f ) );
+ keyFrames.Add(0.0f, Vector2(0.0f, 5.0f));
+ keyFrames.Add(0.2f, Vector2(30.0f, 25.0f));
+ keyFrames.Add(0.4f, Vector2(40.0f, 35.0f));
+ keyFrames.Add(0.6f, Vector2(50.0f, 45.0f));
+ keyFrames.Add(0.8f, Vector2(60.0f, 55.0f));
+ keyFrames.Add(1.0f, Vector2(70.0f, 65.0f));
- animation.AnimateBetween( Property(actor, index ), keyFrames );
+ animation.AnimateBetween(Property(actor, index), keyFrames);
// Start the animation
animation.Play();
// Target value should change to the last key-frame's value straight away
- DALI_TEST_EQUALS( actor.GetProperty< Vector2 >( index ), Vector2( 70.0f, 65.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector2>(index), Vector2(70.0f, 65.0f), TEST_LOCATION);
END_TEST;
}
animation.FinishedSignal().Connect(&application, finishCheck);
AnimationProgressCheck progressCheck(progressSignalReceived);
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "Animation Progress notification set to 30%" );
- DevelAnimation::SetProgressNotification( animation, 0.3f );
+ tet_infoline("Animation Progress notification set to 30%");
+ DevelAnimation::SetProgressNotification(animation, 0.3f);
application.SendNotification();
- application.Render( );
+ application.Render();
- DALI_TEST_EQUALS( 0.3f, DevelAnimation::GetProgressNotification( animation ), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.3f, DevelAnimation::GetProgressNotification(animation), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
// Start the animation from 10% progress
- animation.SetCurrentProgress( 0.1f );
+ animation.SetCurrentProgress(0.1f);
animation.Play();
- tet_infoline( "Animation Playing from 10%" );
+ tet_infoline("Animation Playing from 10%");
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*100.0f ); // 20% progress
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 100.0f); // 20% progress
- tet_infoline( "Animation at 20%" );
+ tet_infoline("Animation at 20%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*200.0f ); // 40% progress
+ application.Render(durationSeconds * 200.0f); // 40% progress
application.SendNotification();
- tet_infoline( "Animation at 40%" );
- DALI_TEST_EQUALS( 0.4f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 40%");
+ DALI_TEST_EQUALS(0.4f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheck.Reset();
- application.Render(durationSeconds*100.0f ); // 50% progress
- tet_infoline( "Animation at 50%" );
+ application.Render(durationSeconds * 100.0f); // 50% progress
+ tet_infoline("Animation at 50%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
application.SendNotification();
- tet_infoline( "Animation at 60%" );
+ tet_infoline("Animation at 60%");
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
application.SendNotification();
- DALI_TEST_EQUALS( 0.8f, animation.GetCurrentProgress(), TEST_LOCATION );
- tet_infoline( "Animation at 80%" );
+ DALI_TEST_EQUALS(0.8f, animation.GetCurrentProgress(), TEST_LOCATION);
+ tet_infoline("Animation at 80%");
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- tet_infoline( "Animation finished" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ tet_infoline("Animation finished");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
// Play animation after the initial delay time
- animation.PlayAfter( 0.2f );
+ animation.PlayAfter(0.2f);
application.SendNotification();
application.Render(0); // start animation
- application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
tet_printf("Testing that playing after 2 seconds with negative speedfactor\n");
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetSpeedFactor( -1.0f ); // Set SpeedFactor as < 0
+ animation.SetSpeedFactor(-1.0f); // Set SpeedFactor as < 0
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
// Play animation after the initial delay time
- animation.PlayAfter( 0.2f );
+ animation.PlayAfter(0.2f);
application.SendNotification();
application.Render(0); // start animation
- application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) + 1u/*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of Timeperiod in seconds
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of Timeperiod in seconds
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
}
END_TEST;
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetLooping( true );
+ animation.SetLooping(true);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
// Play animation after the initial delay time
- animation.PlayAfter( 0.2f );
+ animation.PlayAfter(0.2f);
application.SendNotification();
application.Render(0); // start animation
- for( int iterations = 0; iterations < 3; ++iterations )
+ for(int iterations = 0; iterations < 3; ++iterations)
{
// The initial delay time of PlayAfter() applies only once in looping mode.
- if( iterations == 0 )
+ if(iterations == 0)
{
- application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move
}
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) /* 100% progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
animation.SetLooping(false);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
tet_printf("Testing that playing after 2 seconds before looping with negative speedfactor\n");
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- animation.SetLooping( true );
- animation.SetSpeedFactor( -1.0f ); //Set SpeedFactor as < 0
+ animation.SetLooping(true);
+ animation.SetSpeedFactor(-1.0f); //Set SpeedFactor as < 0
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
// Play animation after the initial delay time
- animation.PlayAfter( 0.2f );
+ animation.PlayAfter(0.2f);
application.SendNotification();
application.Render(0); // start animation
- for( int iterations = 0; iterations < 3; ++iterations )
+ for(int iterations = 0; iterations < 3; ++iterations)
{
// The initial delay time of PlayAfter() applies only once in looping mode.
- if( iterations == 0 )
+ if(iterations == 0)
{
- application.Render( durationSeconds * 200.f ); // The intial delay time of PlayAfter
+ application.Render(durationSeconds * 200.f); // The intial delay time of PlayAfter
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 1.0f ), TEST_LOCATION ); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 1.0f), TEST_LOCATION); // Not move. NOTE SpeedFactor < 0 so 'targetPosition' is start position.
}
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 25% animation progress, 50% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% animation progress, 50% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 50% animation progress, 100% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% animation progress, 100% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f ) /* 100% progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% progress */);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in second
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in second
}
animation.SetLooping(false);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3(0.0, 0.0, 0.0), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0, 0.0, 0.0), TEST_LOCATION);
}
END_TEST;
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
// When the delay time is negative value, it would treat as play immediately.
- animation.PlayAfter( -2.0f );
+ animation.PlayAfter(-2.0f);
application.SendNotification();
application.Render(0); // start animation
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% animation progress, 0% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 75% animation progress, 50% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% animation progress, 50% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.5f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.5f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f ) + 1u/*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
application.GetScene().Add(actor);
// Build the animation
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Animation animation = Animation::New(durationSeconds);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
- Vector3 targetPosition( 100.0f, 100.0f, 100.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR, TimePeriod( 0.5f, 0.5f ) );
+ Vector3 targetPosition(100.0f, 100.0f, 100.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR, TimePeriod(0.5f, 0.5f));
// Delay time is 0.3s. So after duration times, progress must be 70%. animation will finished at 1.3s.
- animation.PlayAfter( durationSeconds * 0.3f );
+ animation.PlayAfter(durationSeconds * 0.3f);
application.SendNotification();
application.Render(0); // start animation
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 5/6 delay progress, 0% animation progress, 0% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 5/6 delay progress, 0% animation progress, 0% animator progress */);
// We didn't expect the animation to finish yet
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of PlayAfter
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of PlayAfter
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 20% animation progress, 0% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 20% animation progress, 0% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 45% animation progress, 0% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 45% animation progress, 0% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.0f ), TEST_LOCATION ); // Not move - A delay time of TimePeriod in seconds
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.0f), TEST_LOCATION); // Not move - A delay time of TimePeriod in seconds
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 70% animation progress, 40% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 70% animation progress, 40% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.4f ), TEST_LOCATION ); // 40% of animator progress
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.4f), TEST_LOCATION); // 40% of animator progress
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 250.0f )/* 100% delay progress, 95% animation progress, 90% animator progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% delay progress, 95% animation progress, 90% animator progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), ( targetPosition * 0.9f ), TEST_LOCATION ); // 90% of animator progress
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), (targetPosition * 0.9f), TEST_LOCATION); // 90% of animator progress
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 50.0f ) + 1u/*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 50.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// Check that nothing has changed after a couple of buffer swaps
application.Render(0);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationSetLoopingModeP(void)
{
// Test Loop forever and Loop mode being set
- TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
// Default: LoopingMode::RESTART
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
Vector3 targetPosition(10.0f, 10.0f, 10.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*0.5f*1000.0f)/*Only half the animation*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /*Only half the animation*/);
actor.Unparent();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
// LoopingMode::AUTO_REVERSE
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
- animation.SetLooping( true );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetLooping(true);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
- animation.SetLoopingMode( Animation::LoopingMode::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::LoopingMode::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
// Start the animation
animation.Play();
application.SendNotification();
application.Render(0);
- for( int iterations = 0; iterations < 3; ++iterations )
+ for(int iterations = 0; iterations < 3; ++iterations)
{
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
// and arrives at the beginning.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
}
- animation.SetLooping( false );
+ animation.SetLooping(false);
application.SendNotification();
- application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
}
// LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
- animation.SetLooping( true );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetLooping(true);
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
// Specify a negative multiplier to play the animation in reverse
- animation.SetSpeedFactor( -1.0f );
+ animation.SetSpeedFactor(-1.0f);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
- animation.SetLoopingMode( Animation::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
// Start the animation
animation.Play();
application.SendNotification();
application.Render(0);
- for( int iterations = 0; iterations < 3; ++iterations )
+ for(int iterations = 0; iterations < 3; ++iterations)
{
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 50% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 50% time progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// Setting a negative speed factor is to play the animation in reverse.
// So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
// the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 500.0f )/* 100% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 500.0f) /* 100% time progress */);
// We did expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
- animation.SetLooping( false );
+ animation.SetLooping(false);
application.SendNotification();
- application.Render(static_cast< unsigned int >( durationSeconds * 1000.0f ) + 1u /*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
}
END_TEST;
int UtcDaliAnimationSetLoopingModeP2(void)
{
// Test Loop Count and Loop mode being set
- TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
// LoopingMode::AUTO_REVERSE
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
animation.SetLoopCount(3);
DALI_TEST_CHECK(animation.IsLooping());
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
- animation.SetLoopingMode( Animation::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
// Start the animation
animation.Play();
// Loop
float intervalSeconds = 3.0f;
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
// AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
// and arrives at the beginning.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.Render(0);
application.SendNotification();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
finishCheck.Reset();
}
// LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
animation.SetLoopCount(3);
DALI_TEST_CHECK(animation.IsLooping());
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
// Specify a negative multiplier to play the animation in reverse
- animation.SetSpeedFactor( -1.0f );
+ animation.SetSpeedFactor(-1.0f);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
- animation.SetLoopingMode( Animation::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
// Start the animation
animation.Play();
// Loop
float intervalSeconds = 3.0f;
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
// Setting a negative speed factor is to play the animation in reverse.
// So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
// the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.Render(0);
application.SendNotification();
application.SendNotification();
finishCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*intervalSeconds*1000.0f));
+ application.Render(static_cast<unsigned int>(durationSeconds * intervalSeconds * 1000.0f));
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
finishCheck.Reset();
}
int UtcDaliAnimationSetLoopingModeP3(void)
{
// Test Loop Count is 1 (== default) and Loop mode being set
- TestApplication application;
- Integration::Scene stage( application.GetScene() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
// LoopingMode::AUTO_REVERSE
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
DALI_TEST_CHECK(1 == animation.GetLoopCount());
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
- animation.SetLoopingMode( Animation::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
// Start the animation
animation.Play();
application.Render(0);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// AUTO_REVERSE mode means, for Animation duration time, the actor starts from the beginning, passes the targetPosition,
// and arrives at the beginning.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
application.Render(0);
finishCheck.CheckSignalReceived();
// After all animation finished, arrives at the beginning.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
finishCheck.Reset();
}
// LoopingMode::AUTO_REVERSE in Reverse mode, which begin from the end
{
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- float durationSeconds( 1.0f );
- Animation animation = Animation::New( durationSeconds );
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
DALI_TEST_CHECK(1 == animation.GetLoopCount());
- bool signalReceived( false );
- AnimationFinishCheck finishCheck( signalReceived );
- animation.FinishedSignal().Connect( &application, finishCheck );
+ bool signalReceived(false);
+ AnimationFinishCheck finishCheck(signalReceived);
+ animation.FinishedSignal().Connect(&application, finishCheck);
application.SendNotification();
// Specify a negative multiplier to play the animation in reverse
- animation.SetSpeedFactor( -1.0f );
+ animation.SetSpeedFactor(-1.0f);
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition );
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition);
- animation.SetLoopingMode( Animation::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
// Start the animation
animation.Play();
application.Render(0);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 50% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 50% time progress */);
application.SendNotification();
finishCheck.CheckSignalNotReceived();
// Setting a negative speed factor is to play the animation in reverse.
// So, when LoopingMode::AUTO_REVERSE and SetSpeedFactor( -1.0f ) is, for Animation duration time,
// the actor starts from the targetPosition, passes the beginning, and arrives at the targetPosition.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 0.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 0.5f * 1000.0f )/* 100% time progress */ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 0.5f * 1000.0f) /* 100% time progress */);
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
application.SendNotification();
- application.Render( static_cast< unsigned int >( durationSeconds * 1.0f * 1000.0f ) + 1u /*just beyond the animation duration*/ );
+ application.Render(static_cast<unsigned int>(durationSeconds * 1.0f * 1000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
application.Render(0);
finishCheck.CheckSignalReceived();
// After all animation finished, arrives at the target.
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
finishCheck.Reset();
}
Animation animation = Animation::New(1.0f);
// default mode
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::RESTART );
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::RESTART);
- animation.SetLoopingMode( Animation::AUTO_REVERSE );
- DALI_TEST_CHECK( animation.GetLoopingMode() == Animation::AUTO_REVERSE );
+ animation.SetLoopingMode(Animation::AUTO_REVERSE);
+ DALI_TEST_CHECK(animation.GetLoopingMode() == Animation::AUTO_REVERSE);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Connect to ProgressReachedSignal but do not set a required Progress marker" );
+ tet_infoline("Connect to ProgressReachedSignal but do not set a required Progress marker");
Actor actor = Actor::New();
application.GetScene().Add(actor);
AnimationFinishCheck finishCheck(finishedSignalReceived);
animation.FinishedSignal().Connect(&application, finishCheck);
- AnimationProgressCheck progressCheck( progressSignalReceived );
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ AnimationProgressCheck progressCheck(progressSignalReceived);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.Play();
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*100.0f ); // 10% progress
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 100.0f); // 10% progress
application.SendNotification();
- tet_infoline( "Ensure after animation has started playing that ProgressReachedSignal not emitted" );
+ tet_infoline("Ensure after animation has started playing that ProgressReachedSignal not emitted");
progressCheck.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*900.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 900.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
finishCheck.CheckSignalReceived();
- tet_infoline( "Animation finished" );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ tet_infoline("Animation finished");
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationMultipleProgressSignalsP(void)
{
- tet_infoline( "Multiple animations with different progress markers" );
+ tet_infoline("Multiple animations with different progress markers");
TestApplication application;
// Build the animation
Animation animationAlpha = Animation::New(0.0f);
- Animation animationBeta = Animation::New(0.0f);
+ Animation animationBeta = Animation::New(0.0f);
//Set duration
float durationSeconds(1.0f);
bool progressSignalReceivedBeta(false);
AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
- AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
+ AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
- DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
- DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
+ DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
+ DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "AnimationAlpha Progress notification set to 30%" );
- DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
+ tet_infoline("AnimationAlpha Progress notification set to 30%");
+ DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
- tet_infoline( "AnimationBeta Progress notification set to 50%" );
- DevelAnimation::SetProgressNotification( animationBeta, 0.5f );
+ tet_infoline("AnimationBeta Progress notification set to 50%");
+ DevelAnimation::SetProgressNotification(animationBeta, 0.5f);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
// Start the animations from 10% progress
- animationAlpha.SetCurrentProgress( 0.1f );
- animationBeta.SetCurrentProgress( 0.1f );
+ animationAlpha.SetCurrentProgress(0.1f);
+ animationBeta.SetCurrentProgress(0.1f);
animationAlpha.Play();
animationBeta.Play();
- tet_infoline( "Animation Playing from 10%" );
+ tet_infoline("Animation Playing from 10%");
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*100.0f ); // 20% progress
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 100.0f); // 20% progress
- tet_infoline( "Animation at 20% - No signals to be received" );
+ tet_infoline("Animation at 20% - No signals to be received");
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*200.0f ); // 40% progress
+ application.Render(durationSeconds * 200.0f); // 40% progress
application.SendNotification();
- tet_infoline( "Animation at 40% - Alpha signal should be received" );
- DALI_TEST_EQUALS( 0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 40% - Alpha signal should be received");
+ DALI_TEST_EQUALS(0.4f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
progressCheckAlpha.CheckSignalReceived();
progressCheckBeta.CheckSignalNotReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
- application.Render(durationSeconds*100.0f ); // 50% progress
- tet_infoline( "Animation at 50% - Beta should receive signal, Alpha should not" );
+ application.Render(durationSeconds * 100.0f); // 50% progress
+ tet_infoline("Animation at 50% - Beta should receive signal, Alpha should not");
application.SendNotification();
- DALI_TEST_EQUALS( 0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.5f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
- application.Render(static_cast<unsigned int>(durationSeconds*100.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 100.0f) /* 60% progress */);
application.SendNotification();
- tet_infoline( "Animation at 60%" );
+ tet_infoline("Animation at 60%");
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
application.SendNotification();
- tet_infoline( "Animation at 80%" );
+ tet_infoline("Animation at 80%");
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
- tet_infoline( "Animation finished" );
+ tet_infoline("Animation finished");
END_TEST;
}
int UtcDaliAnimationMultipleProgressSignalsP2(void)
{
- tet_infoline( "Multiple animations with different progress markers and big step time" );
+ tet_infoline("Multiple animations with different progress markers and big step time");
TestApplication application;
// Build the animation
Animation animationAlpha = Animation::New(0.0f);
- Animation animationBeta = Animation::New(0.0f);
+ Animation animationBeta = Animation::New(0.0f);
//Set duration
const float durationSeconds(1.0f);
bool progressSignalReceivedBeta(false);
AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
- AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
+ AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
- DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
- DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
+ DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
+ DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "AnimationAlpha Progress notification set to 1%" );
- DevelAnimation::SetProgressNotification( animationAlpha, 0.01f );
+ tet_infoline("AnimationAlpha Progress notification set to 1%");
+ DevelAnimation::SetProgressNotification(animationAlpha, 0.01f);
- tet_infoline( "AnimationBeta Progress notification set to 99%" );
- DevelAnimation::SetProgressNotification( animationBeta, 0.99f );
+ tet_infoline("AnimationBeta Progress notification set to 99%");
+ DevelAnimation::SetProgressNotification(animationBeta, 0.99f);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
// Start the animations unlimited looping
- animationAlpha.SetLooping( true );
- animationBeta.SetLooping( true );
+ animationAlpha.SetLooping(true);
+ animationBeta.SetLooping(true);
animationAlpha.Play();
animationBeta.Play();
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*20.0f ); // 2% progress
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 20.0f); // 2% progress
application.SendNotification();
- DALI_TEST_EQUALS( 0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.02f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 2% - Alpha signals should be received, Beta should not." );
+ tet_infoline("Animation at 2% - Alpha signals should be received, Beta should not.");
progressCheckAlpha.CheckSignalReceived();
progressCheckBeta.CheckSignalNotReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
application.SendNotification();
- application.Render(durationSeconds*960.0f ); // 98% progress
+ application.Render(durationSeconds * 960.0f); // 98% progress
application.SendNotification();
- tet_infoline( "Animation at 98% - No signal received" );
- DALI_TEST_EQUALS( 0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 98% - No signal received");
+ DALI_TEST_EQUALS(0.98f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*40.0f ); // 2% progress
+ application.Render(durationSeconds * 40.0f); // 2% progress
application.SendNotification();
- tet_infoline( "Animation loop once and now 2% - Alpha and Beta should receive signal" );
+ tet_infoline("Animation loop once and now 2% - Alpha and Beta should receive signal");
application.SendNotification();
- DALI_TEST_EQUALS( 0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.02f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
progressCheckAlpha.CheckSignalReceived();
progressCheckBeta.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
application.SendNotification();
- application.Render(durationSeconds*980.0f ); // 100% progress
+ application.Render(durationSeconds * 980.0f); // 100% progress
application.SendNotification();
- tet_infoline( "Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not" );
+ tet_infoline("Animation loop one more time. and now 100% - Beta should receive signal, Alhpa sholud not");
application.SendNotification();
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
- animationAlpha.SetLooping( false );
- animationBeta.SetLooping( false );
+ animationAlpha.SetLooping(false);
+ animationBeta.SetLooping(false);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*2000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 2000.0f) + 1u /*just beyond the animation duration*/);
application.SendNotification();
// We did expect the animation to finish
- tet_infoline( "Animation finished" );
+ tet_infoline("Animation finished");
END_TEST;
}
int UtcDaliAnimationProgressSignalWithPlayAfterP(void)
{
- tet_infoline( "Multiple animations with different progress markers" );
+ tet_infoline("Multiple animations with different progress markers");
TestApplication application;
// Build the animation
Animation animationAlpha = Animation::New(0.0f);
- Animation animationBeta = Animation::New(0.0f);
+ Animation animationBeta = Animation::New(0.0f);
//Set duration
float durationSeconds(1.0f);
bool progressSignalReceivedBeta(false);
AnimationProgressCheck progressCheckAlpha(progressSignalReceivedAlpha, "animation:Alpha");
- AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta" );
+ AnimationProgressCheck progressCheckBeta(progressSignalReceivedBeta, "animation:Beta");
- DevelAnimation::ProgressReachedSignal( animationAlpha ).Connect( &application, progressCheckAlpha );
- DevelAnimation::ProgressReachedSignal( animationBeta ).Connect( &application, progressCheckBeta);
+ DevelAnimation::ProgressReachedSignal(animationAlpha).Connect(&application, progressCheckAlpha);
+ DevelAnimation::ProgressReachedSignal(animationBeta).Connect(&application, progressCheckBeta);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animationAlpha.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
animationBeta.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "AnimationAlpha Progress notification set to 30%" );
- DevelAnimation::SetProgressNotification( animationAlpha, 0.3f );
+ tet_infoline("AnimationAlpha Progress notification set to 30%");
+ DevelAnimation::SetProgressNotification(animationAlpha, 0.3f);
- tet_infoline( "AnimationBeta Progress notification set to ~0% (==Notify when delay is done)" );
- DevelAnimation::SetProgressNotification( animationBeta, Math::MACHINE_EPSILON_1 );
+ tet_infoline("AnimationBeta Progress notification set to ~0% (==Notify when delay is done)");
+ DevelAnimation::SetProgressNotification(animationBeta, Math::MACHINE_EPSILON_1);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
animationBeta.PlayAfter(delaySeconds);
application.SendNotification();
- application.Render(0); // start animation
- application.Render(delaySeconds * 500.0f ); // 50% wait progress
+ application.Render(0); // start animation
+ application.Render(delaySeconds * 500.0f); // 50% wait progress
- tet_infoline( "Delay at 50% - No signals to be received" );
+ tet_infoline("Delay at 50% - No signals to be received");
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
application.SendNotification();
- application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f ); // 100% wait, 5% progress
+ application.Render(delaySeconds * 500.0f + durationSeconds * 50.0f); // 100% wait, 5% progress
application.SendNotification();
- tet_infoline( "Delay at 100%, Animation at 5% - Beta signal should be received" );
- DALI_TEST_EQUALS( 0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Delay at 100%, Animation at 5% - Beta signal should be received");
+ DALI_TEST_EQUALS(0.05f, animationBeta.GetCurrentProgress(), TEST_LOCATION);
progressCheckBeta.CheckSignalReceived();
progressCheckAlpha.CheckSignalNotReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
- application.Render(durationSeconds * 200.0f ); // 25% progress
- tet_infoline( "Animation at 25% - No signals to be received" );
+ application.Render(durationSeconds * 200.0f); // 25% progress
+ tet_infoline("Animation at 25% - No signals to be received");
application.SendNotification();
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
- application.Render(durationSeconds * 200.0f ); // 45% progress
- tet_infoline( "Animation at 45% - Alpha should receive signal, Beta should not" );
+ application.Render(durationSeconds * 200.0f); // 45% progress
+ tet_infoline("Animation at 45% - Alpha should receive signal, Beta should not");
application.SendNotification();
- DALI_TEST_EQUALS( 0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.45f, animationAlpha.GetCurrentProgress(), TEST_LOCATION);
progressCheckAlpha.CheckSignalReceived();
progressCheckBeta.CheckSignalNotReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheckAlpha.Reset();
progressCheckBeta.Reset();
- application.Render(static_cast<unsigned int>(durationSeconds*150.0f)/* 60% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 150.0f) /* 60% progress */);
application.SendNotification();
- tet_infoline( "Animation at 60%" );
+ tet_infoline("Animation at 60%");
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
application.SendNotification();
- tet_infoline( "Animation at 80%" );
+ tet_infoline("Animation at 80%");
progressCheckAlpha.CheckSignalNotReceived();
progressCheckBeta.CheckSignalNotReceived();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) + 1u /*just beyond the animation duration*/);
// We did expect the animation to finish
- tet_infoline( "Animation finished" );
+ tet_infoline("Animation finished");
END_TEST;
}
animation.SetDuration(durationSeconds);
// Set Looping Count
- const int loopCount( 4 );
- animation.SetLoopCount( loopCount );
+ const int loopCount(4);
+ animation.SetLoopCount(loopCount);
bool finishedSignalReceived(false);
bool progressSignalReceived(false);
animation.FinishedSignal().Connect(&application, finishCheck);
AnimationProgressCheck progressCheck(progressSignalReceived);
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "Animation Progress notification set to 50% with looping count 4" );
- DevelAnimation::SetProgressNotification( animation, 0.5f );
+ tet_infoline("Animation Progress notification set to 50% with looping count 4");
+ DevelAnimation::SetProgressNotification(animation, 0.5f);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheck.CheckSignalNotReceived();
for(int count = 0; count < loopCount; count++)
{
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 25%" );
+ tet_infoline("Animation at 25%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
application.SendNotification();
- tet_infoline( "Animation at 50%" );
- DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 50%");
+ DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheck.Reset();
- application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
- tet_infoline( "Animation at 75%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
+ tet_infoline("Animation at 75%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
- application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
- tet_infoline( "Animation at 100%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
+ tet_infoline("Animation at 100%");
application.SendNotification();
//Nothing check at 100% progress. cause It can be both 100% and 0%.
animation.SetDuration(durationSeconds);
// Set Looping Unlmited
- animation.SetLooping( true );
+ animation.SetLooping(true);
bool finishedSignalReceived(false);
bool progressSignalReceived(false);
animation.FinishedSignal().Connect(&application, finishCheck);
AnimationProgressCheck progressCheck(progressSignalReceived);
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "Animation Progress notification set to 50% with unlimited looping" );
- DevelAnimation::SetProgressNotification( animation, 0.5f );
+ tet_infoline("Animation Progress notification set to 50% with unlimited looping");
+ DevelAnimation::SetProgressNotification(animation, 0.5f);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheck.CheckSignalNotReceived();
for(int count = 0; count < 4; count++)
{
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 25%" );
+ tet_infoline("Animation at 25%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
application.SendNotification();
- tet_infoline( "Animation at 50%" );
- DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 50%");
+ DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheck.Reset();
- application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
- tet_infoline( "Animation at 75%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
+ tet_infoline("Animation at 75%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
- application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
- tet_infoline( "Animation at 100%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
+ tet_infoline("Animation at 100%");
application.SendNotification();
//Nothing check at 100% progress. cause It can be both 100% and 0%.
}
finishCheck.CheckSignalNotReceived();
- animation.SetLooping( false );
+ animation.SetLooping(false);
application.Render(0u);
application.SendNotification();
application.Render(static_cast<unsigned int>(durationSeconds * 1000.0f) + 10u);
animation.SetDuration(durationSeconds);
//Set speed negative
- animation.SetSpeedFactor( -1.0f );
+ animation.SetSpeedFactor(-1.0f);
// Set Looping Unlmited
- animation.SetLooping( true );
+ animation.SetLooping(true);
bool finishedSignalReceived(false);
bool progressSignalReceived(false);
animation.FinishedSignal().Connect(&application, finishCheck);
AnimationProgressCheck progressCheck(progressSignalReceived);
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "Animation Progress notification set to 50%" );
- DevelAnimation::SetProgressNotification( animation, 0.5f );
+ tet_infoline("Animation Progress notification set to 50%");
+ DevelAnimation::SetProgressNotification(animation, 0.5f);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheck.CheckSignalNotReceived();
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 25%" );
+ tet_infoline("Animation at 25%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
application.SendNotification();
- tet_infoline( "Animation at 50%" );
- DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 50%");
+ DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheck.Reset();
- application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
- tet_infoline( "Animation at 75%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
+ tet_infoline("Animation at 75%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
- application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
- tet_infoline( "Animation at 100%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
+ tet_infoline("Animation at 100%");
application.SendNotification();
//Nothing check at 100% progress. cause It can be both 100% and 0%.
finishCheck.CheckSignalNotReceived();
animation.Stop();
- animation.SetLooping( false );
- animation.SetLoopCount( 4 );
+ animation.SetLooping(false);
+ animation.SetLoopCount(4);
animation.Play();
application.Render(0u);
application.SendNotification();
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 25%" );
+ tet_infoline("Animation at 25%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
application.SendNotification();
- tet_infoline( "Animation at 50%" );
- DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 50%");
+ DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheck.Reset();
- application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
- tet_infoline( "Animation at 75%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
+ tet_infoline("Animation at 75%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
- application.Render(durationSeconds*0.25*1000.0f ); // 100% progress
- tet_infoline( "Animation at 100%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 100% progress
+ tet_infoline("Animation at 100%");
application.SendNotification();
//Nothing check at 100% progress. cause It can be both 100% and 0%.
animation.FinishedSignal().Connect(&application, finishCheck);
AnimationProgressCheck progressCheck(progressSignalReceived);
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "Animation Progress PlayRange as 10% ~ 90%" );
- animation.SetPlayRange( Vector2( 0.1f, 0.9f ) );
+ tet_infoline("Animation Progress PlayRange as 10% ~ 90%");
+ animation.SetPlayRange(Vector2(0.1f, 0.9f));
- tet_infoline( "Animation Progress notification set to >90% that never can notificated" );
- DevelAnimation::SetProgressNotification( animation, 0.9f + Math::MACHINE_EPSILON_1 );
+ tet_infoline("Animation Progress notification set to >90% that never can notificated");
+ DevelAnimation::SetProgressNotification(animation, 0.9f + Math::MACHINE_EPSILON_1);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheck.CheckSignalNotReceived();
animation.Play();
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*0.25*1000.0f ); // 35% progress
- DALI_TEST_EQUALS( 0.35f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 35% progress
+ DALI_TEST_EQUALS(0.35f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 35%" );
+ tet_infoline("Animation at 35%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 60% progress
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 60% progress
application.SendNotification();
- DALI_TEST_EQUALS( 0.6f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.6f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 60%" );
+ tet_infoline("Animation at 60%");
progressCheck.CheckSignalNotReceived();
- application.Render(durationSeconds*0.25*1000.0f ); // 85% progress
- tet_infoline( "Animation at 85%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 85% progress
+ tet_infoline("Animation at 85%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.85f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.85f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
- application.Render(durationSeconds*0.25*1000.0f ); // 90% progress
- tet_infoline( "Animation over 90%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 90% progress
+ tet_infoline("Animation over 90%");
application.SendNotification();
// progress never signaled because playrange is 90%
animation.FinishedSignal().Connect(&application, finishCheck);
AnimationProgressCheck progressCheck(progressSignalReceived);
- DevelAnimation::ProgressReachedSignal( animation ).Connect( &application, progressCheck);
+ DevelAnimation::ProgressReachedSignal(animation).Connect(&application, progressCheck);
application.SendNotification();
Vector3 targetPosition(100.0f, 100.0f, 100.0f);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
- tet_infoline( "Animation Progress notification set to 50%" );
- DevelAnimation::SetProgressNotification( animation, 0.5f );
+ tet_infoline("Animation Progress notification set to 50%");
+ DevelAnimation::SetProgressNotification(animation, 0.5f);
application.SendNotification();
- application.Render( );
+ application.Render();
progressCheck.CheckSignalNotReceived();
animation.Play();
application.SendNotification();
- application.Render(0); // start animation
- application.Render(durationSeconds*0.25*1000.0f ); // 25% progress
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
+ application.Render(0); // start animation
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 25% progress
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
- tet_infoline( "Animation at 25%" );
+ tet_infoline("Animation at 25%");
progressCheck.CheckSignalNotReceived();
application.SendNotification();
- application.Render(durationSeconds*0.25*1000.0f ); // 50% progress
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 50% progress
application.SendNotification();
- tet_infoline( "Animation at 50%" );
- DALI_TEST_EQUALS( 0.5f, animation.GetCurrentProgress(), TEST_LOCATION );
+ tet_infoline("Animation at 50%");
+ DALI_TEST_EQUALS(0.5f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalReceived();
- tet_infoline( "Progress check reset" );
+ tet_infoline("Progress check reset");
progressCheck.Reset();
- application.Render(durationSeconds*0.25*1000.0f ); // 75% progress
- tet_infoline( "Animation at 75%" );
+ application.Render(durationSeconds * 0.25 * 1000.0f); // 75% progress
+ tet_infoline("Animation at 75%");
application.SendNotification();
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
progressCheck.CheckSignalNotReceived();
Animation animation = Animation::New(1.0f);
DALI_TEST_ASSERTION(
- {
- // non animateable property (STRING)
- animation.AnimateBy( Property( actor, Actor::Property::LAYOUT_DIRECTION ), Property::Value( "new direction" ) );
- }, "Property type is not animatable" );
+ {
+ // non animateable property (STRING)
+ animation.AnimateBy(Property(actor, Actor::Property::LAYOUT_DIRECTION), Property::Value("new direction"));
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable property (MATRIX)
- Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Dali::Matrix() ), Property::ANIMATABLE );
- animation.AnimateBy( Property( actor, index ), Property::Value( Property::MATRIX ) );
- }, "Property type is not animatable" );
+ {
+ // non animateable property (MATRIX)
+ Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Dali::Matrix()), Property::ANIMATABLE);
+ animation.AnimateBy(Property(actor, index), Property::Value(Property::MATRIX));
+ },
+ "Property type is not animatable");
// AnimateBy
DALI_TEST_ASSERTION(
- {
- // non animateable target (NONE)
- animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value() );
- }, "Target value is not animatable" );
+ {
+ // non animateable target (NONE)
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value());
+ },
+ "Target value is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (STRING)
- animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value("foo") );
- }, "Target value is not animatable" );
+ {
+ // non animateable target (STRING)
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value("foo"));
+ },
+ "Target value is not animatable");
DALI_TEST_ASSERTION(
- {
- // not mathing properties (VECTOR3, FLOAT)
- animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( 10.f ) );
- }, "Property and target types don't match" );
+ {
+ // not mathing properties (VECTOR3, FLOAT)
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(10.f));
+ },
+ "Property and target types don't match");
DALI_TEST_ASSERTION(
- {
- // not mathing properties (VECTOR3.A, VECTOR2)
- animation.AnimateBy( Property( actor, Actor::Property::COLOR_ALPHA ), Property::Value( Property::VECTOR2 ) );
- }, "Property and target types don't match" );
+ {
+ // not mathing properties (VECTOR3.A, VECTOR2)
+ animation.AnimateBy(Property(actor, Actor::Property::COLOR_ALPHA), Property::Value(Property::VECTOR2));
+ },
+ "Property and target types don't match");
DALI_TEST_ASSERTION(
- {
- // negative duration
- animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
- }, "Duration must be >=0" );
+ {
+ // negative duration
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
+ },
+ "Duration must be >=0");
END_TEST;
}
// AnimateTo
DALI_TEST_ASSERTION(
- {
- // non animateable property (MAP)
- Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::MAP ), Property::ANIMATABLE );
- animation.AnimateTo( Property( actor, index ), Property::Value( Property::MAP ) );
- }, "Property type is not animatable" );
+ {
+ // non animateable property (MAP)
+ Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::MAP), Property::ANIMATABLE);
+ animation.AnimateTo(Property(actor, index), Property::Value(Property::MAP));
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (NONE)
- animation.AnimateTo( Property( actor, Actor::Property::CLIPPING_MODE ), Property::Value() );
- }, "Property type is not animatable" );
+ {
+ // non animateable target (NONE)
+ animation.AnimateTo(Property(actor, Actor::Property::CLIPPING_MODE), Property::Value());
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (ARRAY)
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Property::ARRAY ) );
- }, "Target value is not animatable" );
+ {
+ // non animateable target (ARRAY)
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Property::ARRAY));
+ },
+ "Target value is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (RECTANGLE)
- animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Property::Value( Rect<int32_t>() ) );
- }, "Target value is not animatable" );
+ {
+ // non animateable target (RECTANGLE)
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), Property::Value(Rect<int32_t>()));
+ },
+ "Target value is not animatable");
DALI_TEST_ASSERTION(
- {
- // not mathing properties (FLOAT, INT)
- animation.AnimateTo( Property( actor, Actor::Property::SCALE_Y ), Property::Value(10) );
- }, "Property and target types don't match" );
+ {
+ // not mathing properties (FLOAT, INT)
+ animation.AnimateTo(Property(actor, Actor::Property::SCALE_Y), Property::Value(10));
+ },
+ "Property and target types don't match");
DALI_TEST_ASSERTION(
- {
- // not mathing properties (VECTOR3, VECTOR2)
- animation.AnimateTo( Property( actor, Actor::Property::COLOR ), Property::Value( Property::VECTOR2 ) );
- }, "Property and target types don't match" );
+ {
+ // not mathing properties (VECTOR3, VECTOR2)
+ animation.AnimateTo(Property(actor, Actor::Property::COLOR), Property::Value(Property::VECTOR2));
+ },
+ "Property and target types don't match");
DALI_TEST_ASSERTION(
- {
- // negative duration
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Property::Value( Vector3(1,2,3) ), TimePeriod(-1) );
- }, "Duration must be >=0" );
+ {
+ // negative duration
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Property::Value(Vector3(1, 2, 3)), TimePeriod(-1));
+ },
+ "Duration must be >=0");
END_TEST;
}
// AnimateBetween
DALI_TEST_ASSERTION(
- {
- // non animateable property (ARRAY)
- Property::Index index = actor.RegisterProperty( "Foobar", Property::Value( Property::ARRAY ), Property::ANIMATABLE );
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.5f, Property::Value( Property::ARRAY ) );
- animation.AnimateBetween( Property( actor, index ), keyframes );
- }, "Property type is not animatable" );
+ {
+ // non animateable property (ARRAY)
+ Property::Index index = actor.RegisterProperty("Foobar", Property::Value(Property::ARRAY), Property::ANIMATABLE);
+ KeyFrames keyframes = KeyFrames::New();
+ keyframes.Add(0.5f, Property::Value(Property::ARRAY));
+ animation.AnimateBetween(Property(actor, index), keyframes);
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (NONE)
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.5f, Property::Value() );
- animation.AnimateBetween( Property( actor, Actor::Property::CLIPPING_MODE ), keyframes );
- }, "Property type is not animatable" );
+ {
+ // non animateable target (NONE)
+ KeyFrames keyframes = KeyFrames::New();
+ keyframes.Add(0.5f, Property::Value());
+ animation.AnimateBetween(Property(actor, Actor::Property::CLIPPING_MODE), keyframes);
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (EXTENTS)
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.5f, Property::Value( Property::EXTENTS ) ); // throws
- animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
- }, "Property type is not animatable" );
+ {
+ // non animateable target (EXTENTS)
+ KeyFrames keyframes = KeyFrames::New();
+ keyframes.Add(0.5f, Property::Value(Property::EXTENTS)); // throws
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // non animateable target (RECTANGLE)
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.5f, Property::Value( Property::MAP ) ); // throws
- animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes );
- }, "Property type is not animatable" );
+ {
+ // non animateable target (RECTANGLE)
+ KeyFrames keyframes = KeyFrames::New();
+ keyframes.Add(0.5f, Property::Value(Property::MAP)); // throws
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes);
+ },
+ "Property type is not animatable");
DALI_TEST_ASSERTION(
- {
- // not mathing properties (VECTOR2, VECTOR4)
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.5f, Property::Value( Vector4( 1, 2, 3, 4 ) ) );
- animation.AnimateBetween( Property( actor, Actor::Property::MAXIMUM_SIZE ), keyframes );
- }, "Property and target types don't match" );
+ {
+ // not mathing properties (VECTOR2, VECTOR4)
+ KeyFrames keyframes = KeyFrames::New();
+ keyframes.Add(0.5f, Property::Value(Vector4(1, 2, 3, 4)));
+ animation.AnimateBetween(Property(actor, Actor::Property::MAXIMUM_SIZE), keyframes);
+ },
+ "Property and target types don't match");
DALI_TEST_ASSERTION(
- {
- // negative duration
- KeyFrames keyframes = KeyFrames::New();
- keyframes.Add( 0.5f, Property::Value(Vector3( 1, 2, 3 ) ) );
- animation.AnimateBetween( Property( actor, Actor::Property::POSITION ), keyframes, TimePeriod(-1) );
- }, "Duration must be >=0" );
+ {
+ // negative duration
+ KeyFrames keyframes = KeyFrames::New();
+ keyframes.Add(0.5f, Property::Value(Vector3(1, 2, 3)));
+ animation.AnimateBetween(Property(actor, Actor::Property::POSITION), keyframes, TimePeriod(-1));
+ },
+ "Duration must be >=0");
END_TEST;
}
CLEAR
};
-void CheckPropertyValuesWhenCallingAnimationMethod( TestFunction functionToTest, const char * testName )
+void CheckPropertyValuesWhenCallingAnimationMethod(TestFunction functionToTest, const char* testName)
{
- tet_printf( "Testing %s\n", testName );
+ tet_printf("Testing %s\n", testName);
// When an Animation::Stop() or Animation::Clear() is called, the event-side property needs to be updated appropriately
// This test checks that that is being done
- const float durationSeconds( 1.0f );
- unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
- const Vector3 originalPosition( Vector3::ZERO );
- const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
- const Vector3 halfWayToTarget( targetPosition * 0.5f );
+ const float durationSeconds(1.0f);
+ unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
+ const Vector3 originalPosition(Vector3::ZERO);
+ const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ const Vector3 halfWayToTarget(targetPosition * 0.5f);
struct ExpectedValue
{
Animation::EndAction endAction;
- Vector3 expectedGetPropertyValue;
+ Vector3 expectedGetPropertyValue;
};
ExpectedValue expectedValueTable[] =
- {
- { Animation::BAKE, halfWayToTarget }, // When baking, the current value is the final value.
- { Animation::BAKE_FINAL, targetPosition }, // When BakeFinal, we should jump to the final value when clearing or stopping.
- { Animation::DISCARD, originalPosition }, // When discarding, we should jump back to the original value when clearing or stopping.
- };
- const auto expectedValueTableCount = sizeof( expectedValueTable ) / sizeof( ExpectedValue );
+ {
+ {Animation::BAKE, halfWayToTarget}, // When baking, the current value is the final value.
+ {Animation::BAKE_FINAL, targetPosition}, // When BakeFinal, we should jump to the final value when clearing or stopping.
+ {Animation::DISCARD, originalPosition}, // When discarding, we should jump back to the original value when clearing or stopping.
+ };
+ const auto expectedValueTableCount = sizeof(expectedValueTable) / sizeof(ExpectedValue);
- for( auto i = 0u; i < expectedValueTableCount; ++i )
+ for(auto i = 0u; i < expectedValueTableCount; ++i)
{
TestApplication application;
application.GetScene().Add(actor);
// Build the animation
- Animation animation = Animation::New( durationSeconds );
- animation.SetEndAction( expectedValueTable[ i ].endAction );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetEndAction(expectedValueTable[i].endAction);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( halfAnimationDuration );
+ application.Render(halfAnimationDuration);
// Stop or Clear the animation early, both have the same effect
- if( functionToTest == TestFunction::STOP )
+ if(functionToTest == TestFunction::STOP)
{
animation.Stop();
}
}
// The event side property should be set the expected value immediately, the update side property will still only be halfway as we haven't run an update yet
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
// After one frame, both values should match regardless of the End Action
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), expectedValueTable[ i ].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), expectedValueTable[i].expectedGetPropertyValue, VECTOR3_EPSILON, TEST_LOCATION);
}
}
} // unnamed namespace
int UtcDaliAnimationStopPropertyValue(void)
{
- CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::STOP, "UtcDaliAnimationStopPropertyValue" );
+ CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::STOP, "UtcDaliAnimationStopPropertyValue");
END_TEST;
}
int UtcDaliAnimationClearPropertyValue(void)
{
- CheckPropertyValuesWhenCallingAnimationMethod( TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue" );
+ CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue");
END_TEST;
}
int UtcDaliAnimationPausePropertyValue(void)
{
- const float durationSeconds( 1.0f );
- unsigned int halfAnimationDuration( static_cast< unsigned int >( durationSeconds * 1000.0f * 0.5f ) );
- const Vector3 originalPosition( Vector3::ZERO );
- const Vector3 targetPosition( 10.0f, 10.0f, 10.0f );
- const Vector3 halfWayToTarget( targetPosition * 0.5f );
+ const float durationSeconds(1.0f);
+ unsigned int halfAnimationDuration(static_cast<unsigned int>(durationSeconds * 1000.0f * 0.5f));
+ const Vector3 originalPosition(Vector3::ZERO);
+ const Vector3 targetPosition(10.0f, 10.0f, 10.0f);
+ const Vector3 halfWayToTarget(targetPosition * 0.5f);
Animation::EndAction endActions[] =
- {
- Animation::BAKE,
- Animation::BAKE_FINAL,
- Animation::DISCARD,
- };
- const auto endActionCount = sizeof( endActions ) / sizeof( endActions[0] );
+ {
+ Animation::BAKE,
+ Animation::BAKE_FINAL,
+ Animation::DISCARD,
+ };
+ const auto endActionCount = sizeof(endActions) / sizeof(endActions[0]);
// For all end actions, when pausing, we stay at the current value
- for( auto i = 0u; i < endActionCount; ++i )
+ for(auto i = 0u; i < endActionCount; ++i)
{
TestApplication application;
application.GetScene().Add(actor);
// Build the animation
- Animation animation = Animation::New( durationSeconds );
- animation.SetEndAction( endActions[ i ] );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), targetPosition, AlphaFunction::LINEAR );
+ Animation animation = Animation::New(durationSeconds);
+ animation.SetEndAction(endActions[i]);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( halfAnimationDuration );
+ application.Render(halfAnimationDuration);
// Puase the animation early
animation.Pause();
// The event side property should be set the current value immediately, the update side property will still only be halfway
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
// After one frame, both values should match regardless of the End Action
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), halfWayToTarget, VECTOR3_EPSILON, TEST_LOCATION);
}
END_TEST;
TestApplication application;
auto actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- auto animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( actor, Actor::Property::POSITION_X ), 100.0f );
- animation.SetLoopCount( 2 );
+ auto animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION_X), 100.0f);
+ animation.SetLoopCount(2);
animation.Play();
application.SendNotification();
- application.Render( 1001 );
+ application.Render(1001);
// One loop completed
- application.Render( 2005 );
+ application.Render(2005);
application.SendNotification();
// 2 loops should have completed
- DALI_TEST_EQUALS( animation.GetCurrentLoop(), 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetCurrentLoop(), 2u, TEST_LOCATION);
// Another render needs to occur after all the loops end
application.SendNotification();
- application.Render( 1000 );
+ application.Render(1000);
// Stop the animation and use PlayFrom, previously we got an Assert here
animation.Stop();
- animation.PlayFrom( 0.5f );
+ animation.PlayFrom(0.5f);
application.SendNotification();
- application.Render( 1000 );
+ application.Render(1000);
- DALI_TEST_EQUALS( animation.GetState(), Animation::PLAYING, TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetState(), Animation::PLAYING, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationCombineToAndByWithStop(void)
{
- tet_infoline( "Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
+ tet_infoline("Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy");
TestApplication application;
auto actor = Actor::New();
- actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ application.GetScene().Add(actor);
- auto animation = Animation::New( 1.0f );
- const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
- animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( -30.0f, 0.0f, 0.0f ), TimePeriod( 1.0f, 1.0f ) );
+ auto animation = Animation::New(1.0f);
+ const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
+ animation.AnimateBy(Property(actor, Actor::Property::POSITION), Vector3(-30.0f, 0.0f, 0.0f), TimePeriod(1.0f, 1.0f));
animation.Play();
application.SendNotification();
- application.Render( 500 );
+ application.Render(500);
application.SendNotification();
- application.Render( 500 );
+ application.Render(500);
application.SendNotification();
- application.Render( 500 );
+ application.Render(500);
// Stop and clear the animation using the current values
animation.Stop();
animation.Clear();
// Check the y position, it should be the same as before
- DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION_Y).Get< float >(), origY, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION_Y).Get<float>(), origY, TEST_LOCATION);
END_TEST;
}
int UtcDaliAnimationCountAndGetAnimationAt(void)
{
- tet_infoline( "UtcDaliAnimationCountAndGetAnimationAt");
+ tet_infoline("UtcDaliAnimationCountAndGetAnimationAt");
TestApplication application;
auto actor = Actor::New();
- actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ application.GetScene().Add(actor);
- auto animation = Animation::New( 1.0f );
- const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >();
- animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) );
+ auto animation = Animation::New(1.0f);
+ const float origY = actor.GetProperty(Actor::Property::POSITION_Y).Get<float>();
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(150.0f, origY, 0.0f), TimePeriod(1.0f));
animation.Play();
application.SendNotification();
- application.Render( 500 );
+ application.Render(500);
uint32_t animationCount = Dali::DevelAnimation::GetAnimationCount();
- DALI_TEST_EQUALS( animationCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(animationCount, 1, TEST_LOCATION);
- DALI_TEST_CHECK( !Dali::DevelAnimation::GetAnimationAt( 5 ) );
+ DALI_TEST_CHECK(!Dali::DevelAnimation::GetAnimationAt(5));
- Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt( 0 );
- DALI_TEST_EQUALS( animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION );
+ Dali::Animation animationReturned = Dali::DevelAnimation::GetAnimationAt(0);
+ DALI_TEST_EQUALS(animationReturned.GetState(), Dali::Animation::State::PLAYING, TEST_LOCATION);
- DALI_TEST_EQUALS( animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION );
- DALI_TEST_EQUALS( animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION );
- DALI_TEST_EQUALS( animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION );
- DALI_TEST_EQUALS( animation.GetState(), animationReturned.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS(animation.GetDuration(), animationReturned.GetDuration(), TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.GetLoopCount(), animationReturned.GetLoopCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.IsLooping(), animationReturned.IsLooping(), TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.GetEndAction(), animationReturned.GetEndAction(), TEST_LOCATION);
+ DALI_TEST_EQUALS(animation.GetState(), animationReturned.GetState(), TEST_LOCATION);
// Stop and clear the animation using the current values
animation.Stop();
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::KeyFrames arg2;
- instance.AnimateBetween(arg1,arg2);
+ instance.AnimateBetween(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
Dali::Animation::Interpolation arg3(Animation::LINEAR);
- instance.AnimateBetween(arg1,arg2,arg3);
+ instance.AnimateBetween(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
Dali::TimePeriod arg3(1.0f);
- instance.AnimateBetween(arg1,arg2,arg3);
+ instance.AnimateBetween(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
- Dali::TimePeriod arg3(1.0f);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
+ Dali::TimePeriod arg3(1.0f);
Dali::Animation::Interpolation arg4(Animation::LINEAR);
- instance.AnimateBetween(arg1,arg2,arg3,arg4);
+ instance.AnimateBetween(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
Dali::AlphaFunction arg3;
- instance.AnimateBetween(arg1,arg2,arg3);
+ instance.AnimateBetween(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
- Dali::AlphaFunction arg3;
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
+ Dali::AlphaFunction arg3;
Dali::Animation::Interpolation arg4(Animation::LINEAR);
- instance.AnimateBetween(arg1,arg2,arg3,arg4);
+ instance.AnimateBetween(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
Dali::AlphaFunction arg3;
- Dali::TimePeriod arg4(1.0f);
- instance.AnimateBetween(arg1,arg2,arg3,arg4);
+ Dali::TimePeriod arg4(1.0f);
+ instance.AnimateBetween(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
- Dali::KeyFrames arg2;
- Dali::AlphaFunction arg3;
- Dali::TimePeriod arg4(1.0f);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::KeyFrames arg2;
+ Dali::AlphaFunction arg3;
+ Dali::TimePeriod arg4(1.0f);
Dali::Animation::Interpolation arg5(Animation::LINEAR);
- instance.AnimateBetween(arg1,arg2,arg3,arg4,arg5);
+ instance.AnimateBetween(arg1, arg2, arg3, arg4, arg5);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
try
{
Dali::Actor arg1;
- float arg2(0.0f);
- instance.Hide(arg1,arg2);
+ float arg2(0.0f);
+ instance.Hide(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
try
{
Dali::Actor arg1;
- float arg2(0.0f);
- instance.Show(arg1,arg2);
+ float arg2(0.0f);
+ instance.Show(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
Dali::Animation instance;
try
{
- Dali::Actor arg1;
- Dali::Path arg2;
+ Dali::Actor arg1;
+ Dali::Path arg2;
Dali::Vector3 arg3;
- instance.Animate(arg1,arg2,arg3);
+ instance.Animate(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
Dali::Animation instance;
try
{
- Dali::Actor arg1;
- Dali::Path arg2;
- Dali::Vector3 arg3;
+ Dali::Actor arg1;
+ Dali::Path arg2;
+ Dali::Vector3 arg3;
Dali::TimePeriod arg4(1.0f);
- instance.Animate(arg1,arg2,arg3,arg4);
+ instance.Animate(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
Dali::Animation instance;
try
{
- Dali::Actor arg1;
- Dali::Path arg2;
- Dali::Vector3 arg3;
+ Dali::Actor arg1;
+ Dali::Path arg2;
+ Dali::Vector3 arg3;
Dali::AlphaFunction arg4;
- instance.Animate(arg1,arg2,arg3,arg4);
+ instance.Animate(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
Dali::Animation instance;
try
{
- Dali::Actor arg1;
- Dali::Path arg2;
- Dali::Vector3 arg3;
+ Dali::Actor arg1;
+ Dali::Path arg2;
+ Dali::Vector3 arg3;
Dali::AlphaFunction arg4;
- Dali::TimePeriod arg5(1.0f);
- instance.Animate(arg1,arg2,arg3,arg4,arg5);
+ Dali::TimePeriod arg5(1.0f);
+ instance.Animate(arg1, arg2, arg3, arg4, arg5);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- instance.AnimateBy(arg1,arg2);
+ instance.AnimateBy(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- Dali::TimePeriod arg3(1.0f);
- instance.AnimateBy(arg1,arg2,arg3);
+ Dali::TimePeriod arg3(1.0f);
+ instance.AnimateBy(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- Dali::AlphaFunction arg3;
- instance.AnimateBy(arg1,arg2,arg3);
+ Dali::AlphaFunction arg3;
+ instance.AnimateBy(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- Dali::AlphaFunction arg3;
- Dali::TimePeriod arg4(1.0f);
- instance.AnimateBy(arg1,arg2,arg3,arg4);
+ Dali::AlphaFunction arg3;
+ Dali::TimePeriod arg4(1.0f);
+ instance.AnimateBy(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliAnimationAnimateToNegative01(void)
{
TestApplication application;
- Dali::Actor actor;
+ Dali::Actor actor;
Dali::Animation instance;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- instance.AnimateTo(arg1,arg2);
+ instance.AnimateTo(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- Dali::TimePeriod arg3(1.0f);
- instance.AnimateTo(arg1,arg2,arg3);
+ Dali::TimePeriod arg3(1.0f);
+ instance.AnimateTo(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- Dali::AlphaFunction arg3;
- instance.AnimateTo(arg1,arg2,arg3);
+ Dali::AlphaFunction arg3;
+ instance.AnimateTo(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
{
TestApplication application;
Dali::Animation instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
- Dali::Property arg1(actor, Actor::Property::POSITION);
+ Dali::Property arg1(actor, Actor::Property::POSITION);
Dali::Property::Value arg2;
- Dali::AlphaFunction arg3;
- Dali::TimePeriod arg4(1.0f);
- instance.AnimateTo(arg1,arg2,arg3,arg4);
+ Dali::AlphaFunction arg3;
+ Dali::TimePeriod arg4(1.0f);
+ instance.AnimateTo(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
Dali::KeyFrames instance;
try
{
- float arg1(0.0f);
+ float arg1(0.0f);
Dali::Property::Value arg2;
- instance.Add(arg1,arg2);
+ instance.Add(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
Dali::KeyFrames instance;
try
{
- float arg1(0.0f);
+ float arg1(0.0f);
Dali::Property::Value arg2;
- Dali::AlphaFunction arg3;
- instance.Add(arg1,arg2,arg3);
+ Dali::AlphaFunction arg3;
+ instance.Add(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
*
*/
-#include <iostream>
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
// Temp include
#include <dali/public-api/object/any.h>
struct MyStruct
{
MyStruct()
- : mFloatValue( 0.f ),
- mIntValue( 0 )
- {}
+ : mFloatValue(0.f),
+ mIntValue(0)
+ {
+ }
- MyStruct( float fValue, int iValue )
- : mFloatValue( fValue ),
- mIntValue( iValue )
- {}
+ MyStruct(float fValue, int iValue)
+ : mFloatValue(fValue),
+ mIntValue(iValue)
+ {
+ }
- MyStruct( const MyStruct& myStruct )
- : mFloatValue( myStruct.mFloatValue ),
- mIntValue( myStruct.mIntValue )
- {}
+ MyStruct(const MyStruct& myStruct)
+ : mFloatValue(myStruct.mFloatValue),
+ mIntValue(myStruct.mIntValue)
+ {
+ }
- MyStruct& operator=( const MyStruct& myStruct )
+ MyStruct& operator=(const MyStruct& myStruct)
{
mFloatValue = myStruct.mFloatValue;
- mIntValue = myStruct.mIntValue;
+ mIntValue = myStruct.mIntValue;
return *this;
}
float mFloatValue;
- int mIntValue;
+ int mIntValue;
};
-}
+} // namespace
using namespace Dali;
// Test default constructor.
Any value;
- DALI_TEST_CHECK( typeid( void ) == value.GetType() );
+ DALI_TEST_CHECK(typeid(void) == value.GetType());
// Test constructor Any( const Type& )
Any value1 = 4u;
// Test constructor Any( const Any& ) with a non initialized Any
Any value3 = value;
- DALI_TEST_CHECK( typeid( unsigned int ) == value1.GetType() );
- DALI_TEST_CHECK( typeid( unsigned int ) == value2.GetType() );
- DALI_TEST_CHECK( typeid( void ) == value3.GetType() );
+ DALI_TEST_CHECK(typeid(unsigned int) == value1.GetType());
+ DALI_TEST_CHECK(typeid(unsigned int) == value2.GetType());
+ DALI_TEST_CHECK(typeid(void) == value3.GetType());
unsigned int uiValue1 = 0u;
unsigned int uiValue2 = 0u;
- value1.Get( uiValue1 );
- value2.Get( uiValue2 );
+ value1.Get(uiValue1);
+ value2.Get(uiValue2);
- DALI_TEST_EQUALS( uiValue1, uiValue2, TEST_LOCATION );
+ DALI_TEST_EQUALS(uiValue1, uiValue2, TEST_LOCATION);
END_TEST;
}
value1 = 4.f; // Test operator=( const Type& ) when current object is not initialized.
- value1.Get( fValue );
+ value1.Get(fValue);
- DALI_TEST_EQUALS( fValue, 4.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 4.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
value1 = 9.f; // Test operator=( const Type& ).
- value1.Get( fValue );
+ value1.Get(fValue);
- DALI_TEST_EQUALS( fValue, 9.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 9.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
Any value3 = 5.f;
value1 = value3; // Test operator=( const Any& ).
- value1.Get( fValue );
+ value1.Get(fValue);
- DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
Any value4;
value4 = value3; // Test operator=( const Any& ) when current object is not initialized.
- value4.Get( fValue );
+ value4.Get(fValue);
- DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
// Test assign a value to value3 doesn't modify value1.
value3 = 3.f;
- value1.Get( fValue );
+ value1.Get(fValue);
- DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
- value3.Get( fValue );
+ value3.Get(fValue);
- DALI_TEST_EQUALS( fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
// Test the branch when copying the same object.
- Any value5 = 3.f;
- Any& value6( value5 );
+ Any value5 = 3.f;
+ Any& value6(value5);
value6 = value5;
- value6.Get( fValue );
- DALI_TEST_EQUALS( fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ value6.Get(fValue);
+ DALI_TEST_EQUALS(fValue, 3.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
// test assignment for non-empty Any = empty Any
Any value7;
value6 = value7;
- DALI_TEST_CHECK( value6.Empty() );
-
+ DALI_TEST_CHECK(value6.Empty());
END_TEST;
}
{
value1 = value2; // Test operator=( const Any& );
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
assert = true;
}
- if( assert )
+ if(assert)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
else
{
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
END_TEST;
}
Any value;
- DALI_TEST_CHECK( typeid( void ) == value.GetType() );
+ DALI_TEST_CHECK(typeid(void) == value.GetType());
value = 5.f;
- DALI_TEST_CHECK( typeid( float ) == value.GetType() );
+ DALI_TEST_CHECK(typeid(float) == value.GetType());
END_TEST;
}
tet_infoline("Test Get().");
- Any value1( 5.f );
+ Any value1(5.f);
float fValue = value1.Get<float>();
- DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
fValue = 0.f;
- value1.Get( fValue );
- DALI_TEST_EQUALS( fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ value1.Get(fValue);
+ DALI_TEST_EQUALS(fValue, 5.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
class MyClass
{
public:
- MyClass( float fValue, int iValue )
- : mAny( MyStruct( fValue, iValue ) )
+ MyClass(float fValue, int iValue)
+ : mAny(MyStruct(fValue, iValue))
{
}
const MyStruct& Get() const
{
- return AnyCastReference<MyStruct>( mAny );
+ return AnyCastReference<MyStruct>(mAny);
}
MyStruct* GetPointer()
{
- return AnyCast<MyStruct>( &mAny );
+ return AnyCast<MyStruct>(&mAny);
}
const MyStruct* GetPointer() const
{
- return AnyCast<MyStruct>( &mAny );
+ return AnyCast<MyStruct>(&mAny);
}
private:
Dali::Any mAny;
};
- MyClass myClass( 3.25f, 3 );
+ MyClass myClass(3.25f, 3);
- MyStruct myStruct1 = myClass.Get();
+ MyStruct myStruct1 = myClass.Get();
const MyStruct& myStruct2 = myClass.Get();
- MyStruct* myStruct3 = myClass.GetPointer();
+ MyStruct* myStruct3 = myClass.GetPointer();
const MyStruct* myStruct4 = myClass.GetPointer();
- if( myStruct3 == NULL )
+ if(myStruct3 == NULL)
{
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
END_TEST;
}
- if( myStruct4 == NULL )
+ if(myStruct4 == NULL)
{
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
END_TEST;
}
- DALI_TEST_EQUALS( myStruct1.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct2.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct3->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct4->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct1.mIntValue, 3, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct2.mIntValue, 3, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct3->mIntValue, 3, TEST_LOCATION );
- DALI_TEST_EQUALS( myStruct4->mIntValue, 3, TEST_LOCATION );
+ DALI_TEST_EQUALS(myStruct1.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct2.mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct3->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct4->mFloatValue, 3.25f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct1.mIntValue, 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct2.mIntValue, 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct3->mIntValue, 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(myStruct4->mIntValue, 3, TEST_LOCATION);
// Test on empty any object
Dali::Any myAny;
- float* f = myAny.GetPointer<float>();
- DALI_TEST_CHECK( f == NULL );
+ float* f = myAny.GetPointer<float>();
+ DALI_TEST_CHECK(f == NULL);
// Test on getting wrong type
myAny = 1.f;
try
{
myAny.GetPointer<int>();
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
}
END_TEST;
tet_infoline("Test Get().");
Any value1;
- Any value2( 5.f );
+ Any value2(5.f);
bool assert1 = false;
bool assert2 = false;
try
{
- uiValue = value1.Get< unsigned int >();
+ uiValue = value1.Get<unsigned int>();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
assert1 = true;
}
try
{
- uiValue = value2.Get< unsigned int >();
+ uiValue = value2.Get<unsigned int>();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
assert2 = true;
}
- if( assert1 && assert2 )
+ if(assert1 && assert2)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
else
{
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
- uiValue++; // supresss warning from unused variable
+ uiValue++; // supresss warning from unused variable
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
#include "dali-test-suite-utils/dali-test-suite-utils.h"
using namespace Dali;
-
void utc_base_handle_startup(void)
{
test_return_value = TET_UNDEF;
namespace
{
-
// Functor to test whether an animation finish signal is emitted
struct AnimationFinishCheck
{
void CheckSignalReceived()
{
- if (!mSignalReceived)
+ if(!mSignalReceived)
{
tet_printf("Expected Finish signal was not received\n");
tet_result(TET_FAIL);
{
// object + copy + passedByValue, ref count == 3
DALI_TEST_CHECK(passedByValue);
- if (passedByValue)
+ if(passedByValue)
{
DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
{
};
// used for testing ThisIsSaferThanReturningVoidStar
-class FakeHandle : public BaseHandle
+class FakeHandle : public BaseHandle
{
public:
-
void RunTest()
{
return ThisIsSaferThanReturningVoidStar();
}
};
-} // anon namespace
+} // namespace
int UtcDaliBaseHandleConstructorVoid(void)
{
// Copy the object, ref count == 2
BaseHandle copy(object);
DALI_TEST_CHECK(copy);
- if (copy)
+ if(copy)
{
DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
BaseHandle anotherCopy = ImplicitCopyConstructor(copy);
DALI_TEST_CHECK(anotherCopy);
- if (anotherCopy)
+ if(anotherCopy)
{
DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
// anotherCopy out of scope, ref count == 2
DALI_TEST_CHECK(copy);
- if (copy)
+ if(copy)
{
DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
BaseHandle object = Actor::New();
DALI_TEST_CHECK(object);
- if (object)
+ if(object)
{
DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
BaseHandle copy = object;
DALI_TEST_CHECK(copy);
- if (copy)
+ if(copy)
{
DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
// Initialize an object, ref count == 1
BaseHandle object = Actor::New();
- DALI_TEST_EQUALS( 1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
// Move the object, ref count == 1
- BaseHandle move = std::move( object );
- DALI_TEST_CHECK( move );
+ BaseHandle move = std::move(object);
+ DALI_TEST_CHECK(move);
// Check that object is moved (not copied, so ref count keeps the same)
- if ( move )
+ if(move)
{
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
- DALI_TEST_CHECK( !object );
+ DALI_TEST_CHECK(!object);
END_TEST;
}
// Initialize an object, ref count == 1
BaseHandle object = Actor::New();
- DALI_TEST_EQUALS( 1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, object.GetBaseObject().ReferenceCount(), TEST_LOCATION);
// Move the object, ref count == 1
BaseHandle move;
- move = std::move( object );
- DALI_TEST_CHECK( move );
+ move = std::move(object);
+ DALI_TEST_CHECK(move);
// Check that object is moved (not copied, so ref count keeps the same)
- if ( move )
+ if(move)
{
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
- DALI_TEST_CHECK( !object );
+ DALI_TEST_CHECK(!object);
END_TEST;
}
std::vector<Actor> myVector;
- for (int i=0; i<TargetVectorSize; ++i)
+ for(int i = 0; i < TargetVectorSize; ++i)
{
Actor actor = Actor::New();
std::stringstream stream;
- stream << "Actor " << i+1;
- actor.SetProperty( Actor::Property::NAME,stream.str());
+ stream << "Actor " << i + 1;
+ actor.SetProperty(Actor::Property::NAME, stream.str());
myVector.push_back(actor);
}
DALI_TEST_EQUALS(TargetVectorSize, static_cast<int>(myVector.size()), TEST_LOCATION);
- DALI_TEST_CHECK(myVector[0].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 1");
- DALI_TEST_CHECK(myVector[1].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 2");
- DALI_TEST_CHECK(myVector[2].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 3");
- DALI_TEST_CHECK(myVector[3].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 4");
- DALI_TEST_CHECK(myVector[4].GetProperty< std::string >( Actor::Property::NAME ) == "Actor 5");
+ DALI_TEST_CHECK(myVector[0].GetProperty<std::string>(Actor::Property::NAME) == "Actor 1");
+ DALI_TEST_CHECK(myVector[1].GetProperty<std::string>(Actor::Property::NAME) == "Actor 2");
+ DALI_TEST_CHECK(myVector[2].GetProperty<std::string>(Actor::Property::NAME) == "Actor 3");
+ DALI_TEST_CHECK(myVector[3].GetProperty<std::string>(Actor::Property::NAME) == "Actor 4");
+ DALI_TEST_CHECK(myVector[4].GetProperty<std::string>(Actor::Property::NAME) == "Actor 5");
END_TEST;
}
TestApplication application;
tet_infoline("Positive Test Dali::BaseHandle::UtcDaliBaseHandleDoAction");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
BaseHandle actorObject = actor;
DALI_TEST_CHECK(actorObject);
DALI_TEST_CHECK(actorObject.DoAction("invalidCommand", attributes) == false);
// Check that the actor is visible
- actor.SetProperty( Actor::Property::VISIBLE,true);
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
+ actor.SetProperty(Actor::Property::VISIBLE, true);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
// Check the actor performed an action to hide itself
DALI_TEST_CHECK(actorObject.DoAction("hide", attributes) == true);
application.Render();
// Check that the actor is now invisible
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
// Check the actor performed an action to show itself
DALI_TEST_CHECK(actorObject.DoAction("show", attributes) == true);
application.Render();
// Check that the actor is now visible
- DALI_TEST_CHECK(actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
application.GetScene().Add(actor);
// Build an animation with initial duration of 1 second
- float durationSeconds(1.0f);
- Animation animation = Animation::New(durationSeconds);
+ float durationSeconds(1.0f);
+ Animation animation = Animation::New(durationSeconds);
BaseHandle animationObject = animation;
DALI_TEST_CHECK(animationObject);
animation.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition, AlphaFunction::LINEAR);
// Set the new duration to be 2 seconds
- float newDurationSeconds(2.0f);
- Property::Value newDurationSecondsValue = Property::Value( newDurationSeconds );
- attributes["duration"] = newDurationSecondsValue;
+ float newDurationSeconds(2.0f);
+ Property::Value newDurationSecondsValue = Property::Value(newDurationSeconds);
+ attributes["duration"] = newDurationSecondsValue;
// Check the animation performed an action to play itself with the specified duration of 2 seconds
animationObject.DoAction("play", attributes);
- bool signalReceived(false);
+ bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
// use the handle API to connect the signal
- animation.ConnectSignal( &application, "finished", finishCheck );
+ animation.ConnectSignal(&application, "finished", finishCheck);
// just for coverage connect to non-existant signal as well
- animation.ConnectSignal( &application, "foo", finishCheck );
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ animation.ConnectSignal(&application, "foo", finishCheck);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
application.SendNotification();
application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) /* half of time */);
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
// pause
animationObject.DoAction("pause", attributes);
application.SendNotification();
- application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) + 1u/*just beyond the animation duration*/);
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
// continue
animationObject.DoAction("play", attributes);
application.SendNotification();
- application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) + 1u /*just beyond the animation duration*/);
// We expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), targetPosition, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), targetPosition, TEST_LOCATION);
// play again
signalReceived = false;
animationObject.DoAction("stop", attributes);
application.SendNotification();
application.Render(static_cast<uint32_t>(newDurationSeconds * 1000.0f) /* full time */);
- DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(signalReceived, false, TEST_LOCATION);
// Check the new animation duration is 2 seconds
DALI_TEST_EQUALS(animation.GetDuration(), newDurationSeconds, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliBaseHandleConnectSignal(void)
{
TestApplication application;
// get the root layer
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.SetProperty( Actor::Property::POSITION, Vector2( 240, 400 ));
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.SetProperty(Actor::Property::POSITION, Vector2(240, 400));
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- DALI_TEST_CHECK( gTouchCallBackCalled == false );
+ DALI_TEST_CHECK(gTouchCallBackCalled == false);
// connect to its touch signal
- actor.ConnectSignal( &application, "touched", TestCallback() );
+ actor.ConnectSignal(&application, "touched", TestCallback());
application.SendNotification();
application.Render(1000);
// simulate a touch event
Dali::Integration::Point point;
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 240, 400 ) );
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(240, 400));
Dali::Integration::TouchEvent event;
- event.AddPoint( point );
- application.ProcessEvent( event );
+ event.AddPoint(point);
+ application.ProcessEvent(event);
application.SendNotification();
application.Render(1000);
application.SendNotification();
application.Render(1000);
- DALI_TEST_CHECK( application.GetConnectionCount() > 0 );
- DALI_TEST_CHECK( gTouchCallBackCalled == true );
+ DALI_TEST_CHECK(application.GetConnectionCount() > 0);
+ DALI_TEST_CHECK(gTouchCallBackCalled == true);
gTouchCallBackCalled = false;
application.DisconnectAll();
// simulate another touch event
- application.ProcessEvent( event );
+ application.ProcessEvent(event);
- DALI_TEST_CHECK( gTouchCallBackCalled == false );
+ DALI_TEST_CHECK(gTouchCallBackCalled == false);
END_TEST;
}
std::string typeName = actor.GetTypeName();
- DALI_TEST_CHECK( typeName.size() );
- DALI_TEST_CHECK( typeName == std::string("Actor") );
+ DALI_TEST_CHECK(typeName.size());
+ DALI_TEST_CHECK(typeName == std::string("Actor"));
END_TEST;
}
int UtcDaliBaseHandleGetTypeNameN(void)
{
-
TestApplication application;
tet_infoline("Testing Dali::BaseObject::GetTypeName");
- FakeObject object;
+ FakeObject object;
std::string typeName = object.GetTypeName();
- DALI_TEST_CHECK( typeName.empty() );
+ DALI_TEST_CHECK(typeName.empty());
END_TEST;
}
tet_infoline("Testing Dali::BaseHandle::GetTypeInfo");
Dali::TypeInfo info;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
- bool ok = actor.GetTypeInfo( info );
- DALI_TEST_CHECK( ok );
+ bool ok = actor.GetTypeInfo(info);
+ DALI_TEST_CHECK(ok);
END_TEST;
}
handle.RunTest();
tet_result(TET_PASS);
END_TEST;
-
}
int UtcDaliBaseHandleGetTypeInfoN(void)
tet_infoline("Testing Dali::BaseHandle::GetTypeInfo");
Dali::TypeInfo info;
- FakeObject object;
+ FakeObject object;
- bool ok = object.GetTypeInfo( info );
- DALI_TEST_CHECK( !ok );
+ bool ok = object.GetTypeInfo(info);
+ DALI_TEST_CHECK(!ok);
END_TEST;
}
Dali::RefObject* p = actor.GetObjectPtr();
- DALI_TEST_CHECK( p != NULL );
+ DALI_TEST_CHECK(p != NULL);
END_TEST;
}
// get the root layer
BaseHandle handle = Actor::New();
- DALI_TEST_CHECK( static_cast<BaseHandle::BooleanType>( handle ) );
+ DALI_TEST_CHECK(static_cast<BaseHandle::BooleanType>(handle));
END_TEST;
}
int UtcDaliBaseHandleCompareOperatorN(void)
{
TestApplication application;
- BaseHandle handle1 = Actor::New();
- BaseHandle handle2 = handle1;
+ BaseHandle handle1 = Actor::New();
+ BaseHandle handle2 = handle1;
- DALI_TEST_CHECK( (handle1 < handle2) == false );
+ DALI_TEST_CHECK((handle1 < handle2) == false);
END_TEST;
}
int UtcDaliBaseHandleDoActionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::BaseHandle instance;
try
{
- std::string arg1;
+ std::string arg1;
Dali::Property::Map arg2;
- instance.DoAction(arg1,arg2);
+ instance.DoAction(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliBaseHandleGetTypeInfoNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::BaseHandle instance;
try
{
int UtcDaliBaseHandleGetTypeNameNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::BaseHandle instance;
try
{
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <limits>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/object/csharp-type-info.h>
#include <dali/devel-api/object/csharp-type-registry.h>
#include <dali/internal/event/common/type-registry-impl.h>
+#include <dali/public-api/dali-core.h>
#include <dali/public-api/object/property.h>
-using namespace Dali;
+#include <stdlib.h>
+#include <iostream>
+#include <limits>
+using namespace Dali;
namespace
{
-
-
static bool CreateCustomNamedInitCalled = false;
-
-BaseHandle* CreateCustomNamedInit(const char* const typeName )
+BaseHandle* CreateCustomNamedInit(const char* const typeName)
{
CreateCustomNamedInitCalled = true;
// Property Registration
bool setPropertyCalled = false;
bool getPropertyCalled = false;
-int intPropertyValue = 0;
+int intPropertyValue = 0;
-void SetProperty( BaseObject* object, const char* const propertyName , Property::Value* value )
+void SetProperty(BaseObject* object, const char* const propertyName, Property::Value* value)
{
-
- value->Get( intPropertyValue );
+ value->Get(intPropertyValue);
setPropertyCalled = true;
}
-Property::Value* GetProperty( BaseObject* object, const char* const propertyName )
+Property::Value* GetProperty(BaseObject* object, const char* const propertyName)
{
- getPropertyCalled = true;
- Property::Value* x = new Property::Value( 10 );
+ getPropertyCalled = true;
+ Property::Value* x = new Property::Value(10);
return x;
}
-}
+} // namespace
int UtcDaliRegisterCSharpTypeP(void)
{
-
TestApplication application;
- CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit );
+ CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit);
- Dali::TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo( "CSharpControl" );
+ Dali::TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo("CSharpControl");
info.CreateInstance();
- DALI_TEST_EQUALS( CreateCustomNamedInitCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(CreateCustomNamedInitCalled, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliRegisterCSharpTypeNoInitP(void)
{
-
TestApplication application;
CreateCustomNamedInitCalled = false;
- CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit );
+ CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit);
GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions();
- DALI_TEST_EQUALS( CreateCustomNamedInitCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(CreateCustomNamedInitCalled, false, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit );
+ CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit);
// should cause an assert because we're registering same type twice
try
{
- CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit );
- tet_result( TET_FAIL );
+ CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Duplicate type name in Type Registration", TEST_LOCATION);
}
END_TEST;
int UtcDaliRegisterCSharpTypeCreateP(void)
{
-
TestApplication application;
CreateCustomNamedInitCalled = false;
- CSharpTypeRegistry::RegisterType( "CSharpControl", typeid( Dali::Actor), &CreateCustomNamedInit );
-
+ CSharpTypeRegistry::RegisterType("CSharpControl", typeid(Dali::Actor), &CreateCustomNamedInit);
- TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo( "CSharpControl");
+ TypeInfo info = Dali::TypeRegistry::Get().GetTypeInfo("CSharpControl");
BaseHandle handle = info.CreateInstance();
- DALI_TEST_EQUALS( CreateCustomNamedInitCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(CreateCustomNamedInitCalled, true, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliRegisterCSharpPropertyP(void)
{
TestApplication application;
- CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit );
-
+ CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit);
- bool registered = CSharpTypeRegistry::RegisterProperty( "DateControl",
- "year",
- 10000 + 1,
- Property::INTEGER,
- SetProperty,
- GetProperty );
-
- DALI_TEST_EQUALS( registered, true, TEST_LOCATION );
+ bool registered = CSharpTypeRegistry::RegisterProperty("DateControl",
+ "year",
+ 10000 + 1,
+ Property::INTEGER,
+ SetProperty,
+ GetProperty);
+ DALI_TEST_EQUALS(registered, true, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRegisterCSharpPropertyN(void)
{
TestApplication application;
// register the same property twice
- CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit );
-
-
- bool registered = CSharpTypeRegistry::RegisterProperty( "DateControl",
- "year",
- 10000 + 1,
- Property::INTEGER,
- SetProperty,
- GetProperty );
+ CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit);
- DALI_TEST_EQUALS( registered, true, TEST_LOCATION );
+ bool registered = CSharpTypeRegistry::RegisterProperty("DateControl",
+ "year",
+ 10000 + 1,
+ Property::INTEGER,
+ SetProperty,
+ GetProperty);
+ DALI_TEST_EQUALS(registered, true, TEST_LOCATION);
// should fail second time with an assert as the property is already registered
try
{
- registered = CSharpTypeRegistry::RegisterProperty( "DateControl",
- "year",
- 10000 + 1,
- Property::INTEGER,
- SetProperty,
- GetProperty );
-
- tet_result( TET_FAIL );
+ registered = CSharpTypeRegistry::RegisterProperty("DateControl",
+ "year",
+ 10000 + 1,
+ Property::INTEGER,
+ SetProperty,
+ GetProperty);
+
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property index already added to Type", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property index already added to Type", TEST_LOCATION);
}
END_TEST;
{
TestApplication application;
- // register the same property twice
- CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit );;
-
- Property::Index index(100001);
+ // register the same property twice
+ CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit);
+ ;
- CSharpTypeRegistry::RegisterProperty( "DateControl",
- "year",
- index,
- Property::INTEGER,
- SetProperty,
- GetProperty );
+ Property::Index index(100001);
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ CSharpTypeRegistry::RegisterProperty("DateControl",
+ "year",
+ index,
+ Property::INTEGER,
+ SetProperty,
+ GetProperty);
- TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "DateControl" );
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo("DateControl");
- // Check the property is writable in the type registry
- Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
+ // Check the property is writable in the type registry
+ Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo);
- Property::Value value(25);
+ Property::Value value(25);
- typeInfoImpl.SetProperty( NULL, index, value );
+ typeInfoImpl.SetProperty(NULL, index, value);
- DALI_TEST_EQUALS( 25, intPropertyValue , TEST_LOCATION );
+ DALI_TEST_EQUALS(25, intPropertyValue, TEST_LOCATION);
- Property::Value value2(50);
+ Property::Value value2(50);
- typeInfoImpl.SetProperty( NULL, "year", value2 );
+ typeInfoImpl.SetProperty(NULL, "year", value2);
- DALI_TEST_EQUALS( 50, intPropertyValue , TEST_LOCATION );
+ DALI_TEST_EQUALS(50, intPropertyValue, TEST_LOCATION);
- DALI_TEST_EQUALS( setPropertyCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(setPropertyCalled, true, TEST_LOCATION);
- END_TEST;
+ END_TEST;
}
-
int UtcDaliRegisterCSharpPropertyGetP(void)
{
TestApplication application;
- // register the same property twice
- CSharpTypeRegistry::RegisterType( "DateControl", typeid( Dali::Actor), &CreateCustomNamedInit );
-
- Property::Index index(100001);
+ // register the same property twice
+ CSharpTypeRegistry::RegisterType("DateControl", typeid(Dali::Actor), &CreateCustomNamedInit);
- CSharpTypeRegistry::RegisterProperty( "DateControl",
- "year",
- index,
- Property::INTEGER,
- SetProperty,
- GetProperty );
+ Property::Index index(100001);
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ CSharpTypeRegistry::RegisterProperty("DateControl",
+ "year",
+ index,
+ Property::INTEGER,
+ SetProperty,
+ GetProperty);
- TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( "DateControl" );
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo("DateControl");
- // Check the property is writable in the type registry
- Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
+ // Check the property is writable in the type registry
+ Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo);
- Property::Value value(1);
+ Property::Value value(1);
- value = typeInfoImpl.GetProperty( NULL, index );
+ value = typeInfoImpl.GetProperty(NULL, index);
- int propValue;
- value.Get( propValue );
+ int propValue;
+ value.Get(propValue);
- DALI_TEST_EQUALS( getPropertyCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( propValue, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(getPropertyCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(propValue, 10, TEST_LOCATION);
- value = typeInfoImpl.GetProperty( NULL, "year");
- value.Get( propValue );
+ value = typeInfoImpl.GetProperty(NULL, "year");
+ value.Get(propValue);
- DALI_TEST_EQUALS( propValue, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(propValue, 10, TEST_LOCATION);
- END_TEST;
+ END_TEST;
}
int UtcDaliRegisterCSharpPropertyNotRegisteredN(void)
TestApplication application;
// control not registered, should fail
- bool registered = CSharpTypeRegistry::RegisterProperty( "DateControl",
- "year",
- 10000 + 1,
- Property::INTEGER,
- SetProperty,
- GetProperty );
+ bool registered = CSharpTypeRegistry::RegisterProperty("DateControl",
+ "year",
+ 10000 + 1,
+ Property::INTEGER,
+ SetProperty,
+ GetProperty);
- DALI_TEST_EQUALS( registered, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(registered, false, TEST_LOCATION);
END_TEST;
}
-
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <cmath>
#include <dali/public-api/dali-core.h>
+
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/actors/camera-actor-devel.h>
+#include <stdlib.h>
+
+#include <cmath>
+#include <iostream>
#include "dali-test-suite-utils/dali-test-suite-utils.h"
namespace
{
-
-const float FLOAT_EPSILON = 0.001f;
-const float TEST_ASPECT_RATIO = 0.123f;
-const float TEST_FIELD_OF_VIEW = Radian(Degree(40.0f));
+const float FLOAT_EPSILON = 0.001f;
+const float TEST_ASPECT_RATIO = 0.123f;
+const float TEST_FIELD_OF_VIEW = Radian(Degree(40.0f));
const float TEST_NEAR_PLANE_DISTANCE = 0.23f;
-const float TEST_FAR_PLANE_DISTANCE = 0.973f;
+const float TEST_FAR_PLANE_DISTANCE = 0.973f;
-const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME( "uLightCameraProjectionMatrix" );
-const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME( "uLightCameraViewMatrix" );
+const std::string SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME("uLightCameraProjectionMatrix");
+const std::string SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME("uLightCameraViewMatrix");
const char* const RENDER_SHADOW_VERTEX_SOURCE =
" uniform mediump mat4 uLightCameraProjectionMatrix;\n"
" uniform mediump mat4 uLightCameraViewMatrix;\n"
struct PropertyDetails
{
- std::string name; ///< The name of the property.
- Property::Type type; ///< The property type.
- bool writable; ///< Whether the property is writable
- bool animatable; ///< Whether the property is animatable.
- bool constraintInput; ///< Whether the property can be used as an input to a constraint.
- Property::Index enumIndex; ///< Used to check the index is correct within a debug build.
+ std::string name; ///< The name of the property.
+ Property::Type type; ///< The property type.
+ bool writable; ///< Whether the property is writable
+ bool animatable; ///< Whether the property is animatable.
+ bool constraintInput; ///< Whether the property can be used as an input to a constraint.
+ Property::Index enumIndex; ///< Used to check the index is correct within a debug build.
};
} // Anonymous namespace
-
int UtcDaliCameraActorConstructorP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::CameraActor()" );
+ tet_infoline("Testing Dali::CameraActor::CameraActor()");
CameraActor actor;
- DALI_TEST_CHECK( !actor );
+ DALI_TEST_CHECK(!actor);
END_TEST;
}
int UtcDaliCameraActorDestructorP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::~CameraActor (P)" );
+ tet_infoline("Testing Dali::~CameraActor (P)");
CameraActor* actor = new CameraActor();
delete actor;
actor = NULL;
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
int UtcDaliCameraActorCopyConstructorP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Copy Constructor (P)" );
+ tet_infoline("Testing Dali::CameraActor Copy Constructor (P)");
CameraActor actor = CameraActor::New();
- CameraActor copyActor( actor );
+ CameraActor copyActor(actor);
- DALI_TEST_CHECK( copyActor );
- DALI_TEST_CHECK( copyActor == actor );
+ DALI_TEST_CHECK(copyActor);
+ DALI_TEST_CHECK(copyActor == actor);
END_TEST;
}
int UtcDaliCameraActorCopyConstructorN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Copy Constructor (N)" );
+ tet_infoline("Testing Dali::CameraActor Copy Constructor (N)");
CameraActor actor;
- CameraActor copyActor( actor );
+ CameraActor copyActor(actor);
- DALI_TEST_CHECK( !copyActor );
+ DALI_TEST_CHECK(!copyActor);
END_TEST;
}
int UtcDaliCameraActorAssignmentOperatorP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Assignment Operator (P)" );
+ tet_infoline("Testing Dali::CameraActor Assignment Operator (P)");
const CameraActor actor = CameraActor::New();
CameraActor copyActor = actor;
- DALI_TEST_CHECK( copyActor );
- DALI_TEST_CHECK( copyActor == actor );
+ DALI_TEST_CHECK(copyActor);
+ DALI_TEST_CHECK(copyActor == actor);
END_TEST;
}
int UtcDaliCameraActorAssignmentOperatorN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor = (N)" );
+ tet_infoline("Testing Dali::CameraActor = (N)");
CameraActor actor;
CameraActor copyActor = actor;
- DALI_TEST_CHECK( !copyActor );
+ DALI_TEST_CHECK(!copyActor);
END_TEST;
}
int UtcDaliCameraActorNewP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::New (P)" );
+ tet_infoline("Testing Dali::CameraActor::New (P)");
CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
actor.Reset();
- DALI_TEST_CHECK( !actor );
+ DALI_TEST_CHECK(!actor);
END_TEST;
}
int UtcDaliCameraActorNewDefaultPerspectiveProjection(void)
{
TestApplication application;
- tet_infoline( "Test the perspective projection of a camera actor is set appropriately when not passing in a size" );
+ tet_infoline("Test the perspective projection of a camera actor is set appropriately when not passing in a size");
CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
// All the properties should still be the default values
// Defaults taken from scene-graph-camera.cpp
- DALI_TEST_EQUALS( 4.0f/3.0f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 45.0f*(Math::PI/180.0f), actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 3.0f * 800.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 0.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(4.0f / 3.0f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(45.0f * (Math::PI / 180.0f), actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(3.0f * 800.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
// Add it to the stage, then the values should be updated to reflect a 480.0f by 800.0f scene (default stage size)
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- DALI_TEST_EQUALS( 0.6f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 0.489957f, actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 4895.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 1600.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.6f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
// Ensure the values stay the same after update/render
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( 0.6f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 0.489957f, actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 4895.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 1600.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.6f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorDownCastP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::DownCast (P)" );
+ tet_infoline("Testing Dali::CameraActor::DownCast (P)");
- CameraActor camera = CameraActor::New();
- Actor anActor = Actor::New();
- anActor.Add( camera );
+ CameraActor camera = CameraActor::New();
+ Actor anActor = Actor::New();
+ anActor.Add(camera);
- Actor child = anActor.GetChildAt( 0 );
- CameraActor cameraActor = CameraActor::DownCast( child );
- DALI_TEST_CHECK( cameraActor );
+ Actor child = anActor.GetChildAt(0);
+ CameraActor cameraActor = CameraActor::DownCast(child);
+ DALI_TEST_CHECK(cameraActor);
cameraActor.Reset();
- DALI_TEST_CHECK( !cameraActor );
+ DALI_TEST_CHECK(!cameraActor);
- cameraActor = DownCast< CameraActor >( child );
- DALI_TEST_CHECK( cameraActor );
+ cameraActor = DownCast<CameraActor>(child);
+ DALI_TEST_CHECK(cameraActor);
END_TEST;
}
int UtcDaliCameraActorDownCastN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::DownCast (N)" );
+ tet_infoline("Testing Dali::CameraActor::DownCast (N)");
- Actor actor1 = Actor::New();
+ Actor actor1 = Actor::New();
Actor anActor = Actor::New();
- anActor.Add( actor1 );
+ anActor.Add(actor1);
- Actor child = anActor.GetChildAt( 0 );
- CameraActor cameraActor = CameraActor::DownCast( child );
- DALI_TEST_CHECK( !cameraActor );
+ Actor child = anActor.GetChildAt(0);
+ CameraActor cameraActor = CameraActor::DownCast(child);
+ DALI_TEST_CHECK(!cameraActor);
Actor unInitialzedActor;
- cameraActor = CameraActor::DownCast( unInitialzedActor );
- DALI_TEST_CHECK( !cameraActor );
+ cameraActor = CameraActor::DownCast(unInitialzedActor);
+ DALI_TEST_CHECK(!cameraActor);
- cameraActor = DownCast< CameraActor >( unInitialzedActor );
- DALI_TEST_CHECK( !cameraActor );
+ cameraActor = DownCast<CameraActor>(unInitialzedActor);
+ DALI_TEST_CHECK(!cameraActor);
END_TEST;
}
int UtcDaliCameraActorSetGetTypeP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor GetType (P)" );
+ tet_infoline("Testing Dali::CameraActor GetType (P)");
CameraActor actor = CameraActor::New();
- DALI_TEST_EQUALS( actor.GetType(), Dali::Camera::FREE_LOOK, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetType(), Dali::Camera::FREE_LOOK, TEST_LOCATION);
- actor.SetType( Dali::Camera::LOOK_AT_TARGET );
- DALI_TEST_EQUALS( actor.GetType(), Dali::Camera::LOOK_AT_TARGET, TEST_LOCATION );
+ actor.SetType(Dali::Camera::LOOK_AT_TARGET);
+ DALI_TEST_EQUALS(actor.GetType(), Dali::Camera::LOOK_AT_TARGET, TEST_LOCATION);
- DALI_TEST_EQUALS( "LOOK_AT_TARGET", actor.GetProperty< std::string >( CameraActor::Property::TYPE ), TEST_LOCATION );
- DALI_TEST_EQUALS( "LOOK_AT_TARGET", actor.GetCurrentProperty< std::string >( CameraActor::Property::TYPE ), TEST_LOCATION );
+ DALI_TEST_EQUALS("LOOK_AT_TARGET", actor.GetProperty<std::string>(CameraActor::Property::TYPE), TEST_LOCATION);
+ DALI_TEST_EQUALS("LOOK_AT_TARGET", actor.GetCurrentProperty<std::string>(CameraActor::Property::TYPE), TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetGetTypeN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor GetType (N)" );
+ tet_infoline("Testing Dali::CameraActor GetType (N)");
CameraActor actor;
{
cameraType = actor.GetType();
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera", TEST_LOCATION);
}
const CameraActor aConstActor;
{
cameraType = aConstActor.GetType();
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera", TEST_LOCATION);
}
- DALI_TEST_EQUALS( cameraType, Dali::Camera::FREE_LOOK, TEST_LOCATION );
+ DALI_TEST_EQUALS(cameraType, Dali::Camera::FREE_LOOK, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetFieldOfViewP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Field of view (P)" );
+ tet_infoline("Testing Dali::CameraActor Set Field of view (P)");
- CameraActor defaultCamera = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
+ CameraActor defaultCamera = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
const float defaultFieldOfView = defaultCamera.GetFieldOfView();
- CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- DALI_TEST_EQUALS( actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION );
+ CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ DALI_TEST_EQUALS(actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION);
float fieldOfView = Math::PI / 3.0f;
- actor.SetFieldOfView( fieldOfView );
- DALI_TEST_EQUALS( actor.GetFieldOfView(), fieldOfView, TEST_LOCATION );
+ actor.SetFieldOfView(fieldOfView);
+ DALI_TEST_EQUALS(actor.GetFieldOfView(), fieldOfView, TEST_LOCATION);
float value;
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetFieldOfViewN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Field of view (N)" );
+ tet_infoline("Testing Dali::CameraActor Set Field of view (N)");
- CameraActor defaultCamera = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
+ CameraActor defaultCamera = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
const float defaultFieldOfView = defaultCamera.GetFieldOfView();
- CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- DALI_TEST_EQUALS( actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION );
+ CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ DALI_TEST_EQUALS(actor.GetFieldOfView(), defaultFieldOfView, TEST_LOCATION);
float fieldOfView = Math::PI / 3.0f;
- actor.SetFieldOfView( fieldOfView );
- DALI_TEST_EQUALS( actor.GetFieldOfView(), fieldOfView, TEST_LOCATION );
+ actor.SetFieldOfView(fieldOfView);
+ DALI_TEST_EQUALS(actor.GetFieldOfView(), fieldOfView, TEST_LOCATION);
float value;
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(fieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetFieldOfViewP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Field of view (P)" );
- const Vector2 size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT );
+ tet_infoline("Testing Dali::CameraActor Get Field of view (P)");
+ const Vector2 size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT);
- CameraActor defaultCamera = CameraActor::New( size );
+ CameraActor defaultCamera = CameraActor::New(size);
- const float cameraZ = 2.0f * std::max( size.width, size.height );
- const float expectedFieldOfView = 2.0f * std::atan( size.height * 0.5f / cameraZ );
+ const float cameraZ = 2.0f * std::max(size.width, size.height);
+ const float expectedFieldOfView = 2.0f * std::atan(size.height * 0.5f / cameraZ);
- CameraActor actor = CameraActor::New( size );
- DALI_TEST_EQUALS( actor.GetFieldOfView(), expectedFieldOfView, TEST_LOCATION );
+ CameraActor actor = CameraActor::New(size);
+ DALI_TEST_EQUALS(actor.GetFieldOfView(), expectedFieldOfView, TEST_LOCATION);
float value;
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( expectedFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(expectedFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetFieldOfViewN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Field of view (N)" );
+ tet_infoline("Testing Dali::CameraActor Get Field of view (N)");
CameraActor defaultCamera = CameraActor::New();
{
defaultCamera.GetFieldOfView();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetAspectRatioP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Aspect Ratio (P)" );
+ tet_infoline("Testing Dali::CameraActor Set Aspect Ratio (P)");
- CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- DALI_TEST_EQUALS( actor.GetAspectRatio(), static_cast<float>( TestApplication::DEFAULT_SURFACE_WIDTH ) / static_cast<float>( TestApplication::DEFAULT_SURFACE_HEIGHT ), TEST_LOCATION );
+ CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ DALI_TEST_EQUALS(actor.GetAspectRatio(), static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH) / static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION);
// Set an initial value to confirm a further set changes it.
float aspect = 4.0f / 3.0f;
- actor.SetAspectRatio( aspect );
- DALI_TEST_EQUALS( actor.GetAspectRatio(), aspect, TEST_LOCATION );
+ actor.SetAspectRatio(aspect);
+ DALI_TEST_EQUALS(actor.GetAspectRatio(), aspect, TEST_LOCATION);
aspect = 16.0f / 9.0f;
- actor.SetAspectRatio( aspect );
- DALI_TEST_EQUALS( actor.GetAspectRatio(), aspect, TEST_LOCATION );
+ actor.SetAspectRatio(aspect);
+ DALI_TEST_EQUALS(actor.GetAspectRatio(), aspect, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetAspectRatioN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Aspect Ratio (N)" );
+ tet_infoline("Testing Dali::CameraActor Set Aspect Ratio (N)");
CameraActor actor;
bool asserted = true;
try
{
- actor.SetAspectRatio( 16.0f / 9.0f );
+ actor.SetAspectRatio(16.0f / 9.0f);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
TestApplication application;
tet_infoline("Testing Dali::CameraActor Get Aspect Ratio");
- CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- float defaultAspect = static_cast<float>( TestApplication::DEFAULT_SURFACE_WIDTH ) / static_cast<float>( TestApplication::DEFAULT_SURFACE_HEIGHT );
+ CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ float defaultAspect = static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH) / static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT);
- DALI_TEST_EQUALS( actor.GetAspectRatio(), defaultAspect, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetAspectRatio(), defaultAspect, TEST_LOCATION);
float value = 0.0f;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( defaultAspect, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(defaultAspect, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetAspectRatioN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Aspect Ratio (N)" );
+ tet_infoline("Testing Dali::CameraActor Get Aspect Ratio (N)");
CameraActor actor;
{
actor.GetAspectRatio();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetNearClippingPlaneP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Near clipping plane (P)" );
+ tet_infoline("Testing Dali::CameraActor Set Near clipping plane (P)");
CameraActor actor = CameraActor::New();
// Set a value so we are not relying on a particular default for this test case.
- actor.SetNearClippingPlane( 200.0f );
- DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 200.0f, TEST_LOCATION );
+ actor.SetNearClippingPlane(200.0f);
+ DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 200.0f, TEST_LOCATION);
- actor.SetNearClippingPlane( 400.0f );
- DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 400.0f, TEST_LOCATION );
+ actor.SetNearClippingPlane(400.0f);
+ DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 400.0f, TEST_LOCATION);
// Check setting the property.
- actor.SetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE, Property::Value( 300.0f ) );
- DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 300.0f, FLOAT_EPSILON, TEST_LOCATION );
+ actor.SetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE, Property::Value(300.0f));
+ DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 300.0f, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetNearClippingPlaneN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Near clipping plane (N)" );
+ tet_infoline("Testing Dali::CameraActor Set Near clipping plane (N)");
CameraActor actor;
bool asserted = true;
try
{
- actor.SetNearClippingPlane( 200.0f );
+ actor.SetNearClippingPlane(200.0f);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorGetNearClippingPlaneP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Near clipping plane (P)" );
+ tet_infoline("Testing Dali::CameraActor Get Near clipping plane (P)");
// Check the default value.
- CameraActor actor = CameraActor::New();
- float defaultValue = 800.0f;
- DALI_TEST_EQUALS( actor.GetNearClippingPlane(), defaultValue, TEST_LOCATION );
+ CameraActor actor = CameraActor::New();
+ float defaultValue = 800.0f;
+ DALI_TEST_EQUALS(actor.GetNearClippingPlane(), defaultValue, TEST_LOCATION);
// Check getting the property.
float value;
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( defaultValue, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(defaultValue, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetNearClippingPlaneN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Near clipping plane (N)" );
+ tet_infoline("Testing Dali::CameraActor Get Near clipping plane (N)");
CameraActor actor;
- bool asserted = true;
+ bool asserted = true;
try
{
actor.GetNearClippingPlane();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetFarClippingPlaneP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Far clipping plane (P)" );
+ tet_infoline("Testing Dali::CameraActor Set Far clipping plane (P)");
CameraActor actor = CameraActor::New();
// Set a value so we are not relying on a particular default for this test case.
- actor.SetFarClippingPlane( 2000.0f );
- DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 2000.0f, TEST_LOCATION );
+ actor.SetFarClippingPlane(2000.0f);
+ DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 2000.0f, TEST_LOCATION);
- actor.SetFarClippingPlane( 4000.0f );
- DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 4000.0f, TEST_LOCATION );
+ actor.SetFarClippingPlane(4000.0f);
+ DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 4000.0f, TEST_LOCATION);
// Check setting the property.
- actor.SetProperty( CameraActor::Property::FAR_PLANE_DISTANCE, 2000.0f );
- DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 2000.0f, FLOAT_EPSILON, TEST_LOCATION );
+ actor.SetProperty(CameraActor::Property::FAR_PLANE_DISTANCE, 2000.0f);
+ DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 2000.0f, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetFarClippingPlaneN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Far clipping plane (N)" );
+ tet_infoline("Testing Dali::CameraActor Set Far clipping plane (N)");
CameraActor actor;
bool asserted = true;
try
{
- actor.SetFarClippingPlane( 2000.0f );
+ actor.SetFarClippingPlane(2000.0f);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorGetFarClippingPlaneP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Far clipping plane (P)" );
+ tet_infoline("Testing Dali::CameraActor Get Far clipping plane (P)");
- CameraActor actor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- float defaultValue = 800.0f + ( 0xFFFF >> 4 );
- DALI_TEST_EQUALS( actor.GetFarClippingPlane(), defaultValue, TEST_LOCATION );
+ CameraActor actor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ float defaultValue = 800.0f + (0xFFFF >> 4);
+ DALI_TEST_EQUALS(actor.GetFarClippingPlane(), defaultValue, TEST_LOCATION);
// Check getting the property.
float value;
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( defaultValue, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(defaultValue, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetFarClippingPlaneN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Far clipping plane (N)" );
+ tet_infoline("Testing Dali::CameraActor Get Far clipping plane (N)");
CameraActor actor;
{
actor.GetFarClippingPlane();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetTargetPositionP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Target Position (P)" );
+ tet_infoline("Testing Dali::CameraActor Set Target Position (P)");
CameraActor actor = CameraActor::New();
- Vector3 target1( 10.0f, 20.0f, 30.0f );
- Vector3 target2( 15.0f, 25.0f, 35.0f );
+ Vector3 target1(10.0f, 20.0f, 30.0f);
+ Vector3 target2(15.0f, 25.0f, 35.0f);
// Set a value so we are not relying on a particular default for this test case.
- actor.SetTargetPosition( target1 );
- DALI_TEST_EQUALS( actor.GetTargetPosition(), target1, TEST_LOCATION );
+ actor.SetTargetPosition(target1);
+ DALI_TEST_EQUALS(actor.GetTargetPosition(), target1, TEST_LOCATION);
- actor.SetTargetPosition( target2 );
- DALI_TEST_EQUALS( actor.GetTargetPosition(), target2, TEST_LOCATION );
+ actor.SetTargetPosition(target2);
+ DALI_TEST_EQUALS(actor.GetTargetPosition(), target2, TEST_LOCATION);
// Check setting the property.
- actor.SetProperty( CameraActor::Property::TARGET_POSITION, target1 );
- DALI_TEST_EQUALS( actor.GetTargetPosition(), target1, FLOAT_EPSILON, TEST_LOCATION );
+ actor.SetProperty(CameraActor::Property::TARGET_POSITION, target1);
+ DALI_TEST_EQUALS(actor.GetTargetPosition(), target1, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetTargetPositionN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set Target Position (N)" );
+ tet_infoline("Testing Dali::CameraActor Set Target Position (N)");
CameraActor actor;
bool asserted = true;
try
{
- actor.SetTargetPosition( Vector3( 10.0f, 20.0f, 30.0f ) );
+ actor.SetTargetPosition(Vector3(10.0f, 20.0f, 30.0f));
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorGetTargetPositionP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Target Position (P)" );
+ tet_infoline("Testing Dali::CameraActor Get Target Position (P)");
CameraActor actor = CameraActor::New();
- Vector3 defaultValue( Vector3::ZERO );
- DALI_TEST_EQUALS( actor.GetTargetPosition(), defaultValue, TEST_LOCATION );
+ Vector3 defaultValue(Vector3::ZERO);
+ DALI_TEST_EQUALS(actor.GetTargetPosition(), defaultValue, TEST_LOCATION);
// Check getting the property.
Vector3 value;
- actor.GetProperty( CameraActor::Property::TARGET_POSITION ).Get( value );
- DALI_TEST_EQUALS( defaultValue, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::TARGET_POSITION).Get(value);
+ DALI_TEST_EQUALS(defaultValue, value, FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetTargetPositionN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get Target Position (N)" );
+ tet_infoline("Testing Dali::CameraActor Get Target Position (N)");
CameraActor actor;
{
actor.GetTargetPosition();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetInvertYAxisP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set InvertYAxis (P)" );
+ tet_infoline("Testing Dali::CameraActor Set InvertYAxis (P)");
CameraActor actor = CameraActor::New();
// Set a value so we are not relying on a particular default for this test case.
- actor.SetInvertYAxis( false );
- DALI_TEST_EQUALS( actor.GetInvertYAxis(), false, TEST_LOCATION );
+ actor.SetInvertYAxis(false);
+ DALI_TEST_EQUALS(actor.GetInvertYAxis(), false, TEST_LOCATION);
- actor.SetInvertYAxis( true );
- DALI_TEST_EQUALS( actor.GetInvertYAxis(), true, TEST_LOCATION );
+ actor.SetInvertYAxis(true);
+ DALI_TEST_EQUALS(actor.GetInvertYAxis(), true, TEST_LOCATION);
- actor.SetProperty( CameraActor::Property::INVERT_Y_AXIS, false );
- DALI_TEST_EQUALS( actor.GetInvertYAxis(), false, TEST_LOCATION );
+ actor.SetProperty(CameraActor::Property::INVERT_Y_AXIS, false);
+ DALI_TEST_EQUALS(actor.GetInvertYAxis(), false, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetInvertYAxisN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Set InvertYAxis (N)" );
+ tet_infoline("Testing Dali::CameraActor Set InvertYAxis (N)");
CameraActor actor;
bool asserted = true;
try
{
- actor.SetInvertYAxis( false );
+ actor.SetInvertYAxis(false);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorGetInvertYAxisP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get InvertYAxis (P)" );
+ tet_infoline("Testing Dali::CameraActor Get InvertYAxis (P)");
// Check the default value.
CameraActor actor = CameraActor::New();
- DALI_TEST_EQUALS( actor.GetInvertYAxis(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetInvertYAxis(), false, TEST_LOCATION);
// Check getting the property.
bool bValue;
- actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS ).Get( bValue );
- DALI_TEST_EQUALS( false, bValue, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue);
+ DALI_TEST_EQUALS(false, bValue, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetInvertYAxisN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Get InvertYAxis (N)" );
+ tet_infoline("Testing Dali::CameraActor Get InvertYAxis (N)");
CameraActor actor;
{
actor.GetInvertYAxis();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetPerspectiveProjectionP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetPerspectiveProjection (P)" );
+ tet_infoline("Testing Dali::CameraActor::SetPerspectiveProjection (P)");
CameraActor actor = CameraActor::New();
- actor.SetPerspectiveProjection( Size( 100.f, 150.f ) );
+ actor.SetPerspectiveProjection(Size(100.f, 150.f));
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
float value;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( 0.666666f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( 0.489957f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 150.f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 4245.f, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(0.666666f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(0.489957f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(150.f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(4245.f, value, FLOAT_EPSILON, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
// Ensure these values persist after adding to the stage and an update/render pass
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( 0.666666f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( 0.489957f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 150.f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 4245.f, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(0.666666f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(0.489957f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(150.f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(4245.f, value, FLOAT_EPSILON, TEST_LOCATION);
// Call method with a ZERO size, this should reset the perspective projection using the size of the scene we've been added to
- actor.SetPerspectiveProjection( Vector2::ZERO );
+ actor.SetPerspectiveProjection(Vector2::ZERO);
- DALI_TEST_EQUALS( 0.6f, actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 0.489957f, actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 800.0f, actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 4895.0f, actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get< float >(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( 1600.0f, actor.GetProperty( Actor::Property::POSITION_Z ).Get< float >(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.6f, actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.489957f, actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(800.0f, actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(4895.0f, actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get<float>(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(1600.0f, actor.GetProperty(Actor::Property::POSITION_Z).Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetPerspectiveProjectionN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetPerspectiveProjection (N)" );
+ tet_infoline("Testing Dali::CameraActor::SetPerspectiveProjection (N)");
CameraActor actor = CameraActor::New();
// Check that setting perspective projection without a size does not do anything.
- actor.SetPerspectiveProjection( Size::ZERO );
+ actor.SetPerspectiveProjection(Size::ZERO);
// So the default values should be the same as defined in CameraActor
float nearClippingPlane = 800.0f;
- float farClippingPlane = nearClippingPlane + 2.0f * nearClippingPlane;
+ float farClippingPlane = nearClippingPlane + 2.0f * nearClippingPlane;
- DALI_TEST_EQUALS( nearClippingPlane, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( farClippingPlane, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(nearClippingPlane, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(farClippingPlane, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetOrthographicProjectionP1(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (P,1)" );
+ tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,1)");
- CameraActor actor = CameraActor::New( Size( 1080.0f, 1920.0f ) );
- DALI_TEST_CHECK( actor );
+ CameraActor actor = CameraActor::New(Size(1080.0f, 1920.0f));
+ DALI_TEST_CHECK(actor);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- actor.SetOrthographicProjection( Size( 1080.0f, 1920.0f ) );
+ actor.SetOrthographicProjection(Size(1080.0f, 1920.0f));
application.SendNotification();
- application.Render( 0 );
+ application.Render(0);
application.Render();
application.SendNotification();
float defaultFieldOfView;
float defaultNearPlaneDistance;
float defaultFarPlaneDistance;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( defaultAspectRatio );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( defaultFieldOfView );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( defaultNearPlaneDistance );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( defaultFarPlaneDistance );
- Vector3 defaultPos = actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance);
+ Vector3 defaultPos = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
- actor.SetOrthographicProjection( Size( 1080.0f, 1920.0f ) );
+ actor.SetOrthographicProjection(Size(1080.0f, 1920.0f));
application.SendNotification();
- application.Render( 0 );
+ application.Render(0);
application.Render();
application.SendNotification();
float value;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( defaultNearPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( defaultFarPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(defaultNearPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(defaultFarPlaneDistance, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( -540.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 540.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::TOP_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 960.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( -960.0f, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-540.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(540.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(960.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-960.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- Vector3 pos = actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
- DALI_TEST_EQUALS( defaultPos.z, pos.z, 0.001f, TEST_LOCATION );
+ Vector3 pos = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
+ DALI_TEST_EQUALS(defaultPos.z, pos.z, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetOrthographicProjectionN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (N)" );
+ tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (N)");
CameraActor actor;
- bool asserted = true;
+ bool asserted = true;
try
{
actor.GetProjectionMode();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetOrthographicProjectionP2(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (P,2)" );
+ tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,2)");
CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
float defaultAspectRatio;
float defaultFieldOfView;
float defaultNearPlaneDistance;
float defaultFarPlaneDistance;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( defaultAspectRatio );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( defaultFieldOfView );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( defaultNearPlaneDistance );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( defaultFarPlaneDistance );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance);
// Check setting with specific near and far plane distances.
- actor.SetOrthographicProjection( -100.0f, 200.0f, -300.0f, 500.0f, 400.0f, 4000.0f );
+ actor.SetOrthographicProjection(-100.0f, 200.0f, -300.0f, 500.0f, 400.0f, 4000.0f);
float value;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 400.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 4000.0f, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(400.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(4000.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- actor.GetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( -100.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 200.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::TOP_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( -300.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 500.0f, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-100.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(200.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-300.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(500.0f, value, FLOAT_EPSILON, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetOrthographicProjectionP3(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetOrthographicProjection (P,3)" );
+ tet_infoline("Testing Dali::CameraActor::SetOrthographicProjection (P,3)");
CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
float defaultAspectRatio;
float defaultFieldOfView;
float defaultNearPlaneDistance;
float defaultFarPlaneDistance;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( defaultAspectRatio );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( defaultFieldOfView );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( defaultNearPlaneDistance );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( defaultFarPlaneDistance );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(defaultAspectRatio);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(defaultFieldOfView);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(defaultNearPlaneDistance);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(defaultFarPlaneDistance);
- actor.SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION );
+ actor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
- actor.SetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE, -100.0f );
- actor.SetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE, 200.0f );
- actor.SetProperty( CameraActor::Property::TOP_PLANE_DISTANCE, -300.0f );
- actor.SetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE, 500.0f );
- actor.SetNearClippingPlane( 400.0f );
- actor.SetFarClippingPlane( 4000.0f );
+ actor.SetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE, -100.0f);
+ actor.SetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE, 200.0f);
+ actor.SetProperty(CameraActor::Property::TOP_PLANE_DISTANCE, -300.0f);
+ actor.SetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE, 500.0f);
+ actor.SetNearClippingPlane(400.0f);
+ actor.SetFarClippingPlane(4000.0f);
float value;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 400.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 4000.0f, value, FLOAT_EPSILON, TEST_LOCATION );
-
- actor.GetProperty( CameraActor::Property::LEFT_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( -100.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::RIGHT_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 200.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::TOP_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( -300.0f, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::BOTTOM_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( 500.0f, value, FLOAT_EPSILON, TEST_LOCATION );
-
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(defaultAspectRatio, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(defaultFieldOfView, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(400.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(4000.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+
+ actor.GetProperty(CameraActor::Property::LEFT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-100.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::RIGHT_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(200.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::TOP_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(-300.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::BOTTOM_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(500.0f, value, FLOAT_EPSILON, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
std::string stringValue;
- actor.GetProperty( CameraActor::Property::PROJECTION_MODE ).Get( stringValue );
- DALI_TEST_EQUALS( stringValue, "ORTHOGRAPHIC_PROJECTION", TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(stringValue);
+ DALI_TEST_EQUALS(stringValue, "ORTHOGRAPHIC_PROJECTION", TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetProjectionModeP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetProjectionModeP (P)" );
+ tet_infoline("Testing Dali::CameraActor::SetProjectionModeP (P)");
CameraActor actor = CameraActor::New();
// Check that changing the projection mode alone does not alter other presets.
- actor.SetNearClippingPlane( 200.0f );
- actor.SetFarClippingPlane( 400.0f );
+ actor.SetNearClippingPlane(200.0f);
+ actor.SetFarClippingPlane(400.0f);
- actor.SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION );
+ actor.SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION);
- actor.SetProjectionMode( Dali::Camera::ORTHOGRAPHIC_PROJECTION );
+ actor.SetProjectionMode(Dali::Camera::ORTHOGRAPHIC_PROJECTION);
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetNearClippingPlane(), 200.0f, FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetFarClippingPlane(), 400.0f, FLOAT_EPSILON, TEST_LOCATION);
// Check setting the property.
Property::Value setValue = "PERSPECTIVE_PROJECTION";
- actor.SetProperty( CameraActor::Property::PROJECTION_MODE, setValue );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ actor.SetProperty(CameraActor::Property::PROJECTION_MODE, setValue);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetProjectionModeN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetProjectionModeP (N)" );
+ tet_infoline("Testing Dali::CameraActor::SetProjectionModeP (N)");
CameraActor actor;
bool asserted = true;
try
{
- actor.SetProjectionMode( Dali::Camera::PERSPECTIVE_PROJECTION );
+ actor.SetProjectionMode(Dali::Camera::PERSPECTIVE_PROJECTION);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorGetProjectionModeP(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::GetPerspectiveProjection (P)" );
+ tet_infoline("Testing Dali::CameraActor::GetPerspectiveProjection (P)");
CameraActor actor = CameraActor::New();
- actor.SetOrthographicProjection( Size::ONE );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION );
+ actor.SetOrthographicProjection(Size::ONE);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::ORTHOGRAPHIC_PROJECTION, TEST_LOCATION);
- actor.SetPerspectiveProjection( Size( 100.f, 150.f ) );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
+ actor.SetPerspectiveProjection(Size(100.f, 150.f));
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
// Check getting the property.
std::string stringValue;
- actor.GetProperty( CameraActor::Property::PROJECTION_MODE ).Get( stringValue );
- DALI_TEST_EQUALS( stringValue, "PERSPECTIVE_PROJECTION", TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(stringValue);
+ DALI_TEST_EQUALS(stringValue, "PERSPECTIVE_PROJECTION", TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetProjectionModeN(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::GetProjectionMode (N)" );
+ tet_infoline("Testing Dali::CameraActor::GetProjectionMode (N)");
CameraActor actor;
{
actor.GetProjectionMode();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "camera && \"Camera handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "camera && \"Camera handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliCameraActorSetCameraOffScene(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetCamera()" );
+ tet_infoline("Testing Dali::CameraActor::SetCamera()");
CameraActor actor = CameraActor::New();
- actor.SetType( Camera::FREE_LOOK );
- actor.SetFieldOfView( TEST_FIELD_OF_VIEW );
- actor.SetAspectRatio( TEST_ASPECT_RATIO );
- actor.SetNearClippingPlane( TEST_NEAR_PLANE_DISTANCE );
- actor.SetFarClippingPlane( TEST_FAR_PLANE_DISTANCE );
- actor.SetProjectionMode( Camera::PERSPECTIVE_PROJECTION );
+ actor.SetType(Camera::FREE_LOOK);
+ actor.SetFieldOfView(TEST_FIELD_OF_VIEW);
+ actor.SetAspectRatio(TEST_ASPECT_RATIO);
+ actor.SetNearClippingPlane(TEST_NEAR_PLANE_DISTANCE);
+ actor.SetFarClippingPlane(TEST_FAR_PLANE_DISTANCE);
+ actor.SetProjectionMode(Camera::PERSPECTIVE_PROJECTION);
- actor.SetInvertYAxis( false );
+ actor.SetInvertYAxis(false);
- DALI_TEST_EQUALS( TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION );//change to machine epsilon
- DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( Camera::PERSPECTIVE_PROJECTION, actor.GetProjectionMode(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, actor.GetInvertYAxis(), TEST_LOCATION );
+ DALI_TEST_EQUALS(TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION); //change to machine epsilon
+ DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(Camera::PERSPECTIVE_PROJECTION, actor.GetProjectionMode(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION);
- float value;
+ float value;
std::string sValue;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO).Get( value );
- DALI_TEST_EQUALS( TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW).Get( value );
- DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE).Get( value );
- DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE).Get( value );
- DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::PROJECTION_MODE).Get( sValue );
- DALI_TEST_EQUALS( "PERSPECTIVE_PROJECTION", sValue, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::PROJECTION_MODE).Get(sValue);
+ DALI_TEST_EQUALS("PERSPECTIVE_PROJECTION", sValue, TEST_LOCATION);
bool bValue;
- actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS).Get( bValue );
- DALI_TEST_EQUALS( false, bValue, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue);
+ DALI_TEST_EQUALS(false, bValue, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorSetCameraOnScene(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::SetCamera()" );
+ tet_infoline("Testing Dali::CameraActor::SetCamera()");
CameraActor actor = CameraActor::New();
- application.GetScene().Add( actor );
- application.Render( 0 );
+ application.GetScene().Add(actor);
+ application.Render(0);
application.SendNotification();
- actor.SetType( Camera::LOOK_AT_TARGET );
- actor.SetFieldOfView( TEST_FIELD_OF_VIEW );
- actor.SetAspectRatio( TEST_ASPECT_RATIO );
- actor.SetNearClippingPlane( TEST_NEAR_PLANE_DISTANCE );
- actor.SetFarClippingPlane( TEST_FAR_PLANE_DISTANCE );
- actor.SetInvertYAxis( false );
+ actor.SetType(Camera::LOOK_AT_TARGET);
+ actor.SetFieldOfView(TEST_FIELD_OF_VIEW);
+ actor.SetAspectRatio(TEST_ASPECT_RATIO);
+ actor.SetNearClippingPlane(TEST_NEAR_PLANE_DISTANCE);
+ actor.SetFarClippingPlane(TEST_FAR_PLANE_DISTANCE);
+ actor.SetInvertYAxis(false);
- DALI_TEST_EQUALS( false, actor.GetInvertYAxis(), TEST_LOCATION );
+ DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION);
// Will need 2 frames to ensure both buffers are set to same values:
application.Render();
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( false, actor.GetInvertYAxis(), TEST_LOCATION );
+ DALI_TEST_EQUALS(TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, actor.GetInvertYAxis(), TEST_LOCATION);
std::string sValue;
- actor.GetProperty( CameraActor::Property::TYPE ).Get( sValue );
- DALI_TEST_EQUALS( sValue, "LOOK_AT_TARGET", TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::TYPE).Get(sValue);
+ DALI_TEST_EQUALS(sValue, "LOOK_AT_TARGET", TEST_LOCATION);
float value;
- actor.GetProperty( CameraActor::Property::ASPECT_RATIO ).Get( value );
- DALI_TEST_EQUALS( TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FIELD_OF_VIEW ).Get( value );
- DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE ).Get( value );
- DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION );
- actor.GetProperty( CameraActor::Property::FAR_PLANE_DISTANCE ).Get( value);
- DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::ASPECT_RATIO).Get(value);
+ DALI_TEST_EQUALS(TEST_ASPECT_RATIO, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FIELD_OF_VIEW).Get(value);
+ DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION);
+ actor.GetProperty(CameraActor::Property::FAR_PLANE_DISTANCE).Get(value);
+ DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, value, FLOAT_EPSILON, TEST_LOCATION);
bool bValue;
- actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS ).Get( bValue );
- DALI_TEST_EQUALS( false, bValue, TEST_LOCATION );
+ actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue);
+ DALI_TEST_EQUALS(false, bValue, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetCamera(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::GetCamera()" );
+ tet_infoline("Testing Dali::CameraActor::GetCamera()");
CameraActor actor = CameraActor::New();
- actor.SetAspectRatio( TEST_ASPECT_RATIO );
+ actor.SetAspectRatio(TEST_ASPECT_RATIO);
- DALI_TEST_EQUALS( actor.GetAspectRatio(), TEST_ASPECT_RATIO, FLOAT_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetAspectRatio(), TEST_ASPECT_RATIO, FLOAT_EPSILON, TEST_LOCATION);
- actor.SetProperty( CameraActor::Property::TYPE, "FREE_LOOK" );
- actor.SetProperty( CameraActor::Property::ASPECT_RATIO, TEST_ASPECT_RATIO );
- actor.SetProperty( CameraActor::Property::FIELD_OF_VIEW, TEST_FIELD_OF_VIEW );
- actor.SetProperty( CameraActor::Property::NEAR_PLANE_DISTANCE, TEST_NEAR_PLANE_DISTANCE );
- actor.SetProperty( CameraActor::Property::FAR_PLANE_DISTANCE, TEST_FAR_PLANE_DISTANCE );
+ actor.SetProperty(CameraActor::Property::TYPE, "FREE_LOOK");
+ actor.SetProperty(CameraActor::Property::ASPECT_RATIO, TEST_ASPECT_RATIO);
+ actor.SetProperty(CameraActor::Property::FIELD_OF_VIEW, TEST_FIELD_OF_VIEW);
+ actor.SetProperty(CameraActor::Property::NEAR_PLANE_DISTANCE, TEST_NEAR_PLANE_DISTANCE);
+ actor.SetProperty(CameraActor::Property::FAR_PLANE_DISTANCE, TEST_FAR_PLANE_DISTANCE);
- DALI_TEST_EQUALS( Camera::FREE_LOOK, actor.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
- DALI_TEST_EQUALS( TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION );
+ DALI_TEST_EQUALS(Camera::FREE_LOOK, actor.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_ASPECT_RATIO, actor.GetAspectRatio(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_FIELD_OF_VIEW, actor.GetFieldOfView(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_NEAR_PLANE_DISTANCE, actor.GetNearClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
+ DALI_TEST_EQUALS(TEST_FAR_PLANE_DISTANCE, actor.GetFarClippingPlane(), FLOAT_EPSILON, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorDefaultProperties(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor DefaultProperties" );
+ tet_infoline("Testing Dali::CameraActor DefaultProperties");
- CameraActor actor = CameraActor::New();
+ CameraActor actor = CameraActor::New();
Integration::Scene stage = application.GetScene();
stage.Add(actor);
- stage.GetRenderTaskList().GetTask(0).SetCameraActor( actor );
+ stage.GetRenderTaskList().GetTask(0).SetCameraActor(actor);
- actor.SetAspectRatio( TEST_ASPECT_RATIO );
- application.GetScene().Add( actor );
- application.Render( 0 );
+ actor.SetAspectRatio(TEST_ASPECT_RATIO);
+ application.GetScene().Add(actor);
+ application.Render(0);
application.SendNotification();
bool bValue;
- actor.GetProperty( CameraActor::Property::INVERT_Y_AXIS ).Get( bValue );
- DALI_TEST_EQUALS( false, bValue, TEST_LOCATION );
-
- std::vector<Property::Index> indices ;
- indices.push_back( CameraActor::Property::TYPE );
- indices.push_back( CameraActor::Property::PROJECTION_MODE );
- indices.push_back( CameraActor::Property::FIELD_OF_VIEW );
- indices.push_back( CameraActor::Property::ASPECT_RATIO );
- indices.push_back( CameraActor::Property::NEAR_PLANE_DISTANCE );
- indices.push_back( CameraActor::Property::FAR_PLANE_DISTANCE );
- indices.push_back( CameraActor::Property::LEFT_PLANE_DISTANCE );
- indices.push_back( CameraActor::Property::RIGHT_PLANE_DISTANCE );
- indices.push_back( CameraActor::Property::TOP_PLANE_DISTANCE );
- indices.push_back( CameraActor::Property::BOTTOM_PLANE_DISTANCE );
- indices.push_back( CameraActor::Property::TARGET_POSITION );
- indices.push_back( CameraActor::Property::PROJECTION_MATRIX );
- indices.push_back( CameraActor::Property::VIEW_MATRIX );
- indices.push_back( CameraActor::Property::INVERT_Y_AXIS );
-
- DALI_TEST_CHECK( actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) );
-
- for( std::vector<Property::Index>::iterator iter = indices.begin(); iter != indices.end(); ++iter )
- {
- DALI_TEST_EQUALS( *iter, actor.GetPropertyIndex( actor.GetPropertyName( *iter ) ), TEST_LOCATION);
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( *iter ) );
-
- if ( ( *iter == CameraActor::Property::PROJECTION_MATRIX ) ||
- ( *iter == CameraActor::Property::VIEW_MATRIX ) )
+ actor.GetProperty(CameraActor::Property::INVERT_Y_AXIS).Get(bValue);
+ DALI_TEST_EQUALS(false, bValue, TEST_LOCATION);
+
+ std::vector<Property::Index> indices;
+ indices.push_back(CameraActor::Property::TYPE);
+ indices.push_back(CameraActor::Property::PROJECTION_MODE);
+ indices.push_back(CameraActor::Property::FIELD_OF_VIEW);
+ indices.push_back(CameraActor::Property::ASPECT_RATIO);
+ indices.push_back(CameraActor::Property::NEAR_PLANE_DISTANCE);
+ indices.push_back(CameraActor::Property::FAR_PLANE_DISTANCE);
+ indices.push_back(CameraActor::Property::LEFT_PLANE_DISTANCE);
+ indices.push_back(CameraActor::Property::RIGHT_PLANE_DISTANCE);
+ indices.push_back(CameraActor::Property::TOP_PLANE_DISTANCE);
+ indices.push_back(CameraActor::Property::BOTTOM_PLANE_DISTANCE);
+ indices.push_back(CameraActor::Property::TARGET_POSITION);
+ indices.push_back(CameraActor::Property::PROJECTION_MATRIX);
+ indices.push_back(CameraActor::Property::VIEW_MATRIX);
+ indices.push_back(CameraActor::Property::INVERT_Y_AXIS);
+
+ DALI_TEST_CHECK(actor.GetPropertyCount() == (Actor::New().GetPropertyCount() + indices.size()));
+
+ for(std::vector<Property::Index>::iterator iter = indices.begin(); iter != indices.end(); ++iter)
+ {
+ DALI_TEST_EQUALS(*iter, actor.GetPropertyIndex(actor.GetPropertyName(*iter)), TEST_LOCATION);
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(*iter));
+
+ if((*iter == CameraActor::Property::PROJECTION_MATRIX) ||
+ (*iter == CameraActor::Property::VIEW_MATRIX))
{
- DALI_TEST_CHECK( !actor.IsPropertyWritable( *iter ) );
+ DALI_TEST_CHECK(!actor.IsPropertyWritable(*iter));
}
else
{
- DALI_TEST_CHECK( actor.IsPropertyWritable( *iter ) );
+ DALI_TEST_CHECK(actor.IsPropertyWritable(*iter));
}
- DALI_TEST_CHECK( actor.GetPropertyType( *iter ) == actor.GetPropertyType( *iter ) ); // just checking call succeeds
+ DALI_TEST_CHECK(actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter)); // just checking call succeeds
}
// Set/Get one of them.
const float newAspect = TEST_ASPECT_RATIO * 2.0f;
- actor.SetProperty( CameraActor::Property::ASPECT_RATIO, Property::Value( newAspect ) );
+ actor.SetProperty(CameraActor::Property::ASPECT_RATIO, Property::Value(newAspect));
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetAspectRatio(), newAspect, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetAspectRatio(), newAspect, TEST_LOCATION);
END_TEST;
}
-template< typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
-void TEST_CAMERA_PROPERTY( P1 camera, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION )
+template<typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
+void TEST_CAMERA_PROPERTY(P1 camera, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION)
{
- DALI_TEST_EQUALS( camera.GetPropertyName( enumName ), stringName, LOCATION );
- DALI_TEST_EQUALS( camera.GetPropertyIndex( stringName ), static_cast<Property::Index>(enumName), LOCATION );
- DALI_TEST_EQUALS( camera.GetPropertyType( enumName ), type, LOCATION );
- DALI_TEST_EQUALS( camera.IsPropertyWritable( enumName ), isWriteable, LOCATION );
- DALI_TEST_EQUALS( camera.IsPropertyAnimatable( enumName ), isAnimateable, LOCATION );
- DALI_TEST_EQUALS( camera.IsPropertyAConstraintInput( enumName ), isConstraintInput, LOCATION );
+ DALI_TEST_EQUALS(camera.GetPropertyName(enumName), stringName, LOCATION);
+ DALI_TEST_EQUALS(camera.GetPropertyIndex(stringName), static_cast<Property::Index>(enumName), LOCATION);
+ DALI_TEST_EQUALS(camera.GetPropertyType(enumName), type, LOCATION);
+ DALI_TEST_EQUALS(camera.IsPropertyWritable(enumName), isWriteable, LOCATION);
+ DALI_TEST_EQUALS(camera.IsPropertyAnimatable(enumName), isAnimateable, LOCATION);
+ DALI_TEST_EQUALS(camera.IsPropertyAConstraintInput(enumName), isConstraintInput, LOCATION);
}
int UtcDaliCameraActorDefaultPropertiesInherited(void)
{
TestApplication application;
- CameraActor actor = CameraActor::New();
+ CameraActor actor = CameraActor::New();
Integration::Scene stage = application.GetScene();
stage.Add(actor);
- stage.GetRenderTaskList().GetTask(0).SetCameraActor( actor );
+ stage.GetRenderTaskList().GetTask(0).SetCameraActor(actor);
- application.GetScene().Add( actor );
- application.Render( 0 );
+ application.GetScene().Add(actor);
+ application.Render(0);
application.SendNotification();
const PropertyDetails CAMERA_DEFAULT_PROPERTY[] =
- {
-// actor
- { "parentOrigin", Property::VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN },
- { "parentOriginX", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X },
- { "parentOriginY", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y },
- { "parentOriginZ", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z },
- { "anchorPoint", Property::VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT },
- { "anchorPointX", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X },
- { "anchorPointY", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y },
- { "anchorPointZ", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z },
- { "size", Property::VECTOR3, true, true, true, Dali::Actor::Property::SIZE },
- { "sizeWidth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH },
- { "sizeHeight", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT },
- { "sizeDepth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH },
- { "position", Property::VECTOR3, true, true, true, Dali::Actor::Property::POSITION },
- { "positionX", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_X },
- { "positionY", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y },
- { "positionZ", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z },
- { "worldPosition", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION },
- { "worldPositionX", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X },
- { "worldPositionY", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y },
- { "worldPositionZ", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z },
- { "orientation", Property::ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION },
- { "worldOrientation", Property::ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION },
- { "scale", Property::VECTOR3, true, true, true, Dali::Actor::Property::SCALE },
- { "scaleX", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_X },
- { "scaleY", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y },
- { "scaleZ", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z },
- { "worldScale", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE },
- { "visible", Property::BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE },
- { "color", Property::VECTOR4, true, true, true, Dali::Actor::Property::COLOR },
- { "colorRed", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED },
- { "colorGreen", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN },
- { "colorBlue", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE },
- { "colorAlpha", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA },
- { "worldColor", Property::VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR },
- { "worldMatrix", Property::MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX },
- { "name", Property::STRING, true, false, false, Dali::Actor::Property::NAME },
- { "sensitive", Property::BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE },
- { "leaveRequired", Property::BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED },
- { "inheritOrientation", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION },
- { "inheritScale", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE },
- { "colorMode", Property::INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE },
- { "drawMode", Property::INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE },
- { "sizeModeFactor", Property::VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR },
- { "widthResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY },
- { "heightResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY },
- { "sizeScalePolicy", Property::INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY },
- { "widthForHeight", Property::BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT },
- { "heightForWidth", Property::BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH },
- { "padding", Property::VECTOR4, true, false, false, Dali::Actor::Property::PADDING },
- { "minimumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE },
- { "maximumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE },
- { "inheritPosition", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION },
- { "clippingMode", Property::STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE },
- { "layoutDirection", Property::STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION },
- { "inheritLayoutDirection", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION },
- { "opacity", Property::FLOAT, true, true, true, Dali::Actor::Property::OPACITY },
- { "screenPosition", Property::VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION },
- { "positionUsesAnchorPoint",Property::BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT },
- { "culled", Property::BOOLEAN, false, false, true, Dali::Actor::Property::CULLED },
- { "id", Property::INTEGER, false, false, false, Dali::Actor::Property::ID },
- { "hierarchyDepth", Property::INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH },
- { "isRoot", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT },
- { "isLayer", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER },
- { "connectedToScene", Property::BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE },
- { "keyboardFocusable", Property::BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE },
- { "siblingOrder", Property::INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER },
-// camera own
- { "type", Property::STRING, true, false, true, Dali::CameraActor::Property::TYPE },
- { "projectionMode", Property::STRING, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE },
- { "fieldOfView", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FIELD_OF_VIEW },
- { "aspectRatio", Property::FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO },
- { "nearPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE },
- { "farPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE },
- { "leftPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE },
- { "rightPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE },
- { "topPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE },
- { "bottomPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE },
- { "targetPosition", Property::VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION },
- { "projectionMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX },
- { "viewMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX },
- { "invertYAxis", Property::BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS }
- };
-
- for( uint32_t index = 0; index < (sizeof(CAMERA_DEFAULT_PROPERTY)/sizeof(PropertyDetails)); ++index )
- {
- TEST_CAMERA_PROPERTY( actor,
- CAMERA_DEFAULT_PROPERTY[ index ].name,
- CAMERA_DEFAULT_PROPERTY[ index ].type,
- CAMERA_DEFAULT_PROPERTY[ index ].writable,
- CAMERA_DEFAULT_PROPERTY[ index ].animatable,
- CAMERA_DEFAULT_PROPERTY[ index ].constraintInput,
- CAMERA_DEFAULT_PROPERTY[ index ].enumIndex,
- TEST_LOCATION );
+ {
+ // actor
+ {"parentOrigin", Property::VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN},
+ {"parentOriginX", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X},
+ {"parentOriginY", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y},
+ {"parentOriginZ", Property::FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z},
+ {"anchorPoint", Property::VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT},
+ {"anchorPointX", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X},
+ {"anchorPointY", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y},
+ {"anchorPointZ", Property::FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z},
+ {"size", Property::VECTOR3, true, true, true, Dali::Actor::Property::SIZE},
+ {"sizeWidth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH},
+ {"sizeHeight", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT},
+ {"sizeDepth", Property::FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH},
+ {"position", Property::VECTOR3, true, true, true, Dali::Actor::Property::POSITION},
+ {"positionX", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_X},
+ {"positionY", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y},
+ {"positionZ", Property::FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z},
+ {"worldPosition", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION},
+ {"worldPositionX", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X},
+ {"worldPositionY", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y},
+ {"worldPositionZ", Property::FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z},
+ {"orientation", Property::ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION},
+ {"worldOrientation", Property::ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION},
+ {"scale", Property::VECTOR3, true, true, true, Dali::Actor::Property::SCALE},
+ {"scaleX", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_X},
+ {"scaleY", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y},
+ {"scaleZ", Property::FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z},
+ {"worldScale", Property::VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE},
+ {"visible", Property::BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE},
+ {"color", Property::VECTOR4, true, true, true, Dali::Actor::Property::COLOR},
+ {"colorRed", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED},
+ {"colorGreen", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN},
+ {"colorBlue", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE},
+ {"colorAlpha", Property::FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA},
+ {"worldColor", Property::VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR},
+ {"worldMatrix", Property::MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX},
+ {"name", Property::STRING, true, false, false, Dali::Actor::Property::NAME},
+ {"sensitive", Property::BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE},
+ {"leaveRequired", Property::BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED},
+ {"inheritOrientation", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION},
+ {"inheritScale", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE},
+ {"colorMode", Property::INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE},
+ {"drawMode", Property::INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE},
+ {"sizeModeFactor", Property::VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR},
+ {"widthResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY},
+ {"heightResizePolicy", Property::STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY},
+ {"sizeScalePolicy", Property::INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY},
+ {"widthForHeight", Property::BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT},
+ {"heightForWidth", Property::BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH},
+ {"padding", Property::VECTOR4, true, false, false, Dali::Actor::Property::PADDING},
+ {"minimumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE},
+ {"maximumSize", Property::VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE},
+ {"inheritPosition", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION},
+ {"clippingMode", Property::STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE},
+ {"layoutDirection", Property::STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION},
+ {"inheritLayoutDirection", Property::BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION},
+ {"opacity", Property::FLOAT, true, true, true, Dali::Actor::Property::OPACITY},
+ {"screenPosition", Property::VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION},
+ {"positionUsesAnchorPoint", Property::BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT},
+ {"culled", Property::BOOLEAN, false, false, true, Dali::Actor::Property::CULLED},
+ {"id", Property::INTEGER, false, false, false, Dali::Actor::Property::ID},
+ {"hierarchyDepth", Property::INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH},
+ {"isRoot", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT},
+ {"isLayer", Property::BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER},
+ {"connectedToScene", Property::BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE},
+ {"keyboardFocusable", Property::BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE},
+ {"siblingOrder", Property::INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER},
+ // camera own
+ {"type", Property::STRING, true, false, true, Dali::CameraActor::Property::TYPE},
+ {"projectionMode", Property::STRING, true, false, true, Dali::CameraActor::Property::PROJECTION_MODE},
+ {"fieldOfView", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FIELD_OF_VIEW},
+ {"aspectRatio", Property::FLOAT, true, false, true, Dali::CameraActor::Property::ASPECT_RATIO},
+ {"nearPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::NEAR_PLANE_DISTANCE},
+ {"farPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::FAR_PLANE_DISTANCE},
+ {"leftPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::LEFT_PLANE_DISTANCE},
+ {"rightPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::RIGHT_PLANE_DISTANCE},
+ {"topPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::TOP_PLANE_DISTANCE},
+ {"bottomPlaneDistance", Property::FLOAT, true, false, true, Dali::CameraActor::Property::BOTTOM_PLANE_DISTANCE},
+ {"targetPosition", Property::VECTOR3, true, false, true, Dali::CameraActor::Property::TARGET_POSITION},
+ {"projectionMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::PROJECTION_MATRIX},
+ {"viewMatrix", Property::MATRIX, false, false, true, Dali::CameraActor::Property::VIEW_MATRIX},
+ {"invertYAxis", Property::BOOLEAN, true, false, true, Dali::CameraActor::Property::INVERT_Y_AXIS}};
+
+ for(uint32_t index = 0; index < (sizeof(CAMERA_DEFAULT_PROPERTY) / sizeof(PropertyDetails)); ++index)
+ {
+ TEST_CAMERA_PROPERTY(actor,
+ CAMERA_DEFAULT_PROPERTY[index].name,
+ CAMERA_DEFAULT_PROPERTY[index].type,
+ CAMERA_DEFAULT_PROPERTY[index].writable,
+ CAMERA_DEFAULT_PROPERTY[index].animatable,
+ CAMERA_DEFAULT_PROPERTY[index].constraintInput,
+ CAMERA_DEFAULT_PROPERTY[index].enumIndex,
+ TEST_LOCATION);
}
END_TEST;
}
int UtcDaliCameraActorModelView(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor Test view application" );
+ tet_infoline("Testing Dali::CameraActor Test view application");
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::POSITION, Vector3( 20.0f, 30.0f, 40.0f ));
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(20.0f, 30.0f, 40.0f));
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ application.GetScene().Add(actor);
application.SendNotification();
- application.Render( 0 );
+ application.Render(0);
application.Render();
application.SendNotification();
- Matrix resultMatrix( true );
- resultMatrix.SetTransformComponents( Vector3::ONE, Quaternion::IDENTITY, actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) );
+ Matrix resultMatrix(true);
+ resultMatrix.SetTransformComponents(Vector3::ONE, Quaternion::IDENTITY, actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION));
- RenderTask task = application.GetScene().GetRenderTaskList().GetTask( 0 );
+ RenderTask task = application.GetScene().GetRenderTaskList().GetTask(0);
CameraActor cameraActor = task.GetCameraActor();
- Matrix viewMatrix( false );
- cameraActor.GetProperty( CameraActor::Property::VIEW_MATRIX ).Get( viewMatrix );
- Matrix::Multiply( resultMatrix, resultMatrix, viewMatrix );
+ Matrix viewMatrix(false);
+ cameraActor.GetProperty(CameraActor::Property::VIEW_MATRIX).Get(viewMatrix);
+ Matrix::Multiply(resultMatrix, resultMatrix, viewMatrix);
- DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( "uModelView", resultMatrix ) );
+ DALI_TEST_CHECK(application.GetGlAbstraction().CheckUniformValue("uModelView", resultMatrix));
END_TEST;
}
int UtcDaliCameraActorReadProjectionMatrix(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::CameraActor::ReadProjectionMatrix()" );
+ tet_infoline("Testing Dali::CameraActor::ReadProjectionMatrix()");
- CameraActor camera = application.GetScene().GetRenderTaskList().GetTask( 0u ).GetCameraActor();
+ CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor();
application.SendNotification();
- application.Render( 0 );
+ application.Render(0);
application.Render();
application.SendNotification();
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u);
- Actor actor = CreateRenderableActor( image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- application.GetScene().Add( actor );
+ Actor actor = CreateRenderableActor(image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ application.GetScene().Add(actor);
Matrix projectionMatrix;
Matrix viewMatrix;
- camera.GetProperty( CameraActor::CameraActor::Property::PROJECTION_MATRIX ).Get( projectionMatrix );
- camera.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( viewMatrix );
+ camera.GetProperty(CameraActor::CameraActor::Property::PROJECTION_MATRIX).Get(projectionMatrix);
+ camera.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(viewMatrix);
- actor.RegisterProperty( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
- actor.RegisterProperty( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY );
+ actor.RegisterProperty(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME, Matrix::IDENTITY);
+ actor.RegisterProperty(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME, Matrix::IDENTITY);
- Property::Index projectionMatrixPropertyIndex = actor.GetPropertyIndex( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME );
- Property::Index viewMatrixPropertyIndex = actor.GetPropertyIndex( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME );
+ Property::Index projectionMatrixPropertyIndex = actor.GetPropertyIndex(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME);
+ Property::Index viewMatrixPropertyIndex = actor.GetPropertyIndex(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME);
- Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>( actor, projectionMatrixPropertyIndex, EqualToConstraint() );
- projectionMatrixConstraint.AddSource( Source( camera, CameraActor::Property::PROJECTION_MATRIX ) );
- Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>( actor, viewMatrixPropertyIndex, EqualToConstraint() );
- viewMatrixConstraint.AddSource( Source( camera, CameraActor::Property::VIEW_MATRIX ) );
+ Constraint projectionMatrixConstraint = Constraint::New<Dali::Matrix>(actor, projectionMatrixPropertyIndex, EqualToConstraint());
+ projectionMatrixConstraint.AddSource(Source(camera, CameraActor::Property::PROJECTION_MATRIX));
+ Constraint viewMatrixConstraint = Constraint::New<Dali::Matrix>(actor, viewMatrixPropertyIndex, EqualToConstraint());
+ viewMatrixConstraint.AddSource(Source(camera, CameraActor::Property::VIEW_MATRIX));
projectionMatrixConstraint.Apply();
viewMatrixConstraint.Apply();
application.Render();
// Test effects of Constraint.
- DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME.c_str(), projectionMatrix) );
+ DALI_TEST_CHECK(application.GetGlAbstraction().CheckUniformValue(SHADER_LIGHT_CAMERA_PROJECTION_MATRIX_PROPERTY_NAME.c_str(), projectionMatrix));
- DALI_TEST_CHECK( application.GetGlAbstraction().CheckUniformValue( SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME.c_str(), viewMatrix ) );
+ DALI_TEST_CHECK(application.GetGlAbstraction().CheckUniformValue(SHADER_LIGHT_CAMERA_VIEW_MATRIX_PROPERTY_NAME.c_str(), viewMatrix));
END_TEST;
}
int UtcDaliCameraActorAnimatedProperties(void)
{
TestApplication application;
- tet_infoline( "Testing Dali::Internal::CameraActor::GetSceneObjectAnimatableProperty()" );
+ tet_infoline("Testing Dali::Internal::CameraActor::GetSceneObjectAnimatableProperty()");
- CameraActor camera = application.GetScene().GetRenderTaskList().GetTask( 0u ).GetCameraActor();
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- application.GetScene().Add( actor );
+ CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor();
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ application.GetScene().Add(actor);
- Constraint constraint = Constraint::New<Dali::Vector3>( actor, Actor::Property::POSITION, EqualToConstraint() );
- constraint.AddSource( Source( camera, Actor::Property::POSITION ) );
+ Constraint constraint = Constraint::New<Dali::Vector3>(actor, Actor::Property::POSITION, EqualToConstraint());
+ constraint.AddSource(Source(camera, Actor::Property::POSITION));
constraint.Apply();
- camera.SetProperty( Actor::Property::POSITION, Vector3( 100.0f, 200.0f, 300.0f ));
+ camera.SetProperty(Actor::Property::POSITION, Vector3(100.0f, 200.0f, 300.0f));
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3( 100.0f, 200.0f, 300.0f ), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3(100.0f, 200.0f, 300.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorPropertyIndices(void)
{
TestApplication application;
- CameraActor camera = application.GetScene().GetRenderTaskList().GetTask( 0u ).GetCameraActor();
+ CameraActor camera = application.GetScene().GetRenderTaskList().GetTask(0u).GetCameraActor();
- Actor basicActor = Actor::New();
+ Actor basicActor = Actor::New();
Property::IndexContainer indices;
- camera.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() );
- DALI_TEST_EQUALS( indices.Size(), camera.GetPropertyCount(), TEST_LOCATION );
+ camera.GetPropertyIndices(indices);
+ DALI_TEST_CHECK(indices.Size() > basicActor.GetPropertyCount());
+ DALI_TEST_EQUALS(indices.Size(), camera.GetPropertyCount(), TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorCheckLookAtAndFreeLookViews01(void)
{
- TestApplication application;
- Integration::Scene stage = application.GetScene();
- Vector2 stageSize = stage.GetSize();
+ TestApplication application;
+ Integration::Scene stage = application.GetScene();
+ Vector2 stageSize = stage.GetSize();
- CameraActor freeLookCameraActor = CameraActor::New( stageSize );
- freeLookCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- freeLookCameraActor.SetType( Camera::FREE_LOOK );
+ CameraActor freeLookCameraActor = CameraActor::New(stageSize);
+ freeLookCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ freeLookCameraActor.SetType(Camera::FREE_LOOK);
- Vector3 targetPosition( 30.0f, 240.0f, -256.0f );
- Actor target = Actor::New();
- target.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- target.SetProperty( Actor::Property::POSITION, targetPosition );
+ Vector3 targetPosition(30.0f, 240.0f, -256.0f);
+ Actor target = Actor::New();
+ target.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ target.SetProperty(Actor::Property::POSITION, targetPosition);
- Constraint cameraOrientationConstraint = Constraint::New<Quaternion> ( freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt );
- cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_POSITION ) );
- cameraOrientationConstraint.AddSource( Source( freeLookCameraActor, Actor::Property::WORLD_POSITION ) );
- cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_ORIENTATION ) );
+ Constraint cameraOrientationConstraint = Constraint::New<Quaternion>(freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt);
+ cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_POSITION));
+ cameraOrientationConstraint.AddSource(Source(freeLookCameraActor, Actor::Property::WORLD_POSITION));
+ cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_ORIENTATION));
cameraOrientationConstraint.Apply();
- CameraActor lookAtCameraActor = CameraActor::New( stageSize );
- lookAtCameraActor.SetType( Camera::LOOK_AT_TARGET );
- lookAtCameraActor.SetTargetPosition( targetPosition );
- lookAtCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ CameraActor lookAtCameraActor = CameraActor::New(stageSize);
+ lookAtCameraActor.SetType(Camera::LOOK_AT_TARGET);
+ lookAtCameraActor.SetTargetPosition(targetPosition);
+ lookAtCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- stage.Add( target );
- stage.Add( freeLookCameraActor );
- stage.Add( lookAtCameraActor );
+ stage.Add(target);
+ stage.Add(freeLookCameraActor);
+ stage.Add(lookAtCameraActor);
// Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=0.1f )
+ for(float z = -1.0f; z < 1.0f; z += 0.1f)
{
- Vector3 position( x, y, z );
+ Vector3 position(x, y, z);
position.Normalize();
position *= 200.0f;
- freeLookCameraActor.SetProperty( Actor::Property::POSITION, position );
- lookAtCameraActor.SetProperty( Actor::Property::POSITION, position );
+ freeLookCameraActor.SetProperty(Actor::Property::POSITION, position);
+ lookAtCameraActor.SetProperty(Actor::Property::POSITION, position);
application.SendNotification();
application.Render();
application.Render();
Matrix freeLookViewMatrix;
Matrix lookAtViewMatrix;
- freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( freeLookViewMatrix );
- lookAtCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( lookAtViewMatrix );
+ freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(freeLookViewMatrix);
+ lookAtCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(lookAtViewMatrix);
- DALI_TEST_EQUALS( freeLookViewMatrix, lookAtViewMatrix, 0.01, TEST_LOCATION );
+ DALI_TEST_EQUALS(freeLookViewMatrix, lookAtViewMatrix, 0.01, TEST_LOCATION);
}
}
}
int UtcDaliCameraActorCheckLookAtAndFreeLookViews02(void)
{
- TestApplication application;
- Integration::Scene stage = application.GetScene();
- Vector2 stageSize = stage.GetSize();
+ TestApplication application;
+ Integration::Scene stage = application.GetScene();
+ Vector2 stageSize = stage.GetSize();
- CameraActor freeLookCameraActor = CameraActor::New( stageSize );
- freeLookCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- freeLookCameraActor.SetType( Camera::FREE_LOOK );
+ CameraActor freeLookCameraActor = CameraActor::New(stageSize);
+ freeLookCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ freeLookCameraActor.SetType(Camera::FREE_LOOK);
- Vector3 targetPosition( 30.0f, 240.0f, -256.0f );
- Actor target = Actor::New();
- target.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- target.SetProperty( Actor::Property::POSITION, targetPosition );
+ Vector3 targetPosition(30.0f, 240.0f, -256.0f);
+ Actor target = Actor::New();
+ target.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ target.SetProperty(Actor::Property::POSITION, targetPosition);
- Constraint cameraOrientationConstraint = Constraint::New<Quaternion> ( freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt );
- cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_POSITION ) );
- cameraOrientationConstraint.AddSource( Source( freeLookCameraActor, Actor::Property::WORLD_POSITION ) );
- cameraOrientationConstraint.AddSource( Source( target, Actor::Property::WORLD_ORIENTATION ) );
+ Constraint cameraOrientationConstraint = Constraint::New<Quaternion>(freeLookCameraActor, Actor::Property::ORIENTATION, &LookAt);
+ cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_POSITION));
+ cameraOrientationConstraint.AddSource(Source(freeLookCameraActor, Actor::Property::WORLD_POSITION));
+ cameraOrientationConstraint.AddSource(Source(target, Actor::Property::WORLD_ORIENTATION));
cameraOrientationConstraint.Apply();
- CameraActor lookAtCameraActor = CameraActor::New( stageSize );
- lookAtCameraActor.SetType( Camera::LOOK_AT_TARGET );
- lookAtCameraActor.SetTargetPosition( targetPosition );
- lookAtCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ CameraActor lookAtCameraActor = CameraActor::New(stageSize);
+ lookAtCameraActor.SetType(Camera::LOOK_AT_TARGET);
+ lookAtCameraActor.SetTargetPosition(targetPosition);
+ lookAtCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- stage.Add( target );
- stage.Add( freeLookCameraActor );
- stage.Add( lookAtCameraActor );
- stage.GetRenderTaskList().GetTask(0).SetCameraActor( freeLookCameraActor );
+ stage.Add(target);
+ stage.Add(freeLookCameraActor);
+ stage.Add(lookAtCameraActor);
+ stage.GetRenderTaskList().GetTask(0).SetCameraActor(freeLookCameraActor);
// Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=0.1f )
+ for(float z = -1.0f; z < 1.0f; z += 0.1f)
{
- Vector3 position( x, y, z );
+ Vector3 position(x, y, z);
position.Normalize();
position *= 200.0f;
- freeLookCameraActor.SetProperty( Actor::Property::POSITION, position );
- lookAtCameraActor.SetProperty( Actor::Property::POSITION, position );
+ freeLookCameraActor.SetProperty(Actor::Property::POSITION, position);
+ lookAtCameraActor.SetProperty(Actor::Property::POSITION, position);
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
Matrix freeLookViewMatrix;
- freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( freeLookViewMatrix );
+ freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(freeLookViewMatrix);
- Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX );
+ Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
- Matrix freeLookTest( false );
- Matrix::Multiply( freeLookTest, freeLookViewMatrix, freeLookWorld );
- DALI_TEST_EQUALS( freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION );
+ Matrix freeLookTest(false);
+ Matrix::Multiply(freeLookTest, freeLookViewMatrix, freeLookWorld);
+ DALI_TEST_EQUALS(freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION);
}
}
}
int UtcDaliCameraActorCheckLookAtAndFreeLookViews03(void)
{
- TestApplication application;
- Integration::Scene stage = application.GetScene();
- Vector2 stageSize = stage.GetSize();
+ TestApplication application;
+ Integration::Scene stage = application.GetScene();
+ Vector2 stageSize = stage.GetSize();
- Vector3 targetPosition( Vector3::ZERO );
- Vector3 cameraOffset( 0.0f, 0.0f, 100.0f );
+ Vector3 targetPosition(Vector3::ZERO);
+ Vector3 cameraOffset(0.0f, 0.0f, 100.0f);
- CameraActor freeLookCameraActor = CameraActor::New( stageSize );
- freeLookCameraActor.SetType( Camera::FREE_LOOK );
- freeLookCameraActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ CameraActor freeLookCameraActor = CameraActor::New(stageSize);
+ freeLookCameraActor.SetType(Camera::FREE_LOOK);
+ freeLookCameraActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- Quaternion cameraOrientation( Radian( Degree( 180.0f ) ), Vector3::YAXIS );
- freeLookCameraActor.SetProperty( Actor::Property::POSITION, cameraOffset );
- freeLookCameraActor.SetProperty( Actor::Property::ORIENTATION, cameraOrientation );
+ Quaternion cameraOrientation(Radian(Degree(180.0f)), Vector3::YAXIS);
+ freeLookCameraActor.SetProperty(Actor::Property::POSITION, cameraOffset);
+ freeLookCameraActor.SetProperty(Actor::Property::ORIENTATION, cameraOrientation);
Actor cameraAnchor = Actor::New();
- cameraAnchor.Add( freeLookCameraActor );
- stage.Add( cameraAnchor );
- stage.GetRenderTaskList().GetTask(0).SetCameraActor( freeLookCameraActor );
+ cameraAnchor.Add(freeLookCameraActor);
+ stage.Add(cameraAnchor);
+ stage.GetRenderTaskList().GetTask(0).SetCameraActor(freeLookCameraActor);
- for( float angle = 1.0f; angle <= 180.0f; angle += 1.0f )
+ for(float angle = 1.0f; angle <= 180.0f; angle += 1.0f)
{
- Quaternion rotation( Radian( Degree( angle ) ), Vector3::YAXIS );
+ Quaternion rotation(Radian(Degree(angle)), Vector3::YAXIS);
- freeLookCameraActor.SetProperty( Actor::Property::POSITION, rotation.Rotate( cameraOffset ) );
- cameraAnchor.SetProperty( Actor::Property::ORIENTATION, rotation );
+ freeLookCameraActor.SetProperty(Actor::Property::POSITION, rotation.Rotate(cameraOffset));
+ cameraAnchor.SetProperty(Actor::Property::ORIENTATION, rotation);
application.SendNotification();
application.Render();
application.Render();
Matrix freeLookViewMatrix;
- freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( freeLookViewMatrix );
+ freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(freeLookViewMatrix);
- Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty< Matrix >( Actor::Property::WORLD_MATRIX );
+ Matrix freeLookWorld = freeLookCameraActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
- Matrix freeLookTest( false );
- Matrix::Multiply( freeLookTest, freeLookViewMatrix, freeLookWorld );
- DALI_TEST_EQUALS( freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION );
+ Matrix freeLookTest(false);
+ Matrix::Multiply(freeLookTest, freeLookViewMatrix, freeLookWorld);
+ DALI_TEST_EQUALS(freeLookTest, Matrix::IDENTITY, 0.01f, TEST_LOCATION);
}
END_TEST;
}
Integration::Scene stage = application.GetScene();
- Vector3 targetPosition( Vector3::ZERO );
- Vector3 cameraOffset( 0.0f, 100.0f, 100.0f );
+ Vector3 targetPosition(Vector3::ZERO);
+ Vector3 cameraOffset(0.0f, 100.0f, 100.0f);
CameraActor freeLookCameraActor = stage.GetRenderTaskList().GetTask(0).GetCameraActor();
freeLookCameraActor.SetType(Camera::LOOK_AT_TARGET);
- freeLookCameraActor.SetTargetPosition( targetPosition );
- freeLookCameraActor.SetProperty( Actor::Property::POSITION, cameraOffset );
+ freeLookCameraActor.SetTargetPosition(targetPosition);
+ freeLookCameraActor.SetProperty(Actor::Property::POSITION, cameraOffset);
- stage.GetRootLayer().SetProperty( Actor::Property::POSITION, Vector2( 1, 0 ));
+ stage.GetRootLayer().SetProperty(Actor::Property::POSITION, Vector2(1, 0));
application.SendNotification();
application.Render();
application.Render();
Matrix matrixBefore, matrixAfter;
- freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( matrixBefore );
- freeLookCameraActor.SetProperty( Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4( 0.0f, 1.0f, 0.0f, 0.0f));
- stage.GetRootLayer().SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
+ freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(matrixBefore);
+ freeLookCameraActor.SetProperty(Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4(0.0f, 1.0f, 0.0f, 0.0f));
+ stage.GetRootLayer().SetProperty(Actor::Property::POSITION, Vector2(0, 0));
application.SendNotification();
application.Render();
application.SendNotification();
application.Render();
- freeLookCameraActor.GetProperty( CameraActor::CameraActor::Property::VIEW_MATRIX ).Get( matrixAfter );
+ freeLookCameraActor.GetProperty(CameraActor::CameraActor::Property::VIEW_MATRIX).Get(matrixAfter);
- Vector3 position, scale;
+ Vector3 position, scale;
Quaternion rotation;
- matrixAfter.GetTransformComponents( position, rotation, scale );
+ matrixAfter.GetTransformComponents(position, rotation, scale);
- Quaternion reflected( 0, 0, 1, 0 );
+ Quaternion reflected(0, 0, 1, 0);
- DALI_TEST_EQUALS( reflected, rotation, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(reflected, rotation, 0.01f, TEST_LOCATION);
// Test Free Look camera
freeLookCameraActor.SetType(Camera::FREE_LOOK);
// Make sure the recalculation will take place
- freeLookCameraActor.SetProperty( Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4( 0.0f, 1.0f, 0.0f, 0.0f));
+ freeLookCameraActor.SetProperty(Dali::DevelCameraActor::Property::REFLECTION_PLANE, Vector4(0.0f, 1.0f, 0.0f, 0.0f));
application.SendNotification();
application.Render();
application.Render();
// Nothing should change despite of different camera type
- matrixAfter.GetTransformComponents( position, rotation, scale );
- DALI_TEST_EQUALS( reflected, rotation, 0.01f, TEST_LOCATION );
+ matrixAfter.GetTransformComponents(position, rotation, scale);
+ DALI_TEST_EQUALS(reflected, rotation, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliCameraActorGetAspectRatioNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetFieldOfViewNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetInvertYAxisNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetAspectRatioNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetFieldOfViewNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetInvertYAxisNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetProjectionModeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetTargetPositionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetFarClippingPlaneNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetFarClippingPlaneNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetNearClippingPlaneNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetNearClippingPlaneNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetPerspectiveProjectionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetOrthographicProjectionNegative01(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
float arg4(0.0f);
float arg5(0.0f);
float arg6(0.0f);
- instance.SetOrthographicProjection(arg1,arg2,arg3,arg4,arg5,arg6);
+ instance.SetOrthographicProjection(arg1, arg2, arg3, arg4, arg5, arg6);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliCameraActorSetOrthographicProjectionNegative02(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorSetTypeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetProjectionModeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetTargetPositionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
int UtcDaliCameraActorGetTypeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::CameraActor instance;
try
{
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#define ENABLE_VECTOR_ASSERTS
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/common/circular-queue.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/common/circular-queue.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-
int UtcDaliCircularQueueNew(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
- DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliCircularQueuePushBack01(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
- cQ.PushBack( 1 );
- DALI_TEST_EQUALS( cQ.Count(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ cQ.PushBack(1);
+ DALI_TEST_EQUALS(cQ.Count(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
- DALI_TEST_EQUALS( cQ[0], 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ[0], 1, TEST_LOCATION);
- cQ.PushBack( 2 );
- DALI_TEST_EQUALS( cQ.Count(), 2, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ cQ.PushBack(2);
+ DALI_TEST_EQUALS(cQ.Count(), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
- DALI_TEST_EQUALS( cQ[0], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ[1], 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ[0], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ[1], 2, TEST_LOCATION);
END_TEST;
}
int UtcDaliCircularQueuePushBack02(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<20; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Count(), i+1, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Count(), i + 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION);
}
END_TEST;
int UtcDaliCircularQueuePushBack03(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<19; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 19; ++i)
{
- cQ.PushBack( i );
+ cQ.PushBack(i);
}
cQ.PushBack(19);
- DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION);
- for( int i=0; i<10; ++i )
+ for(int i = 0; i < 10; ++i)
{
- tet_infoline( "Test that the end marker wraps around");
+ tet_infoline("Test that the end marker wraps around");
(void)cQ.PopFront();
- cQ.PushBack(20+i);
- DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ[0], 1+i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ[19], 20+i, TEST_LOCATION );
+ cQ.PushBack(20 + i);
+ DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ[0], 1 + i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ[19], 20 + i, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliCircularQueuePushBack04(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<10; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 10; ++i)
{
- cQ.PushBack( i );
+ cQ.PushBack(i);
int v = cQ.PopFront();
- DALI_TEST_EQUALS( v, i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(v, i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION);
}
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
// Queue is empty
cQ.PushBack(10);
- DALI_TEST_EQUALS( cQ[0], 10, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.Count(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ[0], 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.Count(), 1, TEST_LOCATION);
(void)cQ.PopFront();
- DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
// Queue is empty, markers should be in middle
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
+ cQ.PushBack(i);
int v = cQ.PopFront();
- DALI_TEST_EQUALS( v, i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(v, i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliCircularQueuePushBackN(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<20; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Count(), i+1, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Count(), i + 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION);
}
try
{
- cQ.PushBack( 20 );
- DALI_TEST_EQUALS( 0, 1, TEST_LOCATION );// Failure
+ cQ.PushBack(20);
+ DALI_TEST_EQUALS(0, 1, TEST_LOCATION); // Failure
}
- catch( DaliException e )
+ catch(DaliException e)
{
- DALI_TEST_EQUALS( 1, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(1, 1, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliCircularQueueOperatorIndex01(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<20; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Count(), 1+i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Count(), 1 + i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION);
}
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- DALI_TEST_EQUALS( cQ[i], i, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ[i], i, TEST_LOCATION);
}
END_TEST;
int UtcDaliCircularQueueOperatorIndexN01(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
try
{
int v = cQ[0];
DALI_TEST_EQUALS(v, 1, TEST_LOCATION);
}
- catch( DaliException e )
+ catch(DaliException e)
{
DALI_TEST_CHECK(true);
}
END_TEST;
}
-
int UtcDaliCircularQueuePopFront01(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<20; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Count(), 1+i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Count(), 1 + i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION);
}
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
int v = cQ.PopFront();
- DALI_TEST_EQUALS( cQ.Count(), 19-i, TEST_LOCATION );
- DALI_TEST_EQUALS( v, i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), i<19?false:true, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.Count(), 19 - i, TEST_LOCATION);
+ DALI_TEST_EQUALS(v, i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), i < 19 ? false : true, TEST_LOCATION);
}
END_TEST;
}
int UtcDaliCircularQueuePopFront02(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- for( int i=0; i<10; ++i)
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ for(int i = 0; i < 10; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ[i], i, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.Count(), i+1, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ[i], i, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.Count(), i + 1, TEST_LOCATION);
}
- for( int i=0; i<10; ++i)
+ for(int i = 0; i < 10; ++i)
{
- DALI_TEST_EQUALS( cQ.PopFront(), i, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.PopFront(), i, TEST_LOCATION);
}
- DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliCircularQueuePopFrontN01(void)
{
tet_infoline("Try popping from an empty queue");
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
try
{
(void)cQ.PopFront();
- DALI_TEST_CHECK( false );
+ DALI_TEST_CHECK(false);
}
- catch( DaliException e )
+ catch(DaliException e)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
}
-
int UtcDaliCircularQueuePopFrontN02(void)
{
tet_infoline("Try popping from an empty queue");
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
- for( int i=0; i<10; ++i)
+ for(int i = 0; i < 10; ++i)
{
- cQ.PushBack( i );
+ cQ.PushBack(i);
(void)cQ.PopFront();
}
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
try
{
(void)cQ.PopFront();
- DALI_TEST_CHECK( false );
+ DALI_TEST_CHECK(false);
}
- catch( DaliException e )
+ catch(DaliException e)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
int UtcDaliCircularQueueCount(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- DALI_TEST_EQUALS( cQ.Count(), 0, TEST_LOCATION );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ DALI_TEST_EQUALS(cQ.Count(), 0, TEST_LOCATION);
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Count(), 1+i, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Count(), 1 + i, TEST_LOCATION);
}
END_TEST;
int UtcDaliCircularQueueIsEmpty(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
}
// Pop off 19 elements
- for( int i=0; i<19; ++i)
+ for(int i = 0; i < 19; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
}
// pop off last element
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
- tet_infoline( "Add half into queue, then remove");
+ tet_infoline("Add half into queue, then remove");
- for( int i=0; i<10; ++i)
+ for(int i = 0; i < 10; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
}
- for( int i=0; i<9; ++i)
+ for(int i = 0; i < 9; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
}
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
tet_infoline("Markers should now be in the middle of the data structure. Try adding 20 again");
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
}
- for( int i=0; i<19; ++i)
+ for(int i = 0; i < 19; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
}
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliCircularQueueIsFull(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION);
}
- DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION);
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
}
- tet_infoline( "Add half into queue, then remove");
+ tet_infoline("Add half into queue, then remove");
- for( int i=0; i<10; ++i)
+ for(int i = 0; i < 10; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
}
- for( int i=0; i<10; ++i)
+ for(int i = 0; i < 10; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
}
tet_infoline("Markers should now be in the middle of the data structure. Try adding 20 again");
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.IsFull(), i<19?false:true, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.IsFull(), i < 19 ? false : true, TEST_LOCATION);
}
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliCircularQueueFront(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Front(), 0, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Front(), 0, TEST_LOCATION);
}
- for( int i=0; i<19; ++i)
+ for(int i = 0; i < 19; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.Front(), i+1, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.Front(), i + 1, TEST_LOCATION);
}
END_TEST;
}
int UtcDaliCircularQueueBack(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 20 );
+ CircularQueue<int> cQ = CircularQueue<int>(20);
- for( int i=0; i<20; ++i)
+ for(int i = 0; i < 20; ++i)
{
- cQ.PushBack( i );
- DALI_TEST_EQUALS( cQ.Back(), i, TEST_LOCATION );
+ cQ.PushBack(i);
+ DALI_TEST_EQUALS(cQ.Back(), i, TEST_LOCATION);
}
- for( int i=0; i<19; ++i)
+ for(int i = 0; i < 19; ++i)
{
- (void) cQ.PopFront();
- DALI_TEST_EQUALS( cQ.Back(), 19, TEST_LOCATION );
+ (void)cQ.PopFront();
+ DALI_TEST_EQUALS(cQ.Back(), 19, TEST_LOCATION);
}
END_TEST;
}
int UtcDaliCircularQueueSize1(void)
{
- CircularQueue<int> cQ = CircularQueue<int>( 1 );
+ CircularQueue<int> cQ = CircularQueue<int>(1);
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
- cQ.PushBack( 5 );
- DALI_TEST_EQUALS( cQ.IsEmpty(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.Front(), 5, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.Back(), 5, TEST_LOCATION );
+ cQ.PushBack(5);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.Front(), 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.Back(), 5, TEST_LOCATION);
- DALI_TEST_EQUALS( cQ.PopFront(), 5, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsEmpty(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( cQ.IsFull(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(cQ.PopFront(), 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsEmpty(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(cQ.IsFull(), false, TEST_LOCATION);
END_TEST;
}
+// pushback
+// . => [O]
+// se se
- // pushback
- // . => [O]
- // se se
-
- // [O] => [O] [O]
- // se s e
+// [O] => [O] [O]
+// se s e
- // [O] [O] [O] [O] [O] [ ] => [O] [O] [O] [O] [O] [O]
- // s e s e
+// [O] [O] [O] [O] [O] [ ] => [O] [O] [O] [O] [O] [O]
+// s e s e
- // [ ] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [O]
- // s e e s
+// [ ] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [O]
+// s e e s
- // [ ] [ ] [O] [ ] [ ] [ ] => [ ] [ ] [O] [O] [ ] [ ]
- // se s e
+// [ ] [ ] [O] [ ] [ ] [ ] => [ ] [ ] [O] [O] [ ] [ ]
+// se s e
- // [ ] [ ] [ ] [ ] [ ] [O] => [O] [ ] [ ] [ ] [ ] [O]
- // se e s
+// [ ] [ ] [ ] [ ] [ ] [O] => [O] [ ] [ ] [ ] [ ] [O]
+// se e s
- // [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [O] [ ] [ ] [ ]
- // se se
+// [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [O] [ ] [ ] [ ]
+// se se
- // [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [0]
- // se se
- // popfront
- // [O] [O] [O] [O] [O] [O] => [ ] [O] [O] [O] [O] [O]
- // s e s e
+// [ ] [ ] [ ] [ ] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [0]
+// se se
+// popfront
+// [O] [O] [O] [O] [O] [O] => [ ] [O] [O] [O] [O] [O]
+// s e s e
- // [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [ ] [O]
- // e s e s
+// [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [ ] [O]
+// e s e s
- // [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [ ]
- // e s s e
+// [O] [O] [O] [O] [O] [O] => [O] [O] [O] [O] [O] [ ]
+// e s s e
- // [ ] [ ] [O] [O] [ ] [ ] => [ ] [ ] [ ] [O] [ ] [ ]
- // s e se
+// [ ] [ ] [O] [O] [ ] [ ] => [ ] [ ] [ ] [O] [ ] [ ]
+// s e se
- // [ ] [ ] [ ] [O] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [ ]
- // se se
+// [ ] [ ] [ ] [O] [ ] [ ] => [ ] [ ] [ ] [ ] [ ] [ ]
+// se se
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <unistd.h>
-#include <type_traits>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/thread.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <iostream>
+#include <type_traits>
using Dali::ConditionalWait;
using Dali::Thread;
namespace // for local variables to avoid name clashes
{
-volatile int gGlobalValue = 0;
+volatile int gGlobalValue = 0;
volatile bool gWorkerThreadWait = true;
-enum ThreadState { INIT, RUN, TERMINATE } volatile gWorkerThreadState = INIT;
+enum ThreadState
+{
+ INIT,
+ RUN,
+ TERMINATE
+} volatile gWorkerThreadState = INIT;
ConditionalWait* volatile gConditionalWait; // volatile pointer to a ConditionalWait object
class WorkerThreadNotify : public Thread
virtual void Run()
{
gGlobalValue = -1;
- while( gWorkerThreadWait ) // wait till we can exit
+ while(gWorkerThreadWait) // wait till we can exit
{
gWorkerThreadState = RUN;
- usleep( 1 ); // 1 microseconds
+ usleep(1); // 1 microseconds
}
- usleep( 200 ); // give other thread time to get to Wait
+ usleep(200); // give other thread time to get to Wait
gGlobalValue = 1;
gConditionalWait->Notify();
gWorkerThreadState = TERMINATE;
{
virtual void Run()
{
- while( gNotifyCount > 0 )
+ while(gNotifyCount > 0)
{
gConditionalWait->Notify();
- usleep( 10 ); // 10 microseconds between each notify
+ usleep(10); // 10 microseconds between each notify
}
}
};
}
};
-}
+} // namespace
int UtcConditionalWait1P(void)
{
WorkerThreadNotify thread1;
// initialize values
- gConditionalWait = new ConditionalWait();
+ gConditionalWait = new ConditionalWait();
gWorkerThreadWait = true;
- DALI_TEST_EQUALS( INIT, gWorkerThreadState, TEST_LOCATION );
- DALI_TEST_EQUALS( 0, gGlobalValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(INIT, gWorkerThreadState, TEST_LOCATION);
+ DALI_TEST_EQUALS(0, gGlobalValue, TEST_LOCATION);
thread1.Start();
// wait till the thread is in run state
- while( RUN != gWorkerThreadState )
+ while(RUN != gWorkerThreadState)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
// let worker continue and finish
gWorkerThreadWait = false;
gConditionalWait->Wait();
- DALI_TEST_EQUALS( 1, gGlobalValue, TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, gGlobalValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION);
// wait till the thread is terminated state
- while( TERMINATE != gWorkerThreadState )
+ while(TERMINATE != gWorkerThreadState)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
thread1.Join();
tet_infoline("Testing ConditionalWait - scenario: notify without wait");
ConditionalWait wait;
- DALI_TEST_EQUALS( 0u, wait.GetWaitCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, wait.GetWaitCount(), TEST_LOCATION);
wait.Notify();
- DALI_TEST_EQUALS( 0u, wait.GetWaitCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, wait.GetWaitCount(), TEST_LOCATION);
END_TEST;
}
-
int UtcConditionalWait3P(void)
{
tet_infoline("Testing ConditionalWait - scenario: wait - notify N times 2 threads");
// initialize values
gConditionalWait = new ConditionalWait();
- gNotifyCount = 100;
+ gNotifyCount = 100;
WorkerThreadNotifyN thread1;
thread1.Start();
- while( gNotifyCount > 0 )
+ while(gNotifyCount > 0)
{
gConditionalWait->Wait();
--gNotifyCount;
- DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION );
- usleep( 10 ); // 10 microseconds between each notify
+ DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION);
+ usleep(10); // 10 microseconds between each notify
}
- DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION);
thread1.Join();
// initialize values
gConditionalWait = new ConditionalWait();
- gNotifyCount = 100;
+ gNotifyCount = 100;
WorkerThreadNotifyN thread1;
thread1.Start();
WorkerThreadNotifyN thread3;
thread3.Start();
- while( gNotifyCount > 0 )
+ while(gNotifyCount > 0)
{
gConditionalWait->Wait();
--gNotifyCount;
- DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION );
- usleep( 10 ); // 10 microseconds between each notify
+ DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION);
+ usleep(10); // 10 microseconds between each notify
}
thread1.Join();
WorkerThreadWaitN thread4;
thread4.Start();
// wait till all child threads are waiting
- while( gConditionalWait->GetWaitCount() < 4 )
- { }
+ while(gConditionalWait->GetWaitCount() < 4)
+ {
+ }
// notify once, it will resume all threads
gConditionalWait->Notify();
thread3.Join();
thread4.Join();
- DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION);
delete gConditionalWait;
END_TEST;
WorkerThreadWaitN thread4;
thread4.Start();
// wait till all child threads are waiting
- while( gConditionalWait->GetWaitCount() < 4 )
- { }
+ while(gConditionalWait->GetWaitCount() < 4)
+ {
+ }
// notify once but with a scoped lock, it will resume all threads
{
- ConditionalWait::ScopedLock lock( *gConditionalWait );
- gConditionalWait->Notify( lock );
+ ConditionalWait::ScopedLock lock(*gConditionalWait);
+ gConditionalWait->Notify(lock);
}
thread1.Join();
thread3.Join();
thread4.Join();
- DALI_TEST_EQUALS( 0u, gConditionalWait->GetWaitCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, gConditionalWait->GetWaitCount(), TEST_LOCATION);
delete gConditionalWait;
END_TEST;
{
// we want to make sure that ConditionalWait is not copyable (its copy constructor is not defined)
// this test will stop compiling if ConditionalWait has compiler generated copy constructor
- static_assert( !__has_trivial_copy( ConditionalWait ), "ConditionalWait should NOT be copyable" );
+ static_assert(!__has_trivial_copy(ConditionalWait), "ConditionalWait should NOT be copyable");
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
-
-
*/
// EXTERNAL INCLUDES
-#include <iostream>
#include <stdlib.h>
+#include <iostream>
+
// INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
#include <signal-helper.h>
-
using namespace Dali;
void utc_dali_conenction_tracker_startup(void)
test_return_value = TET_PASS;
}
-namespace {
-
-
-} // anon namespace
-
+namespace
+{
+} // namespace
/*******************************************
*
ConnectionTracker tracker;
- DALI_TEST_CHECK( tracker.GetConnectionCount() == 0 );
+ DALI_TEST_CHECK(tracker.GetConnectionCount() == 0);
END_TEST;
}
TestButton* button = new TestButton(1);
{
TestApp testApp;
- button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress);
- DALI_TEST_CHECK( testApp.GetConnectionCount() == 1 );
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( )== 1 );
+ button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress);
+ DALI_TEST_CHECK(testApp.GetConnectionCount() == 1);
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1);
}
// testApp out of scope it should have been disconnected
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0);
delete button;
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- TestApp testApp;
- button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress);
+ TestApp testApp;
+ button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1);
testApp.DisconnectAll();
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0);
delete button;
int UtcConnectionTrackerDisconnectAllN(void)
{
TestApplication application; // Create core for debug logging
- TestApp testApp;
- TestButton* button = new TestButton(1);
+ TestApp testApp;
+ TestButton* button = new TestButton(1);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0);
testApp.DisconnectAll();
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0);
delete button;
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- TestApp testApp;
- button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress);
+ TestApp testApp;
+ button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1);
delete button;
END_TEST;
-
}
int UtcConnectionTrackerSignalConnectedN(void)
{
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- TestApp* testApp( NULL );
+ TestApp* testApp(NULL);
try
{
// connect to a null connection tracker
- button->DownSignal().Connect( testApp, &TestApp::OnButtonPress);
+ button->DownSignal().Connect(testApp, &TestApp::OnButtonPress);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
// Tests that a negative test of an assertion succeeds
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_PASS);
}
END_TEST;
}
-
int UtcConnectionTrackerSignalDisconnectP(void)
{
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- TestApp testApp;
- button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress);
+ TestApp testApp;
+ button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1);
- button->DownSignal().Disconnect(&testApp,&TestApp::OnButtonPress);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 );
+ button->DownSignal().Disconnect(&testApp, &TestApp::OnButtonPress);
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0);
delete button;
END_TEST;
}
-
int UtcConnectionTrackerSignalDisconnectN(void)
{
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- TestApp testApp;
- button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress);
+ TestApp testApp;
+ button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1);
try
{
- application.SignalDisconnected( NULL, NULL );
- tet_result( TET_FAIL );
+ application.SignalDisconnected(NULL, NULL);
+ tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
delete button;
END_TEST;
}
-
int UtcConnectionTrackerGetConnectionCountP(void)
{
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- TestApp testApp;
- button->DownSignal().Connect(&testApp,&TestApp::OnButtonPress);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 1 );
+ TestApp testApp;
+ button->DownSignal().Connect(&testApp, &TestApp::OnButtonPress);
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 1);
delete button;
TestApplication application; // Create core for debug logging
TestButton* button = new TestButton(1);
- DALI_TEST_CHECK( button->DownSignal().GetConnectionCount( ) == 0 );
+ DALI_TEST_CHECK(button->DownSignal().GetConnectionCount() == 0);
delete button;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/animation/path-constrainer.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/animation/path-constrainer.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
using namespace Dali::Internal;
namespace
{
-
-static void SetupPath( Dali::Path& path)
+static void SetupPath(Dali::Path& path)
{
- path.AddPoint(Vector3( 30.0, 80.0, 0.0));
- path.AddPoint(Vector3( 70.0, 120.0, 0.0));
+ path.AddPoint(Vector3(30.0, 80.0, 0.0));
+ path.AddPoint(Vector3(70.0, 120.0, 0.0));
path.AddPoint(Vector3(100.0, 100.0, 0.0));
//Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
- path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+ path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
+ path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
//Control points for second segment
- path.AddControlPoint(Vector3( 78.0, 120.0, 0.0) );
- path.AddControlPoint(Vector3( 93.0, 104.0, 0.0) );
+ path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
}
-static void SetupPathConstrainer( Dali::PathConstrainer& PathConstrainer)
+static void SetupPathConstrainer(Dali::PathConstrainer& PathConstrainer)
{
- PathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f,0.0f,0.0f) );
+ PathConstrainer.SetProperty(Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f, 0.0f, 0.0f));
Dali::Property::Array points;
points.Resize(3);
- points[0] = Vector3( 30.0, 80.0, 0.0);
- points[1] = Vector3( 70.0, 120.0, 0.0);
+ points[0] = Vector3(30.0, 80.0, 0.0);
+ points[1] = Vector3(70.0, 120.0, 0.0);
points[2] = Vector3(100.0, 100.0, 0.0);
- PathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points );
+ PathConstrainer.SetProperty(Dali::PathConstrainer::Property::POINTS, points);
points.Resize(4);
- points[0] = Vector3( 39.0, 90.0, 0.0);
- points[1] = Vector3( 56.0, 119.0, 0.0);
- points[2] = Vector3( 78.0, 120.0, 0.0);
- points[3] = Vector3( 93.0, 104.0, 0.0);
- PathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points );
+ points[0] = Vector3(39.0, 90.0, 0.0);
+ points[1] = Vector3(56.0, 119.0, 0.0);
+ points[2] = Vector3(78.0, 120.0, 0.0);
+ points[3] = Vector3(93.0, 104.0, 0.0);
+ PathConstrainer.SetProperty(Dali::PathConstrainer::Property::CONTROL_POINTS, points);
}
-static void SetupLinearConstrainerUniformProgress( Dali::LinearConstrainer& linearConstrainer)
+static void SetupLinearConstrainerUniformProgress(Dali::LinearConstrainer& linearConstrainer)
{
Dali::Property::Array points;
points.Resize(3);
points[0] = 0.0f;
points[1] = 1.0f;
points[2] = 0.0f;
- linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points );
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points);
}
-static void VerifyLinearConstrainerUniformProgress( Dali::LinearConstrainer& linearConstrainer )
+static void VerifyLinearConstrainerUniformProgress(Dali::LinearConstrainer& linearConstrainer)
{
Dali::Property::Array points;
points.Resize(3);
points[1] = 1.0f;
points[2] = 0.0f;
- Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::VALUE );
+ Property::Value value = linearConstrainer.GetProperty(Dali::LinearConstrainer::Property::VALUE);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<float>(), points[i].Get<float>(), TEST_LOCATION);
}
}
-static void SetupLinearConstrainerNonUniformProgress( Dali::LinearConstrainer& linearConstrainer)
+static void SetupLinearConstrainerNonUniformProgress(Dali::LinearConstrainer& linearConstrainer)
{
Dali::Property::Array points;
points.Resize(3);
points[0] = 0.0f;
points[1] = 1.0f;
points[2] = 0.0f;
- linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points );
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points);
points[0] = 0.0f;
points[1] = 0.25f;
points[2] = 1.0f;
- linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points );
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::PROGRESS, points);
}
} // anonymous namespace
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
//Create a PathConstrainer
Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
- SetupPathConstrainer( pathConstrainer );
+ SetupPathConstrainer(pathConstrainer);
//Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 0.0f, 1.0f );
- pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
+ Vector2 range(0.0f, 1.0f);
+ pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range);
//Create an animation to animate the custom property
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Dali::Animation animation = Dali::Animation::New(durationSeconds);
- animation.AnimateTo(Dali::Property(actor,index),1.0f);
+ animation.AnimateTo(Dali::Property(actor, index), 1.0f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 20% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 20% progress */);
Vector3 position, tangent;
- path.Sample(0.2f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ path.Sample(0.2f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 40% progress */);
- path.Sample(0.4f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 40% progress */);
+ path.Sample(0.4f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 60% progress */);
- path.Sample(0.6f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 60% progress */);
+ path.Sample(0.6f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 80% progress */);
- path.Sample(0.8f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 80% progress */);
+ path.Sample(0.8f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* 100% progress */);
- path.Sample(1.0f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* 100% progress */);
+ path.Sample(1.0f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*200.0f)/* beyond the animation duration*/);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 200.0f) /* beyond the animation duration*/);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
//Create a Path
//Create a PathConstrainer
Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
- SetupPathConstrainer( pathConstrainer );
+ SetupPathConstrainer(pathConstrainer);
//Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 100.0f, 300.0f );
- pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
-
+ Vector2 range(100.0f, 300.0f);
+ pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range);
//Create an animation to animate the custom property
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Dali::Animation animation = Dali::Animation::New(durationSeconds);
- animation.AnimateTo(Dali::Property(actor,index),400.0f);
+ animation.AnimateTo(Dali::Property(actor, index), 400.0f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
-
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
Vector3 position, tangent;
- float tValue;
- actor.GetCurrentProperty( index ).Get(tValue);
- float currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ float tValue;
+ actor.GetCurrentProperty(index).Get(tValue);
+ float currentCursor = (tValue - range.x) / (range.y - range.x);
+ path.Sample(currentCursor, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
- actor.GetCurrentProperty( index ).Get(tValue);
- currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- path.Sample(0.5, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
+ actor.GetCurrentProperty(index).Get(tValue);
+ currentCursor = (tValue - range.x) / (range.y - range.x);
+ path.Sample(currentCursor, position, tangent);
+ path.Sample(0.5, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
- actor.GetCurrentProperty( index ).Get( tValue );
- currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
+ actor.GetCurrentProperty(index).Get(tValue);
+ currentCursor = (tValue - range.x) / (range.y - range.x);
+ path.Sample(currentCursor, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
- actor.GetCurrentProperty( index ).Get( tValue );
- currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
+ actor.GetCurrentProperty(index).Get(tValue);
+ currentCursor = (tValue - range.x) / (range.y - range.x);
+ path.Sample(currentCursor, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
- actor.GetCurrentProperty( index ).Get( tValue );
- currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* beyond the animation duration*/);
+ actor.GetCurrentProperty(index).Get(tValue);
+ currentCursor = (tValue - range.x) / (range.y - range.x);
+ path.Sample(currentCursor, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
// Ensure GetProperty also returns the final result
- actor.GetProperty( index ).Get( tValue );
- currentCursor = ( tValue - range.x ) / (range.y-range.x);
- path.Sample(currentCursor, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ actor.GetProperty(index).Get(tValue);
+ currentCursor = (tValue - range.x) / (range.y - range.x);
+ path.Sample(currentCursor, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
{
//Create a PathConstrainer
Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
- SetupPathConstrainer( pathConstrainer );
+ SetupPathConstrainer(pathConstrainer);
//Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 0.0f, 1.0f );
- pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
+ Vector2 range(0.0f, 1.0f);
+ pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range);
//Test that the constraint is correctly applied
- actor.SetProperty(index,0.5f);
+ actor.SetProperty(index, 0.5f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
Vector3 position, tangent;
- path.Sample(0.5f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
-
+ path.Sample(0.5f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
}
//PathConstrainer has been destroyed. Constraint in the actor should have been removed
- actor.SetProperty(index,0.75f);
+ actor.SetProperty(index, 0.75f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
//Create a Path
//Create a PathConstrainer
Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
- SetupPathConstrainer( pathConstrainer );
+ SetupPathConstrainer(pathConstrainer);
//Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 0.0f, 1.0f );
- pathConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION), Property(actor,index), range );
+ Vector2 range(0.0f, 1.0f);
+ pathConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION), Property(actor, index), range);
//Test that the constraint is correctly applied
- actor.SetProperty(index,0.5f);
+ actor.SetProperty(index, 0.5f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
Vector3 position, tangent;
- path.Sample(0.5f, position, tangent );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), position, TEST_LOCATION );
+ path.Sample(0.5f, position, tangent);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), position, TEST_LOCATION);
//Remove constraint
- pathConstrainer.Remove( actor );
- actor.SetProperty(index,0.75f);
+ pathConstrainer.Remove(actor);
+ actor.SetProperty(index, 0.75f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ), Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION), Vector3::ZERO, TEST_LOCATION);
END_TEST;
}
int UtcPathConstrainerProperties(void)
{
- TestApplication application;
+ TestApplication application;
Dali::PathConstrainer pathConstrainer = Dali::PathConstrainer::New();
- pathConstrainer.SetProperty( Dali::PathConstrainer::Property::FORWARD, Vector3( 1.0f,0.0f,0.0f ) );
- DALI_TEST_EQUALS( pathConstrainer.GetProperty< Vector3 >( Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( pathConstrainer.GetCurrentProperty< Vector3 >( Dali::PathConstrainer::Property::FORWARD ), Vector3( 1.0f, 0.0f, 0.0f ), TEST_LOCATION );
+ pathConstrainer.SetProperty(Dali::PathConstrainer::Property::FORWARD, Vector3(1.0f, 0.0f, 0.0f));
+ DALI_TEST_EQUALS(pathConstrainer.GetProperty<Vector3>(Dali::PathConstrainer::Property::FORWARD), Vector3(1.0f, 0.0f, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(pathConstrainer.GetCurrentProperty<Vector3>(Dali::PathConstrainer::Property::FORWARD), Vector3(1.0f, 0.0f, 0.0f), TEST_LOCATION);
Dali::Property::Array points;
points.Resize(3);
- points[0] = Vector3( 30.0, 80.0, 0.0);
- points[1] = Vector3( 70.0, 120.0, 0.0);
+ points[0] = Vector3(30.0, 80.0, 0.0);
+ points[1] = Vector3(70.0, 120.0, 0.0);
points[2] = Vector3(100.0, 100.0, 0.0);
- pathConstrainer.SetProperty( Dali::PathConstrainer::Property::POINTS, points );
+ pathConstrainer.SetProperty(Dali::PathConstrainer::Property::POINTS, points);
{
- Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::Property::POINTS );
+ Property::Value value = pathConstrainer.GetProperty(Dali::PathConstrainer::Property::POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
{
- Property::Value value = pathConstrainer.GetCurrentProperty( Dali::PathConstrainer::Property::POINTS );
+ Property::Value value = pathConstrainer.GetCurrentProperty(Dali::PathConstrainer::Property::POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
points.Resize(4);
- points[0] = Vector3( 39.0, 90.0, 0.0);
- points[1] = Vector3( 56.0, 119.0, 0.0);
- points[2] = Vector3( 78.0, 120.0, 0.0);
- points[3] = Vector3( 93.0, 104.0, 0.0);
- pathConstrainer.SetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS, points );
+ points[0] = Vector3(39.0, 90.0, 0.0);
+ points[1] = Vector3(56.0, 119.0, 0.0);
+ points[2] = Vector3(78.0, 120.0, 0.0);
+ points[3] = Vector3(93.0, 104.0, 0.0);
+ pathConstrainer.SetProperty(Dali::PathConstrainer::Property::CONTROL_POINTS, points);
{
- Property::Value value = pathConstrainer.GetProperty( Dali::PathConstrainer::Property::CONTROL_POINTS );
+ Property::Value value = pathConstrainer.GetProperty(Dali::PathConstrainer::Property::CONTROL_POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
{
- Property::Value value = pathConstrainer.GetCurrentProperty( Dali::PathConstrainer::Property::CONTROL_POINTS );
+ Property::Value value = pathConstrainer.GetCurrentProperty(Dali::PathConstrainer::Property::CONTROL_POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
//LinearConstrainer test cases
int UtcLinearConstrainerDownCast(void)
{
- TestApplication application;
+ TestApplication application;
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- BaseHandle handle( linearConstrainer );
- Dali::LinearConstrainer linearConstrainer2 = Dali::LinearConstrainer::DownCast( handle );
- DALI_TEST_EQUALS( (bool)linearConstrainer2, true, TEST_LOCATION );
+ BaseHandle handle(linearConstrainer);
+ Dali::LinearConstrainer linearConstrainer2 = Dali::LinearConstrainer::DownCast(handle);
+ DALI_TEST_EQUALS((bool)linearConstrainer2, true, TEST_LOCATION);
- BaseHandle handle2;
- Dali:: LinearConstrainer linearConstrainer3 = Dali::LinearConstrainer::DownCast( handle2 );
- DALI_TEST_EQUALS( (bool)linearConstrainer3, false, TEST_LOCATION );
+ BaseHandle handle2;
+ Dali::LinearConstrainer linearConstrainer3 = Dali::LinearConstrainer::DownCast(handle2);
+ DALI_TEST_EQUALS((bool)linearConstrainer3, false, TEST_LOCATION);
END_TEST;
}
int UtcLinearConstrainerCopyConstructor(void)
{
- TestApplication application;
+ TestApplication application;
Dali::LinearConstrainer linearConstrainer;
- DALI_TEST_EQUALS( (bool)linearConstrainer, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)linearConstrainer, false, TEST_LOCATION);
linearConstrainer = Dali::LinearConstrainer::New();
- DALI_TEST_EQUALS( (bool)linearConstrainer, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)linearConstrainer, true, TEST_LOCATION);
// call the copy constructor
- Dali::LinearConstrainer linearConstrainer2( linearConstrainer );
- DALI_TEST_EQUALS( (bool)linearConstrainer2, true, TEST_LOCATION );
+ Dali::LinearConstrainer linearConstrainer2(linearConstrainer);
+ DALI_TEST_EQUALS((bool)linearConstrainer2, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- DALI_TEST_CHECK( linearConstrainer );
- DALI_TEST_EQUALS( 1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(linearConstrainer);
+ DALI_TEST_EQUALS(1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- SetupLinearConstrainerUniformProgress( linearConstrainer );
- VerifyLinearConstrainerUniformProgress( linearConstrainer );
+ SetupLinearConstrainerUniformProgress(linearConstrainer);
+ VerifyLinearConstrainerUniformProgress(linearConstrainer);
- Dali::LinearConstrainer moved = std::move( linearConstrainer );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- VerifyLinearConstrainerUniformProgress( moved );
- DALI_TEST_CHECK( !linearConstrainer );
+ Dali::LinearConstrainer moved = std::move(linearConstrainer);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ VerifyLinearConstrainerUniformProgress(moved);
+ DALI_TEST_CHECK(!linearConstrainer);
END_TEST;
}
TestApplication application;
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- DALI_TEST_CHECK( linearConstrainer );
- DALI_TEST_EQUALS( 1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(linearConstrainer);
+ DALI_TEST_EQUALS(1, linearConstrainer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- SetupLinearConstrainerUniformProgress( linearConstrainer );
- VerifyLinearConstrainerUniformProgress( linearConstrainer );
+ SetupLinearConstrainerUniformProgress(linearConstrainer);
+ VerifyLinearConstrainerUniformProgress(linearConstrainer);
Dali::LinearConstrainer moved;
- moved = std::move( linearConstrainer );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- VerifyLinearConstrainerUniformProgress( moved );
- DALI_TEST_CHECK( !linearConstrainer );
+ moved = std::move(linearConstrainer);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ VerifyLinearConstrainerUniformProgress(moved);
+ DALI_TEST_CHECK(!linearConstrainer);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
-
//Create a LinearConstrainer without specifying progress for values
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- SetupLinearConstrainerUniformProgress( linearConstrainer );
+ SetupLinearConstrainerUniformProgress(linearConstrainer);
//Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 0.0f, 1.0f );
- linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
+ Vector2 range(0.0f, 1.0f);
+ linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range);
//Create an animation to animate the custom property
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Dali::Animation animation = Dali::Animation::New(durationSeconds);
- animation.AnimateTo(Dali::Property(actor,index),1.0f);
+ animation.AnimateTo(Dali::Property(actor, index), 1.0f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* beyond the animation duration*/);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
//Setup a LinearConstrainer specifying the progress for each value
linearConstrainer.Remove(actor);
- SetupLinearConstrainerNonUniformProgress( linearConstrainer );
- linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
+ SetupLinearConstrainerNonUniformProgress(linearConstrainer);
+ linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range);
- actor.SetProperty(index,0.0f);
+ actor.SetProperty(index, 0.0f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 2.0f/3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 2.0f / 3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f/3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f / 3.0f, Math::MACHINE_EPSILON_1, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* beyond the animation duration*/);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 100.0f );
+ Property::Index index = actor.RegisterProperty("t", 100.0f);
application.GetScene().Add(actor);
//Create a LinearConstrainer
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- SetupLinearConstrainerUniformProgress( linearConstrainer );
+ SetupLinearConstrainerUniformProgress(linearConstrainer);
//Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 100.0f, 300.0f );
- linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
-
+ Vector2 range(100.0f, 300.0f);
+ linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range);
//Create an animation to animate the custom property
- float durationSeconds(1.0f);
+ float durationSeconds(1.0f);
Dali::Animation animation = Dali::Animation::New(durationSeconds);
- animation.AnimateTo(Dali::Property(actor,index),300.0f);
+ animation.AnimateTo(Dali::Property(actor, index), 300.0f);
animation.Play();
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 25% progress */);
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 25% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 50% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 50% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 75% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.5f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 75% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.5f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* 100% progress */);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* 100% progress */);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
application.SendNotification();
- application.Render(static_cast<unsigned int>(durationSeconds*250.0f)/* beyond the animation duration*/);
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ application.Render(static_cast<unsigned int>(durationSeconds * 250.0f) /* beyond the animation duration*/);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
{
//Create a LinearConstrainer
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- SetupLinearConstrainerUniformProgress( linearConstrainer );
+ SetupLinearConstrainerUniformProgress(linearConstrainer);
//Apply the linear constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 0.0f, 1.0f );
- linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
+ Vector2 range(0.0f, 1.0f);
+ linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range);
//Test that the constraint is correctly applied
- actor.SetProperty(index,0.5f);
+ actor.SetProperty(index, 0.5f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION);
}
//LinearConstrainer has been destroyed. Constraint in the actor should have been removed
- actor.SetProperty(index,0.75f);
+ actor.SetProperty(index, 0.75f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
END_TEST;
}
Dali::Actor actor = Dali::Actor::New();
// Register a float property
- Property::Index index = actor.RegisterProperty( "t", 0.0f );
+ Property::Index index = actor.RegisterProperty("t", 0.0f);
application.GetScene().Add(actor);
//Create a LinearConstrainer
Dali::LinearConstrainer linearConstrainer = Dali::LinearConstrainer::New();
- SetupLinearConstrainerUniformProgress( linearConstrainer );
+ SetupLinearConstrainerUniformProgress(linearConstrainer);
//Apply the path constraint to the actor's position. The source property for the constraint will be the custom property "t"
- Vector2 range( 0.0f, 1.0f );
- linearConstrainer.Apply( Property(actor,Dali::Actor::Property::POSITION_X), Property(actor,index), range );
+ Vector2 range(0.0f, 1.0f);
+ linearConstrainer.Apply(Property(actor, Dali::Actor::Property::POSITION_X), Property(actor, index), range);
//Test that the constraint is correctly applied
- actor.SetProperty(index,0.5f);
+ actor.SetProperty(index, 0.5f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 1.0f, TEST_LOCATION);
//Remove constraint
- linearConstrainer.Remove( actor );
- actor.SetProperty(index,0.75f);
+ linearConstrainer.Remove(actor);
+ actor.SetProperty(index, 0.75f);
application.SendNotification();
application.Render(static_cast<unsigned int>(1.0f));
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Dali::Actor::Property::POSITION ).x, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Dali::Actor::Property::POSITION).x, 0.0f, TEST_LOCATION);
END_TEST;
}
points[0] = 0.0f;
points[1] = 1.0f;
points[2] = 0.0f;
- linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::VALUE, points );
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::VALUE, points);
{
- Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::VALUE );
+ Property::Value value = linearConstrainer.GetProperty(Dali::LinearConstrainer::Property::VALUE);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<float>(), points[i].Get<float>(), TEST_LOCATION);
}
}
{
- Property::Value value = linearConstrainer.GetCurrentProperty( Dali::LinearConstrainer::Property::VALUE );
+ Property::Value value = linearConstrainer.GetCurrentProperty(Dali::LinearConstrainer::Property::VALUE);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
points[0] = 0.0f;
points[1] = 0.25f;
points[2] = 1.0f;
- linearConstrainer.SetProperty( Dali::LinearConstrainer::Property::PROGRESS, points );
+ linearConstrainer.SetProperty(Dali::LinearConstrainer::Property::PROGRESS, points);
{
- Property::Value value = linearConstrainer.GetProperty( Dali::LinearConstrainer::Property::PROGRESS );
+ Property::Value value = linearConstrainer.GetProperty(Dali::LinearConstrainer::Property::PROGRESS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<float>(), points[i].Get<float>(), TEST_LOCATION);
}
}
{
- Property::Value value = linearConstrainer.GetCurrentProperty( Dali::LinearConstrainer::Property::PROGRESS );
+ Property::Value value = linearConstrainer.GetCurrentProperty(Dali::LinearConstrainer::Property::PROGRESS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< float >(), points[i].Get< float >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<float>(), points[i].Get<float>(), TEST_LOCATION);
}
}
Dali::LinearConstrainer constrainer = Dali::LinearConstrainer::New();
- Property::Index index = constrainer.RegisterProperty( "sceneProperty", 0 );
- DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+ Property::Index index = constrainer.RegisterProperty("sceneProperty", 0);
+ DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(constrainer.GetProperty<int32_t>(index), 0, TEST_LOCATION);
- constrainer.SetProperty( index, -123 );
- DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+ constrainer.SetProperty(index, -123);
+ DALI_TEST_EQUALS(constrainer.GetProperty<int32_t>(index), -123, TEST_LOCATION);
using Dali::Animation;
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( constrainer, index ), 99 );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(constrainer, index), 99);
- DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+ DALI_TEST_EQUALS(constrainer.GetProperty<int32_t>(index), -123, TEST_LOCATION);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( 1000 /* 100% progress */);
- DALI_TEST_EQUALS( constrainer.GetProperty< int32_t >( index ), 99, TEST_LOCATION );
+ application.Render(1000 /* 100% progress */);
+ DALI_TEST_EQUALS(constrainer.GetProperty<int32_t>(index), 99, TEST_LOCATION);
END_TEST;
}
Dali::PathConstrainer constrainer = Dali::PathConstrainer::New();
- Property::Index index = constrainer.RegisterProperty( "pathProperty", Vector2() );
- DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(), TEST_LOCATION );
+ Property::Index index = constrainer.RegisterProperty("pathProperty", Vector2());
+ DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(constrainer.GetProperty<Vector2>(index), Vector2(), TEST_LOCATION);
- constrainer.SetProperty( index, Vector2(1,2) );
- DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(1,2), TEST_LOCATION );
+ constrainer.SetProperty(index, Vector2(1, 2));
+ DALI_TEST_EQUALS(constrainer.GetProperty<Vector2>(index), Vector2(1, 2), TEST_LOCATION);
using Dali::Animation;
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( constrainer, index ), Vector2(3,4) );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(constrainer, index), Vector2(3, 4));
- DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(1,2), TEST_LOCATION );
+ DALI_TEST_EQUALS(constrainer.GetProperty<Vector2>(index), Vector2(1, 2), TEST_LOCATION);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( 1000 /* 100% progress */);
- DALI_TEST_EQUALS( constrainer.GetProperty< Vector2 >( index ), Vector2(3,4), TEST_LOCATION );
+ application.Render(1000 /* 100% progress */);
+ DALI_TEST_EQUALS(constrainer.GetProperty<Vector2>(index), Vector2(3, 4), TEST_LOCATION);
END_TEST;
}
int UtcDaliLinearConstrainerApplyNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::LinearConstrainer instance;
- Dali::Actor actor;
+ Dali::Actor actor;
try
{
Dali::Property arg1(actor, Dali::Actor::Property::POSITION);
Dali::Property arg2(actor, Dali::Actor::Property::POSITION);
- Dali::Vector2 arg3;
- Dali::Vector2 arg4;
- instance.Apply(arg1,arg2,arg3,arg4);
+ Dali::Vector2 arg3;
+ Dali::Vector2 arg4;
+ instance.Apply(arg1, arg2, arg3, arg4);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliLinearConstrainerRemoveNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::LinearConstrainer instance;
try
{
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
/**
* A function to use for a constraint, no data collected.
*/
-template< typename T >
-void BasicFunction( T& /* current */, const PropertyInputContainer& /* inputs */ )
+template<typename T>
+void BasicFunction(T& /* current */, const PropertyInputContainer& /* inputs */)
{
}
/**
* A functor which sets a given boolean when the functor is called.
*/
-template< typename T >
+template<typename T>
struct BasicCalledFunctor
{
- BasicCalledFunctor( bool& functorCalled ) : mCalled( functorCalled ) { }
+ BasicCalledFunctor(bool& functorCalled)
+ : mCalled(functorCalled)
+ {
+ }
- void operator()( T& /* current */, const PropertyInputContainer& /* inputs */ )
+ void operator()(T& /* current */, const PropertyInputContainer& /* inputs */)
{
mCalled = true;
}
/**
* A functor which increments a given integer when the functor is called.
*/
-template< typename T >
+template<typename T>
struct CalledCountFunctor
{
- CalledCountFunctor( int& callCount ) : mCallCount( callCount ) { }
+ CalledCountFunctor(int& callCount)
+ : mCallCount(callCount)
+ {
+ }
- void operator()( T& /* current */, const PropertyInputContainer& /* inputs */ )
+ void operator()(T& /* current */, const PropertyInputContainer& /* inputs */)
{
++mCallCount;
}
/**
* A functor which sets the given value as the value required when the functor is called.
*/
-template< typename T >
+template<typename T>
struct SetValueFunctor
{
- SetValueFunctor( const T& value ) : mValue( value ) { }
+ SetValueFunctor(const T& value)
+ : mValue(value)
+ {
+ }
- void operator()( T& current, const PropertyInputContainer& /* inputs */ )
+ void operator()(T& current, const PropertyInputContainer& /* inputs */)
{
current = mValue;
}
namespace UtcDaliConstraintNewFunction
{
bool gConstraintFunctionCalled = false;
-void ConstraintFunction( Vector3& /* current */, const PropertyInputContainer& /* inputs */ )
+void ConstraintFunction(Vector3& /* current */, const PropertyInputContainer& /* inputs */)
{
gConstraintFunctionCalled = true;
}
UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( UtcDaliConstraintNewFunction::gConstraintFunctionCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(UtcDaliConstraintNewFunction::gConstraintFunctionCalled, false, TEST_LOCATION);
// Add a constraint
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction );
- DALI_TEST_CHECK( constraint );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction);
+ DALI_TEST_CHECK(constraint);
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( UtcDaliConstraintNewFunction::gConstraintFunctionCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(UtcDaliConstraintNewFunction::gConstraintFunctionCalled, true, TEST_LOCATION);
END_TEST;
}
// Add a constraint with an uninitialised handle
try
{
- Constraint constraint = Constraint::New< Vector3 >( Actor(), Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction );
- DALI_TEST_CHECK( false ); // Should not reach here
+ Constraint constraint = Constraint::New<Vector3>(Actor(), Actor::Property::POSITION, &UtcDaliConstraintNewFunction::ConstraintFunction);
+ DALI_TEST_CHECK(false); // Should not reach here
}
- catch ( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true ); // Should assert!
+ DALI_TEST_CHECK(true); // Should assert!
}
END_TEST;
}
// helper for next test
-void StringConstraintFunction( std::string& /* current */, const PropertyInputContainer& /* inputs */ )
+void StringConstraintFunction(std::string& /* current */, const PropertyInputContainer& /* inputs */)
{
}
UtcDaliConstraintNewFunction::gConstraintFunctionCalled = false;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
try
{
// Add a constraint
- Constraint constraint = Constraint::New< std::string >( actor, Actor::Property::COLOR_MODE, &StringConstraintFunction );
- DALI_TEST_CHECK( constraint );
+ Constraint constraint = Constraint::New<std::string>(actor, Actor::Property::COLOR_MODE, &StringConstraintFunction);
+ DALI_TEST_CHECK(constraint);
constraint.Apply();
tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property not constrainable", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property not constrainable", TEST_LOCATION);
}
END_TEST;
// Ensure that we can create a constraint using a functor and that it is called.
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Add a constraint
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) );
- DALI_TEST_CHECK( constraint );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
+ DALI_TEST_CHECK(constraint);
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
END_TEST;
}
// Create a constraint with an uninitialised handle
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
// Add a constraint with an uninitialised handle
try
{
- Constraint constraint = Constraint::New< Vector3 >( Actor(), Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) );
- DALI_TEST_CHECK( false ); // Should not reach here
+ Constraint constraint = Constraint::New<Vector3>(Actor(), Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
+ DALI_TEST_CHECK(false); // Should not reach here
}
- catch ( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true ); // Should assert!
+ DALI_TEST_CHECK(true); // Should assert!
}
END_TEST;
{
struct Functor
{
- Functor( bool& positionCalled, bool& scaleCalled )
- : mPositionCalled( positionCalled ),
- mScaleCalled( scaleCalled )
+ Functor(bool& positionCalled, bool& scaleCalled)
+ : mPositionCalled(positionCalled),
+ mScaleCalled(scaleCalled)
{
}
- void Position( Vector3& /* current */, const PropertyInputContainer& /* inputs */ )
+ void Position(Vector3& /* current */, const PropertyInputContainer& /* inputs */)
{
mPositionCalled = true;
}
- void Scale( Vector3& /* current */, const PropertyInputContainer& /* inputs */ )
+ void Scale(Vector3& /* current */, const PropertyInputContainer& /* inputs */)
{
mScaleCalled = true;
}
// Ensure that we can create a constraint using a functor and that it is called.
TestApplication application;
- bool positionFunctorCalled = false;
- bool sizeFunctorCalled = false;
+ bool positionFunctorCalled = false;
+ bool sizeFunctorCalled = false;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( positionFunctorCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( sizeFunctorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(positionFunctorCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeFunctorCalled, false, TEST_LOCATION);
// Add a constraint that calls Functor::Position
- Constraint constraint = Constraint::New< Vector3 >(
- actor,
- Actor::Property::POSITION,
- UtcDaliConstraintNewFunctorMember::Functor( positionFunctorCalled, sizeFunctorCalled ),
- &UtcDaliConstraintNewFunctorMember::Functor::Position );
- DALI_TEST_CHECK( constraint );
+ Constraint constraint = Constraint::New<Vector3>(
+ actor,
+ Actor::Property::POSITION,
+ UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled),
+ &UtcDaliConstraintNewFunctorMember::Functor::Position);
+ DALI_TEST_CHECK(constraint);
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( positionFunctorCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( sizeFunctorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(positionFunctorCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeFunctorCalled, false, TEST_LOCATION);
// Add another constraint that calls Functor::Size
- Constraint constraint2 = Constraint::New< Vector3 >(
- actor,
- Actor::Property::SCALE,
- UtcDaliConstraintNewFunctorMember::Functor( positionFunctorCalled, sizeFunctorCalled ),
- &UtcDaliConstraintNewFunctorMember::Functor::Scale );
- DALI_TEST_CHECK( constraint2 );
+ Constraint constraint2 = Constraint::New<Vector3>(
+ actor,
+ Actor::Property::SCALE,
+ UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled),
+ &UtcDaliConstraintNewFunctorMember::Functor::Scale);
+ DALI_TEST_CHECK(constraint2);
constraint2.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( positionFunctorCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( sizeFunctorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(positionFunctorCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(sizeFunctorCalled, true, TEST_LOCATION);
END_TEST;
}
// Create a constraint with an uninitialised handle
TestApplication application;
- bool positionFunctorCalled = false;
- bool sizeFunctorCalled = false;
+ bool positionFunctorCalled = false;
+ bool sizeFunctorCalled = false;
// Add a constraint with an uninitialised handle
try
{
- Constraint constraint = Constraint::New< Vector3 >(
- Actor(),
- Actor::Property::POSITION,
- UtcDaliConstraintNewFunctorMember::Functor( positionFunctorCalled, sizeFunctorCalled ),
- &UtcDaliConstraintNewFunctorMember::Functor::Position );
- DALI_TEST_CHECK( false ); // Should not reach here
+ Constraint constraint = Constraint::New<Vector3>(
+ Actor(),
+ Actor::Property::POSITION,
+ UtcDaliConstraintNewFunctorMember::Functor(positionFunctorCalled, sizeFunctorCalled),
+ &UtcDaliConstraintNewFunctorMember::Functor::Position);
+ DALI_TEST_CHECK(false); // Should not reach here
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_CHECK( true ); // Should assert!
+ DALI_TEST_CHECK(true); // Should assert!
}
END_TEST;
// Ensure we can clone for another actor and it's called appropriately
TestApplication application;
- int calledCount = 0;
+ int calledCount = 0;
Actor actor = Actor::New();
Actor clone = Actor::New();
Integration::Scene stage = application.GetScene();
- stage.Add( actor );
- stage.Add( clone );
+ stage.Add(actor);
+ stage.Add(clone);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( calledCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(calledCount, 0, TEST_LOCATION);
// Add a constraint to actor
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, CalledCountFunctor< Vector3 >( calledCount ) );
- DALI_TEST_CHECK( constraint );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, CalledCountFunctor<Vector3>(calledCount));
+ DALI_TEST_CHECK(constraint);
constraint.Apply();
// Create a clone but don't apply
- Constraint constraintClone = constraint.Clone( clone );
+ Constraint constraintClone = constraint.Clone(clone);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( calledCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(calledCount, 1, TEST_LOCATION);
// Reset
calledCount = 0;
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( calledCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(calledCount, 1, TEST_LOCATION);
// Apply the clone constraint
constraintClone.Apply();
application.Render();
// Should be called once for the new constraint clone and once for the original constraint
- DALI_TEST_EQUALS( calledCount, 3, TEST_LOCATION );
+ DALI_TEST_EQUALS(calledCount, 3, TEST_LOCATION);
// Reset
calledCount = 0;
// Change the position of both actors
- actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- clone.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ clone.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
application.SendNotification();
application.Render();
// Functor should have been called twice
- DALI_TEST_EQUALS( calledCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(calledCount, 2, TEST_LOCATION);
END_TEST;
}
try
{
- Actor actor = Actor::New();
- Constraint clone = constraint.Clone( actor );
- DALI_TEST_CHECK( false );
+ Actor actor = Actor::New();
+ Constraint clone = constraint.Clone(actor);
+ DALI_TEST_CHECK(false);
}
- catch ( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
namespace UtcDaliConstraintClone
{
-void Function( Vector3& /* current */, const PropertyInputContainer& inputs )
+void Function(Vector3& /* current */, const PropertyInputContainer& inputs)
{
- DALI_TEST_EQUALS( inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION );
+ DALI_TEST_EQUALS(inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION);
}
} // namespace UtcDaliConstraintClone
Actor clone = Actor::New();
Integration::Scene stage = application.GetScene();
- stage.Add( actor );
- stage.Add( clone );
+ stage.Add(actor);
+ stage.Add(clone);
application.SendNotification();
application.Render();
// Create a constraint, DON'T Apply it though
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &UtcDaliConstraintClone::Function );
- constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
- constraint.AddSource( LocalSource( Actor::Property::ORIENTATION ) );
- constraint.AddSource( LocalSource( Actor::Property::COLOR ) );
- constraint.AddSource( LocalSource( Actor::Property::VISIBLE ) );
- constraint.SetRemoveAction( Constraint::DISCARD );
- constraint.SetTag( 123 );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &UtcDaliConstraintClone::Function);
+ constraint.AddSource(LocalSource(Actor::Property::SIZE));
+ constraint.AddSource(LocalSource(Actor::Property::ORIENTATION));
+ constraint.AddSource(LocalSource(Actor::Property::COLOR));
+ constraint.AddSource(LocalSource(Actor::Property::VISIBLE));
+ constraint.SetRemoveAction(Constraint::DISCARD);
+ constraint.SetTag(123);
// Clone the constraint & apply the clone
- Constraint constraintClone = constraint.Clone( clone );
+ Constraint constraintClone = constraint.Clone(clone);
constraintClone.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( constraint.GetRemoveAction(), constraintClone.GetRemoveAction(), TEST_LOCATION );
- DALI_TEST_EQUALS( constraint.GetTag(), constraintClone.GetTag(), TEST_LOCATION );
+ DALI_TEST_EQUALS(constraint.GetRemoveAction(), constraintClone.GetRemoveAction(), TEST_LOCATION);
+ DALI_TEST_EQUALS(constraint.GetTag(), constraintClone.GetTag(), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- Constraint copied( constraint );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ Constraint copied(constraint);
Constraint assigned;
- DALI_TEST_CHECK( constraint == copied );
- DALI_TEST_CHECK( copied != assigned );
+ DALI_TEST_CHECK(constraint == copied);
+ DALI_TEST_CHECK(copied != assigned);
assigned = constraint;
- DALI_TEST_CHECK( constraint == assigned );
+ DALI_TEST_CHECK(constraint == assigned);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_CHECK( constraint );
- DALI_TEST_EQUALS( 1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( constraint.GetTargetObject() == actor );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ DALI_TEST_CHECK(constraint);
+ DALI_TEST_EQUALS(1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(constraint.GetTargetObject() == actor);
- Constraint moved = std::move( constraint );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( moved.GetTargetObject() == actor );
- DALI_TEST_CHECK( !constraint );
+ Constraint moved = std::move(constraint);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(moved.GetTargetObject() == actor);
+ DALI_TEST_CHECK(!constraint);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_CHECK( constraint );
- DALI_TEST_EQUALS( 1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( constraint.GetTargetObject() == actor );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ DALI_TEST_CHECK(constraint);
+ DALI_TEST_EQUALS(1, constraint.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(constraint.GetTargetObject() == actor);
Constraint moved;
- moved = std::move( constraint );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( moved.GetTargetObject() == actor );
- DALI_TEST_CHECK( !constraint );
+ moved = std::move(constraint);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(moved.GetTargetObject() == actor);
+ DALI_TEST_CHECK(!constraint);
END_TEST;
}
TestApplication application;
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
// Another BaseHandle type
- Constraint downCast = Constraint::DownCast( actor );
- DALI_TEST_CHECK( ! downCast );
+ Constraint downCast = Constraint::DownCast(actor);
+ DALI_TEST_CHECK(!downCast);
// A constraint
- downCast = Constraint::DownCast( constraint );
- DALI_TEST_CHECK( downCast );
+ downCast = Constraint::DownCast(constraint);
+ DALI_TEST_CHECK(downCast);
// An empty constraint
- downCast = Constraint::DownCast( Constraint() );
- DALI_TEST_CHECK( ! downCast );
+ downCast = Constraint::DownCast(Constraint());
+ DALI_TEST_CHECK(!downCast);
END_TEST;
}
{
TestApplication application;
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_CHECK( constraint.GetTargetObject() == actor );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ DALI_TEST_CHECK(constraint.GetTargetObject() == actor);
Actor actor2 = Actor::New();
- DALI_TEST_CHECK( constraint.GetTargetObject() != actor2 );
+ DALI_TEST_CHECK(constraint.GetTargetObject() != actor2);
END_TEST;
}
try
{
Handle handle = constraint.GetTargetObject();
- DALI_TEST_CHECK( false ); // Should not reach here!
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
{
TestApplication application;
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_EQUALS( constraint.GetTargetProperty(), (Property::Index)Actor::Property::POSITION, TEST_LOCATION );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ DALI_TEST_EQUALS(constraint.GetTargetProperty(), (Property::Index)Actor::Property::POSITION, TEST_LOCATION);
END_TEST;
}
try
{
Property::Index propertyIndex = constraint.GetTargetProperty();
- ( void )propertyIndex;
- DALI_TEST_CHECK( false ); // Should not reach here!
+ (void)propertyIndex;
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
{
TestApplication application;
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_EQUALS( constraint.GetTag(), 0u, TEST_LOCATION );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ DALI_TEST_EQUALS(constraint.GetTag(), 0u, TEST_LOCATION);
const unsigned int tag = 123;
- constraint.SetTag( tag );
- DALI_TEST_EQUALS( constraint.GetTag(), tag, TEST_LOCATION );
+ constraint.SetTag(tag);
+ DALI_TEST_EQUALS(constraint.GetTag(), tag, TEST_LOCATION);
END_TEST;
}
Constraint constraint;
try
{
- constraint.SetTag( 123 );
- DALI_TEST_CHECK( false ); // Should not reach here!
+ constraint.SetTag(123);
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
int tag = constraint.GetTag();
- ( void )tag;
- DALI_TEST_CHECK( false ); // Should not reach here!
+ (void)tag;
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
{
TestApplication application;
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
- DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &BasicFunction<Vector3>);
+ DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION);
- constraint.SetRemoveAction( Constraint::DISCARD );
- DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION );
+ constraint.SetRemoveAction(Constraint::DISCARD);
+ DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION);
- constraint.SetRemoveAction( Constraint::BAKE );
- DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION );
+ constraint.SetRemoveAction(Constraint::BAKE);
+ DALI_TEST_EQUALS(constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION);
END_TEST;
}
Constraint constraint;
try
{
- constraint.SetRemoveAction( Constraint::DISCARD );
- DALI_TEST_CHECK( false ); // Should not reach here!
+ constraint.SetRemoveAction(Constraint::DISCARD);
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
try
{
Constraint::RemoveAction removeAction = constraint.GetRemoveAction();
- ( void )removeAction;
- DALI_TEST_CHECK( false ); // Should not reach here!
+ (void)removeAction;
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
// Should not equal position by default
- Vector3 position( 10.0f, 20.0f, 30.0f );
- DALI_TEST_CHECK( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) != position );
+ Vector3 position(10.0f, 20.0f, 30.0f);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) != position);
// Create a constraint that constrains to position
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) );
- constraint.SetRemoveAction( Constraint::BAKE );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, SetValueFunctor<Vector3>(position));
+ constraint.SetRemoveAction(Constraint::BAKE);
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
// Remove the constraint, it should still be at position
constraint.Remove();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
// Get and store current position
- Vector3 originalPosition = actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION );
+ Vector3 originalPosition = actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION);
// Should not equal position by default
- Vector3 position( 10.0f, 20.0f, 30.0f );
- DALI_TEST_CHECK( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) != position );
+ Vector3 position(10.0f, 20.0f, 30.0f);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) != position);
// Create a constraint that constrains to position
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) );
- constraint.SetRemoveAction( Constraint::DISCARD );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, SetValueFunctor<Vector3>(position));
+ constraint.SetRemoveAction(Constraint::DISCARD);
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), position, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), position, TEST_LOCATION);
// Remove the constraint, it should still be at position
constraint.Remove();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), originalPosition, TEST_LOCATION );
- DALI_TEST_CHECK( actor.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ) != position );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION), originalPosition, TEST_LOCATION);
+ DALI_TEST_CHECK(actor.GetCurrentProperty<Vector3>(Actor::Property::POSITION) != position);
END_TEST;
}
// Ensure constraint functors are called appropriately
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Create a constraint and apply, functor should be called
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
// Reset
functorCalled = false;
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Re-apply the constraint, functor should be called again
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
END_TEST;
}
// Constraint should be automatically applied when the actor is added to the stage and not before
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
// Create an actor and a constraint and apply, DON'T add to stage just yet
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
constraint.Apply();
application.SendNotification();
application.Render();
// Should NOT be called
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Add actor to stage
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
// Should now be called
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
END_TEST;
}
// Constraint should NOT be called at all
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
// Create an actor and a constraint and apply, DON'T add to stage just yet
- Actor actor = Actor::New();
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) );
+ Actor actor = Actor::New();
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
constraint.Apply();
application.SendNotification();
application.Render();
// Should NOT be called
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Remove the constraint
constraint.Remove();
// Add actor to stage
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
// Still should NOT be called
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
END_TEST;
}
// Functor should only be called while the actor is staged.
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
// Create an actor and add to stage
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Integration::Scene stage = application.GetScene();
- stage.Add( actor );
+ stage.Add(actor);
// Create a constraint and apply
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, BasicCalledFunctor< Vector3 >( functorCalled ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, BasicCalledFunctor<Vector3>(functorCalled));
constraint.Apply();
application.SendNotification();
application.Render();
// Constraint should be called
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
// Reset
functorCalled = false;
// Remove actor from stage
- stage.Remove( actor );
+ stage.Remove(actor);
application.SendNotification();
application.Render();
// Constraint should NOT be called
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Re-add to stage
- stage.Add( actor );
+ stage.Add(actor);
application.SendNotification();
application.Render();
// Constraint should be called
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
END_TEST;
}
// Should not cause any problems (subsequent attempts should be no-ops)
TestApplication application;
- int count = 0;
+ int count = 0;
// Create an actor and add to stage
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Integration::Scene stage = application.GetScene();
- stage.Add( actor );
+ stage.Add(actor);
// Create a constraint and apply
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, CalledCountFunctor< Vector3 >( count ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, CalledCountFunctor<Vector3>(count));
constraint.Apply();
// Apply again
application.Render();
// Should only have been called once
- DALI_TEST_EQUALS( count, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(count, 1, TEST_LOCATION);
// Reset
count = 0;
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( count, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(count, 1, TEST_LOCATION);
// Reset
count = 0;
// Change the position property, apply again
- actor.SetProperty( Actor::Property::POSITION, Vector2( 10.0f, 10.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
constraint.Apply();
application.SendNotification();
application.Render();
// Constraint should have been called once
- DALI_TEST_EQUALS( count, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(count, 1, TEST_LOCATION);
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
namespace UtcDaliConstraintAddSource
{
-void Function( Vector3& /* current */, const PropertyInputContainer& inputs )
+void Function(Vector3& /* current */, const PropertyInputContainer& inputs)
{
- DALI_TEST_EQUALS( inputs.Size(), 4u, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION );
- DALI_TEST_EQUALS( inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION );
+ DALI_TEST_EQUALS(inputs.Size(), 4u, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[0]->GetType(), Property::VECTOR3, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[1]->GetType(), Property::ROTATION, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[2]->GetType(), Property::VECTOR4, TEST_LOCATION);
+ DALI_TEST_EQUALS(inputs[3]->GetType(), Property::BOOLEAN, TEST_LOCATION);
}
} // namespace UtcDaliConstraintAddSource
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Create a constraint, add sources
- Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &UtcDaliConstraintAddSource::Function );
- constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
- constraint.AddSource( LocalSource( Actor::Property::ORIENTATION ) );
- constraint.AddSource( LocalSource( Actor::Property::COLOR ) );
- constraint.AddSource( LocalSource( Actor::Property::VISIBLE ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &UtcDaliConstraintAddSource::Function);
+ constraint.AddSource(LocalSource(Actor::Property::SIZE));
+ constraint.AddSource(LocalSource(Actor::Property::ORIENTATION));
+ constraint.AddSource(LocalSource(Actor::Property::COLOR));
+ constraint.AddSource(LocalSource(Actor::Property::VISIBLE));
constraint.Apply();
application.SendNotification();
Constraint constraint;
try
{
- constraint.AddSource( LocalSource( Actor::Property::POSITION ) );
- DALI_TEST_CHECK( false ); // Should not reach here!
+ constraint.AddSource(LocalSource(Actor::Property::POSITION));
+ DALI_TEST_CHECK(false); // Should not reach here!
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
///////////////////////////////////////////////////////////////////////////////
namespace TestChaining
{
-
-const Vector3 gFunction1Output( Vector3::ONE );
-void Function1( Vector3& current, const PropertyInputContainer& /* inputs */ )
+const Vector3 gFunction1Output(Vector3::ONE);
+void Function1(Vector3& current, const PropertyInputContainer& /* inputs */)
{
// current is original position
- DALI_TEST_EQUALS( current, Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(current, Vector3::ZERO, TEST_LOCATION);
current = gFunction1Output;
}
-const Vector3 gFunction2Output( 10.0f, 20.0f, 30.0f );
-void Function2( Vector3& current, const PropertyInputContainer& /* inputs */ )
+const Vector3 gFunction2Output(10.0f, 20.0f, 30.0f);
+void Function2(Vector3& current, const PropertyInputContainer& /* inputs */)
{
// current is output from Function1
- DALI_TEST_EQUALS( current, gFunction1Output, TEST_LOCATION );
+ DALI_TEST_EQUALS(current, gFunction1Output, TEST_LOCATION);
current = gFunction2Output;
}
-const Vector3 gFunction3Output( 10.0f, 20.0f, 30.0f );
-void Function3( Vector3& current, const PropertyInputContainer& /* inputs */ )
+const Vector3 gFunction3Output(10.0f, 20.0f, 30.0f);
+void Function3(Vector3& current, const PropertyInputContainer& /* inputs */)
{
// current is output from Function2
- DALI_TEST_EQUALS( current, gFunction2Output, TEST_LOCATION );
+ DALI_TEST_EQUALS(current, gFunction2Output, TEST_LOCATION);
current = gFunction3Output;
}
-const Vector3 gFunction4Output( 10.0f, 20.0f, 30.0f );
-void Function4( Vector3& current, const PropertyInputContainer& /* inputs */ )
+const Vector3 gFunction4Output(10.0f, 20.0f, 30.0f);
+void Function4(Vector3& current, const PropertyInputContainer& /* inputs */)
{
// current is output from Function3
- DALI_TEST_EQUALS( current, gFunction3Output, TEST_LOCATION );
+ DALI_TEST_EQUALS(current, gFunction3Output, TEST_LOCATION);
current = gFunction4Output;
}
-void Function5( Vector3& current, const PropertyInputContainer& /* inputs */ )
+void Function5(Vector3& current, const PropertyInputContainer& /* inputs */)
{
// current is output from Function4
- DALI_TEST_EQUALS( current, gFunction4Output, TEST_LOCATION );
+ DALI_TEST_EQUALS(current, gFunction4Output, TEST_LOCATION);
current = Vector3::ZERO;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- Constraint constraint1 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function1 );
- Constraint constraint2 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function2 );
- Constraint constraint3 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function3 );
- Constraint constraint4 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function4 );
- Constraint constraint5 = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &TestChaining::Function5 );
+ Constraint constraint1 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function1);
+ Constraint constraint2 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function2);
+ Constraint constraint3 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function3);
+ Constraint constraint4 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function4);
+ Constraint constraint5 = Constraint::New<Vector3>(actor, Actor::Property::POSITION, &TestChaining::Function5);
constraint1.Apply();
constraint2.Apply();
///////////////////////////////////////////////////////////////////////////////
namespace TestPropertyTypes
{
-template< typename T >
-void Execute( T value )
+template<typename T>
+void Execute(T value)
{
TestApplication application;
- bool functorCalled = false;
+ bool functorCalled = false;
- Actor actor = Actor::New();
- Property::Index index = actor.RegisterProperty( "TEMP_PROPERTY_NAME", value );
+ Actor actor = Actor::New();
+ Property::Index index = actor.RegisterProperty("TEMP_PROPERTY_NAME", value);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, false, TEST_LOCATION);
// Add a constraint
- Constraint constraint = Constraint::New< T >( actor, index, BasicCalledFunctor< T >( functorCalled ) );
- DALI_TEST_CHECK( constraint );
+ Constraint constraint = Constraint::New<T>(actor, index, BasicCalledFunctor<T>(functorCalled));
+ DALI_TEST_CHECK(constraint);
constraint.Apply();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
}
-} // namespace UtcDaliConstraintNewFunctor
+} // namespace TestPropertyTypes
int UtcDaliConstraintTestPropertyTypesP(void)
{
// Ensure we can use a constraint functor with all supported property types
- TestPropertyTypes::Execute< bool >( false );
- TestPropertyTypes::Execute< int >( 0 );
- TestPropertyTypes::Execute< float >( 0.0f );
- TestPropertyTypes::Execute< Vector2 >( Vector2::ZERO );
- TestPropertyTypes::Execute< Vector3 >( Vector3::ZERO );
- TestPropertyTypes::Execute< Vector4 >( Vector4::ZERO );
- TestPropertyTypes::Execute< Quaternion >( Quaternion::IDENTITY );
- TestPropertyTypes::Execute< Matrix >( Matrix::IDENTITY );
- TestPropertyTypes::Execute< Matrix3 >( Matrix3::IDENTITY );
+ TestPropertyTypes::Execute<bool>(false);
+ TestPropertyTypes::Execute<int>(0);
+ TestPropertyTypes::Execute<float>(0.0f);
+ TestPropertyTypes::Execute<Vector2>(Vector2::ZERO);
+ TestPropertyTypes::Execute<Vector3>(Vector3::ZERO);
+ TestPropertyTypes::Execute<Vector4>(Vector4::ZERO);
+ TestPropertyTypes::Execute<Quaternion>(Quaternion::IDENTITY);
+ TestPropertyTypes::Execute<Matrix>(Matrix::IDENTITY);
+ TestPropertyTypes::Execute<Matrix3>(Matrix3::IDENTITY);
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
namespace
{
-void SetHalfOpacity( Vector4& current, const PropertyInputContainer& inputs )
+void SetHalfOpacity(Vector4& current, const PropertyInputContainer& inputs)
{
current.a = 0.5f;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Check initial value is fully opaque
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
// Create a constraint whose value is discarded when it is removed
- Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity );
- constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD );
+ Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, SetHalfOpacity);
+ constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD);
constraint.Apply();
// Check value after one render, it should be constrained
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
// Render another frame, ensure the other value has also been updated
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
// Remove the actor from the stage and delete the constraint
actor.Unparent();
// Check value while off-stage, it should be fully opaque
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
// Add the actor back to the stage and check the value, it should be fully opaque again
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Check value when back on-stage, it should be fully opaque as the constraint is no longer applied to it.
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
// Render for another frame to ensure both buffers have the correct value
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
// Check initial value is fully opaque
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
// Create a constraint whose value is discarded when it is removed
- Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity );
- constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD );
+ Constraint constraint = Constraint::New<Vector4>(actor, Actor::Property::COLOR, SetHalfOpacity);
+ constraint.SetRemoveAction(Constraint::RemoveAction::DISCARD);
constraint.Apply();
// Check value after one render, it should be constrained
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
// Render another frame, ensure the other value has also been updated
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
// Remove the actor from the stage
actor.Unparent();
// Check value while off-stage, the constraint is no longer being applied as it's off-stage
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
// Check the other buffer, the constraint should not be applied to this either.
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 1.0f, TEST_LOCATION);
// Add the actor back to the stage and check the value, the constraint should have been re-applied
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
// Render for another frame to ensure both buffers have the correct value
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ).a, 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR).a, 0.5f, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintGetTargetObjectNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintSetRemoveActionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintGetTargetPropertyNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintApplyNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintCloneNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintRemoveNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintSetTagNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintGetRemoveActionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
int UtcDaliConstraintGetTagNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Constraint instance;
try
{
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
{
bool gFunctionCalled = false;
-template< typename T >
-void TestCallbackFunction( T& /* current*/ , const PropertyInputContainer& /* inputs */ )
+template<typename T>
+void TestCallbackFunction(T& /* current*/, const PropertyInputContainer& /* inputs */)
{
gFunctionCalled = true;
}
-template< typename T >
+template<typename T>
struct TestCallbackFunctor
{
- TestCallbackFunctor( bool& functorCalled ) : mFunctorCalled( functorCalled ) { }
+ TestCallbackFunctor(bool& functorCalled)
+ : mFunctorCalled(functorCalled)
+ {
+ }
- void operator()( T& /* current*/ , const PropertyInputContainer& /* inputs */ )
+ void operator()(T& /* current*/, const PropertyInputContainer& /* inputs */)
{
mFunctorCalled = true;
}
bool& mFunctorCalled;
};
-template< typename T >
+template<typename T>
struct TestFunctorMethod
{
- TestFunctorMethod( bool& functorCalled ) : mFunctorCalled( functorCalled ) { }
+ TestFunctorMethod(bool& functorCalled)
+ : mFunctorCalled(functorCalled)
+ {
+ }
- void Method( T& /* current*/ , const PropertyInputContainer& /* inputs */ )
+ void Method(T& /* current*/, const PropertyInputContainer& /* inputs */)
{
mFunctorCalled = true;
}
///////////////////////////////////////////////////////////////////////////////
namespace
{
-template< typename T >
+template<typename T>
void TestFunctionConstructor()
{
gFunctionCalled = false;
- Constraint::Function< T > function( &TestCallbackFunction< T > );
- T current;
- PropertyInputContainer inputs;
+ Constraint::Function<T> function(&TestCallbackFunction<T>);
+ T current;
+ PropertyInputContainer inputs;
- DALI_TEST_EQUALS( gFunctionCalled, false, TEST_LOCATION );
- CallbackBase::Execute< T&, const PropertyInputContainer& >( function, current, inputs );
- DALI_TEST_EQUALS( gFunctionCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(gFunctionCalled, false, TEST_LOCATION);
+ CallbackBase::Execute<T&, const PropertyInputContainer&>(function, current, inputs);
+ DALI_TEST_EQUALS(gFunctionCalled, true, TEST_LOCATION);
}
} // unnamed namespace
int UtcDaliConstraintFunctionWithFunction(void)
{
- TestFunctionConstructor< bool >();
- TestFunctionConstructor< int >();
- TestFunctionConstructor< unsigned int >();
- TestFunctionConstructor< float >();
- TestFunctionConstructor< Vector2 >();
- TestFunctionConstructor< Vector3 >();
- TestFunctionConstructor< Vector4 >();
- TestFunctionConstructor< Quaternion >();
- TestFunctionConstructor< Matrix >();
- TestFunctionConstructor< Matrix3 >();
+ TestFunctionConstructor<bool>();
+ TestFunctionConstructor<int>();
+ TestFunctionConstructor<unsigned int>();
+ TestFunctionConstructor<float>();
+ TestFunctionConstructor<Vector2>();
+ TestFunctionConstructor<Vector3>();
+ TestFunctionConstructor<Vector4>();
+ TestFunctionConstructor<Quaternion>();
+ TestFunctionConstructor<Matrix>();
+ TestFunctionConstructor<Matrix3>();
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
namespace
{
-template< typename T >
+template<typename T>
void TestFunctorConstructor()
{
- bool called = false;
- TestCallbackFunctor< T > functor( called );
- Constraint::Function< T > callback( functor );
- T current;
- PropertyInputContainer inputs;
-
- DALI_TEST_EQUALS( called, false, TEST_LOCATION );
- CallbackBase::Execute< T&, const PropertyInputContainer& >( callback, current, inputs );
- DALI_TEST_EQUALS( called, true, TEST_LOCATION );
+ bool called = false;
+ TestCallbackFunctor<T> functor(called);
+ Constraint::Function<T> callback(functor);
+ T current;
+ PropertyInputContainer inputs;
+
+ DALI_TEST_EQUALS(called, false, TEST_LOCATION);
+ CallbackBase::Execute<T&, const PropertyInputContainer&>(callback, current, inputs);
+ DALI_TEST_EQUALS(called, true, TEST_LOCATION);
}
} // unnamed namespace
int UtcDaliConstraintFunctionWithFunctor(void)
{
- TestFunctorConstructor< bool >();
- TestFunctorConstructor< int >();
- TestFunctorConstructor< unsigned int >();
- TestFunctorConstructor< float >();
- TestFunctorConstructor< Vector2 >();
- TestFunctorConstructor< Vector3 >();
- TestFunctorConstructor< Vector4 >();
- TestFunctorConstructor< Quaternion >();
- TestFunctorConstructor< Matrix >();
- TestFunctorConstructor< Matrix3 >();
+ TestFunctorConstructor<bool>();
+ TestFunctorConstructor<int>();
+ TestFunctorConstructor<unsigned int>();
+ TestFunctorConstructor<float>();
+ TestFunctorConstructor<Vector2>();
+ TestFunctorConstructor<Vector3>();
+ TestFunctorConstructor<Vector4>();
+ TestFunctorConstructor<Quaternion>();
+ TestFunctorConstructor<Matrix>();
+ TestFunctorConstructor<Matrix3>();
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
namespace
{
-template< typename T >
+template<typename T>
void TestFunctorMethodConstructor()
{
- bool called = false;
- TestFunctorMethod< T > functor( called );
- Constraint::Function< T > callback( functor, &TestFunctorMethod< T >::Method );
- T current;
- PropertyInputContainer inputs;
-
- DALI_TEST_EQUALS( called, false, TEST_LOCATION );
- CallbackBase::Execute< T&, const PropertyInputContainer& >( callback, current, inputs );
- DALI_TEST_EQUALS( called, true, TEST_LOCATION );
+ bool called = false;
+ TestFunctorMethod<T> functor(called);
+ Constraint::Function<T> callback(functor, &TestFunctorMethod<T>::Method);
+ T current;
+ PropertyInputContainer inputs;
+
+ DALI_TEST_EQUALS(called, false, TEST_LOCATION);
+ CallbackBase::Execute<T&, const PropertyInputContainer&>(callback, current, inputs);
+ DALI_TEST_EQUALS(called, true, TEST_LOCATION);
}
} // unnamed namespace
int UtcDaliConstraintFunctionWithMethodFunctor(void)
{
- TestFunctorMethodConstructor< bool >();
- TestFunctorMethodConstructor< int >();
- TestFunctorMethodConstructor< unsigned int >();
- TestFunctorMethodConstructor< float >();
- TestFunctorMethodConstructor< Vector2 >();
- TestFunctorMethodConstructor< Vector3 >();
- TestFunctorMethodConstructor< Vector4 >();
- TestFunctorMethodConstructor< Quaternion >();
- TestFunctorMethodConstructor< Matrix >();
- TestFunctorMethodConstructor< Matrix3 >();
+ TestFunctorMethodConstructor<bool>();
+ TestFunctorMethodConstructor<int>();
+ TestFunctorMethodConstructor<unsigned int>();
+ TestFunctorMethodConstructor<float>();
+ TestFunctorMethodConstructor<Vector2>();
+ TestFunctorMethodConstructor<Vector3>();
+ TestFunctorMethodConstructor<Vector4>();
+ TestFunctorMethodConstructor<Quaternion>();
+ TestFunctorMethodConstructor<Matrix>();
+ TestFunctorMethodConstructor<Matrix3>();
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
namespace
{
-template< typename T >
+template<typename T>
void TestFunctionClone()
{
gFunctionCalled = false;
- Constraint::Function< T > callback( &TestCallbackFunction< T > );
- CallbackBase* clone = callback.Clone();
+ Constraint::Function<T> callback(&TestCallbackFunction<T>);
+ CallbackBase* clone = callback.Clone();
- T current;
+ T current;
PropertyInputContainer inputs;
- DALI_TEST_EQUALS( gFunctionCalled, false, TEST_LOCATION );
- CallbackBase::Execute< T&, const PropertyInputContainer& >( *clone, current, inputs );
- DALI_TEST_EQUALS( gFunctionCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(gFunctionCalled, false, TEST_LOCATION);
+ CallbackBase::Execute<T&, const PropertyInputContainer&>(*clone, current, inputs);
+ DALI_TEST_EQUALS(gFunctionCalled, true, TEST_LOCATION);
delete clone;
}
-template< typename T >
+template<typename T>
void TestFunctorClone()
{
- bool called = false;
- TestCallbackFunctor< T > functor( called );
- Constraint::Function< T > callback( functor );
- CallbackBase* clone = callback.Clone();
+ bool called = false;
+ TestCallbackFunctor<T> functor(called);
+ Constraint::Function<T> callback(functor);
+ CallbackBase* clone = callback.Clone();
- T current;
+ T current;
PropertyInputContainer inputs;
- DALI_TEST_EQUALS( called, false, TEST_LOCATION );
- CallbackBase::Execute< T&, const PropertyInputContainer& >( *clone, current, inputs );
- DALI_TEST_EQUALS( called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(called, false, TEST_LOCATION);
+ CallbackBase::Execute<T&, const PropertyInputContainer&>(*clone, current, inputs);
+ DALI_TEST_EQUALS(called, true, TEST_LOCATION);
delete clone;
}
-template< typename T >
+template<typename T>
void TestMethodFunctorClone()
{
- bool called = false;
- TestFunctorMethod< T > functor( called );
- Constraint::Function< T > callback( functor, &TestFunctorMethod< T >::Method );
- CallbackBase* clone = callback.Clone();
+ bool called = false;
+ TestFunctorMethod<T> functor(called);
+ Constraint::Function<T> callback(functor, &TestFunctorMethod<T>::Method);
+ CallbackBase* clone = callback.Clone();
- T current;
+ T current;
PropertyInputContainer inputs;
- DALI_TEST_EQUALS( called, false, TEST_LOCATION );
- CallbackBase::Execute< T&, const PropertyInputContainer& >( *clone, current, inputs );
- DALI_TEST_EQUALS( called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(called, false, TEST_LOCATION);
+ CallbackBase::Execute<T&, const PropertyInputContainer&>(*clone, current, inputs);
+ DALI_TEST_EQUALS(called, true, TEST_LOCATION);
delete clone;
}
int UtcDaliConstraintFunctionFunctionClone(void)
{
- TestFunctionClone< bool >();
- TestFunctionClone< int >();
- TestFunctionClone< unsigned int >();
- TestFunctionClone< float >();
- TestFunctionClone< Vector2 >();
- TestFunctionClone< Vector3 >();
- TestFunctionClone< Vector4 >();
- TestFunctionClone< Quaternion >();
- TestFunctionClone< Matrix >();
- TestFunctionClone< Matrix3 >();
+ TestFunctionClone<bool>();
+ TestFunctionClone<int>();
+ TestFunctionClone<unsigned int>();
+ TestFunctionClone<float>();
+ TestFunctionClone<Vector2>();
+ TestFunctionClone<Vector3>();
+ TestFunctionClone<Vector4>();
+ TestFunctionClone<Quaternion>();
+ TestFunctionClone<Matrix>();
+ TestFunctionClone<Matrix3>();
END_TEST;
}
int UtcDaliConstraintFunctionFunctorClone(void)
{
- TestFunctorClone< bool >();
- TestFunctorClone< int >();
- TestFunctorClone< unsigned int >();
- TestFunctorClone< float >();
- TestFunctorClone< Vector2 >();
- TestFunctorClone< Vector3 >();
- TestFunctorClone< Vector4 >();
- TestFunctorClone< Quaternion >();
- TestFunctorClone< Matrix >();
- TestFunctorClone< Matrix3 >();
+ TestFunctorClone<bool>();
+ TestFunctorClone<int>();
+ TestFunctorClone<unsigned int>();
+ TestFunctorClone<float>();
+ TestFunctorClone<Vector2>();
+ TestFunctorClone<Vector3>();
+ TestFunctorClone<Vector4>();
+ TestFunctorClone<Quaternion>();
+ TestFunctorClone<Matrix>();
+ TestFunctorClone<Matrix3>();
END_TEST;
}
int UtcDaliConstraintFunctionMethodFunctorClone(void)
{
- TestMethodFunctorClone< bool >();
- TestMethodFunctorClone< int >();
- TestMethodFunctorClone< unsigned int >();
- TestMethodFunctorClone< float >();
- TestMethodFunctorClone< Vector2 >();
- TestMethodFunctorClone< Vector3 >();
- TestMethodFunctorClone< Vector4 >();
- TestMethodFunctorClone< Quaternion >();
- TestMethodFunctorClone< Matrix >();
- TestMethodFunctorClone< Matrix3 >();
+ TestMethodFunctorClone<bool>();
+ TestMethodFunctorClone<int>();
+ TestMethodFunctorClone<unsigned int>();
+ TestMethodFunctorClone<float>();
+ TestMethodFunctorClone<Vector2>();
+ TestMethodFunctorClone<Vector3>();
+ TestMethodFunctorClone<Vector4>();
+ TestMethodFunctorClone<Quaternion>();
+ TestMethodFunctorClone<Matrix>();
+ TestMethodFunctorClone<Matrix3>();
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
{
struct CountFunctor
{
- CountFunctor( int& count )
- : mCount( count )
+ CountFunctor(int& count)
+ : mCount(count)
{
++mCount;
}
- CountFunctor( const CountFunctor& other )
- : mCount( other.mCount )
+ CountFunctor(const CountFunctor& other)
+ : mCount(other.mCount)
{
++mCount;
}
- CountFunctor& operator=( const CountFunctor& other )
+ CountFunctor& operator=(const CountFunctor& other)
{
this->mCount = other.mCount;
++mCount;
--mCount;
}
- void operator()( bool& /* current*/ , const PropertyInputContainer& /* inputs */ )
+ void operator()(bool& /* current*/, const PropertyInputContainer& /* inputs */)
{
}
int count = 0;
{
- CountFunctor functor( count );
- Constraint::Function< bool > callback1( functor );
- Constraint::Function< bool > callback2( functor );
- Constraint::Function< bool > callback3( functor );
- Constraint::Function< bool > callback4( functor );
- Constraint::Function< bool > callback5( functor );
- Constraint::Function< bool > callback6( functor );
- Constraint::Function< bool > callback7( functor );
- Constraint::Function< bool > callback8( functor );
- Constraint::Function< bool > callback9( functor );
- DALI_TEST_EQUALS( count, 10, TEST_LOCATION );
+ CountFunctor functor(count);
+ Constraint::Function<bool> callback1(functor);
+ Constraint::Function<bool> callback2(functor);
+ Constraint::Function<bool> callback3(functor);
+ Constraint::Function<bool> callback4(functor);
+ Constraint::Function<bool> callback5(functor);
+ Constraint::Function<bool> callback6(functor);
+ Constraint::Function<bool> callback7(functor);
+ Constraint::Function<bool> callback8(functor);
+ Constraint::Function<bool> callback9(functor);
+ DALI_TEST_EQUALS(count, 10, TEST_LOCATION);
}
- DALI_TEST_EQUALS( count, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(count, 0, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
int UtcDaliLocalSource(void)
{
- LocalSource source( Actor::Property::POSITION );
+ LocalSource source(Actor::Property::POSITION);
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION );
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION);
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
int UtcDaliParentSource(void)
{
- ParentSource source( Actor::Property::POSITION );
+ ParentSource source(Actor::Property::POSITION);
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION );
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::POSITION, TEST_LOCATION);
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
int UtcDaliSource1(void)
{
- Actor actor;
- Source source( actor, Actor::Property::SIZE );
+ Actor actor;
+ Source source(actor, Actor::Property::SIZE);
- DALI_TEST_CHECK( ! source.object );
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION );
+ DALI_TEST_CHECK(!source.object);
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Source source( actor, Actor::Property::SIZE );
- DALI_TEST_EQUALS( source.object, actor, TEST_LOCATION );
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION );
+ Source source(actor, Actor::Property::SIZE);
+ DALI_TEST_EQUALS(source.object, actor, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::SIZE, TEST_LOCATION);
END_TEST;
}
{
Actor actor;
- ConstraintSource source( Source( actor, Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( ! source.object );
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION );
- DALI_TEST_EQUALS( source.sourceType, OBJECT_PROPERTY, TEST_LOCATION );
+ ConstraintSource source(Source(actor, Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(!source.object);
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.sourceType, OBJECT_PROPERTY, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- ConstraintSource source( Source( actor, Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_EQUALS( source.object, actor, TEST_LOCATION );
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION );
- DALI_TEST_EQUALS( source.sourceType, OBJECT_PROPERTY, TEST_LOCATION );
+ ConstraintSource source(Source(actor, Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_EQUALS(source.object, actor, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.sourceType, OBJECT_PROPERTY, TEST_LOCATION);
END_TEST;
}
{
Actor actor;
- ConstraintSource source( LocalSource( Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( ! source.object );
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION );
- DALI_TEST_EQUALS( source.sourceType, LOCAL_PROPERTY, TEST_LOCATION );
+ ConstraintSource source(LocalSource(Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(!source.object);
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.sourceType, LOCAL_PROPERTY, TEST_LOCATION);
END_TEST;
}
{
Actor actor;
- ConstraintSource source( ParentSource( Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( ! source.object );
- DALI_TEST_EQUALS( source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION );
- DALI_TEST_EQUALS( source.sourceType, PARENT_PROPERTY, TEST_LOCATION );
+ ConstraintSource source(ParentSource(Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(!source.object);
+ DALI_TEST_EQUALS(source.propertyIndex, (Property::Index)Actor::Property::PARENT_ORIGIN, TEST_LOCATION);
+ DALI_TEST_EQUALS(source.sourceType, PARENT_PROPERTY, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
struct PropertyInputImpl : public PropertyInput
{
public:
-
// Constants
- static const bool BOOLEAN_VALUE;
- static const float FLOAT_VALUE;
- static const int INTEGER_VALUE;
- static const Vector2 VECTOR2_VALUE;
- static const Vector3 VECTOR3_VALUE;
- static const Vector4 VECTOR4_VALUE;
- static const Matrix3 MATRIX3_VALUE;
- static const Matrix MATRIX_VALUE;
+ static const bool BOOLEAN_VALUE;
+ static const float FLOAT_VALUE;
+ static const int INTEGER_VALUE;
+ static const Vector2 VECTOR2_VALUE;
+ static const Vector3 VECTOR3_VALUE;
+ static const Vector4 VECTOR4_VALUE;
+ static const Matrix3 MATRIX3_VALUE;
+ static const Matrix MATRIX_VALUE;
static const Quaternion QUATERNION_VALUE;
// Construction & Destruction
- PropertyInputImpl( Property::Type type ) : mType( type ) { }
- virtual ~PropertyInputImpl() { }
+ PropertyInputImpl(Property::Type type)
+ : mType(type)
+ {
+ }
+ virtual ~PropertyInputImpl()
+ {
+ }
// Methods
- Property::Type GetType() const { return mType; }
+ Property::Type GetType() const
+ {
+ return mType;
+ }
// Virtual Methods
- virtual const bool& GetBoolean() const { return BOOLEAN_VALUE; }
- virtual const float& GetFloat() const { return FLOAT_VALUE; }
- virtual const int& GetInteger() const { return INTEGER_VALUE; }
- virtual const Vector2& GetVector2() const { return VECTOR2_VALUE; }
- virtual const Vector3& GetVector3() const { return VECTOR3_VALUE; }
- virtual const Vector4& GetVector4() const { return VECTOR4_VALUE; }
- virtual const Matrix3& GetMatrix3() const { return MATRIX3_VALUE; }
- virtual const Matrix& GetMatrix() const { return MATRIX_VALUE; }
- virtual const Quaternion& GetQuaternion() const { return QUATERNION_VALUE; }
+ virtual const bool& GetBoolean() const
+ {
+ return BOOLEAN_VALUE;
+ }
+ virtual const float& GetFloat() const
+ {
+ return FLOAT_VALUE;
+ }
+ virtual const int& GetInteger() const
+ {
+ return INTEGER_VALUE;
+ }
+ virtual const Vector2& GetVector2() const
+ {
+ return VECTOR2_VALUE;
+ }
+ virtual const Vector3& GetVector3() const
+ {
+ return VECTOR3_VALUE;
+ }
+ virtual const Vector4& GetVector4() const
+ {
+ return VECTOR4_VALUE;
+ }
+ virtual const Matrix3& GetMatrix3() const
+ {
+ return MATRIX3_VALUE;
+ }
+ virtual const Matrix& GetMatrix() const
+ {
+ return MATRIX_VALUE;
+ }
+ virtual const Quaternion& GetQuaternion() const
+ {
+ return QUATERNION_VALUE;
+ }
// Data
Property::Type mType;
};
-const bool PropertyInputImpl::BOOLEAN_VALUE = true;
-const float PropertyInputImpl::FLOAT_VALUE = 123.0f;
-const int PropertyInputImpl::INTEGER_VALUE = 456;
-const Vector2 PropertyInputImpl::VECTOR2_VALUE = Vector2( 10.0f, 20.0f );
-const Vector3 PropertyInputImpl::VECTOR3_VALUE = Vector3( 30.0f, 40.0f, 50.0f );
-const Vector4 PropertyInputImpl::VECTOR4_VALUE = Vector4( 60.0f, 70.0f, 80.0f, 90.0f );
-const Matrix3 PropertyInputImpl::MATRIX3_VALUE ( 1.0f, 2.0f, 3.0f,
- 4.0f, 5.0f, 6.0f,
- 7.0f, 8.0f, 9.0f );
-const Matrix PropertyInputImpl::MATRIX_VALUE = Matrix::IDENTITY;
-const Quaternion PropertyInputImpl::QUATERNION_VALUE ( 1.0f, 2.0f, 3.0f, 4.0f );
+const bool PropertyInputImpl::BOOLEAN_VALUE = true;
+const float PropertyInputImpl::FLOAT_VALUE = 123.0f;
+const int PropertyInputImpl::INTEGER_VALUE = 456;
+const Vector2 PropertyInputImpl::VECTOR2_VALUE = Vector2(10.0f, 20.0f);
+const Vector3 PropertyInputImpl::VECTOR3_VALUE = Vector3(30.0f, 40.0f, 50.0f);
+const Vector4 PropertyInputImpl::VECTOR4_VALUE = Vector4(60.0f, 70.0f, 80.0f, 90.0f);
+const Matrix3 PropertyInputImpl::MATRIX3_VALUE(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f);
+const Matrix PropertyInputImpl::MATRIX_VALUE = Matrix::IDENTITY;
+const Quaternion PropertyInputImpl::QUATERNION_VALUE(1.0f, 2.0f, 3.0f, 4.0f);
struct Vector3PropertyInput : public PropertyInputImpl
{
public:
-
// Construction & Destruction
- Vector3PropertyInput( Vector3& value )
- : PropertyInputImpl( Property::VECTOR3 ),
- mValue( value )
+ Vector3PropertyInput(Vector3& value)
+ : PropertyInputImpl(Property::VECTOR3),
+ mValue(value)
{
}
struct QuaternionPropertyInput : public PropertyInputImpl
{
public:
-
// Construction & Destruction
- QuaternionPropertyInput( Quaternion& value )
- : PropertyInputImpl( Property::ROTATION ),
- mValue( value )
+ QuaternionPropertyInput(Quaternion& value)
+ : PropertyInputImpl(Property::ROTATION),
+ mValue(value)
{
}
int UtcDaliConstraintsEqualToConstraintFloat(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::FLOAT );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::FLOAT);
+ inputs.PushBack(&input);
float value = 0.0f;
- DALI_TEST_CHECK( value != PropertyInputImpl::FLOAT_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::FLOAT_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::FLOAT_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::FLOAT_VALUE, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsEqualToConstraintVector2(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::VECTOR2 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::VECTOR2);
+ inputs.PushBack(&input);
Vector2 value;
- DALI_TEST_CHECK( value != PropertyInputImpl::VECTOR2_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::VECTOR2_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR2_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR2_VALUE, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsEqualToConstraintVector3(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::VECTOR3 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::VECTOR3);
+ inputs.PushBack(&input);
Vector3 value;
- DALI_TEST_CHECK( value != PropertyInputImpl::VECTOR3_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::VECTOR3_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR3_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR3_VALUE, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsEqualToConstraintVector4(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::VECTOR4 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::VECTOR4);
+ inputs.PushBack(&input);
Vector4 value;
- DALI_TEST_CHECK( value != PropertyInputImpl::VECTOR4_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::VECTOR4_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR4_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR4_VALUE, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsEqualToConstraintQuaternion(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::ROTATION );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::ROTATION);
+ inputs.PushBack(&input);
Quaternion value;
- DALI_TEST_CHECK( value != PropertyInputImpl::QUATERNION_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::QUATERNION_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::QUATERNION_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::QUATERNION_VALUE, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsEqualToConstraintMatrix3(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::MATRIX3 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::MATRIX3);
+ inputs.PushBack(&input);
Matrix3 value;
- DALI_TEST_CHECK( value != PropertyInputImpl::MATRIX3_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::MATRIX3_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::MATRIX3_VALUE, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(value, PropertyInputImpl::MATRIX3_VALUE, 0.1f, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsEqualToConstraintMatrix(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::MATRIX );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::MATRIX);
+ inputs.PushBack(&input);
Matrix value;
- DALI_TEST_CHECK( value != PropertyInputImpl::MATRIX_VALUE );
+ DALI_TEST_CHECK(value != PropertyInputImpl::MATRIX_VALUE);
EqualToConstraint constraint;
- constraint( value, inputs );
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::MATRIX_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::MATRIX_VALUE, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsRelativeToConstraintUsingFloat(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::VECTOR3 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::VECTOR3);
+ inputs.PushBack(&input);
Vector3 value;
- DALI_TEST_EQUALS( value, Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, Vector3::ZERO, TEST_LOCATION);
- const float scale( 4.0f );
- RelativeToConstraint constraint( scale );
- constraint( value, inputs );
+ const float scale(4.0f);
+ RelativeToConstraint constraint(scale);
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsRelativeToConstraintUsingVector3(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::VECTOR3 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::VECTOR3);
+ inputs.PushBack(&input);
Vector3 value;
- DALI_TEST_EQUALS( value, Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, Vector3::ZERO, TEST_LOCATION);
- const Vector3 scale( 4.0f, 5.0f, 6.0f );
- RelativeToConstraint constraint( scale );
- constraint( value, inputs );
+ const Vector3 scale(4.0f, 5.0f, 6.0f);
+ RelativeToConstraint constraint(scale);
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::VECTOR3_VALUE * scale, TEST_LOCATION);
END_TEST;
}
int UtcDaliConstraintsRelativeToConstraintFloat(void)
{
PropertyInputContainer inputs;
- PropertyInputImpl input( Property::VECTOR3 );
- inputs.PushBack( &input );
+ PropertyInputImpl input(Property::VECTOR3);
+ inputs.PushBack(&input);
- const float scale( 4.0f );
+ const float scale(4.0f);
float value = 0.0f;
- DALI_TEST_CHECK( value != PropertyInputImpl::FLOAT_VALUE * scale );
+ DALI_TEST_CHECK(value != PropertyInputImpl::FLOAT_VALUE * scale);
- RelativeToConstraintFloat constraint( scale );
- constraint( value, inputs );
+ RelativeToConstraintFloat constraint(scale);
+ constraint(value, inputs);
- DALI_TEST_EQUALS( value, PropertyInputImpl::FLOAT_VALUE * scale, TEST_LOCATION );
+ DALI_TEST_EQUALS(value, PropertyInputImpl::FLOAT_VALUE * scale, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Quaternion >( Actor::Property::WORLD_ORIENTATION ), Quaternion::IDENTITY, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Quaternion>(Actor::Property::WORLD_ORIENTATION), Quaternion::IDENTITY, TEST_LOCATION);
- Vector3 targetPosition;
- Vector3 cameraPosition;
+ Vector3 targetPosition;
+ Vector3 cameraPosition;
Quaternion targetOrientation;
- Vector3PropertyInput targetPositionProperty( targetPosition );
- Vector3PropertyInput cameraPositionProperty( cameraPosition );
- QuaternionPropertyInput targetOrientationProperty( targetOrientation );
+ Vector3PropertyInput targetPositionProperty(targetPosition);
+ Vector3PropertyInput cameraPositionProperty(cameraPosition);
+ QuaternionPropertyInput targetOrientationProperty(targetOrientation);
PropertyInputContainer inputs;
- inputs.PushBack( &targetPositionProperty );
- inputs.PushBack( &cameraPositionProperty );
- inputs.PushBack( &targetOrientationProperty );
+ inputs.PushBack(&targetPositionProperty);
+ inputs.PushBack(&cameraPositionProperty);
+ inputs.PushBack(&targetOrientationProperty);
Quaternion current;
// 180 degrees round y
- targetPosition = Vector3::ZERO;
- cameraPosition = Vector3( 0.0f, 0.0f, 1.0f );
+ targetPosition = Vector3::ZERO;
+ cameraPosition = Vector3(0.0f, 0.0f, 1.0f);
targetOrientation = Quaternion::IDENTITY;
- Quaternion lookAtOrientation( Quaternion( Radian( Math::PI ), Vector3::YAXIS ) );
- LookAt( current, inputs );
- DALI_TEST_EQUALS( current, lookAtOrientation, TEST_LOCATION );
+ Quaternion lookAtOrientation(Quaternion(Radian(Math::PI), Vector3::YAXIS));
+ LookAt(current, inputs);
+ DALI_TEST_EQUALS(current, lookAtOrientation, TEST_LOCATION);
// 180 degrees round y * -45 degrees round x
- targetPosition = Vector3::ZERO;
- cameraPosition = Vector3( 0.0f, -1.0f, 1.0f );
+ targetPosition = Vector3::ZERO;
+ cameraPosition = Vector3(0.0f, -1.0f, 1.0f);
targetOrientation = Quaternion::IDENTITY;
- lookAtOrientation = Quaternion( Radian( Math::PI ), Vector3::YAXIS ) * Quaternion( Radian( Math::PI * 0.25f ), -Vector3::XAXIS );
- LookAt( current, inputs );
- DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ lookAtOrientation = Quaternion(Radian(Math::PI), Vector3::YAXIS) * Quaternion(Radian(Math::PI * 0.25f), -Vector3::XAXIS);
+ LookAt(current, inputs);
+ DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION);
// 180 degrees round y * -45 degrees round x at different points
- targetPosition = Vector3( 0.0f, 1.0f, -1.0f );
- cameraPosition = Vector3::ZERO;
+ targetPosition = Vector3(0.0f, 1.0f, -1.0f);
+ cameraPosition = Vector3::ZERO;
targetOrientation = Quaternion::IDENTITY;
- lookAtOrientation = Quaternion( Radian( Math::PI ), Vector3::YAXIS ) * Quaternion( Radian( Math::PI * 0.25f ), -Vector3::XAXIS );
- LookAt( current, inputs );
- DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ lookAtOrientation = Quaternion(Radian(Math::PI), Vector3::YAXIS) * Quaternion(Radian(Math::PI * 0.25f), -Vector3::XAXIS);
+ LookAt(current, inputs);
+ DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION);
// 225 degrees round y
- targetPosition = Vector3( -1.0f, 0.0f, 0.0f );
- cameraPosition = Vector3( 0.0f, 0.0f, 1.0f );
+ targetPosition = Vector3(-1.0f, 0.0f, 0.0f);
+ cameraPosition = Vector3(0.0f, 0.0f, 1.0f);
targetOrientation = Quaternion::IDENTITY;
- lookAtOrientation = Quaternion( Radian( Math::PI * 1.25), Vector3::YAXIS );
- LookAt( current, inputs );
- DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ lookAtOrientation = Quaternion(Radian(Math::PI * 1.25), Vector3::YAXIS);
+ LookAt(current, inputs);
+ DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION);
// 180 degrees round y * -45 degrees round x, Up Vector: 180 degrees
- targetPosition = Vector3::ZERO;
- cameraPosition = Vector3( 0.0f, -1.0f, 1.0f );
- targetOrientation = Quaternion( Radian( Math::PI ), Vector3::ZAXIS );
- lookAtOrientation = Quaternion( Radian( Math::PI ), Vector3::YAXIS ) * Quaternion( Radian( Math::PI * 0.25f ), -Vector3::XAXIS ) * Quaternion( Radian( Math::PI ), -Vector3::ZAXIS );
- LookAt( current, inputs );
- DALI_TEST_EQUALS( current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ targetPosition = Vector3::ZERO;
+ cameraPosition = Vector3(0.0f, -1.0f, 1.0f);
+ targetOrientation = Quaternion(Radian(Math::PI), Vector3::ZAXIS);
+ lookAtOrientation = Quaternion(Radian(Math::PI), Vector3::YAXIS) * Quaternion(Radian(Math::PI * 0.25f), -Vector3::XAXIS) * Quaternion(Radian(Math::PI), -Vector3::ZAXIS);
+ LookAt(current, inputs);
+ DALI_TEST_EQUALS(current, lookAtOrientation, Math::MACHINE_EPSILON_10, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyInputGetExtension(void)
{
- PropertyInputImpl input( Property::BOOLEAN );
- DALI_TEST_CHECK( input.GetExtension() == NULL );
+ PropertyInputImpl input(Property::BOOLEAN);
+ DALI_TEST_CHECK(input.GetExtension() == NULL);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-using namespace Dali;
+#include <iostream>
+using namespace Dali;
namespace
{
static Actor CreateBitmapActor()
{
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::NAME,"Test Image Rendering Actor");
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::NAME, "Test Image Rendering Actor");
return actor;
}
} // anonymous namespace
-
// Positive test case for a method
int UtcDaliContextVertexAttribStartup(void)
{
application.Render();
// check the locations
- for (unsigned int i = 0; i < TEST_MAX_ATTRIBUTE_CACHE_SIZE; i++)
+ for(unsigned int i = 0; i < TEST_MAX_ATTRIBUTE_CACHE_SIZE; i++)
{
- DALI_TEST_CHECK( application.GetGlAbstraction().GetVertexAttribArrayState(i) == false);
+ DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayState(i) == false);
}
tet_result(TET_PASS);
// clear the flag to say they've changed
application.GetGlAbstraction().ClearVertexAttribArrayChanged();
-
// create a test bitmap actor
Actor actor(CreateBitmapActor());
application.GetScene().Add(actor);
-
application.SendNotification();
application.Render();
application.Render();
// if it has changed then the caching has failed
DALI_TEST_CHECK(application.GetGlAbstraction().GetVertexAttribArrayChanged() == false);
-
tet_result(TET_PASS);
END_TEST;
}
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/integration-api/core.h>
+#include <stdlib.h>
+
+#include <cmath> // isfinite
#include <iostream>
#include <sstream>
-#include <cmath> // isfinite
-
-#include <stdlib.h>
-#include <dali/integration-api/core.h>
-#include <dali-test-suite-utils.h>
using namespace Dali;
TestApplication application;
tet_infoline("Testing Dali::GetMaximumUpdateCount");
- DALI_TEST_EQUALS( 2, application.GetCore().GetMaximumUpdateCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(2, application.GetCore().GetMaximumUpdateCount(), TEST_LOCATION);
END_TEST;
}
int UtcDaliCoreGetObjectRegistry(void)
{
TestApplication application;
- DALI_TEST_CHECK( application.GetCore().GetObjectRegistry() );
+ DALI_TEST_CHECK(application.GetCore().GetObjectRegistry());
END_TEST;
}
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-
#include <dali/devel-api/actors/custom-actor-devel.h>
-#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
-#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/public-api/dali-core.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <stdlib.h>
+
+#include <iostream>
+
#include "dali-test-suite-utils/dali-test-suite-utils.h"
#include "test-custom-actor.h"
using namespace Dali;
-
void custom_actor_test_startup(void)
{
test_return_value = TET_UNDEF;
test_return_value = TET_PASS;
}
-
-
using namespace Dali;
-
int UtcDaliCustomActorDestructor(void)
{
TestApplication application;
CustomActor* actor = new CustomActor();
delete actor;
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
int UtcDaliCustomActorImplDestructor(void)
{
- TestApplication application;
+ TestApplication application;
CustomActorImpl* actor = new Test::Impl::TestCustomActor();
- CustomActor customActor( *actor ); // Will automatically unref at the end of this function
+ CustomActor customActor(*actor); // Will automatically unref at the end of this function
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
Test::TestCustomActor custom = Test::TestCustomActor::New();
Actor anActor = Actor::New();
- anActor.Add( custom );
+ anActor.Add(custom);
- Actor child = anActor.GetChildAt(0);
- CustomActor customActor = CustomActor::DownCast( child );
- DALI_TEST_CHECK( customActor );
+ Actor child = anActor.GetChildAt(0);
+ CustomActor customActor = CustomActor::DownCast(child);
+ DALI_TEST_CHECK(customActor);
customActor = NULL;
- DALI_TEST_CHECK( !customActor );
+ DALI_TEST_CHECK(!customActor);
- customActor = DownCast< CustomActor >( child );
- DALI_TEST_CHECK( customActor );
+ customActor = DownCast<CustomActor>(child);
+ DALI_TEST_CHECK(customActor);
END_TEST;
}
TestApplication application;
tet_infoline("Testing Dali::CustomActor::DownCast()");
- Actor actor1 = Actor::New();
+ Actor actor1 = Actor::New();
Actor anActor = Actor::New();
anActor.Add(actor1);
- Actor child = anActor.GetChildAt(0);
- CustomActor customActor = CustomActor::DownCast( child );
- DALI_TEST_CHECK( !customActor );
+ Actor child = anActor.GetChildAt(0);
+ CustomActor customActor = CustomActor::DownCast(child);
+ DALI_TEST_CHECK(!customActor);
Actor unInitialzedActor;
- customActor = CustomActor::DownCast( unInitialzedActor );
- DALI_TEST_CHECK( !customActor );
+ customActor = CustomActor::DownCast(unInitialzedActor);
+ DALI_TEST_CHECK(!customActor);
- customActor = DownCast< CustomActor >( unInitialzedActor );
- DALI_TEST_CHECK( !customActor );
+ customActor = DownCast<CustomActor>(unInitialzedActor);
+ DALI_TEST_CHECK(!customActor);
END_TEST;
}
TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_CHECK( custom );
- DALI_TEST_EQUALS( 1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(custom);
+ DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- int id = custom.GetProperty< int >( Actor::Property::ID );
+ int id = custom.GetProperty<int>(Actor::Property::ID);
- Test::TestCustomActor moved = std::move( custom );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !custom );
+ Test::TestCustomActor moved = std::move(custom);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!custom);
END_TEST;
}
TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_CHECK( custom );
- DALI_TEST_EQUALS( 1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(custom);
+ DALI_TEST_EQUALS(1, custom.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- int id = custom.GetProperty< int >( Actor::Property::ID );
+ int id = custom.GetProperty<int>(Actor::Property::ID);
Test::TestCustomActor moved;
- moved = std::move( custom );
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( id, moved.GetProperty< int >( Actor::Property::ID ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !custom );
+ moved = std::move(custom);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(id, moved.GetProperty<int>(Actor::Property::ID), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!custom);
END_TEST;
}
tet_infoline("Testing Dali::CustomActor::OnSceneConnection() & OnSceneDisconnection");
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
// add the custom actor to stage
- application.GetScene().Add( custom );
+ application.GetScene().Add(custom);
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", custom.GetMethodsCalled()[0], TEST_LOCATION);
- application.GetScene().Remove( custom );
+ application.GetScene().Remove(custom);
- DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", custom.GetMethodsCalled()[1], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorA = Test::TestCustomActor::New();
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
Test::TestCustomActor actorC = Test::TestCustomActor::New();
- actorC.SetProperty( Actor::Property::NAME, "ActorC" );
- actorA.Add( actorC );
+ actorC.SetProperty(Actor::Property::NAME, "ActorC");
+ actorA.Add(actorC);
Test::TestCustomActor actorD = Test::TestCustomActor::New();
- actorD.SetProperty( Actor::Property::NAME, "ActorD" );
- actorB.Add( actorD );
+ actorD.SetProperty(Actor::Property::NAME, "ActorD");
+ actorB.Add(actorD);
Test::TestCustomActor actorE = Test::TestCustomActor::New();
- actorE.SetProperty( Actor::Property::NAME, "ActorE" );
- actorB.Add( actorE );
+ actorE.SetProperty(Actor::Property::NAME, "ActorE");
+ actorB.Add(actorE);
Test::TestCustomActor actorF = Test::TestCustomActor::New();
- actorF.SetProperty( Actor::Property::NAME, "ActorF" );
- actorC.Add( actorF );
+ actorF.SetProperty(Actor::Property::NAME, "ActorF");
+ actorC.Add(actorF);
// add the custom actor to stage
- application.GetScene().Add( actorA );
+ application.GetScene().Add(actorA);
- DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION);
- DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION);
- DALI_TEST_EQUALS( 3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorC.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorC.GetMethodsCalled()[ 2 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(3, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorC.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorC.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorC.GetMethodsCalled()[2], TEST_LOCATION);
- DALI_TEST_EQUALS( 2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorD.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorD.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorD.GetMethodsCalled()[1], TEST_LOCATION);
- DALI_TEST_EQUALS( 2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorE.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorE.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorE.GetMethodsCalled()[1], TEST_LOCATION);
- DALI_TEST_EQUALS( 2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorF.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorF.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorF.GetMethodsCalled()[1], TEST_LOCATION);
// Check sequence is correct in MasterCallStack
- DALI_TEST_EQUALS( 4+4+3+2+2+2, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(4 + 4 + 3 + 2 + 2 + 2, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorC: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorD: OnPropertySet", MasterCallStack[ 5 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorD: OnPropertySet", MasterCallStack[5], TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 6 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorE: OnPropertySet", MasterCallStack[ 7 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 8 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorF: OnPropertySet", MasterCallStack[ 9 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorC: OnChildAdd", MasterCallStack[ 10 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[6], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorE: OnPropertySet", MasterCallStack[7], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[8], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorF: OnPropertySet", MasterCallStack[9], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorC: OnChildAdd", MasterCallStack[10], TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 11 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 12 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorD: OnSceneConnection", MasterCallStack[ 13 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorE: OnSceneConnection", MasterCallStack[ 14 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorC: OnSceneConnection", MasterCallStack[ 15 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorF: OnSceneConnection", MasterCallStack[ 16 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[11], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[12], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorD: OnSceneConnection", MasterCallStack[13], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorE: OnSceneConnection", MasterCallStack[14], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorC: OnSceneConnection", MasterCallStack[15], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorF: OnSceneConnection", MasterCallStack[16], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorA = Test::TestCustomActor::New();
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
- stage.Add( actorA );
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
+ stage.Add(actorA);
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
Test::TestCustomActor actorC = Test::TestCustomActor::New();
- actorC.SetProperty( Actor::Property::NAME, "ActorC" );
- actorA.Add( actorC );
+ actorC.SetProperty(Actor::Property::NAME, "ActorC");
+ actorA.Add(actorC);
Test::TestCustomActor actorD = Test::TestCustomActor::New();
- actorD.SetProperty( Actor::Property::NAME, "ActorD" );
- actorB.Add( actorD );
+ actorD.SetProperty(Actor::Property::NAME, "ActorD");
+ actorB.Add(actorD);
Test::TestCustomActor actorE = Test::TestCustomActor::New();
- actorE.SetProperty( Actor::Property::NAME, "ActorE" );
- actorB.Add( actorE );
+ actorE.SetProperty(Actor::Property::NAME, "ActorE");
+ actorB.Add(actorE);
Test::TestCustomActor actorF = Test::TestCustomActor::New();
- actorF.SetProperty( Actor::Property::NAME, "ActorF" );
- actorC.Add( actorF );
+ actorF.SetProperty(Actor::Property::NAME, "ActorF");
+ actorC.Add(actorF);
// Excercise the message passing to Update thread
actorF.ResetCallStack();
MasterCallStack.clear();
- stage.Remove( actorA );
+ stage.Remove(actorA);
- DALI_TEST_EQUALS( 1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION);
- DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION);
- DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorC.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorC.GetMethodsCalled()[0], TEST_LOCATION);
- DALI_TEST_EQUALS( 1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorD.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorD.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorD.GetMethodsCalled()[0], TEST_LOCATION);
- DALI_TEST_EQUALS( 1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorE.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorE.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorE.GetMethodsCalled()[0], TEST_LOCATION);
- DALI_TEST_EQUALS( 1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorF.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorF.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorF.GetMethodsCalled()[0], TEST_LOCATION);
// Check sequence is correct in MasterCallStack
- DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorD: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorE: OnSceneDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorF: OnSceneDisconnection", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorC: OnSceneDisconnection", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorD: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorE: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorF: OnSceneDisconnection", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorC: OnSceneDisconnection", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
- Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1( actorB );
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
- stage.Add( actorA );
+ Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant1(actorB);
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
+ stage.Add(actorA);
// Check callback sequence
- DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION ); // Called from within OnSceneConnection()
+ DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION); // Called from within OnSceneConnection()
- DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
- DALI_TEST_EQUALS( 5, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(5, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION ); // Occurs during Actor::Add from within from within OnSceneConnection()
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION ); // Occurs after Actor::Add from within from within OnSceneConnection()
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION); // Occurs during Actor::Add from within from within OnSceneConnection()
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION); // Occurs after Actor::Add from within from within OnSceneConnection()
// Excercise the message passing to Update thread
// Check everything is ok after Actors are removed
- stage.Remove( actorA );
+ stage.Remove(actorA);
application.SendNotification();
application.Render();
application.Render();
*/
Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant2();
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
Test::TestCustomActor actorC = Test::TestCustomActor::New();
- actorC.SetProperty( Actor::Property::NAME, "ActorC" );
- actorA.Add( actorC );
+ actorC.SetProperty(Actor::Property::NAME, "ActorC");
+ actorA.Add(actorC);
- stage.Add( actorA );
+ stage.Add(actorA);
// Check callback sequence
- DALI_TEST_EQUALS( 6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION ); // Called from within OnSceneConnection()
- DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 5 ], TEST_LOCATION ); // Called from within OnSceneConnection()
-
- DALI_TEST_EQUALS( 8, (int)(MasterCallStack.size()), TEST_LOCATION );
-
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorC: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 5 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 6 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 7 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(6, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION); // Called from within OnSceneConnection()
+ DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[5], TEST_LOCATION); // Called from within OnSceneConnection()
+
+ DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION);
+
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorC: OnPropertySet", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[5], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[6], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION);
/* Actors B & C should be removed before the point where they could receive an OnSceneConnection callback
* Therefore they shouldn't receive either OnSceneConnection or OnSceneDisconnection
*/
- DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, (int)(actorC.GetMethodsCalled().size()), TEST_LOCATION);
// Excercise the message passing to Update thread
// Check everything is ok after last actor is removed
- stage.Remove( actorA );
+ stage.Remove(actorA);
application.SendNotification();
application.Render();
application.Render();
*/
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
- Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3( actorB );
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
- stage.Add( actorA );
+ Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant3(actorB);
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
+ stage.Add(actorA);
// Excercise the message passing to Update thread
actorB.ResetCallStack();
MasterCallStack.clear();
- stage.Remove( actorA );
+ stage.Remove(actorA);
// Check callback sequence
- DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
// Child was added after parent disconnection, so should not receive OnSceneConnection()
- DALI_TEST_EQUALS( 0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
- DALI_TEST_EQUALS( 2, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant4();
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
- stage.Add( actorA );
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
+ stage.Add(actorA);
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
// Excercise the message passing to Update thread
actorB.ResetCallStack();
MasterCallStack.clear();
- stage.Remove( actorA );
+ stage.Remove(actorA);
// Check callback sequence
- DALI_TEST_EQUALS( 2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[1], TEST_LOCATION);
- DALI_TEST_EQUALS( 1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[0], TEST_LOCATION);
- DALI_TEST_EQUALS( 3, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(3, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 2 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[2], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorA = Test::TestCustomActor::New();
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant5(scene);
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
- scene.Add( actorA );
+ scene.Add(actorA);
// Check callback sequence
- DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorA.GetMethodsCalled()[3], TEST_LOCATION);
- DALI_TEST_EQUALS( 2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
- DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorA = Test::TestCustomActor::New();
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
- scene.Add( actorA );
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
+ scene.Add(actorA);
Test::TestCustomActor actorB = Test::TestCustomActor::NewVariant6(scene);
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
- scene.Remove( actorA );
+ scene.Remove(actorA);
// Check callback sequence
- DALI_TEST_EQUALS( 3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(3, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
- DALI_TEST_EQUALS( 3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(3, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION);
// Disconnect was interrupted, so we should only get one OnSceneConnection() for actorB
- DALI_TEST_EQUALS( 6, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(6, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 5 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[5], TEST_LOCATION);
// Excercise the message passing to Update thread
tet_infoline("Testing Dali::CustomActor::OnChildAdd() & OnChildRemove()");
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
Actor aChild = Actor::New();
- custom.Add( aChild );
+ custom.Add(aChild);
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", custom.GetMethodsCalled()[0], TEST_LOCATION);
- custom.Remove( aChild );
+ custom.Remove(aChild);
- DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildRemove", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildRemove", custom.GetMethodsCalled()[1], TEST_LOCATION);
END_TEST;
}
* The actorB is the child of actorA
*/
- Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7( "ActorA" );
- stage.Add( actorA );
+ Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant7("ActorA");
+ stage.Add(actorA);
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ actorA.Add(actorB);
// Check hierarchy is as follows:
// A
// |
// B
- DALI_TEST_EQUALS( 1, (int)(actorA.GetChildCount()), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(actorA.GetChildCount()), TEST_LOCATION);
Actor container = actorA.GetChildAt(0);
Actor containerChild;
- DALI_TEST_CHECK( container );
- if ( container )
+ DALI_TEST_CHECK(container);
+ if(container)
{
- DALI_TEST_EQUALS( "Container", container.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, (int)(container.GetChildCount()), TEST_LOCATION );
+ DALI_TEST_EQUALS("Container", container.GetProperty<std::string>(Actor::Property::NAME), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, (int)(container.GetChildCount()), TEST_LOCATION);
containerChild = container.GetChildAt(0);
}
- DALI_TEST_CHECK( containerChild );
- if ( containerChild )
+ DALI_TEST_CHECK(containerChild);
+ if(containerChild)
{
- DALI_TEST_EQUALS( "ActorB", containerChild.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, (int)(containerChild.GetChildCount()), TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorB", containerChild.GetProperty<std::string>(Actor::Property::NAME), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, (int)(containerChild.GetChildCount()), TEST_LOCATION);
}
// Check callback sequence
- DALI_TEST_EQUALS( 5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // The mContainer added to actorA
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // The actorB added to actorA
- DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 4 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(5, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA
+ DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[4], TEST_LOCATION);
// mContainer will then receive OnChildAdd
- DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneDisconnection", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneDisconnection", actorB.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[3], TEST_LOCATION);
- DALI_TEST_EQUALS( 9, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(9, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 5 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneDisconnection", MasterCallStack[ 6 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 7 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 8 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[5], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneDisconnection", MasterCallStack[6], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[7], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[8], TEST_LOCATION);
// Excercise the message passing to Update thread
*/
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorB.SetProperty( Actor::Property::NAME, "ActorB" );
- stage.Add( actorB );
+ actorB.SetProperty(Actor::Property::NAME, "ActorB");
+ stage.Add(actorB);
- Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8( actorB );
- actorA.SetProperty( Actor::Property::NAME, "ActorA" );
- stage.Add( actorA );
+ Test::TestCustomActor actorA = Test::TestCustomActor::NewVariant8(actorB);
+ actorA.SetProperty(Actor::Property::NAME, "ActorA");
+ stage.Add(actorA);
Actor childActor = Actor::New();
- childActor.SetProperty( Actor::Property::NAME, "Child" );
+ childActor.SetProperty(Actor::Property::NAME, "Child");
// Reparent from actorA to actorB
- actorA.Add( childActor );
- actorB.Add( childActor );
+ actorA.Add(childActor);
+ actorB.Add(childActor);
// Check hierarchy is as follows:
// A B
// |
// Child
- DALI_TEST_EQUALS( 0, (int)(actorA.GetChildCount()), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, (int)(actorB.GetChildCount()), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, (int)(childActor.GetChildCount()), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(actorA.GetChildCount()), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, (int)(actorB.GetChildCount()), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, (int)(childActor.GetChildCount()), TEST_LOCATION);
Actor child = actorB.GetChildAt(0);
- DALI_TEST_CHECK( child );
- if ( child )
+ DALI_TEST_CHECK(child);
+ if(child)
{
- DALI_TEST_EQUALS( "Child", child.GetProperty< std::string >( Actor::Property::NAME ), TEST_LOCATION );
+ DALI_TEST_EQUALS("Child", child.GetProperty<std::string>(Actor::Property::NAME), TEST_LOCATION);
}
// Check callback sequence
- DALI_TEST_EQUALS( 4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorA.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorA.GetMethodsCalled()[ 1 ], TEST_LOCATION ); // The mContainer added to actorA
- DALI_TEST_EQUALS( "OnChildAdd", actorA.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildRemove", actorA.GetMethodsCalled()[ 3 ], TEST_LOCATION ); // The actorB added to actorA
+ DALI_TEST_EQUALS(4, (int)(actorA.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorA.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorA.GetMethodsCalled()[1], TEST_LOCATION); // The mContainer added to actorA
+ DALI_TEST_EQUALS("OnChildAdd", actorA.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildRemove", actorA.GetMethodsCalled()[3], TEST_LOCATION); // The actorB added to actorA
// mContainer will then receive OnChildAdd
- DALI_TEST_EQUALS( 4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", actorB.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSceneConnection", actorB.GetMethodsCalled()[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(4, (int)(actorB.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", actorB.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSceneConnection", actorB.GetMethodsCalled()[1], TEST_LOCATION);
// The derived class are always notified, no matter the child is successfully removed or not
- DALI_TEST_EQUALS( "OnChildRemove", actorB.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnChildAdd", actorB.GetMethodsCalled()[ 3 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("OnChildRemove", actorB.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnChildAdd", actorB.GetMethodsCalled()[3], TEST_LOCATION);
- DALI_TEST_EQUALS( 8, (int)(MasterCallStack.size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(8, (int)(MasterCallStack.size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "ActorB: OnPropertySet", MasterCallStack[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnSceneConnection", MasterCallStack[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnPropertySet", MasterCallStack[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnSceneConnection", MasterCallStack[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildAdd", MasterCallStack[ 4 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorA: OnChildRemove", MasterCallStack[ 5 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorB: OnPropertySet", MasterCallStack[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnSceneConnection", MasterCallStack[1], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnPropertySet", MasterCallStack[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnSceneConnection", MasterCallStack[3], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildAdd", MasterCallStack[4], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorA: OnChildRemove", MasterCallStack[5], TEST_LOCATION);
// The derived class are always notified, no matter the child is successfully removed or not
- DALI_TEST_EQUALS( "ActorB: OnChildRemove", MasterCallStack[ 6 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "ActorB: OnChildAdd", MasterCallStack[ 7 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("ActorB: OnChildRemove", MasterCallStack[6], TEST_LOCATION);
+ DALI_TEST_EQUALS("ActorB: OnChildAdd", MasterCallStack[7], TEST_LOCATION);
// Excercise the message passing to Update thread
tet_infoline("Testing Dali::CustomActor::OnPropertySet()");
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
custom.SetDaliProperty("yes");
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[0], TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Dali::CustomActor::OnSizeSet()");
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
- custom.SetProperty( Actor::Property::SIZE, Vector2( 9.0f, 10.0f ) );
- DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 9.0f, custom.GetSize().width, TEST_LOCATION );
- DALI_TEST_EQUALS( 10.0f, custom.GetSize().height, TEST_LOCATION );
-
- custom.SetProperty( Actor::Property::SIZE, Vector3( 4.0f, 5.0f, 6.0f ) );
- DALI_TEST_EQUALS( 4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSizeSet", custom.GetMethodsCalled()[ 2 ], TEST_LOCATION );
- DALI_TEST_EQUALS( "OnPropertySet", custom.GetMethodsCalled()[ 3 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 4.0f, custom.GetSize().width, TEST_LOCATION );
- DALI_TEST_EQUALS( 5.0f, custom.GetSize().height, TEST_LOCATION );
- DALI_TEST_EQUALS( 6.0f, custom.GetSize().depth, TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+
+ custom.SetProperty(Actor::Property::SIZE, Vector2(9.0f, 10.0f));
+ DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(9.0f, custom.GetSize().width, TEST_LOCATION);
+ DALI_TEST_EQUALS(10.0f, custom.GetSize().height, TEST_LOCATION);
+
+ custom.SetProperty(Actor::Property::SIZE, Vector3(4.0f, 5.0f, 6.0f));
+ DALI_TEST_EQUALS(4, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSizeSet", custom.GetMethodsCalled()[2], TEST_LOCATION);
+ DALI_TEST_EQUALS("OnPropertySet", custom.GetMethodsCalled()[3], TEST_LOCATION);
+ DALI_TEST_EQUALS(4.0f, custom.GetSize().width, TEST_LOCATION);
+ DALI_TEST_EQUALS(5.0f, custom.GetSize().height, TEST_LOCATION);
+ DALI_TEST_EQUALS(6.0f, custom.GetSize().depth, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Dali::CustomActor::OnSizeAnimation()");
Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
- Animation anim = Animation::New( 1.0f );
- anim.AnimateTo( Property( custom, Actor::Property::SIZE ), Vector3( 8.0f, 9.0f, 10.0f ) );
+ Animation anim = Animation::New(1.0f);
+ anim.AnimateTo(Property(custom, Actor::Property::SIZE), Vector3(8.0f, 9.0f, 10.0f));
anim.Play();
application.SendNotification();
- application.Render( static_cast<unsigned int>( 1000.0f ) );
+ application.Render(static_cast<unsigned int>(1000.0f));
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 8.0f, custom.GetTargetSize().width, TEST_LOCATION );
- DALI_TEST_EQUALS( 9.0f, custom.GetTargetSize().height, TEST_LOCATION );
- DALI_TEST_EQUALS( 10.0f, custom.GetTargetSize().depth, TEST_LOCATION );
+ DALI_TEST_EQUALS(1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(8.0f, custom.GetTargetSize().width, TEST_LOCATION);
+ DALI_TEST_EQUALS(9.0f, custom.GetTargetSize().height, TEST_LOCATION);
+ DALI_TEST_EQUALS(10.0f, custom.GetTargetSize().depth, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Size component animation");
Test::TestCustomActor custom = Test::TestCustomActor::New();
- float intialWidth( 10.0f );
+ float intialWidth(10.0f);
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- custom.SetProperty( Actor::Property::SIZE, Vector2( intialWidth, 10.0f) ); // First method
+ DALI_TEST_EQUALS(0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
+ custom.SetProperty(Actor::Property::SIZE, Vector2(intialWidth, 10.0f)); // First method
- Animation anim = Animation::New( 1.0f );
+ Animation anim = Animation::New(1.0f);
- DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
- anim.AnimateTo( Property( custom, Actor::Property::SIZE_WIDTH ), 20.0f );
+ anim.AnimateTo(Property(custom, Actor::Property::SIZE_WIDTH), 20.0f);
- DALI_TEST_EQUALS( 2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(2, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
- anim.Play(); // Triggers second method ( OnSizeAnimation )
+ anim.Play(); // Triggers second method ( OnSizeAnimation )
application.SendNotification();
- application.Render( static_cast<unsigned int>( 1000.0f ) );
+ application.Render(static_cast<unsigned int>(1000.0f));
- DALI_TEST_EQUALS( 3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS(3, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION);
- DALI_TEST_EQUALS( "OnSizeAnimation", custom.GetMethodsCalled()[ 2 ], TEST_LOCATION );
+ DALI_TEST_EQUALS("OnSizeAnimation", custom.GetMethodsCalled()[2], TEST_LOCATION);
END_TEST;
}
int UtcDaliCustomActorImplOnPropertySet(void)
{
- TestApplication application;
+ TestApplication application;
CustomActorImpl* impl = new Test::Impl::SimpleTestCustomActor();
- CustomActor customActor( *impl ); // Will automatically unref at the end of this function
+ CustomActor customActor(*impl); // Will automatically unref at the end of this function
- impl->OnPropertySet( 0, 0 );
+ impl->OnPropertySet(0, 0);
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::New();
- CustomActorImpl& impl = custom.GetImplementation();
- impl.GetOwner(); // Test
+ CustomActorImpl& impl = custom.GetImplementation();
+ impl.GetOwner(); // Test
const Test::TestCustomActor constCustom = Test::TestCustomActor::New();
- const CustomActorImpl& constImpl = constCustom.GetImplementation();
- constImpl.GetOwner(); // Test
+ const CustomActorImpl& constImpl = constCustom.GetImplementation();
+ constImpl.GetOwner(); // Test
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
DALI_TEST_CHECK(customActorObject.DoAction("invalidCommand", attributes) == false);
// Check that the custom actor is visible
- custom.SetProperty( Actor::Property::VISIBLE,true);
- DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
+ custom.SetProperty(Actor::Property::VISIBLE, true);
+ DALI_TEST_CHECK(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
// Check the custom actor performed an action to hide itself
DALI_TEST_CHECK(customActorObject.DoAction("hide", attributes) == true);
application.Render();
// Check that the custom actor is now invisible
- DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == false);
+ DALI_TEST_CHECK(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == false);
// Check the custom actor performed an action to show itself
DALI_TEST_CHECK(customActorObject.DoAction("show", attributes) == true);
application.Render();
// Check that the custom actor is now visible
- DALI_TEST_CHECK(custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) == true);
+ DALI_TEST_CHECK(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE) == true);
END_TEST;
}
int UtcDaliCustomActorCustomActor(void)
{
Dali::CustomActor customA;
- Dali::CustomActor customB( customA );
+ Dali::CustomActor customB(customA);
- DALI_TEST_CHECK( customA == customB );
+ DALI_TEST_CHECK(customA == customB);
END_TEST;
}
{
TestApplication application;
- DALI_TEST_CHECK( gOnRelayout == false );
+ DALI_TEST_CHECK(gOnRelayout == false);
Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
application.GetScene().Add(custom);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( gOnRelayout == true );
+ DALI_TEST_CHECK(gOnRelayout == true);
gOnRelayout = false;
custom.TestRelayoutRequest();
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( gOnRelayout == true );
+ DALI_TEST_CHECK(gOnRelayout == true);
END_TEST;
}
int UtcDaliCustomActorImplGetHeightForWidthBase(void)
{
- TestApplication application;
+ TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
float width = 300.0f;
application.SendNotification();
application.Render();
- float v = custom.TestGetHeightForWidthBase( width );
+ float v = custom.TestGetHeightForWidthBase(width);
- DALI_TEST_CHECK( v == width );
+ DALI_TEST_CHECK(v == width);
END_TEST;
}
int UtcDaliCustomActorImplGetWidthForHeightBase(void)
{
- TestApplication application;
+ TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
float height = 300.0f;
application.SendNotification();
application.Render();
- float v = custom.TestGetWidthForHeightBase( height );
+ float v = custom.TestGetWidthForHeightBase(height);
- DALI_TEST_CHECK( v == height );
+ DALI_TEST_CHECK(v == height);
END_TEST;
}
int UtcDaliCustomActorImplCalculateChildSizeBase(void)
{
- TestApplication application;
+ TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
Actor child = Actor::New();
child.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
- child.SetProperty( Actor::Property::SIZE, Vector2( 150, 150 ) );
+ child.SetProperty(Actor::Property::SIZE, Vector2(150, 150));
application.SendNotification();
application.Render();
- float v = custom.TestCalculateChildSizeBase( child, Dali::Dimension::ALL_DIMENSIONS );
- DALI_TEST_CHECK( v == 0.0f );
+ float v = custom.TestCalculateChildSizeBase(child, Dali::Dimension::ALL_DIMENSIONS);
+ DALI_TEST_CHECK(v == 0.0f);
END_TEST;
}
int UtcDaliCustomActorImplRelayoutDependentOnChildrenBase(void)
{
- TestApplication application;
+ TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::NewNegoSize();
custom.SetResizePolicy(Dali::ResizePolicy::FIT_TO_CHILDREN, Dali::Dimension::ALL_DIMENSIONS);
- bool v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::ALL_DIMENSIONS );
- DALI_TEST_CHECK( v == true );
+ bool v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::ALL_DIMENSIONS);
+ DALI_TEST_CHECK(v == true);
application.SendNotification();
application.Render();
custom.SetResizePolicy(Dali::ResizePolicy::FIXED, Dali::Dimension::ALL_DIMENSIONS);
- v = custom.TestRelayoutDependentOnChildrenBase( Dali::Dimension::WIDTH );
- DALI_TEST_CHECK( v == false );
+ v = custom.TestRelayoutDependentOnChildrenBase(Dali::Dimension::WIDTH);
+ DALI_TEST_CHECK(v == false);
// why is this here?
application.SendNotification();
// Register Type
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("CustomActor");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
std::string name;
name = handle.GetTypeName();
tet_result(TET_FAIL);
}
- catch( DaliException& e )
+ catch(DaliException& e)
{
exception = e.condition;
- DALI_TEST_EQUALS( exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION );
+ DALI_TEST_EQUALS(exception, "handle && \"BaseObject handle is empty\"", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliCustomActorGetExtensionP(void)
{
TestApplication application;
Test::TestCustomActor custom = Test::TestCustomActor::NewVariant5(application.GetScene());
- DALI_TEST_CHECK( NULL == custom.GetImplementation().GetExtension() );
+ DALI_TEST_CHECK(NULL == custom.GetImplementation().GetExtension());
END_TEST;
}
*/
Test::TestCustomActor actorA = Test::TestCustomActor::New();
- stage.Add( actorA );
+ stage.Add(actorA);
Test::TestCustomActor actorB = Test::TestCustomActor::New();
- actorA.Add( actorB );
+ actorA.Add(actorB);
Test::TestCustomActor actorC = Test::TestCustomActor::New();
- actorA.Add( actorC );
+ actorA.Add(actorC);
Test::TestCustomActor actorD = Test::TestCustomActor::New();
- actorB.Add( actorD );
+ actorB.Add(actorD);
Test::TestCustomActor actorE = Test::TestCustomActor::New();
- actorB.Add( actorE );
+ actorB.Add(actorE);
Test::TestCustomActor actorF = Test::TestCustomActor::New();
- actorC.Add( actorF );
+ actorC.Add(actorF);
// Excercise the message passing to Update thread
application.SendNotification();
application.Render();
application.Render();
- DALI_TEST_EQUALS( 1u, actorA.GetDepth(), TEST_LOCATION );
- DALI_TEST_EQUALS( 2u, actorB.GetDepth(), TEST_LOCATION );
- DALI_TEST_EQUALS( 2u, actorC.GetDepth(), TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, actorD.GetDepth(), TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, actorE.GetDepth(), TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, actorF.GetDepth(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1u, actorA.GetDepth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, actorB.GetDepth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, actorC.GetDepth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, actorD.GetDepth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, actorE.GetDepth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, actorF.GetDepth(), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliCustomActorSetGetProperty(void)
{
TestApplication application; // Need the type registry
Test::TestCustomActor actor = Test::TestCustomActor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- actor.SetProperty( Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f );
- actor.SetProperty( Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE );
- actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE );
- actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20 );
- actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f );
+ actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1, 0.5f);
+ actor.SetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2, Color::WHITE);
+ actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3, Color::BLUE);
+ actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4, 20);
+ actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5, 40.0f);
- Property::Value value = actor.GetProperty( Test::TestCustomActor::Property::TEST_PROPERTY1 );
- DALI_TEST_EQUALS( value.Get<float>(), 0.5f, 0.001f, TEST_LOCATION );
+ Property::Value value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY1);
+ DALI_TEST_EQUALS(value.Get<float>(), 0.5f, 0.001f, TEST_LOCATION);
- value = actor.GetProperty( Test::TestCustomActor::Property::TEST_PROPERTY2 );
- DALI_TEST_EQUALS( value.Get<Vector4>(), Color::WHITE, 0.001f, TEST_LOCATION );
+ value = actor.GetProperty(Test::TestCustomActor::Property::TEST_PROPERTY2);
+ DALI_TEST_EQUALS(value.Get<Vector4>(), Color::WHITE, 0.001f, TEST_LOCATION);
+ value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3);
+ DALI_TEST_EQUALS(value.Get<Vector4>(), Color::BLUE, 0.001f, TEST_LOCATION);
- value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY3 );
- DALI_TEST_EQUALS( value.Get<Vector4>(), Color::BLUE, 0.001f, TEST_LOCATION );
+ value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4);
+ DALI_TEST_EQUALS(value.Get<int>(), 20, TEST_LOCATION);
- value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY4 );
- DALI_TEST_EQUALS( value.Get<int>(), 20, TEST_LOCATION );
-
- value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5 );
- DALI_TEST_EQUALS( value.Get<float>(), 40.0f, 0.001f, TEST_LOCATION );
+ value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY5);
+ DALI_TEST_EQUALS(value.Get<float>(), 40.0f, 0.001f, TEST_LOCATION);
// Get read-only property
- value = actor.GetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6 );
- DALI_TEST_EQUALS( value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION );
+ value = actor.GetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6);
+ DALI_TEST_EQUALS(value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION);
// Attempt to set read-only property and then ensure value hasn't changed
- actor.SetProperty( Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f );
- DALI_TEST_EQUALS( value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION );
+ actor.SetProperty(Test::DevelTestCustomActor::Property::DEVEL_TEST_PROPERTY6, 40.0f);
+ DALI_TEST_EQUALS(value.Get<float>(), 10.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int utcDaliActorGetTypeInfo(void)
{
TestApplication application;
- tet_infoline( "Get the type info of a derived actor" );
+ tet_infoline("Get the type info of a derived actor");
Test::TestCustomActor customActor = Test::TestCustomActor::New();
- Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo( customActor );
+ Dali::TypeInfo typeInfo = Dali::DevelCustomActor::GetTypeInfo(customActor);
- DALI_TEST_EQUALS( typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION );
+ DALI_TEST_EQUALS(typeInfo.GetName(), std::string("TestCustomActor"), TEST_LOCATION);
END_TEST;
}
*/
struct UnregisteredCustomActor : public Dali::CustomActorImpl
{
- UnregisteredCustomActor() : CustomActorImpl( ACTOR_BEHAVIOUR_DEFAULT )
- { }
+ UnregisteredCustomActor()
+ : CustomActorImpl(ACTOR_BEHAVIOUR_DEFAULT)
+ {
+ }
virtual ~UnregisteredCustomActor()
- { }
- virtual void OnSceneConnection( int32_t depth )
- { }
+ {
+ }
+ virtual void OnSceneConnection(int32_t depth)
+ {
+ }
virtual void OnSceneDisconnection()
- { }
+ {
+ }
virtual void OnChildAdd(Actor& child)
- { }
+ {
+ }
virtual void OnChildRemove(Actor& child)
- { }
- virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue )
- { }
+ {
+ }
+ virtual void OnPropertySet(Property::Index index, const Property::Value& propertyValue)
+ {
+ }
virtual void OnSizeSet(const Vector3& targetSize)
- { }
+ {
+ }
virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
- { }
+ {
+ }
virtual bool OnHoverEvent(const HoverEvent& event)
- { return false; }
+ {
+ return false;
+ }
virtual bool OnWheelEvent(const WheelEvent& event)
- { return false; }
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
- { }
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
- { }
+ {
+ return false;
+ }
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
+ {
+ }
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
+ {
+ }
virtual Vector3 GetNaturalSize()
- { return Vector3(); }
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
- { return 0.f; }
- virtual float GetHeightForWidth( float width )
- { return 0.f; }
- virtual float GetWidthForHeight( float height )
- { return 0.f; }
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
- { return false; }
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
- { }
- virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
- { }
+ {
+ return Vector3();
+ }
+ virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
+ {
+ return 0.f;
+ }
+ virtual float GetHeightForWidth(float width)
+ {
+ return 0.f;
+ }
+ virtual float GetWidthForHeight(float height)
+ {
+ return 0.f;
+ }
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS)
+ {
+ return false;
+ }
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
+ {
+ }
+ virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
+ {
+ }
};
-}
+} // namespace Impl
struct UnregisteredCustomActor : public Dali::CustomActor
{
static UnregisteredCustomActor New()
{
Impl::UnregisteredCustomActor* impl = new Impl::UnregisteredCustomActor;
- UnregisteredCustomActor custom( *impl ); // takes ownership
+ UnregisteredCustomActor custom(*impl); // takes ownership
return custom;
}
UnregisteredCustomActor()
- { }
+ {
+ }
~UnregisteredCustomActor()
- { }
- UnregisteredCustomActor( Internal::CustomActor* impl )
- : CustomActor( impl )
- { }
- UnregisteredCustomActor( Impl::UnregisteredCustomActor& impl )
- : CustomActor( impl )
- { }
- static UnregisteredCustomActor DownCast( BaseHandle handle )
+ {
+ }
+ UnregisteredCustomActor(Internal::CustomActor* impl)
+ : CustomActor(impl)
+ {
+ }
+ UnregisteredCustomActor(Impl::UnregisteredCustomActor& impl)
+ : CustomActor(impl)
+ {
+ }
+ static UnregisteredCustomActor DownCast(BaseHandle handle)
{
UnregisteredCustomActor hndl;
- CustomActor custom = Dali::CustomActor::DownCast( handle );
- if( custom )
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
+ if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
- Impl::UnregisteredCustomActor* impl = dynamic_cast<Impl::UnregisteredCustomActor*>( &customImpl );
+ Impl::UnregisteredCustomActor* impl = dynamic_cast<Impl::UnregisteredCustomActor*>(&customImpl);
- if( impl )
+ if(impl)
{
- hndl = UnregisteredCustomActor( customImpl.GetOwner() );
+ hndl = UnregisteredCustomActor(customImpl.GetOwner());
}
}
return hndl;
TestApplication application; // Need the type registry
auto custom = UnregisteredCustomActor::New();
- application.GetScene().Add( custom );
+ application.GetScene().Add(custom);
// should have all actor properties
- DALI_TEST_EQUALS( custom.GetPropertyType( Actor::Property::COLOR ), Property::VECTOR4, TEST_LOCATION );
+ DALI_TEST_EQUALS(custom.GetPropertyType(Actor::Property::COLOR), Property::VECTOR4, TEST_LOCATION);
auto actorHandle = Actor::New();
- DALI_TEST_EQUALS( custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(custom.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION);
- DALI_TEST_EQUALS( custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
- custom.SetProperty( Actor::Property::VISIBLE, false );
+ DALI_TEST_EQUALS(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
+ custom.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render(); // IsVisible returns scene value
- DALI_TEST_EQUALS( custom.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(custom.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
// should have custom actor typename (as it has not registered itself)
- DALI_TEST_EQUALS( "CustomActor", custom.GetTypeName(), TEST_LOCATION );
+ DALI_TEST_EQUALS("CustomActor", custom.GetTypeName(), TEST_LOCATION);
// should have actor actions
- custom.DoAction( "show", Property::Map() );
- DALI_TEST_EQUALS( custom.GetProperty( Actor::Property::VISIBLE ).Get<bool>(), true, TEST_LOCATION );
+ custom.DoAction("show", Property::Map());
+ DALI_TEST_EQUALS(custom.GetProperty(Actor::Property::VISIBLE).Get<bool>(), true, TEST_LOCATION);
Animation animation = Animation::New(0.01f); // very short animation
// should be able to animate actor property
- animation.AnimateTo( Property( custom, Actor::Property::POSITION ), Vector3( 100.0f, 150.0f, 200.0f ) );
+ animation.AnimateTo(Property(custom, Actor::Property::POSITION), Vector3(100.0f, 150.0f, 200.0f));
animation.Play();
application.SendNotification();
application.Render(1000.f);
- DALI_TEST_EQUALS( Vector3( 100.0f, 150.0f, 200.0f ), custom.GetProperty( Actor::Property::POSITION ).Get<Vector3>(), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3( 100.0f, 150.0f, 200.0f ), custom.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetProperty(Actor::Property::POSITION).Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(100.0f, 150.0f, 200.0f), custom.GetCurrentProperty<Vector3>(Actor::Property::POSITION), TEST_LOCATION);
- Dali::WeakHandle<UnregisteredCustomActor> weakRef( custom );
+ Dali::WeakHandle<UnregisteredCustomActor> weakRef(custom);
// should have actor signals
- custom.ConnectSignal( &application, "offScene",
- [weakRef]()
- {
- DALI_TEST_EQUALS( weakRef.GetHandle().GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ), false, TEST_LOCATION );
- } );
+ custom.ConnectSignal(&application, "offScene", [weakRef]() {
+ DALI_TEST_EQUALS(weakRef.GetHandle().GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE), false, TEST_LOCATION);
+ });
- application.GetScene().Remove( custom );
- application.GetScene().Add( custom );
+ application.GetScene().Remove(custom);
+ application.GetScene().Add(custom);
END_TEST;
}
namespace Impl
{
struct DerivedCustomActor : public UnregisteredCustomActor
-{ };
-}
+{
+};
+} // namespace Impl
struct DerivedCustomActor : public UnregisteredCustomActor
{
static DerivedCustomActor New()
{
Impl::DerivedCustomActor* impl = new Impl::DerivedCustomActor;
- DerivedCustomActor custom( *impl ); // takes ownership
+ DerivedCustomActor custom(*impl); // takes ownership
return custom;
}
DerivedCustomActor()
- { }
+ {
+ }
~DerivedCustomActor()
- { }
- DerivedCustomActor( Internal::CustomActor* impl )
- : UnregisteredCustomActor( impl )
- { }
- DerivedCustomActor( Impl::UnregisteredCustomActor& impl )
- : UnregisteredCustomActor( impl )
- { }
+ {
+ }
+ DerivedCustomActor(Internal::CustomActor* impl)
+ : UnregisteredCustomActor(impl)
+ {
+ }
+ DerivedCustomActor(Impl::UnregisteredCustomActor& impl)
+ : UnregisteredCustomActor(impl)
+ {
+ }
};
// register custom
-DALI_TYPE_REGISTRATION_BEGIN( DerivedCustomActor, UnregisteredCustomActor, nullptr );
+DALI_TYPE_REGISTRATION_BEGIN(DerivedCustomActor, UnregisteredCustomActor, nullptr);
DALI_TYPE_REGISTRATION_END()
int UtcDaliCustomActorPropertyRegistrationDefaultValue(void)
TestApplication application; // Need the type registry
// register our base and add a property with default value for it
- Dali::TypeRegistration typeRegistration( typeid( UnregisteredCustomActor ), typeid( Dali::CustomActor ), nullptr );
+ Dali::TypeRegistration typeRegistration(typeid(UnregisteredCustomActor), typeid(Dali::CustomActor), nullptr);
auto derived = DerivedCustomActor::New();
- application.GetScene().Add( derived );
+ application.GetScene().Add(derived);
// should have all actor properties
- DALI_TEST_EQUALS( derived.GetPropertyType( Actor::Property::WORLD_MATRIX ), Property::MATRIX, TEST_LOCATION );
+ DALI_TEST_EQUALS(derived.GetPropertyType(Actor::Property::WORLD_MATRIX), Property::MATRIX, TEST_LOCATION);
auto actorHandle = Actor::New();
- DALI_TEST_EQUALS( derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount(), TEST_LOCATION);
// add a property in base class
- AnimatablePropertyRegistration( typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f );
+ AnimatablePropertyRegistration(typeRegistration, "Foobar", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, 10.f);
// should be one more property now
- DALI_TEST_EQUALS( derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(derived.GetPropertyCount(), actorHandle.GetPropertyCount() + 1, TEST_LOCATION);
// check that the default value is set for base class
- DALI_TEST_EQUALS( UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(UnregisteredCustomActor::New().GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION);
// check that the default value is set for the derived instance as well
- DALI_TEST_EQUALS( derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(derived.GetProperty(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX).Get<float>(), 10.f, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-
// Positive test case for constructors
int UtcDaliDegreeConstructors01(void)
{
TestApplication application;
// Default constructor, does not initialise the value
- Degree degree0( 0.0f );
+ Degree degree0(0.0f);
// Test assignment operator
degree0 = Degree(180.0f);
- DALI_TEST_EQUALS( degree0.degree, 180.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(degree0.degree, 180.0f, 0.001f, TEST_LOCATION);
// Constructor from float value
- Degree degree1( 180.0f );
- DALI_TEST_EQUALS( degree1.degree, 180.0f, 0.001f, TEST_LOCATION );
+ Degree degree1(180.0f);
+ DALI_TEST_EQUALS(degree1.degree, 180.0f, 0.001f, TEST_LOCATION);
// Constructor from a Radian
- Degree degree2( Radian( Math::PI ) );
- DALI_TEST_EQUALS( degree2.degree, 180.0f, 0.001f, TEST_LOCATION );
+ Degree degree2(Radian(Math::PI));
+ DALI_TEST_EQUALS(degree2.degree, 180.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliDegreeCopyConstructor(void)
{
- Degree degree0( 90.0f );
- Degree degree1( degree0 );
- DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION );
+ Degree degree0(90.0f);
+ Degree degree1(degree0);
+ DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliDegreeMoveConstructor(void)
{
- Degree degree0( 90.0f );
- Degree degree1 = std::move( degree0 );
- DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION );
+ Degree degree0(90.0f);
+ Degree degree1 = std::move(degree0);
+ DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliDegreeCopyAssignment(void)
{
- Degree degree0( 90.0f );
+ Degree degree0(90.0f);
Degree degree1;
degree1 = degree0;
- DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliDegreeMoveAssignment(void)
{
- Degree degree0( 90.0f );
+ Degree degree0(90.0f);
Degree degree1;
- degree1 = std::move( degree0 );
- DALI_TEST_EQUALS( degree1.degree, 90.0f, 0.001f, TEST_LOCATION );
+ degree1 = std::move(degree0);
+ DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
TestApplication application;
// Comparison between degrees
- Degree degree0( 90.0f );
- Degree degree1( 90.0f );
- Degree degree2( 180.0f );
+ Degree degree0(90.0f);
+ Degree degree1(90.0f);
+ Degree degree2(180.0f);
- DALI_TEST_CHECK( degree0 == degree1 );
- DALI_TEST_CHECK( degree0 != degree2 );
+ DALI_TEST_CHECK(degree0 == degree1);
+ DALI_TEST_CHECK(degree0 != degree2);
// Comparison between radian to degree
- Degree degree3( 180.0f );
- Degree degree4( 90.0f );
- Radian radian0( Math::PI );
+ Degree degree3(180.0f);
+ Degree degree4(90.0f);
+ Radian radian0(Math::PI);
- DALI_TEST_CHECK( degree3 == Degree(radian0) );
- DALI_TEST_CHECK( degree4 != Degree(radian0) );
+ DALI_TEST_CHECK(degree3 == Degree(radian0));
+ DALI_TEST_CHECK(degree4 != Degree(radian0));
// Comparison with float
- Degree degree5( 90.0f );
+ Degree degree5(90.0f);
- DALI_TEST_CHECK( degree5.degree == 90.0f );
- DALI_TEST_CHECK( degree5.degree != 180.0f );
+ DALI_TEST_CHECK(degree5.degree == 90.0f);
+ DALI_TEST_CHECK(degree5.degree != 180.0f);
END_TEST;
}
*
*/
-#include <iostream>
-#include <algorithm>
-
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/images/distance-field.h>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/images/distance-field.h>
-#include <dali-test-suite-utils.h>
+#include <algorithm>
+#include <iostream>
using std::max;
using namespace Dali;
namespace
{
-
static const float ROTATION_EPSILON = 0.0001f;
static unsigned char sourceImage[] =
-{
- 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
- 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
- 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
- 0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
-};
+ {
+ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
} // anonymous namespace
-
-
int UtcDaliGenerateDistanceField(void)
{
- unsigned char distanceField[4*4];
+ unsigned char distanceField[4 * 4];
GenerateDistanceFieldMap(sourceImage, Size(8.0f, 8.0f), distanceField, Size(4.0f, 4.0f), 0, Size(4.0f, 4.0f));
- if(distanceField[0] <= distanceField[5] &&
- distanceField[5] <= distanceField[10] &&
+ if(distanceField[0] <= distanceField[5] &&
+ distanceField[5] <= distanceField[10] &&
distanceField[10] <= distanceField[15])
{
tet_result(TET_PASS);
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
/// Compare a uint16_t value with an unsigned int
-void DALI_TEST_EQUALS( uint16_t value1, unsigned int value2, const char* location )
+void DALI_TEST_EQUALS(uint16_t value1, unsigned int value2, const char* location)
{
- ::DALI_TEST_EQUALS< uint16_t >( value1, static_cast< uint16_t >( value2 ), location );
+ ::DALI_TEST_EQUALS<uint16_t>(value1, static_cast<uint16_t>(value2), location);
}
} // unnamed namespace
TestApplication application;
Extents extent;
- DALI_TEST_EQUALS( extent.start, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.end, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.top, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.bottom, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(extent.start, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.end, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.top, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.bottom, 0u, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Extents extent( 10u, 20u, 400u, 200u );
- DALI_TEST_EQUALS( extent.start, 10u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.end, 20u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.top, 400u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.bottom, 200u, TEST_LOCATION );
+ Extents extent(10u, 20u, 400u, 200u);
+ DALI_TEST_EQUALS(extent.start, 10u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.end, 20u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.top, 400u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.bottom, 200u, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Extents extent( 10u, 20u, 400u, 200u );
+ Extents extent(10u, 20u, 400u, 200u);
Extents e2 = extent;
- DALI_TEST_EQUALS( e2.start, 10u, TEST_LOCATION );
- DALI_TEST_EQUALS( e2.end, 20u, TEST_LOCATION );
- DALI_TEST_EQUALS( e2.top, 400u, TEST_LOCATION );
- DALI_TEST_EQUALS( e2.bottom, 200u, TEST_LOCATION );
+ DALI_TEST_EQUALS(e2.start, 10u, TEST_LOCATION);
+ DALI_TEST_EQUALS(e2.end, 20u, TEST_LOCATION);
+ DALI_TEST_EQUALS(e2.top, 400u, TEST_LOCATION);
+ DALI_TEST_EQUALS(e2.bottom, 200u, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Extents extent( 10u, 20u, 400u, 200u );
+ Extents extent(10u, 20u, 400u, 200u);
- Extents extent2( extent );
+ Extents extent2(extent);
- DALI_TEST_EQUALS( extent2.start, 10u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent2.end, 20u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent2.top, 400u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent2.bottom, 200u, TEST_LOCATION );
+ DALI_TEST_EQUALS(extent2.start, 10u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent2.end, 20u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent2.top, 400u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent2.bottom, 200u, TEST_LOCATION);
END_TEST;
}
Extents extent;
- Extents extent2( 10u, 20u, 400u, 200u );
+ Extents extent2(10u, 20u, 400u, 200u);
extent = extent2;
- DALI_TEST_EQUALS( extent.start, 10u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.end, 20u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.top, 400u, TEST_LOCATION );
- DALI_TEST_EQUALS( extent.bottom, 200u, TEST_LOCATION );
+ DALI_TEST_EQUALS(extent.start, 10u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.end, 20u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.top, 400u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.bottom, 200u, TEST_LOCATION);
END_TEST;
}
int UtcDaliExtentsAssignP(void)
{
- Extents extent;
- const uint16_t array[] = { 1u, 2u, 3u, 4u };
- extent = (const uint16_t*)array;
-
- DALI_TEST_EQUALS( extent.start, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( extent.end, 2u, TEST_LOCATION);
- DALI_TEST_EQUALS( extent.top, 3u, TEST_LOCATION);
- DALI_TEST_EQUALS( extent.bottom, 4u, TEST_LOCATION);
+ Extents extent;
+ const uint16_t array[] = {1u, 2u, 3u, 4u};
+ extent = (const uint16_t*)array;
+
+ DALI_TEST_EQUALS(extent.start, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.end, 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.top, 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(extent.bottom, 4u, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Extents extent1( 10u, 20u, 200u, 200u );
- Extents extent2( 10u, 120u, 200u, 200u );
- Extents extent3( 10u, 80u, 200u, 200u );
+ Extents extent1(10u, 20u, 200u, 200u);
+ Extents extent2(10u, 120u, 200u, 200u);
+ Extents extent3(10u, 80u, 200u, 200u);
- DALI_TEST_CHECK( extent1 != extent2 );
- DALI_TEST_CHECK( extent1 != extent3 );
+ DALI_TEST_CHECK(extent1 != extent2);
+ DALI_TEST_CHECK(extent1 != extent3);
END_TEST;
}
{
TestApplication application;
- Extents extent1( 10u, 20u, 200u, 200u );
- Extents extent1p( 10u, 20u, 200u, 200u );
+ Extents extent1(10u, 20u, 200u, 200u);
+ Extents extent1p(10u, 20u, 200u, 200u);
- Extents extent2( 10u, 120u, 200u, 200u );
- Extents extent3( 10u, 80u, 200u, 200u );
+ Extents extent2(10u, 120u, 200u, 200u);
+ Extents extent3(10u, 80u, 200u, 200u);
- DALI_TEST_CHECK( extent1 == extent1p );
- DALI_TEST_CHECK( extent1 == extent1 );
- DALI_TEST_CHECK( !( extent1 == extent2 ) );
- DALI_TEST_CHECK( !( extent1 == extent3 ) );
+ DALI_TEST_CHECK(extent1 == extent1p);
+ DALI_TEST_CHECK(extent1 == extent1);
+ DALI_TEST_CHECK(!(extent1 == extent2));
+ DALI_TEST_CHECK(!(extent1 == extent3));
END_TEST;
}
int UtcDaliExtentsOStreamOperatorP(void)
{
- TestApplication application;
+ TestApplication application;
std::ostringstream oss;
- Extents extent( 1u, 2u, 10u, 10u );
+ Extents extent(1u, 2u, 10u, 10u);
oss << extent;
std::string expectedOutput = "[1, 2, 10, 10]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/rendering/frame-buffer-devel.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
- DALI_TEST_CHECK( frameBuffer );
+ DALI_TEST_CHECK(frameBuffer);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH);
- DALI_TEST_CHECK( frameBuffer );
+ DALI_TEST_CHECK(frameBuffer);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::STENCIL );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::STENCIL);
- DALI_TEST_CHECK( frameBuffer );
+ DALI_TEST_CHECK(frameBuffer);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
- DALI_TEST_CHECK( frameBuffer );
+ DALI_TEST_CHECK(frameBuffer);
application.SendNotification();
application.Render();
int UtcDaliFrameBufferNew05(void)
{
TestApplication application;
- FrameBuffer frameBuffer;
- DALI_TEST_CHECK( !frameBuffer );
+ FrameBuffer frameBuffer;
+ DALI_TEST_CHECK(!frameBuffer);
END_TEST;
}
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, static_cast<FrameBuffer::Attachment::Mask>( FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL ) );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, static_cast<FrameBuffer::Attachment::Mask>(FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL));
- DALI_TEST_CHECK( frameBuffer );
+ DALI_TEST_CHECK(frameBuffer);
application.SendNotification();
application.Render();
int UtcDaliFrameBufferNewWithColor01(void)
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height);
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
// check that texture is not empty handle
- DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+ DALI_TEST_CHECK(frameBuffer.GetColorTexture());
END_TEST;
}
int UtcDaliFrameBufferNewWithColor02(void)
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR);
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
// check that texture is not empty handle
- DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+ DALI_TEST_CHECK(frameBuffer.GetColorTexture());
END_TEST;
}
int UtcDaliFrameBufferNewWithColor03(void)
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR_DEPTH);
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
// check that texture is not empty handle
- DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+ DALI_TEST_CHECK(frameBuffer.GetColorTexture());
END_TEST;
}
int UtcDaliFrameBufferNewWithColor04(void)
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_STENCIL );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR_STENCIL);
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
// check that texture is not empty handle
- DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+ DALI_TEST_CHECK(frameBuffer.GetColorTexture());
END_TEST;
}
int UtcDaliFrameBufferNewWithColor05(void)
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH_STENCIL );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::COLOR_DEPTH_STENCIL);
application.SendNotification();
application.Render();
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
// check that texture is not empty handle
- DALI_TEST_CHECK( frameBuffer.GetColorTexture() );
+ DALI_TEST_CHECK(frameBuffer.GetColorTexture());
END_TEST;
}
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
- FrameBuffer frameBufferCopy( frameBuffer );
+ FrameBuffer frameBufferCopy(frameBuffer);
- DALI_TEST_CHECK( frameBufferCopy );
+ DALI_TEST_CHECK(frameBufferCopy);
END_TEST;
}
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
FrameBuffer frameBuffer2;
- DALI_TEST_CHECK( !frameBuffer2 );
+ DALI_TEST_CHECK(!frameBuffer2);
frameBuffer2 = frameBuffer;
- DALI_TEST_CHECK( frameBuffer2 );
+ DALI_TEST_CHECK(frameBuffer2);
END_TEST;
}
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
- DALI_TEST_CHECK( frameBuffer );
- DALI_TEST_EQUALS( 1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ DALI_TEST_CHECK(frameBuffer);
+ DALI_TEST_EQUALS(1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
- DALI_TEST_EQUALS( frameBuffer.GetColorTexture(), texture, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
+ DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
- FrameBuffer move = std::move( frameBuffer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetColorTexture(), texture, TEST_LOCATION );
- DALI_TEST_CHECK( !frameBuffer );
+ FrameBuffer move = std::move(frameBuffer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetColorTexture(), texture, TEST_LOCATION);
+ DALI_TEST_CHECK(!frameBuffer);
END_TEST;
}
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
- DALI_TEST_CHECK( frameBuffer );
- DALI_TEST_EQUALS( 1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ DALI_TEST_CHECK(frameBuffer);
+ DALI_TEST_EQUALS(1, frameBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
- DALI_TEST_EQUALS( frameBuffer.GetColorTexture(), texture, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
+ DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
FrameBuffer move;
- move = std::move( frameBuffer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetColorTexture(), texture, TEST_LOCATION );
- DALI_TEST_CHECK( !frameBuffer );
+ move = std::move(frameBuffer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetColorTexture(), texture, TEST_LOCATION);
+ DALI_TEST_CHECK(!frameBuffer);
END_TEST;
}
int UtcDaliFrameBufferDownCast01(void)
{
TestApplication application;
- unsigned int width(64);
- unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
- BaseHandle handle(frameBuffer);
+ BaseHandle handle(frameBuffer);
FrameBuffer frameBuffer2 = FrameBuffer::DownCast(handle);
- DALI_TEST_CHECK( frameBuffer2 );
+ DALI_TEST_CHECK(frameBuffer2);
END_TEST;
}
{
TestApplication application;
- Handle handle = Handle::New(); // Create a custom object
+ Handle handle = Handle::New(); // Create a custom object
FrameBuffer frameBuffer = FrameBuffer::DownCast(handle);
- DALI_TEST_CHECK( !frameBuffer );
+ DALI_TEST_CHECK(!frameBuffer);
END_TEST;
}
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
texture.GenerateMipmaps();
//Attach mipmap 1
- frameBuffer.AttachColorTexture( texture, 0u, 1u );
+ frameBuffer.AttachColorTexture(texture, 0u, 1u);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height);
texture.GenerateMipmaps();
//Attach NEGATIVE_Y face of the cubemap
- frameBuffer.AttachColorTexture( texture, 0u, CubeMapLayer::NEGATIVE_Y );
+ frameBuffer.AttachColorTexture(texture, 0u, CubeMapLayer::NEGATIVE_Y);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, static_cast<FrameBuffer::Attachment::Mask>( FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL ) );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, static_cast<FrameBuffer::Attachment::Mask>(FrameBuffer::Attachment::DEPTH | FrameBuffer::Attachment::STENCIL));
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
// N.B. it doesn't make sense per se, however the OGL standard doesn't seem to forbid attaching the same texture to different slots.
- for (int i = 0; i < Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i)
+ for(int i = 0; i < Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i)
{
- frameBuffer.AttachColorTexture( texture );
+ frameBuffer.AttachColorTexture(texture);
}
application.SendNotification();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
- Texture textureDepth = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_UNSIGNED_INT, width, height );
- DevelFrameBuffer::AttachDepthTexture( frameBuffer, textureDepth );
+ Texture textureDepth = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_UNSIGNED_INT, width, height);
+ DevelFrameBuffer::AttachDepthTexture(frameBuffer, textureDepth);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::DEPTH_STENCIL );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::DEPTH_STENCIL);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
- Texture textureStencil = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height );
- DevelFrameBuffer::AttachDepthStencilTexture( frameBuffer, textureStencil );
+ Texture textureStencil = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height);
+ DevelFrameBuffer::AttachDepthStencilTexture(frameBuffer, textureStencil);
application.SendNotification();
application.Render();
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture, 0u, 1u );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture, 0u, 1u);
DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture, 0u, 1u );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture, 0u, 1u);
DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, 0), texture, TEST_LOCATION);
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture textures[] = {
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
- Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture textures[] = {
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
+ Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height),
};
- for (auto& t: textures)
+ for(auto& t : textures)
{
- frameBuffer.AttachColorTexture( t, 0u, 1u );
+ frameBuffer.AttachColorTexture(t, 0u, 1u);
}
- for (unsigned int i = 0; i < std::extent<decltype(textures)>::value; ++i)
+ for(unsigned int i = 0; i < std::extent<decltype(textures)>::value; ++i)
{
DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, i), textures[i], TEST_LOCATION);
}
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
- Texture textureDepth = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_FLOAT, width, height );
- DevelFrameBuffer::AttachDepthTexture( frameBuffer, textureDepth );
+ Texture textureDepth = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_FLOAT, width, height);
+ DevelFrameBuffer::AttachDepthTexture(frameBuffer, textureDepth);
- DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthTexture( frameBuffer ), textureDepth, TEST_LOCATION);
+ DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthTexture(frameBuffer), textureDepth, TEST_LOCATION);
END_TEST;
}
unsigned int width(64);
unsigned int height(64);
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- frameBuffer.AttachColorTexture( texture );
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ frameBuffer.AttachColorTexture(texture);
- Texture textureStencil = Texture::New( TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height );
- DevelFrameBuffer::AttachDepthStencilTexture( frameBuffer, textureStencil );
+ Texture textureStencil = Texture::New(TextureType::TEXTURE_2D, Pixel::DEPTH_STENCIL, width, height);
+ DevelFrameBuffer::AttachDepthStencilTexture(frameBuffer, textureStencil);
- DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthStencilTexture( frameBuffer ), textureStencil, TEST_LOCATION);
+ DALI_TEST_EQUALS(DevelFrameBuffer::GetDepthStencilTexture(frameBuffer), textureStencil, TEST_LOCATION);
END_TEST;
}
//Create the texture
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- DALI_TEST_CHECK( texture );
- FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
- DALI_TEST_CHECK( frameBuffer );
- frameBuffer.AttachColorTexture( texture, 0u, 1u );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ DALI_TEST_CHECK(texture);
+ FrameBuffer frameBuffer = FrameBuffer::New(width, height, FrameBuffer::Attachment::NONE);
+ DALI_TEST_CHECK(frameBuffer);
+ frameBuffer.AttachColorTexture(texture, 0u, 1u);
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
application.SendNotification();
// Lose & regain context (in render 'thread')
application.ResetContext();
- DALI_TEST_CHECK( frameBuffer );
+ DALI_TEST_CHECK(frameBuffer);
END_TEST;
}
int UtcDaliFrameBufferGetColorTextureNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::FrameBuffer instance;
try
{
int UtcDaliFrameBufferAttachColorTextureNegative01(void)
{
- TestApplication application;
+ TestApplication application;
Dali::FrameBuffer instance;
try
{
int UtcDaliFrameBufferAttachColorTextureNegative02(void)
{
- TestApplication application;
+ TestApplication application;
Dali::FrameBuffer instance;
try
{
Dali::Texture arg1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 400u, 400u);
- unsigned int arg2(0u);
- unsigned int arg3(0u);
- instance.AttachColorTexture(arg1,arg2,arg3);
+ unsigned int arg2(0u);
+ unsigned int arg3(0u);
+ instance.AttachColorTexture(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/devel-api/common/map-wrapper.h>
#include <dali/devel-api/common/stage-devel.h>
#include <dali/devel-api/update/frame-callback-interface.h>
#include <dali/devel-api/update/update-proxy.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
class FrameCallbackBasic : public FrameCallbackInterface
{
public:
-
FrameCallbackBasic() = default;
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds )
+ virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds)
{
mCalled = true;
}
mCalled = false;
}
- bool mCalled{ false };
+ bool mCalled{false};
};
class FrameCallbackOneActor : public FrameCallbackBasic
{
public:
-
- FrameCallbackOneActor( unsigned int actorId )
- : mActorId( actorId )
+ FrameCallbackOneActor(unsigned int actorId)
+ : mActorId(actorId)
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
- FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
- updateProxy.GetSize( mActorId, mSizeGetSizeCall );
- updateProxy.GetPosition( mActorId, mPositionGetPositionCall );
- updateProxy.GetPositionAndSize( mActorId, mPositionGetPositionAndSizeCall, mSizeGetPositionAndSizeCall );
- updateProxy.GetColor( mActorId, mColor );
- updateProxy.GetScale( mActorId, mScale );
+ FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
+ updateProxy.GetSize(mActorId, mSizeGetSizeCall);
+ updateProxy.GetPosition(mActorId, mPositionGetPositionCall);
+ updateProxy.GetPositionAndSize(mActorId, mPositionGetPositionAndSizeCall, mSizeGetPositionAndSizeCall);
+ updateProxy.GetColor(mActorId, mColor);
+ updateProxy.GetScale(mActorId, mScale);
}
const unsigned int mActorId;
class FrameCallbackSetter : public FrameCallbackBasic
{
public:
-
FrameCallbackSetter(
- unsigned int actorId,
- const Vector3& sizeToSet,
- const Vector3& positionToSet,
- const Vector4& colorToSet,
- const Vector3& scaleToSet )
- : mActorId( actorId ),
- mSizeToSet( sizeToSet ),
- mPositionToSet( positionToSet ),
- mColorToSet( colorToSet ),
- mScaleToSet( scaleToSet )
+ unsigned int actorId,
+ const Vector3& sizeToSet,
+ const Vector3& positionToSet,
+ const Vector4& colorToSet,
+ const Vector3& scaleToSet)
+ : mActorId(actorId),
+ mSizeToSet(sizeToSet),
+ mPositionToSet(positionToSet),
+ mColorToSet(colorToSet),
+ mScaleToSet(scaleToSet)
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
- FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
- updateProxy.SetSize( mActorId, mSizeToSet );
- updateProxy.SetPosition( mActorId, mPositionToSet );
- updateProxy.SetColor( mActorId, mColorToSet );
- updateProxy.SetScale( mActorId, mScaleToSet );
- updateProxy.GetSize( mActorId, mSizeAfterSetting );
- updateProxy.GetPosition( mActorId, mPositionAfterSetting );
- updateProxy.GetColor( mActorId, mColorAfterSetting );
- updateProxy.GetScale( mActorId, mScaleAfterSetting );
+ FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
+ updateProxy.SetSize(mActorId, mSizeToSet);
+ updateProxy.SetPosition(mActorId, mPositionToSet);
+ updateProxy.SetColor(mActorId, mColorToSet);
+ updateProxy.SetScale(mActorId, mScaleToSet);
+ updateProxy.GetSize(mActorId, mSizeAfterSetting);
+ updateProxy.GetPosition(mActorId, mPositionAfterSetting);
+ updateProxy.GetColor(mActorId, mColorAfterSetting);
+ updateProxy.GetScale(mActorId, mScaleAfterSetting);
}
const unsigned int mActorId;
- const Vector3& mSizeToSet;
- const Vector3& mPositionToSet;
- const Vector4& mColorToSet;
- const Vector3& mScaleToSet;
+ const Vector3& mSizeToSet;
+ const Vector3& mPositionToSet;
+ const Vector4& mColorToSet;
+ const Vector3& mScaleToSet;
Vector3 mSizeAfterSetting;
Vector3 mPositionAfterSetting;
class FrameCallbackBaker : public FrameCallbackBasic
{
public:
-
FrameCallbackBaker(
- unsigned int actorId,
- const Vector3& sizeToSet,
- const Vector3& positionToSet,
- const Vector4& colorToSet,
- const Vector3& scaleToSet )
- : mActorId( actorId ),
- mSizeToSet( sizeToSet ),
- mPositionToSet( positionToSet ),
- mColorToSet( colorToSet ),
- mScaleToSet( scaleToSet )
+ unsigned int actorId,
+ const Vector3& sizeToSet,
+ const Vector3& positionToSet,
+ const Vector4& colorToSet,
+ const Vector3& scaleToSet)
+ : mActorId(actorId),
+ mSizeToSet(sizeToSet),
+ mPositionToSet(positionToSet),
+ mColorToSet(colorToSet),
+ mScaleToSet(scaleToSet)
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
- FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
- updateProxy.BakeSize( mActorId, mSizeToSet );
- updateProxy.BakePosition( mActorId, mPositionToSet );
- updateProxy.BakeColor( mActorId, mColorToSet );
- updateProxy.BakeScale( mActorId, mScaleToSet );
- updateProxy.GetSize( mActorId, mSizeAfterSetting );
- updateProxy.GetPosition( mActorId, mPositionAfterSetting );
- updateProxy.GetColor( mActorId, mColorAfterSetting );
- updateProxy.GetScale( mActorId, mScaleAfterSetting );
+ FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
+ updateProxy.BakeSize(mActorId, mSizeToSet);
+ updateProxy.BakePosition(mActorId, mPositionToSet);
+ updateProxy.BakeColor(mActorId, mColorToSet);
+ updateProxy.BakeScale(mActorId, mScaleToSet);
+ updateProxy.GetSize(mActorId, mSizeAfterSetting);
+ updateProxy.GetPosition(mActorId, mPositionAfterSetting);
+ updateProxy.GetColor(mActorId, mColorAfterSetting);
+ updateProxy.GetScale(mActorId, mScaleAfterSetting);
}
const unsigned int mActorId;
- const Vector3& mSizeToSet;
- const Vector3& mPositionToSet;
- const Vector4& mColorToSet;
- const Vector3& mScaleToSet;
+ const Vector3& mSizeToSet;
+ const Vector3& mPositionToSet;
+ const Vector4& mColorToSet;
+ const Vector3& mScaleToSet;
Vector3 mSizeAfterSetting;
Vector3 mPositionAfterSetting;
class FrameCallbackMultipleActors : public FrameCallbackBasic
{
public:
-
FrameCallbackMultipleActors()
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
- FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
- for( auto&& i : mActorIds )
+ FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
+ for(auto&& i : mActorIds)
{
Vector3 position;
Vector3 size;
- updateProxy.GetPositionAndSize( i, position, size );
- mPositions[ i ] = position;
- mSizes[ i ] = size;
+ updateProxy.GetPositionAndSize(i, position, size);
+ mPositions[i] = position;
+ mSizes[i] = size;
}
}
- Vector< unsigned int > mActorIds;
+ Vector<unsigned int> mActorIds;
- std::map< unsigned int, Vector3 > mPositions;
- std::map< unsigned int, Vector3 > mSizes;
+ std::map<unsigned int, Vector3> mPositions;
+ std::map<unsigned int, Vector3> mSizes;
};
class FrameCallbackActorIdCheck : public FrameCallbackBasic
{
public:
-
- FrameCallbackActorIdCheck( unsigned int actorId )
- : mActorId( actorId )
+ FrameCallbackActorIdCheck(unsigned int actorId)
+ : mActorId(actorId)
{
}
- virtual void Update( Dali::UpdateProxy& updateProxy, float elapsedSeconds ) override
+ virtual void Update(Dali::UpdateProxy& updateProxy, float elapsedSeconds) override
{
- FrameCallbackBasic::Update( updateProxy, elapsedSeconds );
+ FrameCallbackBasic::Update(updateProxy, elapsedSeconds);
Vector3 vec3;
Vector4 vec4;
- mGetSizeCallSuccess = updateProxy.GetSize( mActorId, vec3 );
- mGetPositionCallSuccess = updateProxy.GetPosition( mActorId, vec3 );
- mGetColorCallSuccess = updateProxy.GetColor( mActorId, vec4 );
- mGetScaleCallSuccess = updateProxy.GetScale( mActorId, vec3 );
- mGetPositionAndSizeCallSuccess = updateProxy.GetPositionAndSize( mActorId, vec3, vec3 );
- mSetSizeCallSuccess = updateProxy.SetSize( mActorId, vec3 );
- mSetPositionCallSuccess = updateProxy.SetPosition( mActorId, vec3 );
- mSetColorCallSuccess = updateProxy.SetColor( mActorId, vec4 );
- mSetScaleCallSuccess = updateProxy.SetScale( mActorId, vec3 );
- mBakeSizeCallSuccess = updateProxy.BakeSize( mActorId, vec3 );
- mBakePositionCallSuccess = updateProxy.BakePosition( mActorId, vec3 );
- mBakeColorCallSuccess = updateProxy.BakeColor( mActorId, vec4 );
- mBakeScaleCallSuccess = updateProxy.BakeScale( mActorId, vec3 );
+ mGetSizeCallSuccess = updateProxy.GetSize(mActorId, vec3);
+ mGetPositionCallSuccess = updateProxy.GetPosition(mActorId, vec3);
+ mGetColorCallSuccess = updateProxy.GetColor(mActorId, vec4);
+ mGetScaleCallSuccess = updateProxy.GetScale(mActorId, vec3);
+ mGetPositionAndSizeCallSuccess = updateProxy.GetPositionAndSize(mActorId, vec3, vec3);
+ mSetSizeCallSuccess = updateProxy.SetSize(mActorId, vec3);
+ mSetPositionCallSuccess = updateProxy.SetPosition(mActorId, vec3);
+ mSetColorCallSuccess = updateProxy.SetColor(mActorId, vec4);
+ mSetScaleCallSuccess = updateProxy.SetScale(mActorId, vec3);
+ mBakeSizeCallSuccess = updateProxy.BakeSize(mActorId, vec3);
+ mBakePositionCallSuccess = updateProxy.BakePosition(mActorId, vec3);
+ mBakeColorCallSuccess = updateProxy.BakeColor(mActorId, vec4);
+ mBakeScaleCallSuccess = updateProxy.BakeScale(mActorId, vec3);
}
virtual void Reset() override
// Up-call
FrameCallbackBasic::Reset();
- mGetSizeCallSuccess = false;
- mGetPositionCallSuccess = false;
- mGetColorCallSuccess = false;
- mGetScaleCallSuccess = false;
+ mGetSizeCallSuccess = false;
+ mGetPositionCallSuccess = false;
+ mGetColorCallSuccess = false;
+ mGetScaleCallSuccess = false;
mGetPositionAndSizeCallSuccess = false;
- mSetSizeCallSuccess = false;
- mSetPositionCallSuccess = false;
- mSetColorCallSuccess = false;
- mSetScaleCallSuccess = false;
- mBakeSizeCallSuccess = false;
- mBakePositionCallSuccess = false;
- mBakeColorCallSuccess = false;
- mBakeScaleCallSuccess = false;
+ mSetSizeCallSuccess = false;
+ mSetPositionCallSuccess = false;
+ mSetColorCallSuccess = false;
+ mSetScaleCallSuccess = false;
+ mBakeSizeCallSuccess = false;
+ mBakePositionCallSuccess = false;
+ mBakeColorCallSuccess = false;
+ mBakeScaleCallSuccess = false;
}
const uint32_t mActorId;
- bool mGetSizeCallSuccess{ false };
- bool mGetPositionCallSuccess{ false };
- bool mGetColorCallSuccess{ false };
- bool mGetScaleCallSuccess{ false };
- bool mGetPositionAndSizeCallSuccess{ false };
- bool mSetSizeCallSuccess{ false };
- bool mSetPositionCallSuccess{ false };
- bool mSetColorCallSuccess{ false };
- bool mSetScaleCallSuccess{ false };
- bool mBakeSizeCallSuccess{ false };
- bool mBakePositionCallSuccess{ false };
- bool mBakeColorCallSuccess{ false };
- bool mBakeScaleCallSuccess{ false };
+ bool mGetSizeCallSuccess{false};
+ bool mGetPositionCallSuccess{false};
+ bool mGetColorCallSuccess{false};
+ bool mGetScaleCallSuccess{false};
+ bool mGetPositionAndSizeCallSuccess{false};
+ bool mSetSizeCallSuccess{false};
+ bool mSetPositionCallSuccess{false};
+ bool mSetColorCallSuccess{false};
+ bool mSetScaleCallSuccess{false};
+ bool mBakeSizeCallSuccess{false};
+ bool mBakePositionCallSuccess{false};
+ bool mBakeColorCallSuccess{false};
+ bool mBakeScaleCallSuccess{false};
};
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
FrameCallbackBasic frameCallback;
Stage stage = Stage::GetCurrent();
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
frameCallback.mCalled = false;
- DevelStage::RemoveFrameCallback( stage, frameCallback );
+ DevelStage::RemoveFrameCallback(stage, frameCallback);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, false, TEST_LOCATION);
END_TEST;
}
// Test to see that the Getters all return the expected values
TestApplication application;
- Vector2 actorSize( 200, 300 );
- Vector4 color( 0.5f, 0.6f, 0.7f, 0.8f );
- Vector3 position( 10.0f, 20.0f, 30.0f );
- Vector3 scale( 2.0f, 4.0f, 6.0f );
+ Vector2 actorSize(200, 300);
+ Vector4 color(0.5f, 0.6f, 0.7f, 0.8f);
+ Vector3 position(10.0f, 20.0f, 30.0f);
+ Vector3 scale(2.0f, 4.0f, 6.0f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::SIZE, actorSize );
- actor.SetProperty( Actor::Property::COLOR, color );
- actor.SetProperty( Actor::Property::POSITION, position );
- actor.SetProperty( Actor::Property::SCALE, scale );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
+ actor.SetProperty(Actor::Property::COLOR, color);
+ actor.SetProperty(Actor::Property::POSITION, position);
+ actor.SetProperty(Actor::Property::SCALE, scale);
Stage stage = Stage::GetCurrent();
- stage.Add( actor );
+ stage.Add(actor);
- FrameCallbackOneActor frameCallback( actor.GetProperty< int >( Actor::Property::ID ) );
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ FrameCallbackOneActor frameCallback(actor.GetProperty<int>(Actor::Property::ID));
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizeGetSizeCall, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, position, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionGetPositionAndSizeCall, position, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizeGetPositionAndSizeCall, Vector3( actorSize.width, actorSize.height, 0.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mColor, color, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mScale, scale, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizeGetSizeCall, Vector3(actorSize.width, actorSize.height, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mPositionGetPositionCall, position, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mPositionGetPositionAndSizeCall, position, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizeGetPositionAndSizeCall, Vector3(actorSize.width, actorSize.height, 0.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mColor, color, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mScale, scale, TEST_LOCATION);
END_TEST;
}
// Test to see that the setters set the values appropriately
TestApplication application;
- Vector2 actorSize( 200, 300 );
+ Vector2 actorSize(200, 300);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::SIZE, actorSize );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
Stage stage = Stage::GetCurrent();
- stage.Add( actor );
+ stage.Add(actor);
- Vector3 sizeToSet( 1.0f, 2.0f, 3.0f );
- Vector3 positionToSet( 10.0f, 20.0f, 30.0f );
- Vector4 colorToSet( Color::MAGENTA );
- Vector3 scaleToSet( 1.0f, 3.0f, 5.0f );
+ Vector3 sizeToSet(1.0f, 2.0f, 3.0f);
+ Vector3 positionToSet(10.0f, 20.0f, 30.0f);
+ Vector4 colorToSet(Color::MAGENTA);
+ Vector3 scaleToSet(1.0f, 3.0f, 5.0f);
- FrameCallbackSetter frameCallback( actor.GetProperty< int >( Actor::Property::ID ), sizeToSet, positionToSet, colorToSet, scaleToSet );
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ FrameCallbackSetter frameCallback(actor.GetProperty<int>(Actor::Property::ID), sizeToSet, positionToSet, colorToSet, scaleToSet);
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION);
// Ensure the actual actor values haven't changed as we didn't bake the values after removing the callback
- DevelStage::RemoveFrameCallback( stage, frameCallback );
+ DevelStage::RemoveFrameCallback(stage, frameCallback);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>(), Vector3(actorSize), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get<Vector4>(), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get<Vector3>(), Vector3::ONE, TEST_LOCATION);
// Render for a couple more frames to ensure the values are reset properly (some values are double-buffered)
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>(), Vector3(actorSize), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get<Vector4>(), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get<Vector3>(), Vector3::ONE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), Vector3( actorSize ), TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), Color::WHITE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>(), Vector3(actorSize), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get<Vector4>(), Color::WHITE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get<Vector3>(), Vector3::ONE, TEST_LOCATION);
END_TEST;
}
// Test to see that the bake methods bake the values
TestApplication application;
- Vector2 actorSize( 200, 300 );
+ Vector2 actorSize(200, 300);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::SIZE, actorSize );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, actorSize);
Stage stage = Stage::GetCurrent();
- stage.Add( actor );
+ stage.Add(actor);
- Vector3 sizeToSet( 1.0f, 2.0f, 3.0f );
- Vector3 positionToSet( 10.0f, 20.0f, 30.0f );
- Vector4 colorToSet( Color::MAGENTA );
- Vector3 scaleToSet( 1.0f, 3.0f, 5.0f );
+ Vector3 sizeToSet(1.0f, 2.0f, 3.0f);
+ Vector3 positionToSet(10.0f, 20.0f, 30.0f);
+ Vector4 colorToSet(Color::MAGENTA);
+ Vector3 scaleToSet(1.0f, 3.0f, 5.0f);
- FrameCallbackBaker frameCallback( actor.GetProperty< int >( Actor::Property::ID ), sizeToSet, positionToSet, colorToSet, scaleToSet );
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ FrameCallbackBaker frameCallback(actor.GetProperty<int>(Actor::Property::ID), sizeToSet, positionToSet, colorToSet, scaleToSet);
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizeAfterSetting, sizeToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mPositionAfterSetting, positionToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mColorAfterSetting, colorToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mScaleAfterSetting, scaleToSet, TEST_LOCATION);
// Ensure the new values are saved after removing the callback
- DevelStage::RemoveFrameCallback( stage, frameCallback );
+ DevelStage::RemoveFrameCallback(stage, frameCallback);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::POSITION ).Get< Vector3 >(), positionToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SIZE ).Get< Vector3 >(), sizeToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::COLOR ).Get< Vector4 >(), colorToSet, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty( Actor::Property::SCALE ).Get< Vector3 >(), scaleToSet, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION).Get<Vector3>(), positionToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SIZE).Get<Vector3>(), sizeToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::COLOR).Get<Vector4>(), colorToSet, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::SCALE).Get<Vector3>(), scaleToSet, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliFrameCallbackMultipleActors(void)
{
/**
*/
TestApplication application;
- Stage stage = Stage::GetCurrent();
-
- std::map< char, Vector3 > sizes;
- sizes['A'] = Vector3( 50.0f, 50.0f, 0.0f );
- sizes['B'] = Vector3( 100.0f, 100.0f, 0.0f );
- sizes['C'] = Vector3( 150.0f, 150.0f, 0.0f );
- sizes['D'] = Vector3( 200.0f, 200.0f, 0.0f );
- sizes['E'] = Vector3( 250.0f, 250.0f, 0.0f );
- sizes['F'] = Vector3( 300.0f, 300.0f, 0.0f );
- sizes['G'] = Vector3( 350.0f, 350.0f, 0.0f );
- sizes['H'] = Vector3( 400.0f, 350.0f, 0.0f );
-
- std::map< char, Vector3 > positions;
- positions['A'] = Vector3( 0.0f, 1.0f, 2.0f );
- positions['B'] = Vector3( 2.0f, 3.0f, 4.0f );
- positions['C'] = Vector3( 5.0f, 6.0f, 7.0f );
- positions['D'] = Vector3( 8.0f, 9.0f, 10.0f );
- positions['E'] = Vector3( 11.0f, 12.0f, 13.0f );
- positions['F'] = Vector3( 14.0f, 15.0f, 16.0f );
- positions['G'] = Vector3( 17.0f, 18.0f, 19.0f );
- positions['H'] = Vector3( 20.0f, 21.0f, 22.0f );
+ Stage stage = Stage::GetCurrent();
+
+ std::map<char, Vector3> sizes;
+ sizes['A'] = Vector3(50.0f, 50.0f, 0.0f);
+ sizes['B'] = Vector3(100.0f, 100.0f, 0.0f);
+ sizes['C'] = Vector3(150.0f, 150.0f, 0.0f);
+ sizes['D'] = Vector3(200.0f, 200.0f, 0.0f);
+ sizes['E'] = Vector3(250.0f, 250.0f, 0.0f);
+ sizes['F'] = Vector3(300.0f, 300.0f, 0.0f);
+ sizes['G'] = Vector3(350.0f, 350.0f, 0.0f);
+ sizes['H'] = Vector3(400.0f, 350.0f, 0.0f);
+
+ std::map<char, Vector3> positions;
+ positions['A'] = Vector3(0.0f, 1.0f, 2.0f);
+ positions['B'] = Vector3(2.0f, 3.0f, 4.0f);
+ positions['C'] = Vector3(5.0f, 6.0f, 7.0f);
+ positions['D'] = Vector3(8.0f, 9.0f, 10.0f);
+ positions['E'] = Vector3(11.0f, 12.0f, 13.0f);
+ positions['F'] = Vector3(14.0f, 15.0f, 16.0f);
+ positions['G'] = Vector3(17.0f, 18.0f, 19.0f);
+ positions['H'] = Vector3(20.0f, 21.0f, 22.0f);
Actor actorA = Actor::New();
- actorA.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actorA.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorA.SetProperty( Actor::Property::SIZE, sizes['A'] );
- actorA.SetProperty( Actor::Property::POSITION, positions['A'] );
- stage.Add( actorA );
+ actorA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorA.SetProperty(Actor::Property::SIZE, sizes['A']);
+ actorA.SetProperty(Actor::Property::POSITION, positions['A']);
+ stage.Add(actorA);
Actor actorB = Actor::New();
- actorB.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT );
- actorB.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actorB.SetProperty( Actor::Property::SIZE, sizes['B'] );
- actorB.SetProperty( Actor::Property::POSITION, positions['B'] );
- actorA.Add( actorB );
+ actorB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT);
+ actorB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actorB.SetProperty(Actor::Property::SIZE, sizes['B']);
+ actorB.SetProperty(Actor::Property::POSITION, positions['B']);
+ actorA.Add(actorB);
Actor actorC = Actor::New();
- actorC.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER );
- actorC.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER );
- actorC.SetProperty( Actor::Property::SIZE, sizes['C'] );
- actorC.SetProperty( Actor::Property::POSITION, positions['C'] );
- actorB.Add( actorC );
+ actorC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
+ actorC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER);
+ actorC.SetProperty(Actor::Property::SIZE, sizes['C']);
+ actorC.SetProperty(Actor::Property::POSITION, positions['C']);
+ actorB.Add(actorC);
Actor actorD = Actor::New();
- actorD.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT );
- actorD.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- actorD.SetProperty( Actor::Property::SIZE, sizes['D'] );
- actorD.SetProperty( Actor::Property::POSITION, positions['D'] );
- actorA.Add( actorD );
+ actorD.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT);
+ actorD.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ actorD.SetProperty(Actor::Property::SIZE, sizes['D']);
+ actorD.SetProperty(Actor::Property::POSITION, positions['D']);
+ actorA.Add(actorD);
Actor actorE = Actor::New();
- actorE.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT );
- actorE.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
- actorE.SetProperty( Actor::Property::SIZE, sizes['E'] );
- actorE.SetProperty( Actor::Property::POSITION, positions['E'] );
- stage.Add( actorE );
+ actorE.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_LEFT);
+ actorE.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
+ actorE.SetProperty(Actor::Property::SIZE, sizes['E']);
+ actorE.SetProperty(Actor::Property::POSITION, positions['E']);
+ stage.Add(actorE);
Actor actorF = Actor::New();
- actorF.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER );
- actorF.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER );
- actorF.SetProperty( Actor::Property::SIZE, sizes['F'] );
- actorF.SetProperty( Actor::Property::POSITION, positions['F'] );
- actorE.Add( actorF );
+ actorF.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_CENTER);
+ actorF.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
+ actorF.SetProperty(Actor::Property::SIZE, sizes['F']);
+ actorF.SetProperty(Actor::Property::POSITION, positions['F']);
+ actorE.Add(actorF);
Actor actorG = Actor::New();
- actorG.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT );
- actorG.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- actorG.SetProperty( Actor::Property::SIZE, sizes['G'] );
- actorG.SetProperty( Actor::Property::POSITION, positions['G'] );
- actorE.Add( actorG );
+ actorG.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER_RIGHT);
+ actorG.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ actorG.SetProperty(Actor::Property::SIZE, sizes['G']);
+ actorG.SetProperty(Actor::Property::POSITION, positions['G']);
+ actorE.Add(actorG);
Actor actorH = Actor::New();
- actorH.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
- actorH.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT );
- actorH.SetProperty( Actor::Property::SIZE, sizes['H'] );
- actorH.SetProperty( Actor::Property::POSITION, positions['H'] );
- actorG.Add( actorH );
-
- std::map< char, unsigned int > actorIds;
- actorIds['A'] = actorA.GetProperty< int >( Actor::Property::ID );
- actorIds['B'] = actorB.GetProperty< int >( Actor::Property::ID );
- actorIds['C'] = actorC.GetProperty< int >( Actor::Property::ID );
- actorIds['D'] = actorD.GetProperty< int >( Actor::Property::ID );
- actorIds['E'] = actorE.GetProperty< int >( Actor::Property::ID );
- actorIds['F'] = actorF.GetProperty< int >( Actor::Property::ID );
- actorIds['G'] = actorG.GetProperty< int >( Actor::Property::ID );
- actorIds['H'] = actorH.GetProperty< int >( Actor::Property::ID );
+ actorH.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
+ actorH.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_LEFT);
+ actorH.SetProperty(Actor::Property::SIZE, sizes['H']);
+ actorH.SetProperty(Actor::Property::POSITION, positions['H']);
+ actorG.Add(actorH);
+
+ std::map<char, unsigned int> actorIds;
+ actorIds['A'] = actorA.GetProperty<int>(Actor::Property::ID);
+ actorIds['B'] = actorB.GetProperty<int>(Actor::Property::ID);
+ actorIds['C'] = actorC.GetProperty<int>(Actor::Property::ID);
+ actorIds['D'] = actorD.GetProperty<int>(Actor::Property::ID);
+ actorIds['E'] = actorE.GetProperty<int>(Actor::Property::ID);
+ actorIds['F'] = actorF.GetProperty<int>(Actor::Property::ID);
+ actorIds['G'] = actorG.GetProperty<int>(Actor::Property::ID);
+ actorIds['H'] = actorH.GetProperty<int>(Actor::Property::ID);
FrameCallbackMultipleActors frameCallback;
- for( auto&& i : actorIds )
+ for(auto&& i : actorIds)
{
- frameCallback.mActorIds.PushBack( i.second );
+ frameCallback.mActorIds.PushBack(i.second);
}
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
- for( char i = 'A'; i <= 'H'; ++i )
+ for(char i = 'A'; i <= 'H'; ++i)
{
- DALI_TEST_EQUALS( frameCallback.mPositions[ actorIds[ i ] ], positions[ i ], TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizes[ actorIds[ i ] ], sizes[ i ], TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mPositions[actorIds[i]], positions[i], TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizes[actorIds[i]], sizes[i], TEST_LOCATION);
}
// Render again to make sure it still gets called and gives the correct values (in case any optimisations break this)
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
- for( char i = 'A'; i <= 'H'; ++i )
+ for(char i = 'A'; i <= 'H'; ++i)
{
- DALI_TEST_EQUALS( frameCallback.mPositions[ actorIds[ i ] ], positions[ i ], TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizes[ actorIds[ i ] ], sizes[ i ], TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mPositions[actorIds[i]], positions[i], TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizes[actorIds[i]], sizes[i], TEST_LOCATION);
}
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 200, 300 ) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(200, 300));
- Stage stage = Stage::GetCurrent();
- FrameCallbackOneActor frameCallback( actor.GetProperty< int >( Actor::Property::ID ) );
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ Stage stage = Stage::GetCurrent();
+ FrameCallbackOneActor frameCallback(actor.GetProperty<int>(Actor::Property::ID));
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
// All should be default constructed objects
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mPositionGetPositionCall, Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSizeGetSizeCall, Vector3::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mColor, Vector4::ZERO, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mScale, Vector3::ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mPositionGetPositionCall, Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSizeGetSizeCall, Vector3::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mColor, Vector4::ZERO, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mScale, Vector3::ZERO, TEST_LOCATION);
END_TEST;
}
// Test to ensure that there are no issues when trying to use the update-proxy methods with an invalid actor ID.
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- FrameCallbackActorIdCheck frameCallback( 10000 );
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ FrameCallbackActorIdCheck frameCallback(10000);
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
// Invalid Actor ID so all the methods should not return successfully.
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION);
END_TEST;
}
// and then re-start calling the required methods if that actor is re-added back to the stage
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
- FrameCallbackActorIdCheck frameCallback( actor.GetProperty< int >( Actor::Property::ID ) );
- DevelStage::AddFrameCallback( stage, frameCallback, stage.GetRootLayer() );
+ FrameCallbackActorIdCheck frameCallback(actor.GetProperty<int>(Actor::Property::ID));
+ DevelStage::AddFrameCallback(stage, frameCallback, stage.GetRootLayer());
application.SendNotification();
application.Render();
// All methods should return successfully.
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION);
frameCallback.Reset();
// Remove the actor from stage, the methods should not return successfully.
- stage.Remove( actor );
+ stage.Remove(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, false, TEST_LOCATION);
frameCallback.Reset();
// Re-add the actor back to the stage, all the methods should once again, return successfully.
- stage.Add( actor );
+ stage.Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetColorCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetColorCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetColorCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetScaleCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mGetPositionAndSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetPositionCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetColorCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mSetScaleCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeSizeCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakePositionCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeColorCallSuccess, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback.mBakeScaleCallSuccess, true, TEST_LOCATION);
END_TEST;
}
// Test to ensure multiple frame-callbacks work as expected
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
FrameCallbackBasic frameCallback1;
FrameCallbackBasic frameCallback2;
- DevelStage::AddFrameCallback( stage, frameCallback1, stage.GetRootLayer() );
- DevelStage::AddFrameCallback( stage, frameCallback2, stage.GetRootLayer() );
+ DevelStage::AddFrameCallback(stage, frameCallback1, stage.GetRootLayer());
+ DevelStage::AddFrameCallback(stage, frameCallback2, stage.GetRootLayer());
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION);
frameCallback1.Reset();
frameCallback2.Reset();
// Remove the second frame-callback, only the first should be called
- DevelStage::RemoveFrameCallback( stage, frameCallback2 );
+ DevelStage::RemoveFrameCallback(stage, frameCallback2);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION);
frameCallback1.Reset();
frameCallback2.Reset();
// Re-add the second frame-callback and remove the first, only the second should be called
- DevelStage::AddFrameCallback( stage, frameCallback2, stage.GetRootLayer() );
- DevelStage::RemoveFrameCallback( stage, frameCallback1 );
+ DevelStage::AddFrameCallback(stage, frameCallback2, stage.GetRootLayer());
+ DevelStage::RemoveFrameCallback(stage, frameCallback1);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION);
frameCallback1.Reset();
frameCallback2.Reset();
// Attempt removal of the first frame-callback again, should be a no-op and yield the exact same results as the last run
- DevelStage::RemoveFrameCallback( stage, frameCallback1 );
+ DevelStage::RemoveFrameCallback(stage, frameCallback1);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION);
frameCallback1.Reset();
frameCallback2.Reset();
// Remove the second frame-callback as well, neither should be called
- DevelStage::RemoveFrameCallback( stage, frameCallback2 );
+ DevelStage::RemoveFrameCallback(stage, frameCallback2);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION);
END_TEST;
}
// Test to ensure that the frame-callback behaves gracefully if the connected root-actor is destroyed
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
FrameCallbackBasic frameCallback1;
FrameCallbackBasic frameCallback2;
- DevelStage::AddFrameCallback( stage, frameCallback1, actor );
- DevelStage::AddFrameCallback( stage, frameCallback2, actor );
+ DevelStage::AddFrameCallback(stage, frameCallback1, actor);
+ DevelStage::AddFrameCallback(stage, frameCallback2, actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, true, TEST_LOCATION);
frameCallback1.Reset();
frameCallback2.Reset();
// Remove the second frame-callback, only the first should be called
- DevelStage::RemoveFrameCallback( stage, frameCallback2 );
+ DevelStage::RemoveFrameCallback(stage, frameCallback2);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION);
frameCallback1.Reset();
frameCallback2.Reset();
// Remove and destroy the actor, the first one should not be called either
- stage.Remove( actor );
+ stage.Remove(actor);
actor.Reset();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback1.mCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( frameCallback2.mCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback1.mCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(frameCallback2.mCalled, false, TEST_LOCATION);
END_TEST;
}
// Ensure there's no segmentation fault if the callback is deleted without being removed
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
{
FrameCallbackBasic frameCallback;
- DevelStage::AddFrameCallback( stage, frameCallback, actor );
+ DevelStage::AddFrameCallback(stage, frameCallback, actor);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( frameCallback.mCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(frameCallback.mCalled, true, TEST_LOCATION);
frameCallback.Reset();
}
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( true ); // If it runs to here then there's no segmentation fault
+ DALI_TEST_CHECK(true); // If it runs to here then there's no segmentation fault
END_TEST;
}
// Ensure we don't connect the same frame-callback twice
TestApplication application;
- Stage stage = Stage::GetCurrent();
- Actor rootActor = stage.GetRootLayer();
+ Stage stage = Stage::GetCurrent();
+ Actor rootActor = stage.GetRootLayer();
FrameCallbackBasic frameCallback;
- DevelStage::AddFrameCallback( stage, frameCallback, rootActor );
+ DevelStage::AddFrameCallback(stage, frameCallback, rootActor);
try
{
- DevelStage::AddFrameCallback( stage, frameCallback, rootActor );
+ DevelStage::AddFrameCallback(stage, frameCallback, rootActor);
}
- catch( ... )
+ catch(...)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
namespace
{
+struct TexturedQuadVertex
+{
+ Vector2 position;
+ Vector2 textureCoordinates;
+};
-struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
-
-VertexBuffer CreateVertexBuffer( const std::string& aPosition, const std::string& aTexCoord )
+VertexBuffer CreateVertexBuffer(const std::string& aPosition, const std::string& aTexCoord)
{
- const float halfQuadSize = .5f;
+ const float halfQuadSize = .5f;
TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+ {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+ {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+ {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
Property::Map vertexFormat;
vertexFormat[aPosition] = Property::VECTOR2;
vertexFormat[aTexCoord] = Property::VECTOR2;
- VertexBuffer vertexData = VertexBuffer::New( vertexFormat );
- vertexData.SetData( texturedQuadVertexData, 4 );
+ VertexBuffer vertexData = VertexBuffer::New(vertexFormat);
+ vertexData.SetData(texturedQuadVertexData, 4);
return vertexData;
}
-
-}
-
+} // namespace
int UtcDaliGeometryNew01(void)
{
Geometry geometry = Geometry::New();
- DALI_TEST_EQUALS( (bool)geometry, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)geometry, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliGeometryNew02(void)
{
TestApplication application;
- Geometry geometry;
- DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION );
+ Geometry geometry;
+ DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
END_TEST;
}
Geometry geometryCopy(geometry);
- DALI_TEST_EQUALS( (bool)geometryCopy, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)geometryCopy, true, TEST_LOCATION);
END_TEST;
}
Geometry geometry = Geometry::New();
Geometry geometry2;
- DALI_TEST_EQUALS( (bool)geometry2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)geometry2, false, TEST_LOCATION);
geometry2 = geometry;
- DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Geometry geometry = Geometry::New();
- DALI_TEST_CHECK( geometry );
- DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
+ DALI_TEST_CHECK(geometry);
+ DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
- VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
- geometry.AddVertexBuffer( vertexBuffer );
- DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
+ VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
+ geometry.AddVertexBuffer(vertexBuffer);
+ DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
- Geometry move = std::move( geometry );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION );
- DALI_TEST_CHECK( !geometry );
+ Geometry move = std::move(geometry);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION);
+ DALI_TEST_CHECK(!geometry);
END_TEST;
}
TestApplication application;
Geometry geometry = Geometry::New();
- DALI_TEST_CHECK( geometry );
- DALI_TEST_EQUALS( 1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
+ DALI_TEST_CHECK(geometry);
+ DALI_TEST_EQUALS(1, geometry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
- VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
- geometry.AddVertexBuffer( vertexBuffer );
- DALI_TEST_EQUALS( 1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION );
+ VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
+ geometry.AddVertexBuffer(vertexBuffer);
+ DALI_TEST_EQUALS(1u, geometry.GetNumberOfVertexBuffers(), TEST_LOCATION);
Geometry move;
- move = std::move( geometry );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION );
- DALI_TEST_CHECK( !geometry );
+ move = std::move(geometry);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, move.GetNumberOfVertexBuffers(), TEST_LOCATION);
+ DALI_TEST_CHECK(!geometry);
END_TEST;
}
Geometry geometry = Geometry::New();
BaseHandle handle(geometry);
- Geometry geometry2 = Geometry::DownCast(handle);
- DALI_TEST_EQUALS( (bool)geometry2, true, TEST_LOCATION );
+ Geometry geometry2 = Geometry::DownCast(handle);
+ DALI_TEST_EQUALS((bool)geometry2, true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Handle handle = Handle::New(); // Create a custom object
+ Handle handle = Handle::New(); // Create a custom object
Geometry geometry = Geometry::DownCast(handle);
- DALI_TEST_EQUALS( (bool)geometry, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)geometry, false, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test AddVertexBuffer");
- VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
- Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer1 );
+ VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer(vertexBuffer1);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
{
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
+ application.GetGlAbstraction().GetBufferDataCalls();
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
}
// add the second vertex buffer
application.GetGlAbstraction().ResetBufferDataCalls();
- VertexBuffer vertexBuffer2 = CreateVertexBuffer( "aPosition2", "aTexCoord2" );
- geometry.AddVertexBuffer( vertexBuffer2 );
+ VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
+ geometry.AddVertexBuffer(vertexBuffer2);
application.SendNotification();
application.Render(0);
application.Render();
{
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
+ application.GetGlAbstraction().GetBufferDataCalls();
//Check that only the new buffer gets uploaded
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
}
END_TEST;
TestApplication application;
tet_infoline("Test GetNumberOfVertexBuffers");
- VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
- VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
- VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3" );
+ VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
+ VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
+ VertexBuffer vertexBuffer3 = CreateVertexBuffer("aPosition3", "aTexCoord3");
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer1 );
- DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
+ geometry.AddVertexBuffer(vertexBuffer1);
+ DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
- geometry.AddVertexBuffer( vertexBuffer2 );
- geometry.AddVertexBuffer( vertexBuffer3 );
- DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION );
+ geometry.AddVertexBuffer(vertexBuffer2);
+ geometry.AddVertexBuffer(vertexBuffer3);
+ DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 3u, TEST_LOCATION);
- geometry.RemoveVertexBuffer( 2u );
- DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION );
+ geometry.RemoveVertexBuffer(2u);
+ DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 2u, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test RemoveVertexBuffer");
- VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1" );
- VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2" );
+ VertexBuffer vertexBuffer1 = CreateVertexBuffer("aPosition1", "aTexCoord1");
+ VertexBuffer vertexBuffer2 = CreateVertexBuffer("aPosition2", "aTexCoord2");
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer1 );
+ geometry.AddVertexBuffer(vertexBuffer1);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
- DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
- geometry.RemoveVertexBuffer( 0 );
- geometry.AddVertexBuffer( vertexBuffer2 );
- DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION );
+ geometry.RemoveVertexBuffer(0);
+ geometry.AddVertexBuffer(vertexBuffer2);
+ DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 1u, TEST_LOCATION);
- geometry.RemoveVertexBuffer( 0 );
- DALI_TEST_EQUALS( geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION );
+ geometry.RemoveVertexBuffer(0);
+ DALI_TEST_EQUALS(geometry.GetNumberOfVertexBuffers(), 0u, TEST_LOCATION);
//Todo: test by checking the BufferDataCalls
// make sure the vertex buffer in actually removed from gl
- END_TEST;
+ END_TEST;
}
int UtcDaliGeometrySetIndexBuffer(void)
tet_infoline("Test SetIndexBuffer");
- VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+ VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer );
+ geometry.AddVertexBuffer(vertexBuffer);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
{
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
+ application.GetGlAbstraction().GetBufferDataCalls();
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( bufferDataCalls[0], 4*sizeof( TexturedQuadVertex ), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls[0], 4 * sizeof(TexturedQuadVertex), TEST_LOCATION);
}
// Set index buffer
application.GetGlAbstraction().ResetBufferDataCalls();
- const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
- geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+ const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
+ geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
application.SendNotification();
application.Render(0);
application.Render();
{
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
+ application.GetGlAbstraction().GetBufferDataCalls();
//Only the index buffer should be uploaded
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
// should be unsigned short instead of unsigned int
- DALI_TEST_EQUALS( bufferDataCalls[0], 6*sizeof( unsigned short ), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls[0], 6 * sizeof(unsigned short), TEST_LOCATION);
}
-
END_TEST;
}
tet_infoline("Test SetType and GetType: without index buffer");
- unsigned int numVertex = 4u;
- VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
+ unsigned int numVertex = 4u;
+ VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer );
+ geometry.AddVertexBuffer(vertexBuffer);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
/****************************************************/
// Default (TRIANGLES), no index buffer
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// Test the default geometry type is GL_TRIANGLE
// no index buffer, call glDrawArrays,
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
std::stringstream out;
out << GL_TRIANGLES << ", " << 0 << ", " << numVertex;
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
/*********************************************************/
// LINES, no index buffer
- geometry.SetType( Geometry::LINES );
+ geometry.SetType(Geometry::LINES);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_LINES
// no index buffer, call glDrawArrays,
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
out.str("");
out << GL_LINES << ", " << 0 << ", " << numVertex;
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
/*****************************************************/
//POINTS
- geometry.SetType( Geometry::POINTS );
+ geometry.SetType(Geometry::POINTS);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_POINTS
// no index buffer, call glDrawArrays,
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
out.str("");
out << GL_POINTS << ", " << 0 << ", " << numVertex;
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
/*****************************************************/
//TRIANGLE_STRIP, no index buffer
- geometry.SetType( Geometry::TRIANGLE_STRIP );
+ geometry.SetType(Geometry::TRIANGLE_STRIP);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_TRIANGLE_STRIP
// no index buffer, call glDrawArrays,
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
out.str("");
out << GL_TRIANGLE_STRIP << ", " << 0 << ", " << numVertex;
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
/*****************************************************/
//TRIANGLE_FAN, no index buffer
- geometry.SetType( Geometry::TRIANGLE_FAN );
+ geometry.SetType(Geometry::TRIANGLE_FAN);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_TRIANGLE_FAN
// no index buffer, call glDrawArrays,
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
out.str("");
out << GL_TRIANGLE_FAN << ", " << 0 << ", " << numVertex;
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test SetType and GetType: with index buffer");
- unsigned int numVertex = 4u;
- unsigned int numIndex = 6u; // 6 unsigned short
- VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord" );
-
+ unsigned int numVertex = 4u;
+ unsigned int numIndex = 6u; // 6 unsigned short
+ VertexBuffer vertexBuffer = CreateVertexBuffer("aPosition", "aTexCoord");
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer );
- const unsigned short indexData[6] = { 0, 3, 1, 0, 2, 3 };
- geometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
+ geometry.AddVertexBuffer(vertexBuffer);
+ const unsigned short indexData[6] = {0, 3, 1, 0, 2, 3};
+ geometry.SetIndexBuffer(indexData, sizeof(indexData) / sizeof(indexData[0]));
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
+ TraceCallStack& drawTrace = glAbstraction.GetDrawTrace();
/****************************************************/
// Default (TRIANGLES), with index buffer
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// Test the default geometry type is GL_TRIANGLE
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
std::stringstream out;
- out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+ out << GL_TRIANGLES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+ << "indices";
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLES, TEST_LOCATION);
/*********************************************************/
// LINES, with index buffer
- geometry.SetType( Geometry::LINES );
+ geometry.SetType(Geometry::LINES);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_LINES
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
out.str("");
- out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+ out << GL_LINES << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+ << "indices";
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::LINES, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::LINES, TEST_LOCATION);
/*****************************************************/
//POINTS
- geometry.SetType( Geometry::POINTS );
+ geometry.SetType(Geometry::POINTS);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_POINTS
// As Points does not use the index buffer, call glDrawArrays,
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawArrays" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawArrays"), 2, TEST_LOCATION);
out.str("");
out << GL_POINTS << ", " << 0 << ", " << numVertex;
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawArrays", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::POINTS, TEST_LOCATION);
/*****************************************************/
//TRIANGLE_STRIP
- geometry.SetType( Geometry::TRIANGLE_STRIP );
+ geometry.SetType(Geometry::TRIANGLE_STRIP);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_TRIANGLE_STRIP
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
out.str("");
- out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+ out << GL_TRIANGLE_STRIP << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+ << "indices";
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_STRIP, TEST_LOCATION);
/*****************************************************/
//TRIANGLE_FAN
- geometry.SetType( Geometry::TRIANGLE_FAN );
+ geometry.SetType(Geometry::TRIANGLE_FAN);
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
application.Render();
application.SendNotification();
- drawTrace.Enable( false );
+ drawTrace.Enable(false);
// geometry type is set as GL_TRIANGLE_FAN
- DALI_TEST_EQUALS( drawTrace.CountMethod( "DrawElements" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
out.str("");
- out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT<<", "<<"indices";
- DALI_TEST_EQUALS( drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
+ out << GL_TRIANGLE_FAN << ", " << numIndex << ", " << GL_UNSIGNED_SHORT << ", "
+ << "indices";
+ DALI_TEST_EQUALS(drawTrace.TestMethodAndParams(1, "DrawElements", out.str()), true, TEST_LOCATION);
- DALI_TEST_EQUALS( geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
+ DALI_TEST_EQUALS(geometry.GetType(), Geometry::TRIANGLE_FAN, TEST_LOCATION);
END_TEST;
}
int UtcDaliGeometrySetIndexBufferNegative(void)
{
TestApplication application;
- Dali::Geometry instance;
+ Dali::Geometry instance;
try
{
unsigned short* arg1(nullptr);
- unsigned long arg2(0u);
- instance.SetIndexBuffer(arg1,arg2);
+ unsigned long arg2(0u);
+ instance.SetIndexBuffer(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliGeometryAddVertexBufferNegative(void)
{
TestApplication application;
- Dali::Geometry instance;
+ Dali::Geometry instance;
try
{
Dali::VertexBuffer arg1;
int UtcDaliGeometryRemoveVertexBufferNegative(void)
{
TestApplication application;
- Dali::Geometry instance;
+ Dali::Geometry instance;
try
{
unsigned long arg1(0u);
int UtcDaliGeometrySetTypeNegative(void)
{
TestApplication application;
- Dali::Geometry instance;
+ Dali::Geometry instance;
try
{
Dali::Geometry::Type arg1(Geometry::POINTS);
int UtcDaliGeometryGetNumberOfVertexBuffersNegative(void)
{
TestApplication application;
- Dali::Geometry instance;
+ Dali::Geometry instance;
try
{
instance.GetNumberOfVertexBuffers();
int UtcDaliGeometryGetTypeNegative(void)
{
TestApplication application;
- Dali::Geometry instance;
+ Dali::Geometry instance;
try
{
instance.GetType();
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
+
#include <algorithm>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-
int UtcDaliGestureDetectorConstructorN(void)
{
TestApplication application;
detector.Attach(actor);
tet_result(TET_FAIL);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "detector", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "detector", TEST_LOCATION);
}
END_TEST;
}
detector.Attach(actor);
tet_result(TET_PASS);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_FAIL);
}
END_TEST;
detector2.Attach(actor);
tet_result(TET_PASS);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_FAIL);
}
END_TEST;
GestureDetector detector2 = GestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- GestureDetector detector3 = DownCast< GestureDetector >(object);
+ GestureDetector detector3 = DownCast<GestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
GestureDetector detector4 = GestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- GestureDetector detector5 = DownCast< GestureDetector >(unInitializedObject);
+ GestureDetector detector5 = DownCast<GestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
END_TEST;
}
bool found = false;
for(size_t i = 0; i < detector.GetAttachedActorCount(); i++)
{
- if( detector.GetAttachedActor(i) == actor )
+ if(detector.GetAttachedActor(i) == actor)
{
tet_result(TET_PASS);
found = true;
detector.Attach(actor);
tet_result(TET_FAIL);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "actor", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
}
END_TEST;
}
bool found = false;
for(size_t i = 0; i < detector.GetAttachedActorCount(); i++)
{
- if( detector.GetAttachedActor(i) == actor )
+ if(detector.GetAttachedActor(i) == actor)
{
tet_result(TET_PASS);
found = true;
found = false;
for(size_t i = 0; i < detector.GetAttachedActorCount(); i++)
{
- if( detector.GetAttachedActor(i) == actor )
+ if(detector.GetAttachedActor(i) == actor)
{
found = true;
}
detector.Detach(actor);
tet_result(TET_FAIL);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "actor", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "actor", TEST_LOCATION);
}
END_TEST;
}
detector.Detach(actor2);
tet_result(TET_PASS);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_FAIL);
}
END_TEST;
detector.Detach(actor);
detector.Detach(actor);
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_FAIL);
}
const unsigned int actorsToAdd = 5;
std::vector<Actor> myActors;
- for (unsigned int i = 0; i < actorsToAdd; ++i)
+ for(unsigned int i = 0; i < actorsToAdd; ++i)
{
Actor actor = Actor::New();
myActors.push_back(actor);
const unsigned int actorsToAdd = 5;
std::vector<Actor> myActors;
- for (unsigned int i = 0; i < actorsToAdd; ++i)
+ for(unsigned int i = 0; i < actorsToAdd; ++i)
{
Actor actor = Actor::New();
myActors.push_back(actor);
{
detector.DetachAll();
}
- catch (DaliException& e)
+ catch(DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_FAIL);
}
END_TEST;
// Attach another five actors
std::vector<Actor> myActors;
- for (unsigned int i = 0; i < 5; ++i)
+ for(unsigned int i = 0; i < 5; ++i)
{
Actor actor = Actor::New();
myActors.push_back(actor);
// Use pinch gesture as that doen't currently have any properties. Will need to change it if default properties are added.
GestureDetector detector = PinchGestureDetector::New();
- DALI_TEST_EQUALS( detector.GetPropertyCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetPropertyCount(), 0u, TEST_LOCATION);
Property::IndexContainer indices;
- detector.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.Size(), 0u, TEST_LOCATION );
+ detector.GetPropertyIndices(indices);
+ DALI_TEST_EQUALS(indices.Size(), 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( detector.IsPropertyWritable( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.IsPropertyAnimatable( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.IsPropertyAConstraintInput( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetPropertyType( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ), Property::NONE, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetPropertyIndex( "InvalidIndex" ), Property::INVALID_INDEX, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.IsPropertyWritable(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.IsPropertyAnimatable(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.IsPropertyAConstraintInput(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetPropertyType(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX), Property::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetPropertyIndex("InvalidIndex"), Property::INVALID_INDEX, TEST_LOCATION);
- Property::Value propValue = detector.GetProperty( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX );
- DALI_TEST_EQUALS( propValue.GetType(), Property::NONE, TEST_LOCATION );
+ Property::Value propValue = detector.GetProperty(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX);
+ DALI_TEST_EQUALS(propValue.GetType(), Property::NONE, TEST_LOCATION);
- DALI_TEST_CHECK( detector.GetPropertyName( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX ).empty() );
+ DALI_TEST_CHECK(detector.GetPropertyName(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX).empty());
// For coverage only, not testable
- detector.SetProperty( DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX, true );
+ detector.SetProperty(DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX, true);
END_TEST;
}
GestureDetector detector = PinchGestureDetector::New();
- Property::Index index = detector.RegisterProperty( "sceneProperty", 0 );
- DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+ Property::Index index = detector.RegisterProperty("sceneProperty", 0);
+ DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), 0, TEST_LOCATION);
- detector.SetProperty( index, -123 );
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+ detector.SetProperty(index, -123);
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), -123, TEST_LOCATION);
using Dali::Animation;
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( detector, index ), 99 );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(detector, index), 99);
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -123, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), -123, TEST_LOCATION);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( 1000 /* 100% progress */);
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99, TEST_LOCATION );
+ application.Render(1000 /* 100% progress */);
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), 99, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-#include <typeinfo>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/object/handle-devel.h>
+#include <dali/public-api/dali-core.h>
+#include <mesh-builder.h>
+#include <stdlib.h>
+
+#include <iostream>
+#include <typeinfo>
+
#include "dali-test-suite-utils/dali-test-suite-utils.h"
#include "dali-test-suite-utils/test-custom-actor.h"
-#include <mesh-builder.h>
-
using namespace Dali;
void handle_test_startup(void)
namespace
{
-
/// Allows the creation of a BaseObject
class BaseObjectType : public BaseObject
{
{
// object + copy + passedByValue, ref count == 3
DALI_TEST_CHECK(passedByValue);
- if (passedByValue)
+ if(passedByValue)
{
DALI_TEST_EQUALS(3, passedByValue.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
return passedByValue;
}
-} // anon namespace
-
+} // namespace
int UtcDaliHandleConstructorVoid(void)
{
// Copy the object, ref count == 2
Handle copy(object);
DALI_TEST_CHECK(copy);
- if (copy)
+ if(copy)
{
DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
Handle anotherCopy = ImplicitCopyConstructor(copy);
DALI_TEST_CHECK(anotherCopy);
- if (anotherCopy)
+ if(anotherCopy)
{
DALI_TEST_EQUALS(3, anotherCopy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
// anotherCopy out of scope, ref count == 2
DALI_TEST_CHECK(copy);
- if (copy)
+ if(copy)
{
DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
// Initialize a handle, ref count == 1
Handle handle = Actor::New();
- DALI_TEST_EQUALS( 1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- int value( 20 );
- Property::Index index = handle.RegisterProperty( "customProperty", value );
- DALI_TEST_CHECK( handle.GetProperty<int>( index ) == value );
+ int value(20);
+ Property::Index index = handle.RegisterProperty("customProperty", value);
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == value);
// Move the object, ref count == 1
- Handle move = std::move( handle );
- DALI_TEST_CHECK( move );
+ Handle move = std::move(handle);
+ DALI_TEST_CHECK(move);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( move.GetProperty<int>( index ) == value );
- DALI_TEST_CHECK( !handle );
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(move.GetProperty<int>(index) == value);
+ DALI_TEST_CHECK(!handle);
END_TEST;
}
// Initialize a handle, ref count == 1
Handle handle = Actor::New();
- DALI_TEST_EQUALS( 1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, handle.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- int value( 20 );
- Property::Index index = handle.RegisterProperty( "customProperty", value );
- DALI_TEST_CHECK( handle.GetProperty<int>( index ) == value );
+ int value(20);
+ Property::Index index = handle.RegisterProperty("customProperty", value);
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == value);
// Move the object, ref count == 1
Handle move;
- move = std::move( handle );
- DALI_TEST_CHECK( move );
+ move = std::move(handle);
+ DALI_TEST_CHECK(move);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( move.GetProperty<int>( index ) == value );
- DALI_TEST_CHECK( !handle );
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(move.GetProperty<int>(index) == value);
+ DALI_TEST_CHECK(!handle);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( true == actor.Supports( Handle::DYNAMIC_PROPERTIES ) );
+ DALI_TEST_CHECK(true == actor.Supports(Handle::DYNAMIC_PROPERTIES));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- int defaultPropertyCount( actor.GetPropertyCount() );
+ int defaultPropertyCount(actor.GetPropertyCount());
// Register a dynamic property
- actor.RegisterProperty( "testProperty", float(123.0f) );
- DALI_TEST_CHECK( (defaultPropertyCount + 1u) == actor.GetPropertyCount() );
+ actor.RegisterProperty("testProperty", float(123.0f));
+ DALI_TEST_CHECK((defaultPropertyCount + 1u) == actor.GetPropertyCount());
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( "parentOrigin" == actor.GetPropertyName( Actor::Property::PARENT_ORIGIN ) );
+ DALI_TEST_CHECK("parentOrigin" == actor.GetPropertyName(Actor::Property::PARENT_ORIGIN));
// Register a dynamic property
- std::string name("thisNameShouldMatch");
- Property::Index index = actor.RegisterProperty( name, float(123.0f) );
- DALI_TEST_CHECK( name == actor.GetPropertyName( index ) );
+ std::string name("thisNameShouldMatch");
+ Property::Index index = actor.RegisterProperty(name, float(123.0f));
+ DALI_TEST_CHECK(name == actor.GetPropertyName(index));
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin") );
+ DALI_TEST_CHECK(Actor::Property::PARENT_ORIGIN == actor.GetPropertyIndex("parentOrigin"));
// Register a dynamic property
- std::string name("thisNameShouldMatch");
- Property::Index index = actor.RegisterProperty( name, float(123.0f) );
- DALI_TEST_CHECK( index == actor.GetPropertyIndex( name ) );
+ std::string name("thisNameShouldMatch");
+ Property::Index index = actor.RegisterProperty(name, float(123.0f));
+ DALI_TEST_CHECK(index == actor.GetPropertyIndex(name));
END_TEST;
}
Integration::Scene stage = application.GetScene();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
const unsigned int defaultPropertyCount = actor.GetPropertyCount();
application.SendNotification();
application.Render();
- Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
- Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
+ Property::Index key1 = CORE_PROPERTY_MAX_INDEX + 1;
+ Property::Index key2 = CORE_PROPERTY_MAX_INDEX + 2;
const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
- const float withFlake(99.f);
+ const float withFlake(99.f);
- Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
- Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor);
- Property::Index index3 = actor.RegisterProperty( "MyPropertyTwo", Vector3::ONE );
- Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake );
- Property::Index index5 = actor.RegisterProperty( "MyPropertyThree", Vector3::ONE );
+ Property::Index index1 = actor.RegisterProperty("MyPropertyOne", Vector3::ONE);
+ Property::Index index2 = actor.RegisterProperty(key1, "sideColor", testColor);
+ Property::Index index3 = actor.RegisterProperty("MyPropertyTwo", Vector3::ONE);
+ Property::Index index4 = actor.RegisterProperty(key2, "iceCream", withFlake);
+ Property::Index index5 = actor.RegisterProperty("MyPropertyThree", Vector3::ONE);
application.SendNotification();
application.Render();
// Test that we can get the property index from the integer key
- Property::Index testIndex1 = actor.GetPropertyIndex( key1 );
- Property::Index testIndex2 = actor.GetPropertyIndex( key2 );
+ Property::Index testIndex1 = actor.GetPropertyIndex(key1);
+ Property::Index testIndex2 = actor.GetPropertyIndex(key2);
- DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION );
- DALI_TEST_EQUALS( index4, testIndex2, TEST_LOCATION );
+ DALI_TEST_EQUALS(index2, testIndex1, TEST_LOCATION);
+ DALI_TEST_EQUALS(index4, testIndex2, TEST_LOCATION);
// Test that we keep the same indices on the named properties
Property::Index testIndex = actor.GetPropertyIndex("MyPropertyOne");
testIndex = actor.GetPropertyIndex("iceCream");
DALI_TEST_EQUALS(testIndex, index4, TEST_LOCATION);
- DALI_TEST_EQUALS(defaultPropertyCount+5, actor.GetPropertyCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(defaultPropertyCount + 5, actor.GetPropertyCount(), TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- std::string myName("croydon");
- Property::Index intKey = CORE_PROPERTY_MAX_INDEX+1;
- Property::Value value( Color::GREEN );
- Property::Index myIndex = actor.RegisterProperty( intKey, myName, value );
+ std::string myName("croydon");
+ Property::Index intKey = CORE_PROPERTY_MAX_INDEX + 1;
+ Property::Value value(Color::GREEN);
+ Property::Index myIndex = actor.RegisterProperty(intKey, myName, value);
- DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( intKey ), TEST_LOCATION );
+ DALI_TEST_EQUALS(myIndex, actor.GetPropertyIndex(intKey), TEST_LOCATION);
Property::Key key1(myName);
Property::Key key2(intKey);
- DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( myIndex, actor.GetPropertyIndex( key2 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(myIndex, actor.GetPropertyIndex(key1), TEST_LOCATION);
+ DALI_TEST_EQUALS(myIndex, actor.GetPropertyIndex(key2), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliHandleIsPropertyWritable(void)
{
tet_infoline("Positive Test Dali::Handle::IsPropertyWritable()");
Actor actor = Actor::New();
// Actor properties which are writable:
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::PARENT_ORIGIN_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ANCHOR_POINT_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_WIDTH ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_HEIGHT ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SIZE_DEPTH ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::POSITION_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::ORIENTATION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::SCALE_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::VISIBLE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_RED ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_GREEN ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_BLUE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::COLOR_ALPHA ) );
- DALI_TEST_CHECK( true == actor.IsPropertyWritable( Actor::Property::OPACITY ) );
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::PARENT_ORIGIN_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ANCHOR_POINT_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE_WIDTH));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE_HEIGHT));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SIZE_DEPTH));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::POSITION_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::ORIENTATION));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::SCALE_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::VISIBLE));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_RED));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_GREEN));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_BLUE));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::COLOR_ALPHA));
+ DALI_TEST_CHECK(true == actor.IsPropertyWritable(Actor::Property::OPACITY));
// World-properties are not writable:
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_ORIENTATION ) );
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_SCALE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_COLOR ) );
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_X ) );
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Y ) );
- DALI_TEST_CHECK( false == actor.IsPropertyWritable( Actor::Property::WORLD_POSITION_Z ) );
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION));
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_ORIENTATION));
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_SCALE));
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_COLOR));
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION_X));
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION_Y));
+ DALI_TEST_CHECK(false == actor.IsPropertyWritable(Actor::Property::WORLD_POSITION_Z));
END_TEST;
}
Actor actor = Actor::New();
// Actor properties which are animatable:
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_X ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Y ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::PARENT_ORIGIN_Z ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_X ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Y ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::ANCHOR_POINT_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_WIDTH ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_HEIGHT ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SIZE_DEPTH ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::POSITION_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::ORIENTATION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::SCALE_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::VISIBLE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_RED ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_GREEN ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_BLUE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::COLOR_ALPHA ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAnimatable( Actor::Property::OPACITY ) );
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN_X));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN_Y));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::PARENT_ORIGIN_Z));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT_X));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT_Y));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::ANCHOR_POINT_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE_WIDTH));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE_HEIGHT));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SIZE_DEPTH));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::POSITION_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::ORIENTATION));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::SCALE_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::VISIBLE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_RED));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_GREEN));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_BLUE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::COLOR_ALPHA));
+ DALI_TEST_CHECK(true == actor.IsPropertyAnimatable(Actor::Property::OPACITY));
// World-properties can not be animated
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_ORIENTATION ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_SCALE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_COLOR ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_X ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Y ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAnimatable( Actor::Property::WORLD_POSITION_Z ) );
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_ORIENTATION));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_SCALE));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_COLOR));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION_X));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION_Y));
+ DALI_TEST_CHECK(false == actor.IsPropertyAnimatable(Actor::Property::WORLD_POSITION_Z));
END_TEST;
}
Actor actor = Actor::New();
// Actor properties which can be used as a constraint input:
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::PARENT_ORIGIN_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ANCHOR_POINT_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_WIDTH ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_HEIGHT ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_DEPTH ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::POSITION_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::ORIENTATION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::SCALE_Z ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::VISIBLE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_RED ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_GREEN ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_BLUE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_ALPHA ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::OPACITY ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_ORIENTATION ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_SCALE ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_COLOR ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_X ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Y ) );
- DALI_TEST_CHECK( true == actor.IsPropertyAConstraintInput( Actor::Property::WORLD_POSITION_Z ) );
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::PARENT_ORIGIN_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ANCHOR_POINT_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_WIDTH));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_HEIGHT));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_DEPTH));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::POSITION_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::ORIENTATION));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::SCALE_Z));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::VISIBLE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_RED));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_GREEN));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_BLUE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_ALPHA));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::OPACITY));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_ORIENTATION));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_SCALE));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_COLOR));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION_X));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION_Y));
+ DALI_TEST_CHECK(true == actor.IsPropertyAConstraintInput(Actor::Property::WORLD_POSITION_Z));
// Actor properties that cannot be used as a constraint input
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::NAME ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SENSITIVE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::LEAVE_REQUIRED ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_ORIENTATION ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::INHERIT_SCALE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::COLOR_MODE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::DRAW_MODE ) );
- DALI_TEST_CHECK( false == actor.IsPropertyAConstraintInput( Actor::Property::SIZE_MODE_FACTOR ) );
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::NAME));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::SENSITIVE));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::LEAVE_REQUIRED));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::INHERIT_ORIENTATION));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::INHERIT_SCALE));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::COLOR_MODE));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::DRAW_MODE));
+ DALI_TEST_CHECK(false == actor.IsPropertyAConstraintInput(Actor::Property::SIZE_MODE_FACTOR));
END_TEST;
}
-
int UtcDaliHandleGetPropertyType(void)
{
tet_infoline("Positive Test Dali::Handle::GetPropertyType()");
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::PARENT_ORIGIN ) );
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::ANCHOR_POINT ) );
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::SIZE ) );
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::POSITION ) );
- DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( Actor::Property::ORIENTATION ) );
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( Actor::Property::SCALE ) );
- DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( Actor::Property::VISIBLE ) );
- DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( Actor::Property::COLOR ) );
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::PARENT_ORIGIN));
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::ANCHOR_POINT));
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::SIZE));
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::POSITION));
+ DALI_TEST_CHECK(Property::ROTATION == actor.GetPropertyType(Actor::Property::ORIENTATION));
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(Actor::Property::SCALE));
+ DALI_TEST_CHECK(Property::BOOLEAN == actor.GetPropertyType(Actor::Property::VISIBLE));
+ DALI_TEST_CHECK(Property::VECTOR4 == actor.GetPropertyType(Actor::Property::COLOR));
// Register some dynamic properties
- Property::Index boolIndex = actor.RegisterProperty( "boolProperty", bool(true) );
- Property::Index floatIndex = actor.RegisterProperty( "floatProperty", float(123.0f) );
- Property::Index intIndex = actor.RegisterProperty( "intProperty", 123 );
- Property::Index vector2Index = actor.RegisterProperty( "vector2Property", Vector2(1.0f, 2.0f) );
- Property::Index vector3Index = actor.RegisterProperty( "vector3Property", Vector3(1.0f, 2.0f, 3.0f) );
- Property::Index vector4Index = actor.RegisterProperty( "vector4Property", Vector4(1.0f, 2.0f, 3.0f, 4.0f) );
- Property::Index rotationIndex = actor.RegisterProperty( "rotationProperty", AngleAxis(Degree(180.0f), Vector3::YAXIS) );
-
- DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( boolIndex ) );
- DALI_TEST_CHECK( Property::FLOAT == actor.GetPropertyType( floatIndex ) );
- DALI_TEST_CHECK( Property::INTEGER == actor.GetPropertyType( intIndex ) );
- DALI_TEST_CHECK( Property::VECTOR2 == actor.GetPropertyType( vector2Index ) );
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( vector3Index ) );
- DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( vector4Index ) );
- DALI_TEST_CHECK( Property::ROTATION == actor.GetPropertyType( rotationIndex ) );
+ Property::Index boolIndex = actor.RegisterProperty("boolProperty", bool(true));
+ Property::Index floatIndex = actor.RegisterProperty("floatProperty", float(123.0f));
+ Property::Index intIndex = actor.RegisterProperty("intProperty", 123);
+ Property::Index vector2Index = actor.RegisterProperty("vector2Property", Vector2(1.0f, 2.0f));
+ Property::Index vector3Index = actor.RegisterProperty("vector3Property", Vector3(1.0f, 2.0f, 3.0f));
+ Property::Index vector4Index = actor.RegisterProperty("vector4Property", Vector4(1.0f, 2.0f, 3.0f, 4.0f));
+ Property::Index rotationIndex = actor.RegisterProperty("rotationProperty", AngleAxis(Degree(180.0f), Vector3::YAXIS));
+
+ DALI_TEST_CHECK(Property::BOOLEAN == actor.GetPropertyType(boolIndex));
+ DALI_TEST_CHECK(Property::FLOAT == actor.GetPropertyType(floatIndex));
+ DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(intIndex));
+ DALI_TEST_CHECK(Property::VECTOR2 == actor.GetPropertyType(vector2Index));
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(vector3Index));
+ DALI_TEST_CHECK(Property::VECTOR4 == actor.GetPropertyType(vector4Index));
+ DALI_TEST_CHECK(Property::ROTATION == actor.GetPropertyType(rotationIndex));
// Non animatable properties
- Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("yes"), Property::READ_WRITE);
- Property::Index nonAnimV2Index = actor.RegisterProperty( "v2", Vector2(1.f, 2.f), Property::READ_WRITE);
- Property::Index nonAnimV3Index = actor.RegisterProperty( "v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE);
- Property::Index nonAnimV4Index = actor.RegisterProperty( "v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE);
- Property::Index nonAnimBooleanIndex = actor.RegisterProperty( "bool", true, Property::READ_WRITE);
- Property::Index nonAnimFloatIndex = actor.RegisterProperty( "float", 0.f, Property::READ_WRITE);
- Property::Index nonAnimIntegerIndex = actor.RegisterProperty( "int", 0, Property::READ_WRITE);
-
- DALI_TEST_CHECK( nonAnimStringIndex != Property::INVALID_INDEX );
- DALI_TEST_CHECK( nonAnimV2Index != Property::INVALID_INDEX );
- DALI_TEST_CHECK( nonAnimV3Index != Property::INVALID_INDEX );
- DALI_TEST_CHECK( nonAnimV4Index != Property::INVALID_INDEX );
- DALI_TEST_CHECK( nonAnimBooleanIndex != Property::INVALID_INDEX );
- DALI_TEST_CHECK( nonAnimFloatIndex != Property::INVALID_INDEX );
- DALI_TEST_CHECK( nonAnimIntegerIndex != Property::INVALID_INDEX );
-
- DALI_TEST_CHECK( Property::STRING == actor.GetPropertyType( nonAnimStringIndex ) );
- DALI_TEST_CHECK( Property::VECTOR2 == actor.GetPropertyType( nonAnimV2Index ) );
- DALI_TEST_CHECK( Property::VECTOR3 == actor.GetPropertyType( nonAnimV3Index ) );
- DALI_TEST_CHECK( Property::VECTOR4 == actor.GetPropertyType( nonAnimV4Index ) );
- DALI_TEST_CHECK( Property::BOOLEAN == actor.GetPropertyType( nonAnimBooleanIndex ) );
- DALI_TEST_CHECK( Property::FLOAT == actor.GetPropertyType( nonAnimFloatIndex ) );
- DALI_TEST_CHECK( Property::INTEGER == actor.GetPropertyType( nonAnimIntegerIndex ) );
-
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimStringIndex ) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV2Index ) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV3Index ) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimV4Index ) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimBooleanIndex ) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimFloatIndex ) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable( nonAnimIntegerIndex ) );
-
- DALI_TEST_EQUALS( "yes" , actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2(1.f, 2.f) , actor.GetProperty( nonAnimV2Index ).Get<Vector2>(), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3(1.f, 2.f, 3.f) , actor.GetProperty( nonAnimV3Index ).Get<Vector3>(), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector4(1.f, 2.f, 3.f, 4.f) , actor.GetProperty( nonAnimV4Index ).Get<Vector4>(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, actor.GetProperty( nonAnimBooleanIndex ).Get<bool>(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0.f, actor.GetProperty( nonAnimFloatIndex ).Get<float>(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, actor.GetProperty( nonAnimIntegerIndex ).Get<int>(), TEST_LOCATION );
+ Property::Index nonAnimStringIndex = actor.RegisterProperty("manFromDelmonte", std::string("yes"), Property::READ_WRITE);
+ Property::Index nonAnimV2Index = actor.RegisterProperty("v2", Vector2(1.f, 2.f), Property::READ_WRITE);
+ Property::Index nonAnimV3Index = actor.RegisterProperty("v3", Vector3(1.f, 2.f, 3.f), Property::READ_WRITE);
+ Property::Index nonAnimV4Index = actor.RegisterProperty("v4", Vector4(1.f, 2.f, 3.f, 4.f), Property::READ_WRITE);
+ Property::Index nonAnimBooleanIndex = actor.RegisterProperty("bool", true, Property::READ_WRITE);
+ Property::Index nonAnimFloatIndex = actor.RegisterProperty("float", 0.f, Property::READ_WRITE);
+ Property::Index nonAnimIntegerIndex = actor.RegisterProperty("int", 0, Property::READ_WRITE);
+
+ DALI_TEST_CHECK(nonAnimStringIndex != Property::INVALID_INDEX);
+ DALI_TEST_CHECK(nonAnimV2Index != Property::INVALID_INDEX);
+ DALI_TEST_CHECK(nonAnimV3Index != Property::INVALID_INDEX);
+ DALI_TEST_CHECK(nonAnimV4Index != Property::INVALID_INDEX);
+ DALI_TEST_CHECK(nonAnimBooleanIndex != Property::INVALID_INDEX);
+ DALI_TEST_CHECK(nonAnimFloatIndex != Property::INVALID_INDEX);
+ DALI_TEST_CHECK(nonAnimIntegerIndex != Property::INVALID_INDEX);
+
+ DALI_TEST_CHECK(Property::STRING == actor.GetPropertyType(nonAnimStringIndex));
+ DALI_TEST_CHECK(Property::VECTOR2 == actor.GetPropertyType(nonAnimV2Index));
+ DALI_TEST_CHECK(Property::VECTOR3 == actor.GetPropertyType(nonAnimV3Index));
+ DALI_TEST_CHECK(Property::VECTOR4 == actor.GetPropertyType(nonAnimV4Index));
+ DALI_TEST_CHECK(Property::BOOLEAN == actor.GetPropertyType(nonAnimBooleanIndex));
+ DALI_TEST_CHECK(Property::FLOAT == actor.GetPropertyType(nonAnimFloatIndex));
+ DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(nonAnimIntegerIndex));
+
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimStringIndex));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimV2Index));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimV3Index));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimV4Index));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimBooleanIndex));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimFloatIndex));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(nonAnimIntegerIndex));
+
+ DALI_TEST_EQUALS("yes", actor.GetProperty(nonAnimStringIndex).Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(1.f, 2.f), actor.GetProperty(nonAnimV2Index).Get<Vector2>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(1.f, 2.f, 3.f), actor.GetProperty(nonAnimV3Index).Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4(1.f, 2.f, 3.f, 4.f), actor.GetProperty(nonAnimV4Index).Get<Vector4>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, actor.GetProperty(nonAnimBooleanIndex).Get<bool>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.f, actor.GetProperty(nonAnimFloatIndex).Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, actor.GetProperty(nonAnimIntegerIndex).Get<int>(), TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Property::Index nonAnimStringIndex = actor.RegisterProperty( "manFromDelmonte", std::string("no"), Property::READ_WRITE);
+ Property::Index nonAnimStringIndex = actor.RegisterProperty("manFromDelmonte", std::string("no"), Property::READ_WRITE);
//// modify writable?
- actor.SetProperty( nonAnimStringIndex, Property::Value("yes") );
+ actor.SetProperty(nonAnimStringIndex, Property::Value("yes"));
- DALI_TEST_CHECK( "yes" == actor.GetProperty( nonAnimStringIndex ).Get<std::string>() );
+ DALI_TEST_CHECK("yes" == actor.GetProperty(nonAnimStringIndex).Get<std::string>());
//// cannot modify read only?
- Property::Index readonly = actor.RegisterProperty( "float", 0.f, Property::READ_ONLY);
+ Property::Index readonly = actor.RegisterProperty("float", 0.f, Property::READ_ONLY);
DALI_TEST_CHECK(!actor.IsPropertyAnimatable(readonly));
DALI_TEST_CHECK(!actor.IsPropertyWritable(readonly));
- actor.SetProperty( readonly, Property::Value(1.f) );
+ actor.SetProperty(readonly, Property::Value(1.f));
// trying to set a read-only property is a no-op
- DALI_TEST_EQUALS( 0.f, actor.GetProperty( readonly ).Get<float>(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0.f, actor.GetProperty(readonly).Get<float>(), TEST_LOCATION);
/// animatable can be set
- Property::Index write_anim = actor.RegisterProperty( "write_float", 0.f, Property::ANIMATABLE);
+ Property::Index write_anim = actor.RegisterProperty("write_float", 0.f, Property::ANIMATABLE);
DALI_TEST_CHECK(actor.IsPropertyAnimatable(write_anim));
DALI_TEST_CHECK(actor.IsPropertyWritable(write_anim));
- actor.SetProperty( write_anim, Property::Value(1.f) );
+ actor.SetProperty(write_anim, Property::Value(1.f));
//// animate a non animatable property throws
- float durationSeconds(2.0f);
+ float durationSeconds(2.0f);
Animation animation = Animation::New(durationSeconds);
- bool relativeValue(true);
+ bool relativeValue(true);
try
{
animation.AnimateBy(Property(actor, nonAnimStringIndex), relativeValue, AlphaFunction::EASE_IN);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property type is not animatable", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property type is not animatable", TEST_LOCATION);
}
- DALI_TEST_EQUALS( "yes", actor.GetProperty( nonAnimStringIndex ).Get<std::string>(), TEST_LOCATION );
+ DALI_TEST_EQUALS("yes", actor.GetProperty(nonAnimStringIndex).Get<std::string>(), TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
- Property::Value value(Property::ARRAY);
+ Property::Value value(Property::ARRAY);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
- array->PushBack( Property::Value( 0.1f ) );
- array->PushBack( "a string" );
- array->PushBack( Property::Value( Vector3(1,2,3) ) );
+ array->PushBack(Property::Value(0.1f));
+ array->PushBack("a string");
+ array->PushBack(Property::Value(Vector3(1, 2, 3)));
- DALI_TEST_EQUALS( 3u, array->Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(3u, array->Count(), TEST_LOCATION);
- Property::Index propertyIndex = actor.RegisterProperty( "composite", value, Property::READ_WRITE );
+ Property::Index propertyIndex = actor.RegisterProperty("composite", value, Property::READ_WRITE);
- Property::Value out = actor.GetProperty( propertyIndex );
+ Property::Value out = actor.GetProperty(propertyIndex);
Property::Array* outArray = out.GetArray();
- DALI_TEST_CHECK( outArray != NULL );
+ DALI_TEST_CHECK(outArray != NULL);
- DALI_TEST_CHECK( Property::FLOAT == outArray->GetElementAt(0).GetType());
- DALI_TEST_CHECK( Property::STRING == outArray->GetElementAt(1).GetType());
- DALI_TEST_CHECK( Property::VECTOR3 == outArray->GetElementAt(2).GetType());
+ DALI_TEST_CHECK(Property::FLOAT == outArray->GetElementAt(0).GetType());
+ DALI_TEST_CHECK(Property::STRING == outArray->GetElementAt(1).GetType());
+ DALI_TEST_CHECK(Property::VECTOR3 == outArray->GetElementAt(2).GetType());
- DALI_TEST_EQUALS( 0.1f, outArray->GetElementAt(0).Get<float>(), TEST_LOCATION);
- DALI_TEST_EQUALS( "a string", outArray->GetElementAt(1).Get<std::string>(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector3(1,2,3), outArray->GetElementAt(2).Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.1f, outArray->GetElementAt(0).Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS("a string", outArray->GetElementAt(1).Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(1, 2, 3), outArray->GetElementAt(2).Get<Vector3>(), TEST_LOCATION);
// composite types not animatable
bool exception = false;
try
{
- actor.RegisterProperty( "compositemap", value, Property::ANIMATABLE);
+ actor.RegisterProperty("compositemap", value, Property::ANIMATABLE);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
exception = true;
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
}
DALI_TEST_EQUALS(exception, true, TEST_LOCATION);
// Map of maps
Property::Value mapOfMaps(Property::MAP);
- Property::Map* map = mapOfMaps.GetMap();
+ Property::Map* map = mapOfMaps.GetMap();
- map->Insert( "key", Property::Value(Property::MAP) );
- map->Insert( "2key", "a string" );
+ map->Insert("key", Property::Value(Property::MAP));
+ map->Insert("2key", "a string");
- DALI_TEST_EQUALS( "a string", (*map)["2key"].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS("a string", (*map)["2key"].Get<std::string>(), TEST_LOCATION);
Property::Map* innerMap = map->Find("key")->GetMap();
- innerMap->Insert( "subkey", 5.f );
+ innerMap->Insert("subkey", 5.f);
- DALI_TEST_CHECK( NULL != map->Find("key")->GetMap()->Find("subkey") );
- DALI_TEST_EQUALS( 5.f, map->Find("key")->GetMap()->Find("subkey")->Get<float>(), TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map->Find("key")->GetMap()->Find("subkey"));
+ DALI_TEST_EQUALS(5.f, map->Find("key")->GetMap()->Find("subkey")->Get<float>(), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
+ DALI_TEST_CHECK(ParentOrigin::TOP_LEFT == actor.GetProperty(Actor::Property::PARENT_ORIGIN).Get<Vector3>());
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( ParentOrigin::CENTER == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
+ DALI_TEST_CHECK(ParentOrigin::CENTER == actor.GetProperty(Actor::Property::PARENT_ORIGIN).Get<Vector3>());
END_TEST;
}
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.IsPropertyWritable( Actor::Property::WORLD_POSITION ) );
+ DALI_TEST_CHECK(!actor.IsPropertyWritable(Actor::Property::WORLD_POSITION));
// World position is not writable so this is a no-op and should not crash
- actor.SetProperty( Actor::Property::WORLD_POSITION, Vector3(1,2,3) );
+ actor.SetProperty(Actor::Property::WORLD_POSITION, Vector3(1, 2, 3));
END_TEST;
}
Integration::Scene stage = application.GetScene();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
const unsigned int defaultPropertyCount = actor.GetPropertyCount();
application.SendNotification();
application.Render();
- Property::Index index1 = actor.RegisterProperty( "MyProperty", Vector3::ONE );
+ Property::Index index1 = actor.RegisterProperty("MyProperty", Vector3::ONE);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index1), Vector3::ONE, TEST_LOCATION);
// No new property should be registered when we call the below function
- Property::Index index2 = actor.RegisterProperty( "MyProperty", Vector3::ZAXIS );
+ Property::Index index2 = actor.RegisterProperty("MyProperty", Vector3::ZAXIS);
application.SendNotification();
application.Render();
-
- DALI_TEST_EQUALS( index1, index2, TEST_LOCATION ); // We should have the same index as per the first registration
- DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION ); // Property count should be the same
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index2 ), Vector3::ZAXIS, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
+ DALI_TEST_EQUALS(index1, index2, TEST_LOCATION); // We should have the same index as per the first registration
+ DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 1, TEST_LOCATION); // Property count should be the same
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index2), Vector3::ZAXIS, TEST_LOCATION); // Value should be what we sent on second RegisterProperty call
END_TEST;
}
Integration::Scene stage = application.GetScene();
Actor actor = Actor::New();
- stage.Add( actor );
+ stage.Add(actor);
const unsigned int defaultPropertyCount = actor.GetPropertyCount();
application.SendNotification();
application.Render();
- Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
- Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
+ Property::Index key1 = CORE_PROPERTY_MAX_INDEX + 1;
+ Property::Index key2 = CORE_PROPERTY_MAX_INDEX + 2;
const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
- const float withFlake(99.f);
+ const float withFlake(99.f);
- Property::Index index1 = actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
- Property::Index index2 = actor.RegisterProperty( key1, "sideColor", testColor);
- Property::Index index3 = actor.RegisterProperty( key2, "iceCream", withFlake );
+ Property::Index index1 = actor.RegisterProperty("MyPropertyOne", Vector3::ONE);
+ Property::Index index2 = actor.RegisterProperty(key1, "sideColor", testColor);
+ Property::Index index3 = actor.RegisterProperty(key2, "iceCream", withFlake);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector3 >( index1 ), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), testColor, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), withFlake, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(index1), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index2), testColor, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index3), withFlake, TEST_LOCATION);
// No new property should be registered when we call the below functions
- Property::Index testIndex2 = actor.RegisterProperty( "iceCream", 2200.f );
- Property::Index testIndex1 = actor.RegisterProperty( "sideColor", Color::BLACK );
+ Property::Index testIndex2 = actor.RegisterProperty("iceCream", 2200.f);
+ Property::Index testIndex1 = actor.RegisterProperty("sideColor", Color::BLACK);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( index2, testIndex1, TEST_LOCATION ); // We should have the same index as per the first registration
- DALI_TEST_EQUALS( index3, testIndex2, TEST_LOCATION ); // We should have the same index as per the first registration
- DALI_TEST_EQUALS( actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION ); // Property count should be the same
- DALI_TEST_EQUALS( actor.GetProperty< Vector4 >( index2 ), Color::BLACK, TEST_LOCATION ); // Value should be what we sent on second RegisterProperty call
- DALI_TEST_EQUALS( actor.GetProperty< float >( index3 ), 2200.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(index2, testIndex1, TEST_LOCATION); // We should have the same index as per the first registration
+ DALI_TEST_EQUALS(index3, testIndex2, TEST_LOCATION); // We should have the same index as per the first registration
+ DALI_TEST_EQUALS(actor.GetPropertyCount(), defaultPropertyCount + 3, TEST_LOCATION); // Property count should be the same
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(index2), Color::BLACK, TEST_LOCATION); // Value should be what we sent on second RegisterProperty call
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index3), 2200.f, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliHandleGetProperty(void)
{
tet_infoline("Positive Test Dali::Handle::GetProperty()");
Actor actor = Actor::New();
- DALI_TEST_CHECK( ParentOrigin::TOP_LEFT == actor.GetProperty( Actor::Property::PARENT_ORIGIN ).Get<Vector3>() );
- DALI_TEST_CHECK( AnchorPoint::CENTER == actor.GetProperty( Actor::Property::ANCHOR_POINT ).Get<Vector3>() );
- DALI_TEST_CHECK( Vector3::ZERO == actor.GetProperty( Actor::Property::SIZE ).Get<Vector3>() );
- DALI_TEST_CHECK( Vector3::ZERO == actor.GetProperty( Actor::Property::POSITION ).Get<Vector3>() );
- DALI_TEST_CHECK( Vector3::ONE == actor.GetProperty( Actor::Property::SCALE ).Get<Vector3>() );
- DALI_TEST_CHECK( true == actor.GetProperty( Actor::Property::VISIBLE ).Get<bool>() );
- DALI_TEST_CHECK( Color::WHITE == actor.GetProperty( Actor::Property::COLOR ).Get<Vector4>() );
+ DALI_TEST_CHECK(ParentOrigin::TOP_LEFT == actor.GetProperty(Actor::Property::PARENT_ORIGIN).Get<Vector3>());
+ DALI_TEST_CHECK(AnchorPoint::CENTER == actor.GetProperty(Actor::Property::ANCHOR_POINT).Get<Vector3>());
+ DALI_TEST_CHECK(Vector3::ZERO == actor.GetProperty(Actor::Property::SIZE).Get<Vector3>());
+ DALI_TEST_CHECK(Vector3::ZERO == actor.GetProperty(Actor::Property::POSITION).Get<Vector3>());
+ DALI_TEST_CHECK(Vector3::ONE == actor.GetProperty(Actor::Property::SCALE).Get<Vector3>());
+ DALI_TEST_CHECK(true == actor.GetProperty(Actor::Property::VISIBLE).Get<bool>());
+ DALI_TEST_CHECK(Color::WHITE == actor.GetProperty(Actor::Property::COLOR).Get<Vector4>());
END_TEST;
}
Handle handle = Handle::DownCast(baseHandle);
- DALI_TEST_CHECK( handle );
+ DALI_TEST_CHECK(handle);
baseHandle = BaseHandle();
handle = Handle::DownCast(baseHandle);
- DALI_TEST_CHECK( !handle );
+ DALI_TEST_CHECK(!handle);
END_TEST;
}
TestApplication application;
// BaseObject is NOT an Object, so this DownCast should fail
- BaseHandle handle( new BaseObjectType );
- Handle customHandle1 = Handle::DownCast( handle );
- DALI_TEST_CHECK( ! customHandle1 );
+ BaseHandle handle(new BaseObjectType);
+ Handle customHandle1 = Handle::DownCast(handle);
+ DALI_TEST_CHECK(!customHandle1);
// A DownCast on an empty handle will also fail
Handle empty;
- Handle customHandle2 = Handle::DownCast( empty );
- DALI_TEST_CHECK( ! customHandle2 );
+ Handle customHandle2 = Handle::DownCast(empty);
+ DALI_TEST_CHECK(!customHandle2);
END_TEST;
}
int UtcDaliHandleGetPropertyIndices(void)
{
- TestApplication application;
+ TestApplication application;
Property::IndexContainer indices;
// Actor
Actor actor = Actor::New();
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
int numDefaultProperties = indices.Size();
- DALI_TEST_CHECK( numDefaultProperties > 0 );
- DALI_TEST_EQUALS( numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(numDefaultProperties > 0);
+ DALI_TEST_EQUALS(numDefaultProperties, actor.GetPropertyCount(), TEST_LOCATION);
const Vector4 testColor(0.5f, 0.2f, 0.9f, 1.0f);
- const float withFlake(99.f);
+ const float withFlake(99.f);
- Property::Index key1 = CORE_PROPERTY_MAX_INDEX+1;
- Property::Index key2 = CORE_PROPERTY_MAX_INDEX+2;
+ Property::Index key1 = CORE_PROPERTY_MAX_INDEX + 1;
+ Property::Index key2 = CORE_PROPERTY_MAX_INDEX + 2;
- actor.RegisterProperty( "MyPropertyOne", Vector3::ONE );
- actor.RegisterProperty( key1, "sideColor", testColor);
- actor.RegisterProperty( "MyPropertyTwo", 1234 );
- Property::Index index4 = actor.RegisterProperty( key2, "iceCream", withFlake );
- actor.RegisterProperty( "MyPropertyThree", Vector2(.2f,.7f) );
+ actor.RegisterProperty("MyPropertyOne", Vector3::ONE);
+ actor.RegisterProperty(key1, "sideColor", testColor);
+ actor.RegisterProperty("MyPropertyTwo", 1234);
+ Property::Index index4 = actor.RegisterProperty(key2, "iceCream", withFlake);
+ actor.RegisterProperty("MyPropertyThree", Vector2(.2f, .7f));
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
- DALI_TEST_EQUALS( indices.Size(), numDefaultProperties + 5, TEST_LOCATION );
- DALI_TEST_EQUALS( indices[indices.Size()-2], index4, TEST_LOCATION );
+ DALI_TEST_EQUALS(indices.Size(), numDefaultProperties + 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(indices[indices.Size() - 2], index4, TEST_LOCATION);
END_TEST;
}
struct PropertyTypeAnimatable
{
- const char * name;
+ const char* name;
Property::Value value;
- bool animatable;
+ bool animatable;
};
Property::Array array;
- Property::Map map;
+ Property::Map map;
PropertyTypeAnimatable properties[] =
+ {
+ {"Property::BOOLEAN", true, true},
+ {"Property::FLOAT", 1.0f, true},
+ {"Property::INTEGER", 1, true},
+ {"Property::VECTOR2", Vector2::ONE, true},
+ {"Property::VECTOR3", Vector3::ONE, true},
+ {"Property::VECTOR4", Vector4::ONE, true},
+ {"Property::MATRIX3", Matrix3::IDENTITY, true},
+ {"Property::MATRIX", Matrix::IDENTITY, true},
+ {"Property::RECTANGLE", Rect<int>(), false},
+ {"Property::ROTATION", AngleAxis(), true},
+ {"Property::STRING", std::string("Me"), false},
+ {"Property::ARRAY", array, false},
+ {"Property::MAP", map, false},
+ };
+
+ unsigned int numOfProperties(sizeof(properties) / sizeof(properties[0]));
+
+ for(unsigned int i = 0; i < numOfProperties; ++i)
{
- { "Property::BOOLEAN", true, true },
- { "Property::FLOAT", 1.0f, true },
- { "Property::INTEGER", 1, true },
- { "Property::VECTOR2", Vector2::ONE, true },
- { "Property::VECTOR3", Vector3::ONE, true },
- { "Property::VECTOR4", Vector4::ONE, true },
- { "Property::MATRIX3", Matrix3::IDENTITY, true },
- { "Property::MATRIX", Matrix::IDENTITY, true },
- { "Property::RECTANGLE", Rect<int>(), false },
- { "Property::ROTATION", AngleAxis(), true },
- { "Property::STRING", std::string("Me"), false },
- { "Property::ARRAY", array, false },
- { "Property::MAP", map, false },
- };
-
- unsigned int numOfProperties( sizeof( properties ) / sizeof( properties[0] ) );
-
- for ( unsigned int i = 0; i < numOfProperties; ++i )
- {
- tet_printf( "Testing: %s\n", properties[i].name );
+ tet_printf("Testing: %s\n", properties[i].name);
bool exception = false;
try
{
Actor actor = Actor::New();
- actor.RegisterProperty( "manFromDelmonte", properties[i].value );
+ actor.RegisterProperty("manFromDelmonte", properties[i].value);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
exception = true;
}
- DALI_TEST_CHECK( properties[i].animatable != exception );
+ DALI_TEST_CHECK(properties[i].animatable != exception);
}
END_TEST;
}
Handle handle = Handle::New();
- float startValue(1.0f);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ float startValue(1.0f);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
- handle.SetProperty( index, 5.0f );
+ handle.SetProperty(index, 5.0f);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == 5.0f);
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == 5.0f );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == 5.0f);
END_TEST;
}
Handle handle = Handle::New();
- Property::Value value( Property::NONE );
- Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE);
+ Property::Value value(Property::NONE);
+ Property::Index index = handle.RegisterProperty("testProperty", value, Property::READ_WRITE);
// Negative test i.e. setting a property of type NONE is meaningless
- handle.SetProperty( index, 5.0f );
+ handle.SetProperty(index, 5.0f);
- DALI_TEST_CHECK( true ); // got here without crashing
+ DALI_TEST_CHECK(true); // got here without crashing
END_TEST;
}
Handle handle = Handle::New();
- float startValue(5.0f);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ float startValue(5.0f);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
- handle.SetProperty( index, int(1) );
+ handle.SetProperty(index, int(1));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == 1.0f );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == 1.0f);
END_TEST;
}
Handle handle = Handle::New();
- int startValue(5);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
+ int startValue(5);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == startValue);
- handle.SetProperty( index, float(1.5) );
+ handle.SetProperty(index, float(1.5));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<int>(index) == 1 );
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == 1);
END_TEST;
}
Handle handle = Handle::New();
- Rect<int> startValue(1,2,3,4);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
- DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
+ Rect<int> startValue(1, 2, 3, 4);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE);
+ DALI_TEST_EQUALS(handle.GetProperty<Rect<int> >(index), startValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<Rect<int> >(index), startValue, TEST_LOCATION);
// Negative test i.e. there is no conversion from float to Rect
- handle.SetProperty( index, float(1.5) );
+ handle.SetProperty(index, float(1.5));
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<Rect<int> >(index), startValue, TEST_LOCATION);
// Positive test (sanity check)
- Rect<int> endValue(5,6,7,8);
- handle.SetProperty( index, endValue );
- DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), endValue, TEST_LOCATION );
+ Rect<int> endValue(5, 6, 7, 8);
+ handle.SetProperty(index, endValue);
+ DALI_TEST_EQUALS(handle.GetProperty<Rect<int> >(index), endValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< Rect<int> >( index ), endValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<Rect<int> >(index), endValue, TEST_LOCATION);
END_TEST;
}
Handle handle = Handle::New();
- std::string startValue( "Libraries gave us power" );
- Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
- DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
+ std::string startValue("Libraries gave us power");
+ Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE);
+ DALI_TEST_EQUALS(handle.GetProperty<std::string>(index), startValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<std::string>(index), startValue, TEST_LOCATION);
// No conversion from Vector3 to std::string, therefore this should be a NOOP
- handle.SetProperty( index, Vector3(1,2,3) );
+ handle.SetProperty(index, Vector3(1, 2, 3));
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<std::string>(index), startValue, TEST_LOCATION);
// Positive test (sanity check)
- std::string endValue( "Then work came and made us free" );
- handle.SetProperty( index, endValue );
- DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION );
+ std::string endValue("Then work came and made us free");
+ handle.SetProperty(index, endValue);
+ DALI_TEST_EQUALS(handle.GetProperty<std::string>(index), endValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< std::string >( index ), endValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<std::string>(index), endValue, TEST_LOCATION);
END_TEST;
}
Handle handle = Handle::New();
- Property::Value value( Property::ARRAY );
- std::string startValue( "The future teaches you to be alone" );
- value.GetArray()->PushBack( startValue );
+ Property::Value value(Property::ARRAY);
+ std::string startValue("The future teaches you to be alone");
+ value.GetArray()->PushBack(startValue);
- Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE);
- Property::Array check1 = handle.GetProperty< Property::Array >( index );
- DALI_TEST_EQUALS( check1.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
+ Property::Index index = handle.RegisterProperty("testProperty", value, Property::READ_WRITE);
+ Property::Array check1 = handle.GetProperty<Property::Array>(index);
+ DALI_TEST_EQUALS(check1.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- Property::Array check2 = handle.GetProperty< Property::Array >( index );
- DALI_TEST_EQUALS( check2.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
+ Property::Array check2 = handle.GetProperty<Property::Array>(index);
+ DALI_TEST_EQUALS(check2.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION);
// No conversion from int to ARRAY, therefore this should be a NOOP
- handle.SetProperty( index, int(2) );
+ handle.SetProperty(index, int(2));
application.SendNotification();
application.Render(0);
- Property::Array check3 = handle.GetProperty< Property::Array >( index );
- DALI_TEST_EQUALS( check3.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION );
+ Property::Array check3 = handle.GetProperty<Property::Array>(index);
+ DALI_TEST_EQUALS(check3.GetElementAt(0).Get<std::string>(), startValue, TEST_LOCATION);
// Positive test (sanity check)
Property::Value value2(Property::ARRAY);
- std::string endValue( "The present to be afraid and cold" );
- value2.GetArray()->PushBack( endValue );
- handle.SetProperty( index, value2 );
+ std::string endValue("The present to be afraid and cold");
+ value2.GetArray()->PushBack(endValue);
+ handle.SetProperty(index, value2);
- Property::Array check4 = handle.GetProperty< Property::Array >( index );
- DALI_TEST_EQUALS( check4.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION );
+ Property::Array check4 = handle.GetProperty<Property::Array>(index);
+ DALI_TEST_EQUALS(check4.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- Property::Array check5 = handle.GetProperty< Property::Array >( index );
- DALI_TEST_EQUALS( check5.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION );
+ Property::Array check5 = handle.GetProperty<Property::Array>(index);
+ DALI_TEST_EQUALS(check5.GetElementAt(0).Get<std::string>(), endValue, TEST_LOCATION);
END_TEST;
}
Handle handle = Handle::New();
- Property::Value value( Property::MAP );
- std::string startValue( "Culture sucks down words" );
- value.GetMap()->Insert( "1", startValue );
+ Property::Value value(Property::MAP);
+ std::string startValue("Culture sucks down words");
+ value.GetMap()->Insert("1", startValue);
- Property::Index index = handle.RegisterProperty( "testProperty", value, Property::READ_WRITE );
- Property::Value* check1 = handle.GetProperty< Property::Map >( index ).Find("1");
- DALI_TEST_CHECK( NULL != check1 );
+ Property::Index index = handle.RegisterProperty("testProperty", value, Property::READ_WRITE);
+ Property::Value* check1 = handle.GetProperty<Property::Map>(index).Find("1");
+ DALI_TEST_CHECK(NULL != check1);
// No conversion from float to MAP, therefore this should be a NOOP
- handle.SetProperty( index, float(3.0) );
+ handle.SetProperty(index, float(3.0));
// Positive test (sanity check)
- Property::Value value2( Property::MAP );
- std::string endValue( "Itemise loathing and feed yourself smiles" );
- value.GetMap()->Insert( "1", endValue );
- handle.SetProperty( index, value2 );
+ Property::Value value2(Property::MAP);
+ std::string endValue("Itemise loathing and feed yourself smiles");
+ value.GetMap()->Insert("1", endValue);
+ handle.SetProperty(index, value2);
END_TEST;
}
Handle handle = Handle::New();
- Extents startValue(1,2,3,4);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
- DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
+ Extents startValue(1, 2, 3, 4);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE);
+ DALI_TEST_EQUALS(handle.GetProperty<Extents>(index), startValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<Extents>(index), startValue, TEST_LOCATION);
// Negative test i.e. there is no conversion from float to Extents
- handle.SetProperty( index, float(1.5) );
+ handle.SetProperty(index, float(1.5));
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<Extents>(index), startValue, TEST_LOCATION);
// Positive test (sanity check)
- Extents endValue(5,6,7,8);
- handle.SetProperty( index, endValue );
- DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION );
+ Extents endValue(5, 6, 7, 8);
+ handle.SetProperty(index, endValue);
+ DALI_TEST_EQUALS(handle.GetProperty<Extents>(index), endValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< Extents >( index ), endValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<Extents>(index), endValue, TEST_LOCATION);
END_TEST;
}
Handle handle = Handle::New();
- bool startValue(true);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue, Property::READ_WRITE);
- DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
+ bool startValue(true);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue, Property::READ_WRITE);
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(index), startValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(index), startValue, TEST_LOCATION);
// Negative test i.e. there is no conversion from float to bool
- handle.SetProperty( index, float(0.0) );
+ handle.SetProperty(index, float(0.0));
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), startValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(index), startValue, TEST_LOCATION);
// Positive test (sanity check)
bool endValue(false);
- handle.SetProperty( index, endValue );
- DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION );
+ handle.SetProperty(index, endValue);
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(index), endValue, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( handle.GetProperty< bool >( index ), endValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(index), endValue, TEST_LOCATION);
END_TEST;
}
Handle handle = Handle::New();
- int startValue(5);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
+ int startValue(5);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == startValue);
// Negative test i.e. there is no conversion from Vector3 to int
- handle.SetProperty( index, Vector3(1,2,3) );
+ handle.SetProperty(index, Vector3(1, 2, 3));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<int>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<int>(index) == startValue);
END_TEST;
}
Handle handle = Handle::New();
- float startValue(5.0);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ float startValue(5.0);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
// Negative test i.e. there is no conversion from Vector3 to float
- handle.SetProperty( index, Vector3(1,2,3) );
+ handle.SetProperty(index, Vector3(1, 2, 3));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<float>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<float>(index) == startValue);
END_TEST;
}
Handle handle = Handle::New();
- Quaternion startValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
+ Quaternion startValue(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == startValue);
// Negative test i.e. there is no conversion from float to Quaternion
- handle.SetProperty( index, float(7.0) );
+ handle.SetProperty(index, float(7.0));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == startValue);
// Positive test (sanity check)
- Quaternion endValue( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- handle.SetProperty( index, endValue );
- DALI_TEST_CHECK( handle.GetProperty<Quaternion>(index) == endValue );
+ Quaternion endValue(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ handle.SetProperty(index, endValue);
+ DALI_TEST_CHECK(handle.GetProperty<Quaternion>(index) == endValue);
END_TEST;
}
Handle handle = Handle::New();
- Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- Matrix startValue(rotation);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
+ Quaternion rotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Matrix startValue(rotation);
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == startValue);
// Negative test i.e. there is no conversion from float to Matrix
- handle.SetProperty( index, float(7.0) );
+ handle.SetProperty(index, float(7.0));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == startValue);
// Positive test (sanity check)
- Quaternion endRotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
- Matrix endValue(endRotation);
- handle.SetProperty( index, endValue );
- DALI_TEST_CHECK( handle.GetProperty<Matrix>(index) == endValue );
+ Quaternion endRotation(Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+ Matrix endValue(endRotation);
+ handle.SetProperty(index, endValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix>(index) == endValue);
END_TEST;
}
Handle handle = Handle::New();
- Matrix3 startValue(11,12,13,
- 21,22,23,
- 31,32,33);
+ Matrix3 startValue(11, 12, 13, 21, 22, 23, 31, 32, 33);
- Property::Index index = handle.RegisterProperty( "testProperty", startValue );
- DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
+ Property::Index index = handle.RegisterProperty("testProperty", startValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == startValue);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == startValue);
// Negative test i.e. there is no conversion from float to Matrix3
- handle.SetProperty( index, float(7.0) );
+ handle.SetProperty(index, float(7.0));
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == startValue );
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == startValue);
// Positive test (sanity check)
- Matrix3 endValue(31,32,33,
- 21,22,23,
- 11,12,13);
- handle.SetProperty( index, endValue );
- DALI_TEST_CHECK( handle.GetProperty<Matrix3>(index) == endValue );
+ Matrix3 endValue(31, 32, 33, 21, 22, 23, 11, 12, 13);
+ handle.SetProperty(index, endValue);
+ DALI_TEST_CHECK(handle.GetProperty<Matrix3>(index) == endValue);
END_TEST;
}
TestApplication application;
Handle handle = WeightObject::New();
- DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
+ DALI_TEST_CHECK(handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f);
// process the message so scene object is added to update manager
application.SendNotification();
// scope for the weight object
{
Handle handle = WeightObject::New();
- DALI_TEST_CHECK( handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f );
+ DALI_TEST_CHECK(handle.GetProperty<float>(WeightObject::WEIGHT) == 0.0f);
// process the message so scene object is added to update manager
application.SendNotification();
int UtcDaliHandleSetTypeInfo(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
Actor actor = Actor::DownCast(typeInfo.CreateInstance());
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
DevelHandle::SetTypeInfo(actor, typeInfo);
TypeInfo newTypeInfo;
- bool success = actor.GetTypeInfo( newTypeInfo );
- DALI_TEST_CHECK( success );
+ bool success = actor.GetTypeInfo(newTypeInfo);
+ DALI_TEST_CHECK(success);
DALI_TEST_CHECK(typeInfo.GetName() == newTypeInfo.GetName());
DALI_TEST_CHECK(typeInfo.GetBaseName() == newTypeInfo.GetBaseName());
{
TestApplication application;
- tet_infoline( "Create a custom property and set the value ensuring it can be retrieved synchronously" );
+ tet_infoline("Create a custom property and set the value ensuring it can be retrieved synchronously");
Actor actor = Actor::New();
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
- tet_infoline( "Create the custom property with an initial value" );
- float startValue(1.0f);
- Property::Index index = actor.RegisterProperty( "testProperty", startValue );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), startValue, TEST_LOCATION );
+ tet_infoline("Create the custom property with an initial value");
+ float startValue(1.0f);
+ Property::Index index = actor.RegisterProperty("testProperty", startValue);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), startValue, TEST_LOCATION);
- tet_infoline( "Set the value, retrieve it and ensure both the synchronous and the async version work" );
- actor.SetProperty( index, 5.0f );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), startValue, TEST_LOCATION );
+ tet_infoline("Set the value, retrieve it and ensure both the synchronous and the async version work");
+ actor.SetProperty(index, 5.0f);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), startValue, TEST_LOCATION);
- tet_infoline( "Render and retrieve values again" );
+ tet_infoline("Render and retrieve values again");
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 5.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 5.0f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Create a custom property and retrieve its type" );
+ tet_infoline("Create a custom property and retrieve its type");
- Handle handle = Handle::New();
- Property::Index index = handle.RegisterProperty( "testProperty", 1.0f );
- DALI_TEST_EQUALS( handle.GetPropertyType( index ), Property::FLOAT, TEST_LOCATION );
+ Handle handle = Handle::New();
+ Property::Index index = handle.RegisterProperty("testProperty", 1.0f);
+ DALI_TEST_EQUALS(handle.GetPropertyType(index), Property::FLOAT, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Create a custom property and retrieve whether it's animatable etc." );
+ tet_infoline("Create a custom property and retrieve whether it's animatable etc.");
- Handle handle = Handle::New();
- Property::Index index = handle.RegisterProperty( "testProperty", 1.0f );
- DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION );
+ Handle handle = Handle::New();
+ Property::Index index = handle.RegisterProperty("testProperty", 1.0f);
+ DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.IsPropertyWritable(index), true, TEST_LOCATION);
- index = handle.RegisterProperty( "testProperty2", 1.0f, Property::READ_ONLY );
- DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), false, TEST_LOCATION );
+ index = handle.RegisterProperty("testProperty2", 1.0f, Property::READ_ONLY);
+ DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.IsPropertyWritable(index), false, TEST_LOCATION);
- index = handle.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE );
- DALI_TEST_EQUALS( handle.IsPropertyAnimatable( index ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.IsPropertyWritable( index ), true, TEST_LOCATION );
+ index = handle.RegisterProperty("testProperty3", 1.0f, Property::READ_WRITE);
+ DALI_TEST_EQUALS(handle.IsPropertyAnimatable(index), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.IsPropertyWritable(index), true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Get a default and non-animatable custom property using the GetCurrentProperty API" );
+ tet_infoline("Get a default and non-animatable custom property using the GetCurrentProperty API");
Actor actor = Actor::New();
- application.GetScene().Add( actor );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), true, TEST_LOCATION );
+ application.GetScene().Add(actor);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE), true, TEST_LOCATION);
- Property::Index index = actor.RegisterProperty( "testProperty3", 1.0f, Property::READ_WRITE );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 1.0f, TEST_LOCATION );
+ Property::Index index = actor.RegisterProperty("testProperty3", 1.0f, Property::READ_WRITE);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 1.0f, TEST_LOCATION);
- actor.SetProperty( index, 2.0f );
- DALI_TEST_EQUALS( actor.GetProperty< float >( index ), 2.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetCurrentProperty< float >( index ), 2.0f, TEST_LOCATION );
+ actor.SetProperty(index, 2.0f);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(index), 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<float>(index), 2.0f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Needs type registry
- tet_infoline( "Test if a registered custom property exists on object" );
+ tet_infoline("Test if a registered custom property exists on object");
- Actor actor = Actor::New();
- auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
+ Actor actor = Actor::New();
+ auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
- DALI_TEST_EQUALS( actor.DoesCustomPropertyExist( propertyIndex ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(propertyIndex), true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Needs type registry
- tet_infoline( "Test if a registered custom property does not exist on object" );
+ tet_infoline("Test if a registered custom property does not exist on object");
- Actor actor = Actor::New();
- auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
+ Actor actor = Actor::New();
+ auto propertyIndex = actor.RegisterProperty("customProperty1", 1.0f);
- DALI_TEST_EQUALS( actor.DoesCustomPropertyExist( propertyIndex+1 ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(propertyIndex + 1), false, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Needs type registry
- tet_infoline( "Test that a default property does not show as a custom property on object" );
+ tet_infoline("Test that a default property does not show as a custom property on object");
Actor actor = Actor::New();
- DALI_TEST_EQUALS( actor.DoesCustomPropertyExist( Actor::Property::POSITION ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.DoesCustomPropertyExist(Actor::Property::POSITION), false, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Needs type registry
- tet_infoline( "Test that a child property does not exist on actor after parenting to container" );
+ tet_infoline("Test that a child property does not exist on actor after parenting to container");
TypeRegistry typeRegistry = TypeRegistry::Get();
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
- const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const char* CHILD_PROPERTY_NAME( "childProperty" );
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
- ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
auto container = Test::TestCustomActor::New();
- application.GetScene().Add( container );
+ application.GetScene().Add(container);
auto child = Actor::New();
- container.Add( child ); // Resolve child properties (if any)
+ container.Add(child); // Resolve child properties (if any)
- DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), false, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Needs type registry
- tet_infoline( "Test that a child property exists after being set" );
+ tet_infoline("Test that a child property exists after being set");
TypeRegistry typeRegistry = TypeRegistry::Get();
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
- const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const char* CHILD_PROPERTY_NAME( "childProperty" );
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
- ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
auto container = Test::TestCustomActor::New();
- application.GetScene().Add( container );
+ application.GetScene().Add(container);
auto child = Actor::New();
- container.Add( child ); // Resolve child properties (if any)
- child.SetProperty( CHILD_PROPERTY, 2 );
+ container.Add(child); // Resolve child properties (if any)
+ child.SetProperty(CHILD_PROPERTY, 2);
- DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty<int>(CHILD_PROPERTY), 2, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Needs type registry
- tet_infoline( "Test that a child property is re-indexed after registration, and that it exists" );
+ tet_infoline("Test that a child property is re-indexed after registration, and that it exists");
TypeRegistry typeRegistry = TypeRegistry::Get();
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
- const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const char* CHILD_PROPERTY_NAME( "childProperty" );
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
- ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
auto container = Test::TestCustomActor::New();
- application.GetScene().Add( container );
+ application.GetScene().Add(container);
auto child = Actor::New();
- child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
- container.Add( child ); // Resolve child properties (if any)
+ child.RegisterProperty(CHILD_PROPERTY_NAME, Property::Value(3));
+ container.Add(child); // Resolve child properties (if any)
- DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty<int>(CHILD_PROPERTY), 3, TEST_LOCATION);
END_TEST;
}
namespace
{
-
struct PropertySetSignalCheck
{
PropertySetSignalCheck(bool& signalReceived, Property::Value& value)
void operator()(Handle& handle, Property::Index index, Property::Value value)
{
mSignalReceived = true;
- mValue = value;
+ mValue = value;
}
void Reset()
void CheckSignalReceived()
{
- if (!mSignalReceived)
+ if(!mSignalReceived)
{
tet_printf("Expected Property Set signal was not received\n");
tet_result(TET_FAIL);
}
}
- bool& mSignalReceived; // owned by individual tests
+ bool& mSignalReceived; // owned by individual tests
Property::Value& mValue;
};
-} // anon namespace
+} // namespace
int UtcDaliHandlePropertySetSignal01(void)
{
TestApplication application;
- bool signalReceived(false);
- Property::Value value;
+ bool signalReceived(false);
+ Property::Value value;
PropertySetSignalCheck propertySetCheck(signalReceived, value);
- tet_infoline( "Test that setting a default property triggers a signal" );
+ tet_infoline("Test that setting a default property triggers a signal");
auto actor = Actor::New();
actor.PropertySetSignal().Connect(&application, propertySetCheck);
- actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS );
+ actor.SetProperty(Actor::Property::POSITION, Vector3::XAXIS);
propertySetCheck.CheckSignalReceived();
END_TEST;
}
-
int UtcDaliHandlePropertySetSignal02(void)
{
TestApplication application;
- bool signalReceived(false);
- Property::Value value;
+ bool signalReceived(false);
+ Property::Value value;
PropertySetSignalCheck propertySetCheck(signalReceived, value);
- tet_infoline( "Test that setting a custom property triggers a signal" );
+ tet_infoline("Test that setting a custom property triggers a signal");
auto actor = Actor::New();
actor.PropertySetSignal().Connect(&application, propertySetCheck);
auto propertyIndex = actor.RegisterProperty("propName", 3.0f);
- actor.SetProperty( propertyIndex, 5.0f );
+ actor.SetProperty(propertyIndex, 5.0f);
propertySetCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 5.0f ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(5.0f), 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliHandlePropertySetSignal03(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- bool signalReceived(false);
- Property::Value value;
+ bool signalReceived(false);
+ Property::Value value;
PropertySetSignalCheck propertySetCheck(signalReceived, value);
- tet_infoline( "Test that setting a child property triggers a signal" );
+ tet_infoline("Test that setting a child property triggers a signal");
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(Test::TestCustomActor) );
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(Test::TestCustomActor));
- const Property::Index CHILD_PROPERTY( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const char* CHILD_PROPERTY_NAME( "childProperty" );
+ const Property::Index CHILD_PROPERTY(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const char* CHILD_PROPERTY_NAME("childProperty");
- ChildPropertyRegistration( customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER );
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), CHILD_PROPERTY_NAME, CHILD_PROPERTY, Property::INTEGER);
auto container = Test::TestCustomActor::New();
- application.GetScene().Add( container );
+ application.GetScene().Add(container);
auto child = Actor::New();
- child.RegisterProperty( CHILD_PROPERTY_NAME, Property::Value(3) );
+ child.RegisterProperty(CHILD_PROPERTY_NAME, Property::Value(3));
child.PropertySetSignal().Connect(&application, propertySetCheck);
- container.Add( child ); // Resolve child properties (if any)
+ container.Add(child); // Resolve child properties (if any)
- DALI_TEST_EQUALS( child.DoesCustomPropertyExist( CHILD_PROPERTY ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( child.GetProperty<int>( CHILD_PROPERTY ), 3, TEST_LOCATION );
+ DALI_TEST_EQUALS(child.DoesCustomPropertyExist(CHILD_PROPERTY), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(child.GetProperty<int>(CHILD_PROPERTY), 3, TEST_LOCATION);
- child.SetProperty( CHILD_PROPERTY, 29 );
+ child.SetProperty(CHILD_PROPERTY, 29);
propertySetCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( 29 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(29), TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliHandlePropertySetSignal04(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- bool signalReceived(false);
- Property::Value value;
+ bool signalReceived(false);
+ Property::Value value;
PropertySetSignalCheck propertySetCheck(signalReceived, value);
- tet_infoline( "Test that setting a property on a vanilla Object triggers a signal" );
+ tet_infoline("Test that setting a property on a vanilla Object triggers a signal");
constexpr Property::Index TEST_PROPERTY_KEY_INDEX = 1;
- const std::string TEST_PROPERTY_KEY_NAME = "testProperty";
+ const std::string TEST_PROPERTY_KEY_NAME = "testProperty";
Handle vanillaObject = Handle::New();
- auto propertyIndex = vanillaObject.RegisterProperty(
+ auto propertyIndex = vanillaObject.RegisterProperty(
TEST_PROPERTY_KEY_INDEX,
TEST_PROPERTY_KEY_NAME,
- Color::WHITE );
+ Color::WHITE);
vanillaObject.PropertySetSignal().Connect(&application, propertySetCheck);
- DALI_TEST_EQUALS( vanillaObject.DoesCustomPropertyExist( propertyIndex ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( vanillaObject.GetProperty<Vector4>( propertyIndex ), Color::WHITE, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(vanillaObject.DoesCustomPropertyExist(propertyIndex), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(vanillaObject.GetProperty<Vector4>(propertyIndex), Color::WHITE, 0.001f, TEST_LOCATION);
vanillaObject[TEST_PROPERTY_KEY_NAME] = Color::RED;
propertySetCheck.CheckSignalReceived();
- DALI_TEST_EQUALS( propertySetCheck.mValue, Property::Value( Color::RED ), 0.001f, TEST_LOCATION );
- DALI_TEST_VALUE_EQUALS( vanillaObject[propertyIndex], Property::Value( Color::RED), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(propertySetCheck.mValue, Property::Value(Color::RED), 0.001f, TEST_LOCATION);
+ DALI_TEST_VALUE_EQUALS(vanillaObject[propertyIndex], Property::Value(Color::RED), 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliHandlePropertySetProperties(void)
{
TestApplication application;
- const Vector3 actorSize( 10.0f, 20.0f, 30.0f );
- const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f );
- const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f );
+ const Vector3 actorSize(10.0f, 20.0f, 30.0f);
+ const Vector3 anchorPoint(1.0f, 0.5f, 0.0f);
+ const Vector4 color(0.1f, 0.2, 0.3f, 0.4f);
Handle handle = Actor::New();
handle.SetProperties(
- Property::Map
- {
- { Actor::Property::SIZE, actorSize },
- { Actor::Property::ANCHOR_POINT, anchorPoint },
- { "color", color },
- { "invalid", Vector2::ZERO } // It should quietly ignore invalid data
- }
- );
- DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION );
+ Property::Map{
+ {Actor::Property::SIZE, actorSize},
+ {Actor::Property::ANCHOR_POINT, anchorPoint},
+ {"color", color},
+ {"invalid", Vector2::ZERO} // It should quietly ignore invalid data
+ });
+ DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::SIZE).Get<Vector3>(), actorSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::ANCHOR_POINT).Get<Vector3>(), anchorPoint, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::COLOR).Get<Vector4>(), color, TEST_LOCATION);
END_TEST;
}
int UtcDaliHandleTemplateNew01(void)
{
TestApplication application;
- const Vector3 actorSize( 10.0f, 20.0f, 30.0f );
- const Vector3 anchorPoint( 1.0f, 0.5f, 0.0f );
- const Vector4 color( 0.1f, 0.2, 0.3f, 0.4f );
+ const Vector3 actorSize(10.0f, 20.0f, 30.0f);
+ const Vector3 anchorPoint(1.0f, 0.5f, 0.0f);
+ const Vector4 color(0.1f, 0.2, 0.3f, 0.4f);
- Handle handle = Handle::New< Actor >(
- Property::Map
- {
- { Actor::Property::SIZE, actorSize },
- { Actor::Property::ANCHOR_POINT, anchorPoint },
- { "color", color },
- { "invalid", Vector2::ZERO } // It should quietly ignore invalid data
- }
- );
+ Handle handle = Handle::New<Actor>(
+ Property::Map{
+ {Actor::Property::SIZE, actorSize},
+ {Actor::Property::ANCHOR_POINT, anchorPoint},
+ {"color", color},
+ {"invalid", Vector2::ZERO} // It should quietly ignore invalid data
+ });
- DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::SIZE ).Get< Vector3 >(), actorSize, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::ANCHOR_POINT ).Get< Vector3 >(), anchorPoint, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty( Actor::Property::COLOR ).Get< Vector4 >(), color, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::SIZE).Get<Vector3>(), actorSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::ANCHOR_POINT).Get<Vector3>(), anchorPoint, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty(Actor::Property::COLOR).Get<Vector4>(), color, TEST_LOCATION);
END_TEST;
}
Handle handle = Actor::New();
handle.SetProperties(
- Property::Map
- {
- { Actor::Property::SIZE, Vector3( 400.0f, 200.0f, 100.0f ) },
- { Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER },
- { Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER },
- { Actor::Property::NAME, "Actor" },
- { Actor::Property::LEAVE_REQUIRED, true },
- { "color", Color::RED },
- }
- );
+ Property::Map{
+ {Actor::Property::SIZE, Vector3(400.0f, 200.0f, 100.0f)},
+ {Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_CENTER},
+ {Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER},
+ {Actor::Property::NAME, "Actor"},
+ {Actor::Property::LEAVE_REQUIRED, true},
+ {"color", Color::RED},
+ });
Property::Map map;
- handle.GetProperties( map );
+ handle.GetProperties(map);
// Get all the properties and ensure they match
- DALI_TEST_EQUALS( handle.GetPropertyCount(), map.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetPropertyCount(), map.Count(), TEST_LOCATION);
- for( auto position = 0u; position < map.Count(); ++position )
+ for(auto position = 0u; position < map.Count(); ++position)
{
- auto keyValuePair = map.GetKeyValue( position );
- const auto& index = keyValuePair.first.indexKey;
- const auto& value = keyValuePair.second;
- auto handleValue = handle.GetProperty( index );
+ auto keyValuePair = map.GetKeyValue(position);
+ const auto& index = keyValuePair.first.indexKey;
+ const auto& value = keyValuePair.second;
+ auto handleValue = handle.GetProperty(index);
- switch( value.GetType() )
+ switch(value.GetType())
{
- case Property::NONE: break;
- case Property::BOOLEAN: DALI_TEST_EQUALS( value.Get< bool >(), handleValue.Get< bool >(), TEST_LOCATION ); break;
- case Property::FLOAT: DALI_TEST_EQUALS( value.Get< float >(), handleValue.Get< float >(), TEST_LOCATION ); break;
- case Property::INTEGER: DALI_TEST_EQUALS( value.Get< int >(), handleValue.Get< int >(), TEST_LOCATION ); break;
- case Property::VECTOR2: DALI_TEST_EQUALS( value.Get< Vector2 >(), handleValue.Get< Vector2 >(), TEST_LOCATION ); break;
- case Property::VECTOR3: DALI_TEST_EQUALS( value.Get< Vector3 >(), handleValue.Get< Vector3 >(), TEST_LOCATION ); break;
- case Property::VECTOR4: DALI_TEST_EQUALS( value.Get< Vector4 >(), handleValue.Get< Vector4 >(), TEST_LOCATION ); break;
- case Property::MATRIX3: DALI_TEST_EQUALS( value.Get< Matrix3 >(), handleValue.Get< Matrix3 >(), TEST_LOCATION ); break;
- case Property::MATRIX: DALI_TEST_EQUALS( value.Get< Matrix >(), handleValue.Get< Matrix >(), TEST_LOCATION ); break;
- case Property::RECTANGLE: DALI_TEST_EQUALS( value.Get< Rect< int > >(), handleValue.Get< Rect< int > >(), TEST_LOCATION ); break;
- case Property::ROTATION: DALI_TEST_EQUALS( value.Get< Quaternion >(), handleValue.Get< Quaternion >(), TEST_LOCATION ); break;
- case Property::STRING: DALI_TEST_EQUALS( value.Get< std::string >(), handleValue.Get< std::string >(), TEST_LOCATION ); break;
- case Property::ARRAY: DALI_TEST_EQUALS( value.GetArray()->Count(), handleValue.GetArray()->Count(), TEST_LOCATION ); break;
- case Property::MAP: DALI_TEST_EQUALS( value.GetMap()->Count(), handleValue.GetMap()->Count(), TEST_LOCATION ); break;
- case Property::EXTENTS: DALI_TEST_EQUALS( value.Get< Extents >(), handleValue.Get< Extents >(), TEST_LOCATION ); break;
+ case Property::NONE:
+ break;
+ case Property::BOOLEAN:
+ DALI_TEST_EQUALS(value.Get<bool>(), handleValue.Get<bool>(), TEST_LOCATION);
+ break;
+ case Property::FLOAT:
+ DALI_TEST_EQUALS(value.Get<float>(), handleValue.Get<float>(), TEST_LOCATION);
+ break;
+ case Property::INTEGER:
+ DALI_TEST_EQUALS(value.Get<int>(), handleValue.Get<int>(), TEST_LOCATION);
+ break;
+ case Property::VECTOR2:
+ DALI_TEST_EQUALS(value.Get<Vector2>(), handleValue.Get<Vector2>(), TEST_LOCATION);
+ break;
+ case Property::VECTOR3:
+ DALI_TEST_EQUALS(value.Get<Vector3>(), handleValue.Get<Vector3>(), TEST_LOCATION);
+ break;
+ case Property::VECTOR4:
+ DALI_TEST_EQUALS(value.Get<Vector4>(), handleValue.Get<Vector4>(), TEST_LOCATION);
+ break;
+ case Property::MATRIX3:
+ DALI_TEST_EQUALS(value.Get<Matrix3>(), handleValue.Get<Matrix3>(), TEST_LOCATION);
+ break;
+ case Property::MATRIX:
+ DALI_TEST_EQUALS(value.Get<Matrix>(), handleValue.Get<Matrix>(), TEST_LOCATION);
+ break;
+ case Property::RECTANGLE:
+ DALI_TEST_EQUALS(value.Get<Rect<int> >(), handleValue.Get<Rect<int> >(), TEST_LOCATION);
+ break;
+ case Property::ROTATION:
+ DALI_TEST_EQUALS(value.Get<Quaternion>(), handleValue.Get<Quaternion>(), TEST_LOCATION);
+ break;
+ case Property::STRING:
+ DALI_TEST_EQUALS(value.Get<std::string>(), handleValue.Get<std::string>(), TEST_LOCATION);
+ break;
+ case Property::ARRAY:
+ DALI_TEST_EQUALS(value.GetArray()->Count(), handleValue.GetArray()->Count(), TEST_LOCATION);
+ break;
+ case Property::MAP:
+ DALI_TEST_EQUALS(value.GetMap()->Count(), handleValue.GetMap()->Count(), TEST_LOCATION);
+ break;
+ case Property::EXTENTS:
+ DALI_TEST_EQUALS(value.Get<Extents>(), handleValue.Get<Extents>(), TEST_LOCATION);
+ break;
}
}
// Add a custom property and ensure the count goes up by one.
const auto countBefore = map.Count();
- handle.RegisterProperty( "tempProperty", Color::GREEN );
- handle.GetProperties( map );
- DALI_TEST_EQUALS( countBefore + 1, map.Count(), TEST_LOCATION );
+ handle.RegisterProperty("tempProperty", Color::GREEN);
+ handle.GetProperties(map);
+ DALI_TEST_EQUALS(countBefore + 1, map.Count(), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliHandleSetPropertyNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
- int arg1(0);
+ int arg1(0);
Dali::Property::Value arg2;
- instance.SetProperty(arg1,arg2);
+ instance.SetProperty(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliHandleRegisterPropertyNegative01(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
- std::string arg1;
+ std::string arg1;
Dali::Property::Value arg2;
- instance.RegisterProperty(arg1,arg2);
+ instance.RegisterProperty(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliHandleRegisterPropertyNegative02(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
- std::string arg1;
- Dali::Property::Value arg2;
+ std::string arg1;
+ Dali::Property::Value arg2;
Dali::Property::AccessMode arg3(Property::READ_ONLY);
- instance.RegisterProperty(arg1,arg2,arg3);
+ instance.RegisterProperty(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliHandleRemoveConstraintsNegative01(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
unsigned int arg1(0u);
int UtcDaliHandleRemoveConstraintsNegative02(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
instance.RemoveConstraints();
int UtcDaliHandleAddPropertyNotificationNegative01(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
- int arg1(0);
- int arg2(0);
+ int arg1(0);
+ int arg2(0);
Dali::PropertyCondition arg3;
- instance.AddPropertyNotification(arg1,arg2,arg3);
+ instance.AddPropertyNotification(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliHandleAddPropertyNotificationNegative02(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
- int arg1(0);
+ int arg1(0);
Dali::PropertyCondition arg2;
- instance.AddPropertyNotification(arg1,arg2);
+ instance.AddPropertyNotification(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliHandleRemovePropertyNotificationNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
Dali::PropertyNotification arg1;
int UtcDaliHandleRemovePropertyNotificationsNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
instance.RemovePropertyNotifications();
int UtcDaliHandleGetPropertyNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleGetPropertyNameNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleGetPropertyTypeNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleGetPropertyCountNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
instance.GetPropertyCount();
int UtcDaliHandleGetPropertyIndexNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
std::string arg1;
int UtcDaliHandleGetCurrentPropertyNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleGetPropertyIndicesNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
Dali::Vector<int> arg1;
int UtcDaliHandleIsPropertyWritableNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleIsPropertyAnimatableNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleIsPropertyAConstraintInputNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
int arg1(0);
int UtcDaliHandleSupportsNegative(void)
{
TestApplication application;
- Dali::Handle instance;
+ Dali::Handle instance;
try
{
Dali::Handle::Capability arg1(Handle::DYNAMIC_PROPERTIES);
END_TEST;
}
-
int UtcDaliHandleIndexOperatorByIndexP01(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
- actor[Actor::Property::SIZE] = Vector3( 100.0f, 200.0f, 1.0f );
+ actor[Actor::Property::SIZE] = Vector3(100.0f, 200.0f, 1.0f);
- DALI_TEST_EQUALS( actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3( 100.0f, 200.0f, 1.0f ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetProperty<Vector3>(Actor::Property::SIZE), Vector3(100.0f, 200.0f, 1.0f), 0.001f, TEST_LOCATION);
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
- actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) );
-
- Vector3 position = actor[ Actor::Property::POSITION ];
- DALI_TEST_EQUALS( position, Vector3( 10.0f, 20.0f, 0.0f ), TEST_LOCATION );
+ Vector3 position = actor[Actor::Property::POSITION];
+ DALI_TEST_EQUALS(position, Vector3(10.0f, 20.0f, 0.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliHandleIndexOperatorByIndexP02(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f);
actor.SetProperty(Actor::Property::COLOR, defaultActorColor);
actor[Actor::Property::COLOR_RED] = 0.5f;
- DALI_TEST_EQUALS( actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS( actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<float>(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty<Vector4>(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
- DALI_TEST_EQUALS( (float)actor[ Actor::Property::POSITION_Z ], 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS((float)actor[Actor::Property::POSITION_Z], 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliHandleIndexOperatorByIndexP03(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f);
actor.SetProperty(Actor::Property::COLOR, defaultActorColor);
// Value under test is second to allow compiler to deduce type
- DALI_TEST_VALUE_EQUALS( actor[Actor::Property::COLOR_RED], 1.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_VALUE_EQUALS(actor[Actor::Property::COLOR_RED], 1.0f, 0.001f, TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
- DALI_TEST_EQUALS( (float)actor[ Actor::Property::POSITION_Z ], 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS((float)actor[Actor::Property::POSITION_Z], 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliHandleIndexOperatorByNameP01(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
- actor["size"] = Vector3( 100.0f, 200.0f, 1.0f );
+ actor["size"] = Vector3(100.0f, 200.0f, 1.0f);
- DALI_TEST_VALUE_EQUALS( actor.GetProperty(Actor::Property::SIZE), Vector3( 100.0f, 200.0f, 1.0f ), 0.001f, TEST_LOCATION );
+ DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::SIZE), Vector3(100.0f, 200.0f, 1.0f), 0.001f, TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) );
- Vector3 position = actor[ "position" ];
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
+ Vector3 position = actor["position"];
- DALI_TEST_EQUALS( position, Vector3( 10.0f, 20.0f, 0.0f ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(position, Vector3(10.0f, 20.0f, 0.0f), 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliHandleIndexOperatorByNameP02(void)
{
TestApplication application;
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
const Vector4 defaultActorColor(1.0f, 1.0f, 1.0f, 1.0f);
actor.SetProperty(Actor::Property::COLOR, defaultActorColor);
actor["colorRed"] = 0.5f;
- DALI_TEST_VALUE_EQUALS( actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION);
- DALI_TEST_VALUE_EQUALS( actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
+ DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::COLOR_RED), 0.5f, 0.001f, TEST_LOCATION);
+ DALI_TEST_VALUE_EQUALS(actor.GetProperty(Actor::Property::COLOR), Vector4(0.5f, 1.0f, 1.0f, 1.0f), 0.001f, TEST_LOCATION);
- actor.SetProperty( Actor::Property::POSITION, Vector3( 10.0f, 20.0f, 0.0f ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(10.0f, 20.0f, 0.0f));
- float positionY = actor[ "positionY" ];
- DALI_TEST_EQUALS( positionY, 20.0f, 0.001f, TEST_LOCATION );
+ float positionY = actor["positionY"];
+ DALI_TEST_EQUALS(positionY, 20.0f, 0.001f, TEST_LOCATION);
// Should automatically promote IndirectValue to Property::Value rvalue.
- DALI_TEST_VALUE_EQUALS( actor["positionZ"], 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_VALUE_EQUALS(actor["positionZ"], 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliHandleIndexOperatorNegative02(void)
{
TestApplication application;
try
{
Vector3 position = actor[Actor::Property::POSITION];
- if( position == position )
+ if(position == position)
{
DALI_TEST_CHECK(false); // Should throw before reaching here.
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <string>
-#include <stdlib.h>
-#include <dali/devel-api/common/hash.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/common/hash.h>
+#include <stdlib.h>
+
+#include <string>
void utc_dali_hash_startup(void)
{
test_return_value = TET_PASS;
}
-
int UtcDaliHash(void)
{
// To fully test the Hash distribution we need to use a tool like http://code.google.com/p/smhasher/
tet_infoline("UtcDaliHash");
- const std::string testString1( "highp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );");
- const std::string testString2( "lowp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );");
+ const std::string testString1("highp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );");
+ const std::string testString2("lowp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );");
- DALI_TEST_CHECK( Dali::CalculateHash( testString1 ) != Dali::CalculateHash( testString2 ) );
- DALI_TEST_CHECK( Dali::CalculateHash( testString1, testString2 ) != Dali::CalculateHash( testString2, testString1 ) );
+ DALI_TEST_CHECK(Dali::CalculateHash(testString1) != Dali::CalculateHash(testString2));
+ DALI_TEST_CHECK(Dali::CalculateHash(testString1, testString2) != Dali::CalculateHash(testString2, testString1));
END_TEST;
}
// negative test, check hash value == initial value
const std::string emptyString;
- DALI_TEST_CHECK( Dali::CalculateHash( emptyString ) != 0 );
- DALI_TEST_CHECK( Dali::CalculateHash( emptyString, emptyString ) != 0 );
+ DALI_TEST_CHECK(Dali::CalculateHash(emptyString) != 0);
+ DALI_TEST_CHECK(Dali::CalculateHash(emptyString, emptyString) != 0);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
/**
* The functor to be used in the hit-test algorithm to check whether the actor is hittable.
*/
{
bool hittable = false;
- switch (type)
+ switch(type)
{
case Dali::HitTestAlgorithm::CHECK_ACTOR:
{
// Check whether the actor is visible and not fully transparent.
- if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE )
- && actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) // not FULLY_TRANSPARENT
+ if(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) && actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR).a > 0.01f) // not FULLY_TRANSPARENT
{
// Check whether the actor has the specific name "HittableActor"
- if(actor.GetProperty< std::string >( Actor::Property::NAME ) == "HittableActor")
+ if(actor.GetProperty<std::string>(Actor::Property::NAME) == "HittableActor")
{
hittable = true;
}
}
case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
{
- if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible.
+ if(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE)) // Actor is visible, if not visible then none of its children are visible.
{
hittable = true;
}
return hittable;
};
-
bool DefaultIsActorTouchableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::TraverseType type)
{
bool hittable = false;
- switch (type)
+ switch(type)
{
case Dali::HitTestAlgorithm::CHECK_ACTOR:
{
- if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) &&
- actor.GetProperty< bool >( Actor::Property::SENSITIVE ) &&
- actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f)
+ if(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) &&
+ actor.GetProperty<bool>(Actor::Property::SENSITIVE) &&
+ actor.GetCurrentProperty<Vector4>(Actor::Property::WORLD_COLOR).a > 0.01f)
{
hittable = true;
}
}
case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE:
{
- if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) && // Actor is visible, if not visible then none of its children are visible.
- actor.GetProperty< bool >( Actor::Property::SENSITIVE )) // Actor is sensitive, if insensitive none of its children should be hittable either.
+ if(actor.GetCurrentProperty<bool>(Actor::Property::VISIBLE) && // Actor is visible, if not visible then none of its children are visible.
+ actor.GetProperty<bool>(Actor::Property::SENSITIVE)) // Actor is sensitive, if insensitive none of its children should be hittable either.
{
hittable = true;
}
} // anonymous namespace
-
// Positive test case for a method
int UtcDaliHitTestAlgorithmWithFunctor(void)
{
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor.SetProperty( Actor::Property::NAME,"NonHittableActor");
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::NAME, "NonHittableActor");
stage.Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 localCoordinates;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Perform a hit-test at the given screen coordinates
Dali::HitTestAlgorithm::Results results;
- Dali::HitTestAlgorithm::HitTest( stage, screenCoordinates, results, IsActorHittableFunction );
- DALI_TEST_CHECK( results.actor != actor );
+ Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction);
+ DALI_TEST_CHECK(results.actor != actor);
- actor.SetProperty( Actor::Property::NAME,"HittableActor");
+ actor.SetProperty(Actor::Property::NAME, "HittableActor");
- results.actor = Actor();
+ results.actor = Actor();
results.actorCoordinates = Vector2::ZERO;
// Perform a hit-test at the given screen coordinates
- Dali::HitTestAlgorithm::HitTest( stage, screenCoordinates, results, IsActorHittableFunction );
- DALI_TEST_CHECK( results.actor == actor );
- DALI_TEST_EQUALS( localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION );
+ Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction);
+ DALI_TEST_CHECK(results.actor == actor);
+ DALI_TEST_EQUALS(localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Testing Dali::HitTestAlgorithm with parallel Ortho camera()");
- Stage stage = Stage::GetCurrent();
- RenderTaskList renderTaskList = stage.GetRenderTaskList();
- RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
- Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
+ Stage stage = Stage::GetCurrent();
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
+ Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
- Vector2 stageSize ( stage.GetSize() );
- cameraActor.SetOrthographicProjection( stageSize );
- cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f));
+ Vector2 stageSize(stage.GetSize());
+ cameraActor.SetOrthographicProjection(stageSize);
+ cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f));
- Vector2 actorSize( stageSize * 0.5f );
+ Vector2 actorSize(stageSize * 0.5f);
// Create two actors with half the size of the stage and set them to be partially overlapping
Actor blue = Actor::New();
- blue.SetProperty( Actor::Property::NAME, "Blue" );
- blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(1.0f/3.0f, 1.0f/3.0f, 0.5f) );
- blue.SetProperty( Actor::Property::SIZE, actorSize );
- blue.SetProperty( Actor::Property::POSITION_Z, 30.0f);
-
- Actor green = Actor::New( );
- green.SetProperty( Actor::Property::NAME, "Green" );
- green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(2.0f/3.0f, 2.0f/3.0f, 0.5f) );
- green.SetProperty( Actor::Property::SIZE, actorSize );
+ blue.SetProperty(Actor::Property::NAME, "Blue");
+ blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(1.0f / 3.0f, 1.0f / 3.0f, 0.5f));
+ blue.SetProperty(Actor::Property::SIZE, actorSize);
+ blue.SetProperty(Actor::Property::POSITION_Z, 30.0f);
+
+ Actor green = Actor::New();
+ green.SetProperty(Actor::Property::NAME, "Green");
+ green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(2.0f / 3.0f, 2.0f / 3.0f, 0.5f));
+ green.SetProperty(Actor::Property::SIZE, actorSize);
// Add the actors to the view
- stage.Add( blue );
- stage.Add( green );
+ stage.Add(blue);
+ stage.Add(green);
// Render and notify
application.SendNotification();
HitTestAlgorithm::Results results;
HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == green );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 1.0f/6.0f, TEST_LOCATION );
+ DALI_TEST_CHECK(results.actor == green);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 1.0f / 6.0f, TEST_LOCATION);
HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == blue );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION );
+ DALI_TEST_CHECK(results.actor == blue);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == green );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION );
+ DALI_TEST_CHECK(results.actor == green);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliHitTestAlgorithmOrtho02(void)
{
TestApplication application;
tet_infoline("Testing Dali::HitTestAlgorithm with offset Ortho camera()");
- Stage stage = Stage::GetCurrent();
- RenderTaskList renderTaskList = stage.GetRenderTaskList();
- RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
- Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
+ Stage stage = Stage::GetCurrent();
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
+ Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
- Vector2 stageSize ( stage.GetSize() );
- cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f,
- stageSize.y * 0.3f, -stageSize.y * 0.7f,
- 800.0f, 4895.0f);
- cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f));
+ Vector2 stageSize(stage.GetSize());
+ cameraActor.SetOrthographicProjection(-stageSize.x * 0.3f, stageSize.x * 0.7f, stageSize.y * 0.3f, -stageSize.y * 0.7f, 800.0f, 4895.0f);
+ cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f));
- Vector2 actorSize( stageSize * 0.5f );
+ Vector2 actorSize(stageSize * 0.5f);
// Create two actors with half the size of the stage and set them to be partially overlapping
Actor blue = Actor::New();
- blue.SetProperty( Actor::Property::NAME, "Blue" );
- blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.2f, 0.2f, 0.5f) );
- blue.SetProperty( Actor::Property::SIZE, actorSize );
- blue.SetProperty( Actor::Property::POSITION_Z, 30.0f);
-
- Actor green = Actor::New( );
- green.SetProperty( Actor::Property::NAME, "Green" );
- green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.4f, 0.4f, 0.5f) );
- green.SetProperty( Actor::Property::SIZE, actorSize );
+ blue.SetProperty(Actor::Property::NAME, "Blue");
+ blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.2f, 0.2f, 0.5f));
+ blue.SetProperty(Actor::Property::SIZE, actorSize);
+ blue.SetProperty(Actor::Property::POSITION_Z, 30.0f);
+
+ Actor green = Actor::New();
+ green.SetProperty(Actor::Property::NAME, "Green");
+ green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.4f, 0.4f, 0.5f));
+ green.SetProperty(Actor::Property::SIZE, actorSize);
// Add the actors to the view
- stage.Add( blue );
- stage.Add( green );
+ stage.Add(blue);
+ stage.Add(green);
// Render and notify
application.SendNotification();
{
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == green );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION );
+ HitTest(stage, Vector2(240.0f, 400.0f), results, &DefaultIsActorTouchableFunction);
+ DALI_TEST_CHECK(results.actor == green);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION);
}
{
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2( 0.001f, 0.001f ), results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == blue );
- DALI_TEST_EQUALS( results.actorCoordinates, Vector2( 0.001f, 0.001f ), 0.001f, TEST_LOCATION );
+ HitTest(stage, Vector2(0.001f, 0.001f), results, &DefaultIsActorTouchableFunction);
+ DALI_TEST_CHECK(results.actor == blue);
+ DALI_TEST_EQUALS(results.actorCoordinates, Vector2(0.001f, 0.001f), 0.001f, TEST_LOCATION);
}
{
HitTestAlgorithm::Results results;
HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( ! results.actor );
- DALI_TEST_EQUALS( results.actorCoordinates, Vector2::ZERO, TEST_LOCATION );
+ DALI_TEST_CHECK(!results.actor);
+ DALI_TEST_EQUALS(results.actorCoordinates, Vector2::ZERO, TEST_LOCATION);
}
// Just inside green
{
HitTestAlgorithm::Results results;
- HitTest(stage, stageSize*0.69f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == green );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION );
+ HitTest(stage, stageSize * 0.69f, results, &DefaultIsActorTouchableFunction);
+ DALI_TEST_CHECK(results.actor == green);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION);
}
END_TEST;
TestApplication application;
tet_infoline("Testing Dali::HitTestAlgorithm with a stencil");
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
Actor rootLayer = stage.GetRootLayer();
- rootLayer.SetProperty( Actor::Property::NAME, "RootLayer" );
+ rootLayer.SetProperty(Actor::Property::NAME, "RootLayer");
// Create a layer
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- layer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- layer.SetProperty( Actor::Property::NAME, "layer" );
- stage.Add( layer );
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ layer.SetProperty(Actor::Property::NAME, "layer");
+ stage.Add(layer);
// Create a clipping actor and add it to the layer.
Actor clippingActor = CreateRenderableActor();
- clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- clippingActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) );
- clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- clippingActor.SetProperty( Actor::Property::NAME, "clippingActor" );
- layer.Add( clippingActor );
+ clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ clippingActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
+ clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ clippingActor.SetProperty(Actor::Property::NAME, "clippingActor");
+ layer.Add(clippingActor);
// Create a renderable actor and add it to the clipping actor.
Actor childActor = CreateRenderableActor();
- childActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- childActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- childActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- childActor.SetProperty( Actor::Property::NAME, "childActor" );
- clippingActor.Add( childActor );
+ childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ childActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ childActor.SetProperty(Actor::Property::NAME, "childActor");
+ clippingActor.Add(childActor);
// Render and notify
application.SendNotification();
// Hit within clippingActor and childActor.
HitTestAlgorithm::Results results;
- HitTest( stage, Vector2( 10.0f, 10.0f ), results, &DefaultIsActorTouchableFunction );
- DALI_TEST_CHECK( results.actor == childActor );
- tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetProperty< std::string >( Actor::Property::NAME ).c_str() : "NULL" ) );
+ HitTest(stage, Vector2(10.0f, 10.0f), results, &DefaultIsActorTouchableFunction);
+ DALI_TEST_CHECK(results.actor == childActor);
+ tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty<std::string>(Actor::Property::NAME).c_str() : "NULL"));
// Hit within childActor but outside of clippingActor, should hit the root-layer instead.
- HitTest( stage, Vector2( 60.0f, 60.0f ), results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == rootLayer );
- tet_printf( "Hit: %s\n", ( results.actor ? results.actor.GetProperty< std::string >( Actor::Property::NAME ).c_str() : "NULL" ) );
+ HitTest(stage, Vector2(60.0f, 60.0f), results, &DefaultIsActorTouchableFunction);
+ DALI_TEST_CHECK(results.actor == rootLayer);
+ tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty<std::string>(Actor::Property::NAME).c_str() : "NULL"));
END_TEST;
}
TestApplication application;
tet_infoline("Testing Dali::HitTestAlgorithm with overlay actors");
- Stage stage = Stage::GetCurrent();
- RenderTaskList renderTaskList = stage.GetRenderTaskList();
- RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
- Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
+ Stage stage = Stage::GetCurrent();
+ RenderTaskList renderTaskList = stage.GetRenderTaskList();
+ RenderTask defaultRenderTask = renderTaskList.GetTask(0u);
+ Dali::CameraActor cameraActor = defaultRenderTask.GetCameraActor();
- Vector2 stageSize ( stage.GetSize() );
- cameraActor.SetOrthographicProjection( stageSize );
- cameraActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f));
+ Vector2 stageSize(stage.GetSize());
+ cameraActor.SetOrthographicProjection(stageSize);
+ cameraActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 1600.0f));
- Vector2 actorSize( stageSize * 0.5f );
+ Vector2 actorSize(stageSize * 0.5f);
// Create two actors with half the size of the stage and set them to be partially overlapping
Actor blue = Actor::New();
- blue.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
- blue.SetProperty( Actor::Property::NAME, "Blue" );
- blue.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- blue.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(1.0f/3.0f, 1.0f/3.0f, 0.5f) );
- blue.SetProperty( Actor::Property::SIZE, actorSize );
- blue.SetProperty( Actor::Property::POSITION_Z, 30.0f);
-
- Actor green = Actor::New( );
- green.SetProperty( Actor::Property::NAME, "Green" );
- green.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
- green.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(2.0f/3.0f, 2.0f/3.0f, 0.5f) );
- green.SetProperty( Actor::Property::SIZE, actorSize );
+ blue.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
+ blue.SetProperty(Actor::Property::NAME, "Blue");
+ blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ blue.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(1.0f / 3.0f, 1.0f / 3.0f, 0.5f));
+ blue.SetProperty(Actor::Property::SIZE, actorSize);
+ blue.SetProperty(Actor::Property::POSITION_Z, 30.0f);
+
+ Actor green = Actor::New();
+ green.SetProperty(Actor::Property::NAME, "Green");
+ green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ green.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(2.0f / 3.0f, 2.0f / 3.0f, 0.5f));
+ green.SetProperty(Actor::Property::SIZE, actorSize);
// Add the actors to the view
- stage.Add( blue );
- stage.Add( green );
+ stage.Add(blue);
+ stage.Add(green);
// Render and notify
application.SendNotification();
//Hit in the intersection. Should pick the blue actor since it is an overlay.
HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == blue );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 5.0f/6.0f, TEST_LOCATION );
+ DALI_TEST_CHECK(results.actor == blue);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 5.0f / 6.0f, TEST_LOCATION);
//Hit in the blue actor
HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == blue );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION );
+ DALI_TEST_CHECK(results.actor == blue);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
//Hit in the green actor
HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == green );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION );
+ DALI_TEST_CHECK(results.actor == green);
+ DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/hover-event-devel.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali/devel-api/events/hover-event-devel.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
- : functorCalled( false ),
+ : functorCalled(false),
hoverEvent(),
hoveredActor()
{
hoveredActor.Reset();
}
- bool functorCalled;
+ bool functorCalled;
HoverEvent hoverEvent;
- Actor hoveredActor;
+ Actor hoveredActor;
};
// Functor that sets the data when called
* @param[in] data Reference to the data to store callback information.
* @param[in] returnValue What the functor should return.
*/
- HoverEventFunctor( SignalData& data, bool returnValue = true )
- : signalData( data ),
- returnValue( returnValue )
+ HoverEventFunctor(SignalData& data, bool returnValue = true)
+ : signalData(data),
+ returnValue(returnValue)
{
}
- bool operator()( Actor actor, const HoverEvent& hoverEvent )
+ bool operator()(Actor actor, const HoverEvent& hoverEvent)
{
signalData.functorCalled = true;
- signalData.hoveredActor = actor;
- signalData.hoverEvent = hoverEvent;
+ signalData.hoveredActor = actor;
+ signalData.hoverEvent = hoverEvent;
return returnValue;
}
SignalData& signalData;
- bool returnValue;
+ bool returnValue;
};
// Functor that removes the actor when called.
* @param[in] data Reference to the data to store callback information.
* @param[in] returnValue What the functor should return.
*/
- RemoveActorFunctor( SignalData& data, bool returnValue = true )
- : HoverEventFunctor( data, returnValue )
+ RemoveActorFunctor(SignalData& data, bool returnValue = true)
+ : HoverEventFunctor(data, returnValue)
{
}
- bool operator()( Actor actor, const HoverEvent& hoverEvent )
+ bool operator()(Actor actor, const HoverEvent& hoverEvent)
{
- Actor parent( actor.GetParent() );
- if ( parent )
+ Actor parent(actor.GetParent());
+ if(parent)
{
- parent.Remove( actor );
+ parent.Remove(actor);
}
- return HoverEventFunctor::operator()( actor, hoverEvent );
+ return HoverEventFunctor::operator()(actor, hoverEvent);
}
};
-Integration::HoverEvent GenerateSingleHover( PointState::Type state, const Vector2& screenPosition )
+Integration::HoverEvent GenerateSingleHover(PointState::Type state, const Vector2& screenPosition)
{
Integration::HoverEvent hoverEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- hoverEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ hoverEvent.points.push_back(point);
return hoverEvent;
}
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 localCoordinates;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0, data.hoverEvent.GetDeviceId(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, data.hoverEvent.GetTime(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor, data.hoverEvent.GetHitActor(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, data.hoverEvent.GetDeviceId(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetScreenPosition(1), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetLocalPosition(1), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Actor(), data.hoverEvent.GetHitActor(1), TEST_LOCATION);
data.Reset();
// Emit a motion signal
screenCoordinates.x = screenCoordinates.y = 11.0f;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0, data.hoverEvent.GetDeviceId(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, data.hoverEvent.GetTime(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor, data.hoverEvent.GetHitActor(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, data.hoverEvent.GetDeviceId(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetScreenPosition(1), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetLocalPosition(1), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Actor(), data.hoverEvent.GetHitActor(1), TEST_LOCATION);
data.Reset();
// Emit a finished signal
screenCoordinates.x = screenCoordinates.y = 12.0f;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( PointState::FINISHED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( 0, data.hoverEvent.GetDeviceId( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, data.hoverEvent.GetTime(), TEST_LOCATION );
- DALI_TEST_EQUALS( actor, data.hoverEvent.GetHitActor( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( -1, data.hoverEvent.GetDeviceId( 1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 1 ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetScreenPosition( 1 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.hoverEvent.GetLocalPosition( 1 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( Dali::Actor(), data.hoverEvent.GetHitActor( 1 ), TEST_LOCATION );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleHover(PointState::FINISHED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0, data.hoverEvent.GetDeviceId(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, data.hoverEvent.GetTime(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actor, data.hoverEvent.GetHitActor(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, data.hoverEvent.GetDeviceId(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetScreenPosition(1), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.hoverEvent.GetLocalPosition(1), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Dali::Actor(), data.hoverEvent.GetHitActor(1), TEST_LOCATION);
data.Reset();
// Emit a started signal where the actor is not present
screenCoordinates.x = screenCoordinates.y = 200.0f;
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( !data.hoverEvent );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(!data.hoverEvent);
END_TEST;
}
{
TestApplication application;
- Integration::Scene stage = application.GetScene();
- Vector2 stageSize = stage.GetSize();
+ Integration::Scene stage = application.GetScene();
+ Vector2 stageSize = stage.GetSize();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
stage.Add(actor);
// Render and notify
application.Render();
// Get the camera's near and far planes
- RenderTaskList taskList = stage.GetRenderTaskList();
- Dali::RenderTask task = taskList.GetTask(0);
- CameraActor camera = task.GetCameraActor();
- float nearPlane = camera.GetNearClippingPlane();
- float farPlane = camera.GetFarClippingPlane();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ Dali::RenderTask task = taskList.GetTask(0);
+ CameraActor camera = task.GetCameraActor();
+ float nearPlane = camera.GetNearClippingPlane();
+ float farPlane = camera.GetFarClippingPlane();
// Calculate the current distance of the actor from the camera
float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f);
- float distance = (stageSize.y * 0.5f) / tanHalfFov;
+ float distance = (stageSize.y * 0.5f) / tanHalfFov;
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
- Vector2 screenCoordinates( stageSize.x * 0.5f, stageSize.y * 0.5f );
+ Vector2 screenCoordinates(stageSize.x * 0.5f, stageSize.y * 0.5f);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a started signal where actor is just at the camera's near plane
- actor.SetProperty( Actor::Property::POSITION_Z, distance - nearPlane);
+ actor.SetProperty(Actor::Property::POSITION_Z, distance - nearPlane);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a started signal where actor is closer than the camera's near plane
- actor.SetProperty( Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f);
+ actor.SetProperty(Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a started signal where actor is just at the camera's far plane
- actor.SetProperty( Actor::Property::POSITION_Z, distance - farPlane);
+ actor.SetProperty(Actor::Property::POSITION_Z, distance - farPlane);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a started signal where actor is further than the camera's far plane
- actor.SetProperty( Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f);
+ actor.SetProperty(Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
{
// Emit an empty HoverEvent
Integration::HoverEvent event;
- application.ProcessEvent( event );
- tet_result( TET_FAIL );
+ application.ProcessEvent(event);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_ASSERT( e, "!event.points.empty()", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "!event.points.empty()", TEST_LOCATION);
}
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
- application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// Emit another interrupted signal, our signal handler should not be called.
- application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
int UtcDaliHoverParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data, false );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data, false);
+ actor.HoveredSignal().Connect(&application, functor);
// Connect to root actor's hovered signal
- SignalData rootData;
- HoverEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.HoveredSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ HoverEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.HoveredSignal().Connect(&application, rootFunctor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 actorCoordinates, rootCoordinates;
- actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit a motion signal
screenCoordinates.x = screenCoordinates.y = 11.0f;
- actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit a finished signal
screenCoordinates.x = screenCoordinates.y = 12.0f;
- actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( PointState::FINISHED, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleHover(PointState::FINISHED, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorCoordinates, data.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit a started signal where the actor is not present, will hit the root actor though
screenCoordinates.x = screenCoordinates.y = 200.0f;
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.hoverEvent.GetScreenPosition( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.hoverEvent.GetLocalPosition( 0 ), 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) );
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.hoverEvent.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.hoverEvent.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.hoverEvent.GetLocalPosition(0), 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0));
END_TEST;
}
int UtcDaliHoverInterruptedParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data, false );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data, false);
+ actor.HoveredSignal().Connect(&application, functor);
// Connect to root actor's hovered signal
- SignalData rootData;
- HoverEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.HoveredSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ HoverEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.HoveredSignal().Connect(&application, rootFunctor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit an interrupted signal
- application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit another started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
rootData.Reset();
// Remove actor from Stage
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
// Render and notify
application.SendNotification();
application.Render();
// Emit an interrupted signal, only root actor's signal should be called.
- application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit another interrupted state, none of the signal's should be called.
- application.ProcessEvent( GenerateSingleHover( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, rootData.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Set actor to require leave events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// Another motion outside of actor, no signalling
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(201.0f, 201.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// We do not want to listen to leave events anymore
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
// Another motion event outside of actor, no signalling
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverLeaveParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data, false );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data, false);
+ actor.HoveredSignal().Connect(&application, functor);
// Connect to root actor's hovered signal
- SignalData rootData;
- HoverEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.HoveredSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ HoverEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.HoveredSignal().Connect(&application, rootFunctor);
// Set actor to require leave events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
- rootActor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
+ rootActor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Another motion outside of actor, only rootActor signalled
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(201.0f, 201.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// We do not want to listen to leave events of actor anymore
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
// Another motion event outside of root actor, only root signalled
- Vector2 stageSize( application.GetScene().GetSize() );
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( stageSize.width + 10.0f, stageSize.height + 10.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ Vector2 stageSize(application.GetScene().GetSize());
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(stageSize.width + 10.0f, stageSize.height + 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, rootData.hoverEvent.GetState(0), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
// Change actor to insensitive
- actor.SetProperty( Actor::Property::SENSITIVE, false );
+ actor.SetProperty(Actor::Property::SENSITIVE, false);
// Emit a motion signal, signalled with an interrupted
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverActorBecomesInsensitiveParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data, false );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data, false);
+ actor.HoveredSignal().Connect(&application, functor);
// Connect to root actor's hovered signal
- SignalData rootData;
- HoverEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.HoveredSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ HoverEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.HoveredSignal().Connect(&application, rootFunctor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::STARTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoverEvent.GetHitActor( 0 ) );
- DALI_TEST_CHECK( actor == rootData.hoverEvent.GetHitActor( 0 ) );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoverEvent.GetHitActor(0));
+ DALI_TEST_CHECK(actor == rootData.hoverEvent.GetHitActor(0));
data.Reset();
rootData.Reset();
// Remove actor from Stage
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
// Render and notify
application.SendNotification();
application.Render();
// Make root actor insensitive
- rootActor.SetProperty( Actor::Property::SENSITIVE, false );
+ rootActor.SetProperty(Actor::Property::SENSITIVE, false);
// Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.hoverEvent.GetState(0), TEST_LOCATION);
END_TEST;
}
int UtcDaliHoverMultipleLayers(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
+ SignalData data;
+ HoverEventFunctor functor(data);
- Layer layer1 ( Layer::New() );
- layer1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer1 );
+ Layer layer1(Layer::New());
+ layer1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer1);
- Actor actor1 ( Actor::New() );
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor1.SetProperty( Actor::Property::POSITION_Z, 1.0f ); // Should hit actor1 in this layer
- layer1.Add( actor1 );
+ Actor actor1(Actor::New());
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::POSITION_Z, 1.0f); // Should hit actor1 in this layer
+ layer1.Add(actor1);
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer1 and actor1
- layer1.HoveredSignal().Connect( &application, functor );
- actor1.HoveredSignal().Connect( &application, functor );
+ layer1.HoveredSignal().Connect(&application, functor);
+ actor1.HoveredSignal().Connect(&application, functor);
// Hit in hittable area, actor1 should be hit
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.hoveredActor == actor1 );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.hoveredActor == actor1);
data.Reset();
// Make layer1 insensitive, nothing should be hit
- layer1.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ layer1.SetProperty(Actor::Property::SENSITIVE, false);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Make layer1 sensitive again, again actor1 will be hit
- layer1.SetProperty( Actor::Property::SENSITIVE, true );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.hoveredActor == actor1 );
+ layer1.SetProperty(Actor::Property::SENSITIVE, true);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.hoveredActor == actor1);
data.Reset();
// Make rootActor insensitive, nothing should be hit
- rootActor.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ rootActor.SetProperty(Actor::Property::SENSITIVE, false);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Make rootActor sensitive
- rootActor.SetProperty( Actor::Property::SENSITIVE, true );
+ rootActor.SetProperty(Actor::Property::SENSITIVE, true);
// Add another layer
- Layer layer2 ( Layer::New() );
- layer2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- layer2.SetProperty( Actor::Property::POSITION_Z, 10.0f ); // Should hit layer2 in this layer rather than actor2
- application.GetScene().Add( layer2 );
+ Layer layer2(Layer::New());
+ layer2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ layer2.SetProperty(Actor::Property::POSITION_Z, 10.0f); // Should hit layer2 in this layer rather than actor2
+ application.GetScene().Add(layer2);
- Actor actor2 ( Actor::New() );
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- layer2.Add( actor2 );
+ Actor actor2(Actor::New());
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ layer2.Add(actor2);
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer2 and actor2
- layer2.HoveredSignal().Connect( &application, functor );
- actor2.HoveredSignal().Connect( &application, functor );
+ layer2.HoveredSignal().Connect(&application, functor);
+ actor2.HoveredSignal().Connect(&application, functor);
// Emit an event, should hit layer2
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
//DALI_TEST_CHECK( data.hoveredActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
// Make layer2 insensitive, should hit actor1
- layer2.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.hoveredActor == actor1 );
+ layer2.SetProperty(Actor::Property::SENSITIVE, false);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.hoveredActor == actor1);
data.Reset();
// Make layer2 sensitive again, should hit layer2
- layer2.SetProperty( Actor::Property::SENSITIVE, true );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ layer2.SetProperty(Actor::Property::SENSITIVE, true);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
//DALI_TEST_CHECK( data.hoveredActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
// Make layer2 invisible, render and notify
- layer2.SetProperty( Actor::Property::VISIBLE, false );
+ layer2.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render();
// Should hit actor1
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.hoveredActor == actor1 );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.hoveredActor == actor1);
data.Reset();
// Make rootActor invisible, render and notify
- rootActor.SetProperty( Actor::Property::VISIBLE, false );
+ rootActor.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render();
// Should not hit anything
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverMultipleRenderTasks(void)
{
- TestApplication application;
- Integration::Scene stage ( application.GetScene() );
- Vector2 stageSize ( stage.GetSize() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
+ Vector2 stageSize(stage.GetSize());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
stage.Add(actor);
// Create render task
- Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f );
- RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() );
- renderTask.SetViewport( viewport );
- renderTask.SetInputEnabled( true );
+ Viewport viewport(stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f);
+ RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask());
+ renderTask.SetViewport(viewport);
+ renderTask.SetInputEnabled(true);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Disable input on renderTask, should not be hittable
- renderTask.SetInputEnabled( false );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ renderTask.SetInputEnabled(false);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverMultipleRenderTasksWithChildLayer(void)
{
- TestApplication application;
- Integration::Scene stage ( application.GetScene() );
- Vector2 stageSize ( stage.GetSize() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
+ Vector2 stageSize(stage.GetSize());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
stage.Add(actor);
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
actor.Add(layer);
// Create render task
- Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f );
- RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() );
- renderTask.SetViewport( viewport );
- renderTask.SetInputEnabled( true );
- renderTask.SetSourceActor( actor );
+ Viewport viewport(stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f);
+ RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask());
+ renderTask.SetViewport(viewport);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetSourceActor(actor);
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
- layer.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
+ layer.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Disable input on renderTask, should not be hittable
- renderTask.SetInputEnabled( false );
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ renderTask.SetInputEnabled(false);
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverOffscreenRenderTasks(void)
{
- TestApplication application;
- Integration::Scene stage ( application.GetScene() );
- Vector2 stageSize ( stage.GetSize() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
+ Vector2 stageSize(stage.GetSize());
// FrameBufferImage for offscreen RenderTask
- FrameBuffer frameBuffer = FrameBuffer::New( stageSize.width, stageSize.height );
+ FrameBuffer frameBuffer = FrameBuffer::New(stageSize.width, stageSize.height);
// Create a renderable actor to display the FrameBufferImage
Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture());
- renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- renderableActor.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, stageSize.y ) );
- renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
- stage.Add( renderableActor );
+ renderableActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ renderableActor.SetProperty(Actor::Property::SIZE, Vector2(stageSize.x, stageSize.y));
+ renderableActor.ScaleBy(Vector3(1.0f, -1.0f, 1.0f)); // FIXME
+ stage.Add(renderableActor);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- stage.Add( actor );
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ stage.Add(actor);
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); // Ensure framebuffer connects
- stage.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
+ stage.GetRenderTaskList().GetTask(0u).SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION);
// Create a RenderTask
RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
- renderTask.SetSourceActor( actor );
+ renderTask.SetSourceActor(actor);
renderTask.SetFrameBuffer(frameBuffer);
- renderTask.SetInputEnabled( true );
+ renderTask.SetInputEnabled(true);
// Create another RenderTask
- RenderTask renderTask2( stage.GetRenderTaskList().CreateTask() );
- renderTask2.SetInputEnabled( true );
+ RenderTask renderTask2(stage.GetRenderTaskList().CreateTask());
+ renderTask2.SetInputEnabled(true);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverMultipleRenderableActors(void)
{
- TestApplication application;
- Integration::Scene stage ( application.GetScene() );
- Vector2 stageSize ( stage.GetSize() );
+ TestApplication application;
+ Integration::Scene stage(application.GetScene());
+ Vector2 stageSize(stage.GetSize());
Actor parent = CreateRenderableActor();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
stage.Add(parent);
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(actor);
// Render and notify
application.Render();
// Connect to layer's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- parent.HoveredSignal().Connect( &application, functor );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ parent.HoveredSignal().Connect(&application, functor);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.hoveredActor );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.hoveredActor);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- RemoveActorFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ RemoveActorFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Register for leave events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Re-add, render and notify
application.Render();
// Emit another signal outside of actor's area, should not get anything as the scene has changed.
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(210.0f, 210.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Render and notify
application.Render();
// Emit another signal outside of actor's area, should not get anything as the scene has changed.
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(210.0f, 210.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Re-add actor back to stage, render and notify
application.Render();
// Emit another started event
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Completely delete the actor
actor.Reset();
// Emit event, should not crash and should not receive an event.
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(210.0f, 210.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data, false );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data, false);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started signal
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Remove actor from stage
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
// Render and notify
application.SendNotification();
application.Render();
// Emit a move at the same point, we should not be signalled.
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliHoverLeaveActorReadded(void)
{
- TestApplication application;
+ TestApplication application;
Integration::Scene stage = application.GetScene();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
stage.Add(actor);
// Set actor to receive hover-events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's hovered signal
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit a started and motion
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 11.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(11.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Remove actor from stage and add again
- stage.Remove( actor );
- stage.Add( actor );
+ stage.Remove(actor);
+ stage.Add(actor);
// Emit a motion within the actor's bounds
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 12.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(12.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a motion outside the actor's bounds
- application.ProcessEvent( GenerateSingleHover( PointState::MOTION, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, data.hoverEvent.GetState( 0 ), TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, data.hoverEvent.GetState(0), TEST_LOCATION);
data.Reset();
END_TEST;
int UtcDaliHoverClippingActor(void)
{
- TestApplication application;
+ TestApplication application;
Integration::Scene stage = application.GetScene();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- stage.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ stage.Add(actor);
Actor clippingActor = Actor::New();
- clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) );
- clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- stage.Add( clippingActor );
+ clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
+ clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ stage.Add(clippingActor);
// Add a child to the clipped region.
Actor clippingChild = Actor::New();
- clippingChild.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) );
- clippingChild.SetProperty( Actor::Property::POSITION, Vector2( 25.0f, 25.0f ));
- clippingChild.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- clippingActor.Add( clippingChild );
+ clippingChild.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
+ clippingChild.SetProperty(Actor::Property::POSITION, Vector2(25.0f, 25.0f));
+ clippingChild.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ clippingActor.Add(clippingChild);
// Render and notify.
application.SendNotification();
application.Render();
// Connect to actor's hovered signal.
- SignalData data;
- HoverEventFunctor functor( data );
- actor.HoveredSignal().Connect( &application, functor );
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
// Emit an event within clipped area - no hit.
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit an event outside the clipped area but within the actor area, we should have a hit.
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 60.0f, 60.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(60.0f, 60.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- clippingChild.HoveredSignal().Connect( &application, functor );
+ clippingChild.HoveredSignal().Connect(&application, functor);
// Emit an event inside part of the child which is within the clipped area, we should have a hit.
- application.ProcessEvent( GenerateSingleHover( PointState::STARTED, Vector2( 30.0f, 30.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(30.0f, 30.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
{
TestApplication application;
- Dali::HoverEvent hoverEvent = DevelHoverEvent::New( 100 );
- DALI_TEST_CHECK( hoverEvent );
+ Dali::HoverEvent hoverEvent = DevelHoverEvent::New(100);
+ DALI_TEST_CHECK(hoverEvent);
// Emit a started signal
- DALI_TEST_EQUALS( 100, hoverEvent.GetTime(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, hoverEvent.GetPointCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(100, hoverEvent.GetTime(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, hoverEvent.GetPointCount(), TEST_LOCATION);
END_TEST;
}
-
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
using namespace Dali;
namespace
{
-
const int REPEAT = 1000;
-size_t g_creationCount = 0;
-size_t g_destructionCount = 0;
-size_t g_creationCountSubclass = 0;
-size_t g_destructionCountSubclass = 0;
-size_t g_creationCountUnrelated = 0;
+size_t g_creationCount = 0;
+size_t g_destructionCount = 0;
+size_t g_creationCountSubclass = 0;
+size_t g_destructionCountSubclass = 0;
+size_t g_creationCountUnrelated = 0;
size_t g_destructionCountUnrelated = 0;
class Counted : public RefObject
TestObject& Assign(const TestObject& testObject)
{
RefObject::operator=(testObject);
- data = testObject.data;
+ data = testObject.data;
return *this;
}
int data;
};
-
} // Anonymous namespace
/**
*/
int UtcDaliIntrusivePtrIntrusivePtr(void)
{
- tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr()" );
+ tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr()");
g_creationCount = g_destructionCount = 0;
IntrusivePtr<Counted> counted;
- DALI_TEST_EQUALS( g_creationCount, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
// Test the pointer is null
- DALI_TEST_EQUALS( counted.Get(), (Counted*) 0, TEST_LOCATION );
- DALI_TEST_EQUALS( &(*counted), (Counted*) 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted.Get(), (Counted*)0, TEST_LOCATION);
+ DALI_TEST_EQUALS(&(*counted), (Counted*)0, TEST_LOCATION);
// Check destruction of the null smart pointer does nothing:
counted = IntrusivePtr<Counted>();
- DALI_TEST_EQUALS( g_creationCount, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrIntrusivePtrTP(void)
{
- tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr(T*)" );
+ tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr(T*)");
g_creationCount = g_destructionCount = 0;
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
counted = 0;
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrIntrusivePtrIntrusivePtrUP(void)
{
- tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr<U> const &)" );
+ tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr<U> const &)");
g_creationCount = g_destructionCount = g_creationCountSubclass = g_destructionCountSubclass = 0;
- IntrusivePtr<CountedSubclass> countedSubclass( new CountedSubclass );
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_creationCountSubclass, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCountSubclass, 0u, TEST_LOCATION );
+ IntrusivePtr<CountedSubclass> countedSubclass(new CountedSubclass);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_creationCountSubclass, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCountSubclass, 0u, TEST_LOCATION);
- IntrusivePtr<Counted> counted( countedSubclass );
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(countedSubclass);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION);
// Make loads more references:
- std::vector< IntrusivePtr<Counted> > intrusivePtrs;
- for( int i = 0; i < REPEAT; ++i )
+ std::vector<IntrusivePtr<Counted> > intrusivePtrs;
+ for(int i = 0; i < REPEAT; ++i)
{
- intrusivePtrs.push_back( IntrusivePtr<Counted>( countedSubclass ) );
+ intrusivePtrs.push_back(IntrusivePtr<Counted>(countedSubclass));
}
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION);
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_creationCountSubclass, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_creationCountSubclass, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrIntrusivePtrIntrusivePtrP(void)
{
- tet_infoline( "Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr const &)" );
+ tet_infoline("Testing Dali::IntrusivePtr::IntrusivePtr(IntrusivePtr const &)");
// Pass a pointer to a constructed second object:
// Pass a pointer to null:
g_creationCount = g_destructionCount = 0;
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION);
- IntrusivePtr<Counted> counted2( counted );
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION );
- DALI_TEST_EQUALS( counted.Get(), counted2.Get(), TEST_LOCATION );
+ IntrusivePtr<Counted> counted2(counted);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted.Get(), counted2.Get(), TEST_LOCATION);
// Make loads more references:
- std::vector< IntrusivePtr<Counted> > intrusivePtrs;
- for( int i = 0; i < REPEAT; ++i )
+ std::vector<IntrusivePtr<Counted> > intrusivePtrs;
+ for(int i = 0; i < REPEAT; ++i)
{
- intrusivePtrs.push_back( IntrusivePtr<Counted>( counted ) );
+ intrusivePtrs.push_back(IntrusivePtr<Counted>(counted));
}
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2 + REPEAT, TEST_LOCATION);
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
intrusivePtrs.clear();
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION);
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
counted.Reset();
- DALI_TEST_EQUALS( counted2->ReferenceCount(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted2->ReferenceCount(), 1, TEST_LOCATION);
counted2.Reset();
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrGetP(void)
{
- tet_infoline( "Testing Dali::IntrusivePtr::Get()" );
+ tet_infoline("Testing Dali::IntrusivePtr::Get()");
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_CHECK( counted.Get() != 0 );
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_CHECK(counted.Get() != 0);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrGetN(void)
{
- tet_infoline( "Testing Dali::IntrusivePtr::Get()" );
+ tet_infoline("Testing Dali::IntrusivePtr::Get()");
g_creationCount = 0;
- IntrusivePtr<Counted> counted( 0 );
- DALI_TEST_CHECK( counted.Get() == 0 );
- DALI_TEST_EQUALS( g_creationCount, 0u, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(0);
+ DALI_TEST_CHECK(counted.Get() == 0);
+ DALI_TEST_EQUALS(g_creationCount, 0u, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrArrowOperatorP(void)
{
- tet_infoline( "Positive Test for Dali::IntrusivePtr::operator->()" );
+ tet_infoline("Positive Test for Dali::IntrusivePtr::operator->()");
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_CHECK( (counted.operator->()) != 0 );
- DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_CHECK((counted.operator->()) != 0);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrArrowOperatorN(void)
{
- tet_infoline( "Negative Test for Dali::IntrusivePtr::operator->()" );
+ tet_infoline("Negative Test for Dali::IntrusivePtr::operator->()");
IntrusivePtr<Counted> counted;
- DALI_TEST_CHECK( (counted.operator->()) == 0 );
+ DALI_TEST_CHECK((counted.operator->()) == 0);
END_TEST;
}
int UtcDaliIntrusivePtrIndirectionOperatorP(void)
{
- tet_infoline( "Positive Test for Dali::IntrusivePtr::operator*()" );
+ tet_infoline("Positive Test for Dali::IntrusivePtr::operator*()");
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_CHECK( &(counted.operator*()) != 0 );
- DALI_TEST_EQUALS( (*counted).ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_CHECK(&(counted.operator*()) != 0);
+ DALI_TEST_EQUALS((*counted).ReferenceCount(), 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrIndirectionOperatorN(void)
{
- tet_infoline( "Negative Test for Dali::IntrusivePtr::operator*()" );
+ tet_infoline("Negative Test for Dali::IntrusivePtr::operator*()");
IntrusivePtr<Counted> counted;
- DALI_TEST_CHECK( &(counted.operator*()) == 0 );
+ DALI_TEST_CHECK(&(counted.operator*()) == 0);
END_TEST;
}
int UtcDaliIntrusivePtrResetP(void)
{
- tet_infoline( "Positive Test for Dali::IntrusivePtr::Reset()" );
+ tet_infoline("Positive Test for Dali::IntrusivePtr::Reset()");
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_CHECK( counted.Get() != 0 );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_CHECK(counted.Get() != 0);
counted.Reset();
- DALI_TEST_CHECK( counted.Get() == 0 );
+ DALI_TEST_CHECK(counted.Get() == 0);
END_TEST;
}
int UtcDaliIntrusivePtrResetN(void)
{
- tet_infoline( "Negative Test for Dali::IntrusivePtr::Reset()" );
+ tet_infoline("Negative Test for Dali::IntrusivePtr::Reset()");
IntrusivePtr<Counted> counted;
- Counted* firstGet = counted.Get();
+ Counted* firstGet = counted.Get();
counted.Reset();
- DALI_TEST_EQUALS( counted.Get(), firstGet, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted.Get(), firstGet, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrResetTP(void)
{
- tet_infoline( "Positive Test for Dali::IntrusivePtr::Reset(T*)" );
+ tet_infoline("Positive Test for Dali::IntrusivePtr::Reset(T*)");
g_creationCount = g_destructionCount = 0;
- IntrusivePtr<Counted> counted( new Counted );
+ IntrusivePtr<Counted> counted(new Counted);
- IntrusivePtr<Counted> counted2( new Counted );
+ IntrusivePtr<Counted> counted2(new Counted);
- DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( counted2->ReferenceCount(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted2->ReferenceCount(), 1, TEST_LOCATION);
- counted.Reset( counted2.Get() );
+ counted.Reset(counted2.Get());
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION );
- DALI_TEST_EQUALS( counted2->ReferenceCount(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted2->ReferenceCount(), 2, TEST_LOCATION);
- DALI_TEST_EQUALS( counted.Get(), counted2.Get(), TEST_LOCATION );
+ DALI_TEST_EQUALS(counted.Get(), counted2.Get(), TEST_LOCATION);
- DALI_TEST_EQUALS( g_creationCount, 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_creationCount, 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION);
- counted2.Reset( (Counted*) 0 );
- counted.Reset( counted2.Get() );
- DALI_TEST_EQUALS( g_destructionCount, 2u, TEST_LOCATION );
+ counted2.Reset((Counted*)0);
+ counted.Reset(counted2.Get());
+ DALI_TEST_EQUALS(g_destructionCount, 2u, TEST_LOCATION);
// Check that reseting nulls is harmless:
- counted2.Reset( counted.Get() );
- counted.Reset( counted2.Get() );
+ counted2.Reset(counted.Get());
+ counted.Reset(counted2.Get());
- DALI_TEST_EQUALS( g_destructionCount, 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(g_destructionCount, 2u, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliIntrusivePtrResetTN(void)
{
- tet_infoline( "Negative Test for Dali::IntrusivePtr::Reset(T*)" );
+ tet_infoline("Negative Test for Dali::IntrusivePtr::Reset(T*)");
g_creationCount = g_destructionCount = 0;
- IntrusivePtr<Counted> counted( new Counted );
+ IntrusivePtr<Counted> counted(new Counted);
- counted.Reset( (Counted*) 0 );
+ counted.Reset((Counted*)0);
- DALI_TEST_EQUALS( counted.Get(), (Counted*) 0, TEST_LOCATION );
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(counted.Get(), (Counted*)0, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliIntrusivePtrOperatorBooleanTypeP(void)
{
- tet_infoline( "Positive Test for Dali::IntrusivePtr::operator Booleantype()" );
+ tet_infoline("Positive Test for Dali::IntrusivePtr::operator Booleantype()");
- IntrusivePtr<Counted> counted( new Counted );
- DALI_TEST_CHECK( counted.operator BooleanType() != 0 );
- DALI_TEST_CHECK( counted );
+ IntrusivePtr<Counted> counted(new Counted);
+ DALI_TEST_CHECK(counted.operator BooleanType() != 0);
+ DALI_TEST_CHECK(counted);
typedef void (IntrusivePtr<Counted>::*BoolIdiomFunc)() const;
- BoolIdiomFunc func = static_cast<BoolIdiomFunc>( counted.operator BooleanType() );
+ BoolIdiomFunc func = static_cast<BoolIdiomFunc>(counted.operator BooleanType());
((counted).*func)(); // purely for test coverage
counted.Reset();
- DALI_TEST_CHECK( counted.operator BooleanType() == 0 );
+ DALI_TEST_CHECK(counted.operator BooleanType() == 0);
END_TEST;
}
int UtcDaliIntrusivePtrOperatorBooleanTypeN(void)
{
- tet_infoline( "Negative Test for Dali::IntrusivePtr::operator Booleantype()" );
+ tet_infoline("Negative Test for Dali::IntrusivePtr::operator Booleantype()");
IntrusivePtr<Counted> counted;
- DALI_TEST_CHECK( counted.operator BooleanType() == 0 );
- DALI_TEST_CHECK( !counted );
+ DALI_TEST_CHECK(counted.operator BooleanType() == 0);
+ DALI_TEST_CHECK(!counted);
END_TEST;
}
/** Equality of two different types*/
int UtcDaliIntrusivePtrOperatorEqualTU(void)
{
- tet_infoline( "Test for Dali::IntrusivePtr::operator ==(T, U)" );
+ tet_infoline("Test for Dali::IntrusivePtr::operator ==(T, U)");
- IntrusivePtr<Counted> counted1( new Counted );
- IntrusivePtr<CountedSubclass> countedSubclass1( new CountedSubclass );
- IntrusivePtr<CountedSubclass> countedSubclass2( new CountedSubclass );
- IntrusivePtr<Counted> counted2( countedSubclass2 );
+ IntrusivePtr<Counted> counted1(new Counted);
+ IntrusivePtr<CountedSubclass> countedSubclass1(new CountedSubclass);
+ IntrusivePtr<CountedSubclass> countedSubclass2(new CountedSubclass);
+ IntrusivePtr<Counted> counted2(countedSubclass2);
- DALI_TEST_EQUALS( operator==( counted1, countedSubclass1 ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( operator==( counted2, countedSubclass2 ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(operator==(counted1, countedSubclass1), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(operator==(counted2, countedSubclass2), true, TEST_LOCATION);
END_TEST;
}
/** Inequality of two different types*/
int UtcDaliIntrusivePtrOperatorNotEqualTU(void)
{
- tet_infoline( "Test for Dali::IntrusivePtr::operator !=(T, U)" );
+ tet_infoline("Test for Dali::IntrusivePtr::operator !=(T, U)");
- IntrusivePtr<Counted> counted1( new Counted );
- IntrusivePtr<CountedSubclass> countedSubclass1( new CountedSubclass );
- IntrusivePtr<CountedSubclass> countedSubclass2( new CountedSubclass );
- IntrusivePtr<Counted> counted2( countedSubclass2 );
+ IntrusivePtr<Counted> counted1(new Counted);
+ IntrusivePtr<CountedSubclass> countedSubclass1(new CountedSubclass);
+ IntrusivePtr<CountedSubclass> countedSubclass2(new CountedSubclass);
+ IntrusivePtr<Counted> counted2(countedSubclass2);
- DALI_TEST_EQUALS( operator!=( counted1, countedSubclass1 ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( operator!=( counted2, countedSubclass2 ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(operator!=(counted1, countedSubclass1), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(operator!=(counted2, countedSubclass2), false, TEST_LOCATION);
END_TEST;
}
/** Equality of two different types where right hand side is a raw pointer */
int UtcDaliIntrusivePtrOperatorEqualRightPointerTU(void)
{
- tet_infoline( "Test for Dali::IntrusivePtr::operator ==(T, U*)" );
+ tet_infoline("Test for Dali::IntrusivePtr::operator ==(T, U*)");
- IntrusivePtr<Counted> counted1( new Counted );
- IntrusivePtr<CountedSubclass> countedSubclass1( new CountedSubclass );
- IntrusivePtr<CountedSubclass> countedSubclass2( new CountedSubclass );
- IntrusivePtr<Counted> counted2( countedSubclass2 );
+ IntrusivePtr<Counted> counted1(new Counted);
+ IntrusivePtr<CountedSubclass> countedSubclass1(new CountedSubclass);
+ IntrusivePtr<CountedSubclass> countedSubclass2(new CountedSubclass);
+ IntrusivePtr<Counted> counted2(countedSubclass2);
- DALI_TEST_EQUALS( operator==( counted1, countedSubclass1.Get() ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( operator==( counted2, countedSubclass2.Get() ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(operator==(counted1, countedSubclass1.Get()), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(operator==(counted2, countedSubclass2.Get()), true, TEST_LOCATION);
END_TEST;
}
/** Inequality of two different types where the right hand side is a raw pointer */
int UtcDaliIntrusivePtrOperatorNotEqualRightPointerTU(void)
{
- tet_infoline( "Test for Dali::IntrusivePtr::operator !=(T, U*)" );
+ tet_infoline("Test for Dali::IntrusivePtr::operator !=(T, U*)");
- IntrusivePtr<Counted> counted1( new Counted );
- IntrusivePtr<CountedSubclass> countedSubclass1( new CountedSubclass );
- IntrusivePtr<CountedSubclass> countedSubclass2( new CountedSubclass );
- IntrusivePtr<Counted> counted2( countedSubclass2 );
+ IntrusivePtr<Counted> counted1(new Counted);
+ IntrusivePtr<CountedSubclass> countedSubclass1(new CountedSubclass);
+ IntrusivePtr<CountedSubclass> countedSubclass2(new CountedSubclass);
+ IntrusivePtr<Counted> counted2(countedSubclass2);
- DALI_TEST_EQUALS( operator!=( counted1, countedSubclass1.Get() ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( operator!=( counted2, countedSubclass2.Get() ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(operator!=(counted1, countedSubclass1.Get()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(operator!=(counted2, countedSubclass2.Get()), false, TEST_LOCATION);
END_TEST;
}
/** Equality of two different types where left hand side is a raw pointer */
int UtcDaliIntrusivePtrOperatorEqualLeftPointerTU(void)
{
- tet_infoline( "Test for Dali::IntrusivePtr::operator ==(T*, U)" );
+ tet_infoline("Test for Dali::IntrusivePtr::operator ==(T*, U)");
- IntrusivePtr<Counted> counted1( new Counted );
- IntrusivePtr<CountedSubclass> countedSubclass1( new CountedSubclass );
- IntrusivePtr<CountedSubclass> countedSubclass2( new CountedSubclass );
- IntrusivePtr<Counted> counted2( countedSubclass2 );
+ IntrusivePtr<Counted> counted1(new Counted);
+ IntrusivePtr<CountedSubclass> countedSubclass1(new CountedSubclass);
+ IntrusivePtr<CountedSubclass> countedSubclass2(new CountedSubclass);
+ IntrusivePtr<Counted> counted2(countedSubclass2);
- DALI_TEST_EQUALS( operator==( counted1.Get(), countedSubclass1 ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( operator==( counted2.Get(), countedSubclass2 ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(operator==(counted1.Get(), countedSubclass1), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(operator==(counted2.Get(), countedSubclass2), true, TEST_LOCATION);
END_TEST;
}
/** Inequality of two different types where the left hand side is a raw pointer */
int UtcDaliIntrusivePtrOperatorNotEqualLeftPointerTU(void)
{
- tet_infoline( "Test for Dali::IntrusivePtr::operator !=(T*, U)" );
+ tet_infoline("Test for Dali::IntrusivePtr::operator !=(T*, U)");
- IntrusivePtr<Counted> counted1( new Counted );
- IntrusivePtr<CountedSubclass> countedSubclass1( new CountedSubclass );
- IntrusivePtr<CountedSubclass> countedSubclass2( new CountedSubclass );
- IntrusivePtr<Counted> counted2( countedSubclass2 );
+ IntrusivePtr<Counted> counted1(new Counted);
+ IntrusivePtr<CountedSubclass> countedSubclass1(new CountedSubclass);
+ IntrusivePtr<CountedSubclass> countedSubclass2(new CountedSubclass);
+ IntrusivePtr<Counted> counted2(countedSubclass2);
- DALI_TEST_EQUALS( operator!=( counted1.Get(), countedSubclass1 ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( operator!=( counted2.Get(), countedSubclass2 ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(operator!=(counted1.Get(), countedSubclass1), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(operator!=(counted2.Get(), countedSubclass2), false, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test for Dali::RefObject(const RefObject&)");
{
- IntrusivePtr<TestObject> testPtr( new TestObject );
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<TestObject> testPtr(new TestObject);
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
- const TestObject& testObject=*testPtr.Get();
+ const TestObject& testObject = *testPtr.Get();
{
- IntrusivePtr<TestObject> testPtr2( new TestObject(testObject) );
- DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<TestObject> testPtr2(new TestObject(testObject));
+ DALI_TEST_EQUALS(testPtr2->ReferenceCount(), 1, TEST_LOCATION);
}
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliRefObjectAssignmentOperator(void)
{
tet_infoline("Test for Dali::RefObject::operator=(const RefObject&)");
{
- IntrusivePtr<TestObject> testPtr( new TestObject );
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<TestObject> testPtr(new TestObject);
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
- const TestObject& testObject=*testPtr.Get();
+ const TestObject& testObject = *testPtr.Get();
{
- IntrusivePtr<TestObject> testPtr2( new TestObject() );
- testPtr->data = 33;
+ IntrusivePtr<TestObject> testPtr2(new TestObject());
+ testPtr->data = 33;
IntrusivePtr<TestObject> testPtr3 = testPtr2;
- DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 2, TEST_LOCATION );
- DALI_TEST_EQUALS( testPtr2->data, 201, TEST_LOCATION );
+ DALI_TEST_EQUALS(testPtr2->ReferenceCount(), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(testPtr2->data, 201, TEST_LOCATION);
TestObject& testObject2 = *testPtr2.Get();
- testObject2 = testObject;
+ testObject2 = testObject;
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( testPtr2->ReferenceCount(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(testPtr2->ReferenceCount(), 2, TEST_LOCATION);
}
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliRefObjectAssignmentOperatorToNull(void)
{
tet_infoline("Testing Dali::IntrusivePtr = nullptr");
g_creationCount = g_destructionCount = 0;
- IntrusivePtr<Counted> counted( new Counted );
+ IntrusivePtr<Counted> counted(new Counted);
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
IntrusivePtr<Counted> counted2 = counted;
- DALI_TEST_EQUALS( g_creationCount, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_creationCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( counted->ReferenceCount(), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 2, TEST_LOCATION);
counted2 = nullptr;
- DALI_TEST_EQUALS( g_destructionCount, 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( counted->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(counted->ReferenceCount(), 1, TEST_LOCATION);
counted = nullptr;
- DALI_TEST_EQUALS( g_destructionCount, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(g_destructionCount, 1u, TEST_LOCATION);
END_TEST;
}
int UtcDaliIntrusivePtrMoveConstructor(void)
{
- IntrusivePtr<TestObject> testPtr( new TestObject );
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( testPtr->data, 201, TEST_LOCATION );
+ IntrusivePtr<TestObject> testPtr(new TestObject);
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(testPtr->data, 201, TEST_LOCATION);
- IntrusivePtr<TestObject> movePtr = std::move( testPtr );
- DALI_TEST_EQUALS( movePtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( movePtr->data, 201, TEST_LOCATION );
- DALI_TEST_CHECK( !testPtr );
+ IntrusivePtr<TestObject> movePtr = std::move(testPtr);
+ DALI_TEST_EQUALS(movePtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(movePtr->data, 201, TEST_LOCATION);
+ DALI_TEST_CHECK(!testPtr);
- IntrusivePtr<TestObject> anotherTestPtr( new TestObject );
- DALI_TEST_EQUALS( anotherTestPtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( anotherTestPtr->data, 201, TEST_LOCATION );
- IntrusivePtr<TestObject> anotherMovePtr = std::move( anotherTestPtr );
- DALI_TEST_EQUALS( anotherMovePtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( anotherMovePtr->data, 201, TEST_LOCATION );
- DALI_TEST_CHECK( !anotherTestPtr.Get() );
+ IntrusivePtr<TestObject> anotherTestPtr(new TestObject);
+ DALI_TEST_EQUALS(anotherTestPtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(anotherTestPtr->data, 201, TEST_LOCATION);
+ IntrusivePtr<TestObject> anotherMovePtr = std::move(anotherTestPtr);
+ DALI_TEST_EQUALS(anotherMovePtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(anotherMovePtr->data, 201, TEST_LOCATION);
+ DALI_TEST_CHECK(!anotherTestPtr.Get());
- IntrusivePtr<CountedSubclass> countedSubclass( new CountedSubclass );
- DALI_TEST_EQUALS( countedSubclass->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<CountedSubclass> countedSubclass(new CountedSubclass);
+ DALI_TEST_EQUALS(countedSubclass->ReferenceCount(), 1, TEST_LOCATION);
- IntrusivePtr<Counted> countedMovePtr = std::move( countedSubclass );
- DALI_TEST_EQUALS( countedMovePtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_CHECK( !countedSubclass );
+ IntrusivePtr<Counted> countedMovePtr = std::move(countedSubclass);
+ DALI_TEST_EQUALS(countedMovePtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_CHECK(!countedSubclass);
END_TEST;
}
int UtcDaliIntrusivePtrMoveAssignment(void)
{
- IntrusivePtr<TestObject> testPtr( new TestObject );
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( testPtr->data, 201, TEST_LOCATION );
+ IntrusivePtr<TestObject> testPtr(new TestObject);
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(testPtr->data, 201, TEST_LOCATION);
- IntrusivePtr<TestObject> secondPtr( testPtr );
- DALI_TEST_EQUALS( testPtr->ReferenceCount(), 2, TEST_LOCATION );
+ IntrusivePtr<TestObject> secondPtr(testPtr);
+ DALI_TEST_EQUALS(testPtr->ReferenceCount(), 2, TEST_LOCATION);
IntrusivePtr<TestObject> thirdPtr;
- testPtr = std::move( thirdPtr );
- DALI_TEST_EQUALS( secondPtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( secondPtr->data, 201, TEST_LOCATION );
- DALI_TEST_CHECK( !testPtr.Get() );
+ testPtr = std::move(thirdPtr);
+ DALI_TEST_EQUALS(secondPtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(secondPtr->data, 201, TEST_LOCATION);
+ DALI_TEST_CHECK(!testPtr.Get());
- IntrusivePtr<TestObject> fourthPtr( new TestObject );
- testPtr = std::move( fourthPtr );
- DALI_TEST_CHECK( !fourthPtr.Get() );
+ IntrusivePtr<TestObject> fourthPtr(new TestObject);
+ testPtr = std::move(fourthPtr);
+ DALI_TEST_CHECK(!fourthPtr.Get());
- IntrusivePtr<CountedSubclass> countedSubclassPtr( new CountedSubclass );
- DALI_TEST_EQUALS( countedSubclassPtr->ReferenceCount(), 1, TEST_LOCATION );
+ IntrusivePtr<CountedSubclass> countedSubclassPtr(new CountedSubclass);
+ DALI_TEST_EQUALS(countedSubclassPtr->ReferenceCount(), 1, TEST_LOCATION);
IntrusivePtr<Counted> countedMovePtr;
- countedMovePtr = std::move( countedSubclassPtr );
- DALI_TEST_EQUALS( countedMovePtr->ReferenceCount(), 1, TEST_LOCATION );
- DALI_TEST_CHECK( !countedSubclassPtr );
+ countedMovePtr = std::move(countedSubclassPtr);
+ DALI_TEST_EQUALS(countedMovePtr->ReferenceCount(), 1, TEST_LOCATION);
+ DALI_TEST_CHECK(!countedSubclassPtr);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/key-event-integ.h>
+#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/key-event-devel.h>
+#include <dali/integration-api/events/key-event-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
using namespace Dali;
namespace
{
-
// Key Event Test references
-const static int SHIFT_MODIFIER = 0x1;
-const static int CTRL_MODIFIER = 0x2;
-const static int ALT_MODIFIER = 0x4;
-const static int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER;
+const static int SHIFT_MODIFIER = 0x1;
+const static int CTRL_MODIFIER = 0x2;
+const static int ALT_MODIFIER = 0x4;
+const static int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER;
const static int SHIFT_AND_ALT_MODIFIER = SHIFT_MODIFIER | ALT_MODIFIER;
-const static int CTRL_AND_ALT_MODIFIER = CTRL_MODIFIER | ALT_MODIFIER;
+const static int CTRL_AND_ALT_MODIFIER = CTRL_MODIFIER | ALT_MODIFIER;
const static char* TEST_STRING_1 = "alpha";
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
keyedActor.Reset();
}
- bool functorCalled;
+ bool functorCalled;
KeyEvent receivedKeyEvent;
- Actor keyedActor;
+ Actor keyedActor;
};
// Functor that sets the data when called
struct KeyEventReceivedFunctor
{
- KeyEventReceivedFunctor( SignalData& data ) : signalData( data ) { }
+ KeyEventReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( Actor actor, const KeyEvent& keyEvent )
+ bool operator()(Actor actor, const KeyEvent& keyEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedKeyEvent = keyEvent;
- signalData.keyedActor = actor;
+ signalData.keyedActor = actor;
return true;
}
SignalData& signalData;
};
-} // anon namespace
+} // namespace
int UtcDaliKeyEventConstructor(void)
{
TestApplication application; // Reset all test adapter return codes
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
END_TEST;
int UtcDaliKeyEventCopyAssignment(void)
{
// Test Assignment operator
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
- Dali::KeyEvent event2 = DevelKeyEvent::New(TEST_STRING_1, "J", "j", 88, CTRL_MODIFIER, 0lu, KeyEvent::UP, "", "", Device::Class::USER, Device::Subclass::FINGER); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event2 );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("J", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("j", event2.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(88, event2.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(CTRL_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::UP, event2.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::USER, event2.GetDeviceClass(), TEST_LOCATION); // check device class
+ Dali::KeyEvent event2 = DevelKeyEvent::New(TEST_STRING_1, "J", "j", 88, CTRL_MODIFIER, 0lu, KeyEvent::UP, "", "", Device::Class::USER, Device::Subclass::FINGER); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event2);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("J", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("j", event2.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(88, event2.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(CTRL_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::UP, event2.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::USER, event2.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::FINGER, event2.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
event = event2;
- DALI_TEST_CHECK( event );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("J", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("j", event.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(88, event.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::UP, event.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::USER, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("J", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("j", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(88, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::UP, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::USER, event.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::FINGER, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
END_TEST;
int UtcDaliKeyEventCopyConstructor(void)
{
// Test Assignment operator
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
- KeyEvent event2( event );
- DALI_TEST_CHECK( event2 );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", event2.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, event2.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, event2.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, event2.GetDeviceClass(), TEST_LOCATION); // check device class
+ KeyEvent event2(event);
+ DALI_TEST_CHECK(event2);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event2.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", event2.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", event2.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, event2.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event2.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event2.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event2.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event2.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event2.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event2.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, event2.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
END_TEST;
int UtcDaliKeyEventMoveAssignment(void)
{
// Test Assignment operator
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
KeyEvent move;
- move = std::move( event );
- DALI_TEST_CHECK( move );
-
- DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class
+ move = std::move(event);
+ DALI_TEST_CHECK(move);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, move.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
- DALI_TEST_CHECK( !event );
+ DALI_TEST_CHECK(!event);
END_TEST;
}
int UtcDaliKeyEventMoveConstructor(void)
{
// Test Assignment operator
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
-
- DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", event.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", event.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", event.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, event.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, event.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
- KeyEvent move = std::move( event );
- DALI_TEST_CHECK( move );
-
- DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name
- DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string
- DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string
- DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode
- DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time
- DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state
- DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose
- DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name
- DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class
+ KeyEvent move = std::move(event);
+ DALI_TEST_CHECK(move);
+
+ DALI_TEST_EQUALS(TEST_STRING_1, move.GetKeyName(), TEST_LOCATION); // check key name
+ DALI_TEST_EQUALS("I", move.GetLogicalKey(), TEST_LOCATION); // check logical key string
+ DALI_TEST_EQUALS("i", move.GetKeyString(), TEST_LOCATION); // check key string
+ DALI_TEST_EQUALS(99, move.GetKeyCode(), TEST_LOCATION); // check keyCode
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, move.GetKeyModifier(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0lu, move.GetTime(), TEST_LOCATION); // check time
+ DALI_TEST_EQUALS(KeyEvent::DOWN, move.GetState(), TEST_LOCATION); // check state
+ DALI_TEST_EQUALS("", move.GetCompose(), TEST_LOCATION); // check compose
+ DALI_TEST_EQUALS("", move.GetDeviceName(), TEST_LOCATION); // check device name
+ DALI_TEST_EQUALS(Device::Class::NONE, move.GetDeviceClass(), TEST_LOCATION); // check device class
DALI_TEST_EQUALS(Device::Subclass::NONE, move.GetDeviceSubclass(), TEST_LOCATION); // check device subclass
- DALI_TEST_CHECK( !event );
+ DALI_TEST_CHECK(!event);
END_TEST;
}
{
TestApplication application; // Reset all test adapter return codes
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION);
DALI_TEST_EQUALS(false, event.IsShiftModifier(), TEST_LOCATION); // check IsShiftModifier
- DevelKeyEvent::SetKeyModifier( event, SHIFT_MODIFIER ); // Set to Shift Modifier
+ DevelKeyEvent::SetKeyModifier(event, SHIFT_MODIFIER); // Set to Shift Modifier
DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check able to set
{
TestApplication application; // Reset all test adapter return codes
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION);
DALI_TEST_EQUALS(false, event.IsCtrlModifier(), TEST_LOCATION); // check IsCtrlModifier
- DevelKeyEvent::SetKeyModifier( event, CTRL_MODIFIER ); // Set to Ctrl Modifier
+ DevelKeyEvent::SetKeyModifier(event, CTRL_MODIFIER); // Set to Ctrl Modifier
DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check able to set
{
TestApplication application; // Reset all test adapter return codes
- Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
- DALI_TEST_CHECK( event );
+ Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE); // set name to test, key string to i and modifier to shift
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION);
DALI_TEST_EQUALS(false, event.IsAltModifier(), TEST_LOCATION); // check IsAltModifier
- DevelKeyEvent::SetKeyModifier( event, ALT_MODIFIER ); // Set to Alt Modifier
+ DevelKeyEvent::SetKeyModifier(event, ALT_MODIFIER); // Set to Alt Modifier
DALI_TEST_EQUALS(ALT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION); // check able to set
- DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier
+ DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New("i", "I", "i", 0, SHIFT_AND_CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
DALI_TEST_EQUALS(true, (bool)(event.IsCtrlModifier() & event.IsShiftModifier()), TEST_LOCATION);
- DevelKeyEvent::SetKeyModifier( event, SHIFT_MODIFIER ); // Set to Shift Modifier
+ DevelKeyEvent::SetKeyModifier(event, SHIFT_MODIFIER); // Set to Shift Modifier
DALI_TEST_EQUALS(false, (bool)(event.IsCtrlModifier() & event.IsShiftModifier()), TEST_LOCATION);
END_TEST;
Dali::KeyEvent event = DevelKeyEvent::New("i", "I", "i", 0, SHIFT_AND_CTRL_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
DALI_TEST_EQUALS(true, (bool)(event.IsCtrlModifier() | event.IsAltModifier()), TEST_LOCATION);
- DevelKeyEvent::SetKeyModifier( event, SHIFT_MODIFIER ); // Set to Shift Modifier
+ DevelKeyEvent::SetKeyModifier(event, SHIFT_MODIFIER); // Set to Shift Modifier
DALI_TEST_EQUALS(false, (bool)(event.IsCtrlModifier() & event.IsAltModifier()), TEST_LOCATION);
END_TEST;
{
Integration::KeyEvent keyEvent;
- DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
- DALI_TEST_CHECK( keyEvent.keyName == std::string() );
- DALI_TEST_CHECK( keyEvent.logicalKey == std::string() );
- DALI_TEST_CHECK( keyEvent.keyString == std::string() );
- DALI_TEST_EQUALS( keyEvent.keyCode, -1, TEST_LOCATION );
- DALI_TEST_EQUALS( keyEvent.keyModifier, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( keyEvent.time, 0lu, TEST_LOCATION );
- DALI_TEST_EQUALS( keyEvent.state, Integration::KeyEvent::DOWN, TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.compose, std::string(), TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.deviceName, std::string(), TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.deviceClass, Device::Class::NONE, TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.deviceSubclass, Device::Subclass::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.type, Integration::Event::Key, TEST_LOCATION);
+ DALI_TEST_CHECK(keyEvent.keyName == std::string());
+ DALI_TEST_CHECK(keyEvent.logicalKey == std::string());
+ DALI_TEST_CHECK(keyEvent.keyString == std::string());
+ DALI_TEST_EQUALS(keyEvent.keyCode, -1, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.keyModifier, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.time, 0lu, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.state, Integration::KeyEvent::DOWN, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.compose, std::string(), TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.deviceName, std::string(), TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.deviceClass, Device::Class::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.deviceSubclass, Device::Subclass::NONE, TEST_LOCATION);
}
{
- const std::string keyName("keyName");
- const std::string logicalKey("logicalKey");
- const std::string keyString("keyString");
- const int keyCode(333);
- const int keyModifier(312);
- const unsigned long timeStamp(132);
+ const std::string keyName("keyName");
+ const std::string logicalKey("logicalKey");
+ const std::string keyString("keyString");
+ const int keyCode(333);
+ const int keyModifier(312);
+ const unsigned long timeStamp(132);
const Integration::KeyEvent::State keyState(Integration::KeyEvent::UP);
- const std::string compose("compose");
- const std::string deviceName("hwKeyboard");
- const Device::Class::Type deviceClass = Device::Class::KEYBOARD;
- const Device::Subclass::Type deviceSubclass = Device::Subclass::NONE;
-
- Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass );
- DALI_TEST_EQUALS( keyEvent.type, Integration::Event::Key, TEST_LOCATION );
- DALI_TEST_CHECK( keyEvent.keyName == keyName );
- DALI_TEST_CHECK( keyEvent.logicalKey == logicalKey );
- DALI_TEST_CHECK( keyEvent.keyString == keyString );
- DALI_TEST_EQUALS( keyEvent.keyCode, keyCode, TEST_LOCATION );
- DALI_TEST_EQUALS( keyEvent.keyModifier, keyModifier, TEST_LOCATION );
- DALI_TEST_EQUALS( keyEvent.time, timeStamp, TEST_LOCATION );
- DALI_TEST_EQUALS( keyEvent.state, keyState, TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.compose, compose, TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.deviceName, deviceName, TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.deviceClass, deviceClass, TEST_LOCATION);
- DALI_TEST_EQUALS( keyEvent.deviceSubclass, deviceSubclass, TEST_LOCATION);
+ const std::string compose("compose");
+ const std::string deviceName("hwKeyboard");
+ const Device::Class::Type deviceClass = Device::Class::KEYBOARD;
+ const Device::Subclass::Type deviceSubclass = Device::Subclass::NONE;
+
+ Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, keyModifier, timeStamp, keyState, compose, deviceName, deviceClass, deviceSubclass);
+ DALI_TEST_EQUALS(keyEvent.type, Integration::Event::Key, TEST_LOCATION);
+ DALI_TEST_CHECK(keyEvent.keyName == keyName);
+ DALI_TEST_CHECK(keyEvent.logicalKey == logicalKey);
+ DALI_TEST_CHECK(keyEvent.keyString == keyString);
+ DALI_TEST_EQUALS(keyEvent.keyCode, keyCode, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.keyModifier, keyModifier, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.time, timeStamp, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.state, keyState, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.compose, compose, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.deviceName, deviceName, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.deviceClass, deviceClass, TEST_LOCATION);
+ DALI_TEST_EQUALS(keyEvent.deviceSubclass, deviceSubclass, TEST_LOCATION);
}
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
- DALI_TEST_EQUALS( TEST_STRING_1, event.GetKeyName(), TEST_LOCATION );
+ DALI_TEST_EQUALS(TEST_STRING_1, event.GetKeyName(), TEST_LOCATION);
- DevelKeyEvent::SetKeyName( event, "keyName" );
- DALI_TEST_EQUALS( "keyName", event.GetKeyName(), TEST_LOCATION );
+ DevelKeyEvent::SetKeyName(event, "keyName");
+ DALI_TEST_EQUALS("keyName", event.GetKeyName(), TEST_LOCATION);
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
- DALI_TEST_EQUALS( "i", event.GetKeyString(), TEST_LOCATION );
+ DALI_TEST_EQUALS("i", event.GetKeyString(), TEST_LOCATION);
- DevelKeyEvent::SetKeyString( event, "keyString" );
- DALI_TEST_EQUALS( "keyString", event.GetKeyString(), TEST_LOCATION );
+ DevelKeyEvent::SetKeyString(event, "keyString");
+ DALI_TEST_EQUALS("keyString", event.GetKeyString(), TEST_LOCATION);
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
- DALI_TEST_EQUALS( 99, event.GetKeyCode(), TEST_LOCATION );
+ DALI_TEST_EQUALS(99, event.GetKeyCode(), TEST_LOCATION);
- DevelKeyEvent::SetKeyCode( event, 88 );
- DALI_TEST_EQUALS( 88, event.GetKeyCode(), TEST_LOCATION );
+ DevelKeyEvent::SetKeyCode(event, 88);
+ DALI_TEST_EQUALS(88, event.GetKeyCode(), TEST_LOCATION);
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
- DALI_TEST_EQUALS( SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION );
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION);
- DevelKeyEvent::SetKeyModifier( event, ALT_MODIFIER );
- DALI_TEST_EQUALS( ALT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION );
+ DevelKeyEvent::SetKeyModifier(event, ALT_MODIFIER);
+ DALI_TEST_EQUALS(ALT_MODIFIER, event.GetKeyModifier(), TEST_LOCATION);
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
- DALI_TEST_EQUALS( 0lu, event.GetTime(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0lu, event.GetTime(), TEST_LOCATION);
- DevelKeyEvent::SetTime( event, 100lu );
- DALI_TEST_EQUALS( 100lu, event.GetTime(), TEST_LOCATION );
+ DevelKeyEvent::SetTime(event, 100lu);
+ DALI_TEST_EQUALS(100lu, event.GetTime(), TEST_LOCATION);
END_TEST;
}
Dali::KeyEvent event = DevelKeyEvent::New(TEST_STRING_1, "I", "i", 99, SHIFT_MODIFIER, 0lu, KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE);
- DALI_TEST_EQUALS( KeyEvent::DOWN, event.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS(KeyEvent::DOWN, event.GetState(), TEST_LOCATION);
- DevelKeyEvent::SetState( event, KeyEvent::UP );
- DALI_TEST_EQUALS( KeyEvent::UP, event.GetState(), TEST_LOCATION );
+ DevelKeyEvent::SetState(event, KeyEvent::UP);
+ DALI_TEST_EQUALS(KeyEvent::UP, event.GetState(), TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-
+#include <dali-test-suite-utils.h>
#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-
int UtcDaliLayerNew(void)
{
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
DALI_TEST_CHECK(layer);
END_TEST;
TestApplication application;
tet_infoline("Testing Dali::Layer::DownCast()");
- Layer actor1 = Layer::New();
+ Layer actor1 = Layer::New();
Actor anActor = Actor::New();
anActor.Add(actor1);
Actor child = anActor.GetChildAt(0);
- Layer layer = DownCast< Layer >(child);
+ Layer layer = DownCast<Layer>(child);
DALI_TEST_CHECK(layer);
END_TEST;
TestApplication application;
tet_infoline("Testing Dali::Layer::DownCast()");
- Actor actor1 = Actor::New();
+ Actor actor1 = Actor::New();
Actor anActor = Actor::New();
anActor.Add(actor1);
Actor child = anActor.GetChildAt(0);
- Layer layer = DownCast< Layer >(child);
+ Layer layer = DownCast<Layer>(child);
DALI_TEST_CHECK(!layer);
Actor unInitialzedActor;
- layer = Layer::DownCast( unInitialzedActor );
+ layer = Layer::DownCast(unInitialzedActor);
DALI_TEST_CHECK(!layer);
END_TEST;
}
int UtcDaliLayerMoveConstructor(void)
{
TestApplication application;
- Layer layer = Layer::New();
- DALI_TEST_CHECK( layer );
- DALI_TEST_EQUALS( 1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
+ Layer layer = Layer::New();
+ DALI_TEST_CHECK(layer);
+ DALI_TEST_EQUALS(1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, layer.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
- application.GetScene().Add( layer );
- DALI_TEST_EQUALS( 2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
+ application.GetScene().Add(layer);
+ DALI_TEST_EQUALS(2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, layer.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
- Layer move = std::move( layer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, move.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
- DALI_TEST_CHECK( !layer );
+ Layer move = std::move(layer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, move.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
+ DALI_TEST_CHECK(!layer);
END_TEST;
}
int UtcDaliLayerMoveAssignment(void)
{
TestApplication application;
- Layer layer = Layer::New();
- DALI_TEST_CHECK( layer );
- DALI_TEST_EQUALS( 1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
+ Layer layer = Layer::New();
+ DALI_TEST_CHECK(layer);
+ DALI_TEST_EQUALS(1, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, layer.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
- application.GetScene().Add( layer );
- DALI_TEST_EQUALS( 2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
+ application.GetScene().Add(layer);
+ DALI_TEST_EQUALS(2, layer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, layer.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
Layer move;
- move = std::move( layer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, move.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
- DALI_TEST_CHECK( !layer );
+ move = std::move(layer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, move.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
+ DALI_TEST_CHECK(!layer);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::GetDepth()");
TestApplication application;
- Layer layer1 = Layer::New();
- Layer layer2 = Layer::New();
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
// layers are not on scene
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// root depth is 0
- Layer root = application.GetScene().GetLayer( 0 );
- DALI_TEST_EQUALS(root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ Layer root = application.GetScene().GetLayer(0);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
application.GetScene().Add(layer1);
application.GetScene().Add(layer2);
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::Raise()");
TestApplication application;
- Layer layer1 = Layer::New();
- Layer layer2 = Layer::New();
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
application.GetScene().Add(layer1);
application.GetScene().Add(layer2);
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
layer1.Raise();
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
// get root
- Layer root = application.GetScene().GetLayer( 0 );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ Layer root = application.GetScene().GetLayer(0);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
root.Raise();
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::Lower()");
TestApplication application;
- Layer layer1 = Layer::New();
- Layer layer2 = Layer::New();
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
application.GetScene().Add(layer1);
application.GetScene().Add(layer2);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
layer2.Lower();
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
// get root
- Layer root = application.GetScene().GetLayer( 0 );
+ Layer root = application.GetScene().GetLayer(0);
root.Lower();
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
layer2.Lower();
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::RaiseToTop()");
TestApplication application;
- Layer layer1 = Layer::New();
- Layer layer2 = Layer::New();
- Layer layer3 = Layer::New();
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+ Layer layer3 = Layer::New();
application.GetScene().Add(layer1);
application.GetScene().Add(layer2);
application.GetScene().Add(layer3);
- Layer root = application.GetScene().GetLayer( 0 );
+ Layer root = application.GetScene().GetLayer(0);
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
layer1.RaiseToTop();
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
root.RaiseToTop();
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::LowerToBottom()");
TestApplication application;
- Layer layer1 = Layer::New();
- Layer layer2 = Layer::New();
- Layer layer3 = Layer::New();
+ Layer layer1 = Layer::New();
+ Layer layer2 = Layer::New();
+ Layer layer3 = Layer::New();
application.GetScene().Add(layer1);
application.GetScene().Add(layer2);
application.GetScene().Add(layer3);
- DALI_TEST_EQUALS(layer1.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer2.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION);
- DALI_TEST_EQUALS(layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer1.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
layer3.LowerToBottom();
- DALI_TEST_EQUALS(layer3.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Layer layer = Layer::New();
- DALI_TEST_CHECK( !layer.GetProperty< bool >( Layer::Property::CLIPPING_ENABLE ) );
+ DALI_TEST_CHECK(!layer.GetProperty<bool>(Layer::Property::CLIPPING_ENABLE));
- layer.SetProperty( Layer::Property::CLIPPING_ENABLE, true );
- DALI_TEST_CHECK( layer.GetProperty< bool >( Layer::Property::CLIPPING_ENABLE ) );
+ layer.SetProperty(Layer::Property::CLIPPING_ENABLE, true);
+ DALI_TEST_CHECK(layer.GetProperty<bool>(Layer::Property::CLIPPING_ENABLE));
END_TEST;
}
TestApplication application;
Layer layer = Layer::New();
- DALI_TEST_CHECK( !layer.GetProperty< bool >( Layer::Property::CLIPPING_ENABLE ) );
+ DALI_TEST_CHECK(!layer.GetProperty<bool>(Layer::Property::CLIPPING_ENABLE));
END_TEST;
}
tet_infoline("Testing Dali::Layer::SetClippingBox()");
TestApplication application;
- ClippingBox testBox(5,6, 77,83);
+ ClippingBox testBox(5, 6, 77, 83);
Layer layer = Layer::New();
- DALI_TEST_CHECK(layer.GetProperty< Rect<int32_t> >( Layer::Property::CLIPPING_BOX ) != testBox);
- layer.SetProperty( Layer::Property::CLIPPING_BOX, testBox );
- DALI_TEST_CHECK(layer.GetProperty< Rect<int32_t> >( Layer::Property::CLIPPING_BOX ) == testBox);
+ DALI_TEST_CHECK(layer.GetProperty<Rect<int32_t> >(Layer::Property::CLIPPING_BOX) != testBox);
+ layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox);
+ DALI_TEST_CHECK(layer.GetProperty<Rect<int32_t> >(Layer::Property::CLIPPING_BOX) == testBox);
END_TEST;
}
TestApplication application;
Layer layer = Layer::New();
- DALI_TEST_CHECK( layer.GetProperty< Rect<int32_t> >( Layer::Property::CLIPPING_BOX ) == ClippingBox(0,0,0,0) );
+ DALI_TEST_CHECK(layer.GetProperty<Rect<int32_t> >(Layer::Property::CLIPPING_BOX) == ClippingBox(0, 0, 0, 0));
END_TEST;
}
TestApplication application;
// create two transparent actors so there is something to sort
- Actor actor = CreateRenderableActor();
+ Actor actor = CreateRenderableActor();
Actor actor2 = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 1, 1 ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f ) ); // 50% transparent
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 1, 1 ) );
- actor2.SetProperty( Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f ) ); // 50% transparent
+ actor.SetProperty(Actor::Property::SIZE, Vector2(1, 1));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f)); // 50% transparent
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(1, 1));
+ actor2.SetProperty(Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f)); // 50% transparent
// add to scene
- application.GetScene().Add( actor );
- application.GetScene().Add( actor2 );
+ application.GetScene().Add(actor);
+ application.GetScene().Add(actor2);
- Layer root = application.GetScene().GetLayer( 0 );
+ Layer root = application.GetScene().GetLayer(0);
gTestSortFunctionCalled = 0;
root.SetSortFunction(TestSortFunction);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( gTestSortFunctionCalled > 0 );
+ DALI_TEST_CHECK(gTestSortFunctionCalled > 0);
END_TEST;
}
-
int UtcDaliLayerRaiseAbove(void)
{
tet_infoline("Testing Dali::Layer::RaiseAbove()");
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
// try to raise above root layer
- Layer root = application.GetScene().GetLayer( 0 );
- layer.RaiseAbove( root );
+ Layer root = application.GetScene().GetLayer(0);
+ layer.RaiseAbove(root);
// layer depth is zero as its not on scene
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// add to scene
- application.GetScene().Add( layer );
- layer.RaiseAbove( root );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
- root.RaiseAbove( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- layer.RaiseAbove( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
+ application.GetScene().Add(layer);
+ layer.RaiseAbove(root);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ root.RaiseAbove(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ layer.RaiseAbove(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// make another layer on the scene
Layer layer2 = Layer::New();
- application.GetScene().Add( layer2 );
- layer.RaiseAbove( layer2 );
- DALI_TEST_GREATER( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
- layer2.RaiseAbove( layer );
- DALI_TEST_GREATER( layer2.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
- root.RaiseAbove( layer2 );
- DALI_TEST_GREATER( root.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
+ application.GetScene().Add(layer2);
+ layer.RaiseAbove(layer2);
+ DALI_TEST_GREATER(layer.GetProperty<int>(Layer::Property::DEPTH), layer2.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
+ layer2.RaiseAbove(layer);
+ DALI_TEST_GREATER(layer2.GetProperty<int>(Layer::Property::DEPTH), layer.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
+ root.RaiseAbove(layer2);
+ DALI_TEST_GREATER(root.GetProperty<int>(Layer::Property::DEPTH), layer2.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::RaiseBelow()");
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
// try to lower below root layer
- Layer root = application.GetScene().GetLayer( 0 );
- layer.LowerBelow( root );
+ Layer root = application.GetScene().GetLayer(0);
+ layer.LowerBelow(root);
// layer depth is zero as its not on scene
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// add to scene
- application.GetScene().Add( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
- layer.LowerBelow( root );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- root.LowerBelow( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
- layer.LowerBelow( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
+ application.GetScene().Add(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ layer.LowerBelow(root);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ root.LowerBelow(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ layer.LowerBelow(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
// make another layer on the scene
Layer layer2 = Layer::New();
- application.GetScene().Add( layer2 );
- layer.LowerBelow( layer2 );
- DALI_TEST_GREATER( layer2.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
- layer2.LowerBelow( layer );
- DALI_TEST_GREATER( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
- root.LowerBelow( layer2 );
- DALI_TEST_GREATER( layer2.GetProperty< int >( Layer::Property::DEPTH ), root.GetProperty< int >( Layer::Property::DEPTH ), TEST_LOCATION );
+ application.GetScene().Add(layer2);
+ layer.LowerBelow(layer2);
+ DALI_TEST_GREATER(layer2.GetProperty<int>(Layer::Property::DEPTH), layer.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
+ layer2.LowerBelow(layer);
+ DALI_TEST_GREATER(layer.GetProperty<int>(Layer::Property::DEPTH), layer2.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
+ root.LowerBelow(layer2);
+ DALI_TEST_GREATER(layer2.GetProperty<int>(Layer::Property::DEPTH), root.GetProperty<int>(Layer::Property::DEPTH), TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::MoveAbove()");
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
// try to raise above root layer
- Layer root = application.GetScene().GetLayer( 0 );
- layer.MoveAbove( root );
+ Layer root = application.GetScene().GetLayer(0);
+ layer.MoveAbove(root);
// layer depth is zero as its not on scene
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- root.MoveAbove( layer );
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ root.MoveAbove(layer);
// root depth is zero as layer is not on scene
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// add to scene
- application.GetScene().Add( layer );
- layer.MoveAbove( root );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- root.MoveAbove( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
+ application.GetScene().Add(layer);
+ layer.MoveAbove(root);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ root.MoveAbove(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
// make another layer on the scene
Layer layer2 = Layer::New();
- application.GetScene().Add( layer2 );
- layer.MoveAbove( layer2 );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ) + 1u, TEST_LOCATION );
- layer2.MoveAbove( root );
- DALI_TEST_EQUALS( layer2.GetProperty< int >( Layer::Property::DEPTH ), root.GetProperty< int >( Layer::Property::DEPTH ) + 1u, TEST_LOCATION );
- root.MoveAbove( layer );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ) + 1u, TEST_LOCATION );
+ application.GetScene().Add(layer2);
+ layer.MoveAbove(layer2);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), layer2.GetProperty<int>(Layer::Property::DEPTH) + 1u, TEST_LOCATION);
+ layer2.MoveAbove(root);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), root.GetProperty<int>(Layer::Property::DEPTH) + 1u, TEST_LOCATION);
+ root.MoveAbove(layer);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), layer.GetProperty<int>(Layer::Property::DEPTH) + 1u, TEST_LOCATION);
Layer layer3 = Layer::New();
- application.GetScene().Add( layer3 );
- DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION );
- root.MoveAbove( layer3 );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION );
- DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetScene().GetLayer( 0 ).GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- layer3.MoveAbove( application.GetScene().GetLayer( 0 ) );
- DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
+ application.GetScene().Add(layer3);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+ root.MoveAbove(layer3);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetScene().GetLayer(0).GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ layer3.MoveAbove(application.GetScene().GetLayer(0));
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::MoveBelow()");
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
// try to raise above root layer
- Layer root = application.GetScene().GetLayer( 0 );
- layer.MoveBelow( root );
+ Layer root = application.GetScene().GetLayer(0);
+ layer.MoveBelow(root);
// layer depth is zero as its not on scene
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- root.MoveBelow( layer );
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ root.MoveBelow(layer);
// root depth is zero as layer is not on scene
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// add to scene
- application.GetScene().Add( layer );
- layer.MoveBelow( root );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
- root.MoveBelow( layer );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 0u, TEST_LOCATION );
+ application.GetScene().Add(layer);
+ layer.MoveBelow(root);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ root.MoveBelow(layer);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 0u, TEST_LOCATION);
// make another layer on the scene
Layer layer2 = Layer::New();
- application.GetScene().Add( layer2 );
- layer.MoveBelow( layer2 );
- DALI_TEST_EQUALS( layer.GetProperty< int >( Layer::Property::DEPTH ), layer2.GetProperty< int >( Layer::Property::DEPTH ) - 1u, TEST_LOCATION );
- layer2.MoveBelow( root );
- DALI_TEST_EQUALS( layer2.GetProperty< int >( Layer::Property::DEPTH ), root.GetProperty< int >( Layer::Property::DEPTH ) - 1u, TEST_LOCATION );
- root.MoveBelow( layer );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), layer.GetProperty< int >( Layer::Property::DEPTH ) - 1u, TEST_LOCATION );
+ application.GetScene().Add(layer2);
+ layer.MoveBelow(layer2);
+ DALI_TEST_EQUALS(layer.GetProperty<int>(Layer::Property::DEPTH), layer2.GetProperty<int>(Layer::Property::DEPTH) - 1u, TEST_LOCATION);
+ layer2.MoveBelow(root);
+ DALI_TEST_EQUALS(layer2.GetProperty<int>(Layer::Property::DEPTH), root.GetProperty<int>(Layer::Property::DEPTH) - 1u, TEST_LOCATION);
+ root.MoveBelow(layer);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), layer.GetProperty<int>(Layer::Property::DEPTH) - 1u, TEST_LOCATION);
Layer layer3 = Layer::New();
- application.GetScene().Add( layer3 );
- DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION );
- root.MoveBelow( layer3 );
- DALI_TEST_EQUALS( root.GetProperty< int >( Layer::Property::DEPTH ), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( layer3.GetProperty< int >( Layer::Property::DEPTH ), 3u, TEST_LOCATION );
+ application.GetScene().Add(layer3);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
+ root.MoveBelow(layer3);
+ DALI_TEST_EQUALS(root.GetProperty<int>(Layer::Property::DEPTH), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(layer3.GetProperty<int>(Layer::Property::DEPTH), 3u, TEST_LOCATION);
END_TEST;
}
indices.push_back(Layer::Property::CONSUMES_TOUCH);
indices.push_back(Layer::Property::CONSUMES_HOVER);
- DALI_TEST_CHECK(actor.GetPropertyCount() == ( Actor::New().GetPropertyCount() + indices.size() ) );
+ DALI_TEST_CHECK(actor.GetPropertyCount() == (Actor::New().GetPropertyCount() + indices.size()));
for(std::vector<Property::Index>::iterator iter = indices.begin(); iter != indices.end(); ++iter)
{
- DALI_TEST_CHECK( *iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter)) );
- DALI_TEST_CHECK( *iter == Layer::Property::DEPTH ? !actor.IsPropertyWritable(*iter) : actor.IsPropertyWritable(*iter) );
- DALI_TEST_CHECK( !actor.IsPropertyAnimatable(*iter) );
- DALI_TEST_CHECK( actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter) ); // just checking call succeeds
+ DALI_TEST_CHECK(*iter == actor.GetPropertyIndex(actor.GetPropertyName(*iter)));
+ DALI_TEST_CHECK(*iter == Layer::Property::DEPTH ? !actor.IsPropertyWritable(*iter) : actor.IsPropertyWritable(*iter));
+ DALI_TEST_CHECK(!actor.IsPropertyAnimatable(*iter));
+ DALI_TEST_CHECK(actor.GetPropertyType(*iter) == actor.GetPropertyType(*iter)); // just checking call succeeds
}
// set/get one of them
- actor.SetProperty( Layer::Property::CLIPPING_BOX, ClippingBox( 0, 0, 0, 0 ) );
+ actor.SetProperty(Layer::Property::CLIPPING_BOX, ClippingBox(0, 0, 0, 0));
- ClippingBox testBox(10,20,30,40);
- DALI_TEST_CHECK(actor.GetProperty< Rect<int32_t> >( Layer::Property::CLIPPING_BOX ) != testBox);
+ ClippingBox testBox(10, 20, 30, 40);
+ DALI_TEST_CHECK(actor.GetProperty<Rect<int32_t> >(Layer::Property::CLIPPING_BOX) != testBox);
actor.SetProperty(Layer::Property::CLIPPING_BOX, Property::Value(Rect<int>(testBox)));
Property::Value v = actor.GetProperty(Layer::Property::CLIPPING_BOX);
DALI_TEST_CHECK(v.Get<Rect<int> >() == testBox);
- v = actor.GetCurrentProperty( Layer::Property::CLIPPING_BOX );
+ v = actor.GetCurrentProperty(Layer::Property::CLIPPING_BOX);
DALI_TEST_CHECK(v.Get<Rect<int> >() == testBox);
// set the same boundaries, but through a clipping box object
- actor.SetProperty( Layer::Property::CLIPPING_BOX, testBox );
- DALI_TEST_CHECK( actor.GetProperty< Rect<int32_t> >( Layer::Property::CLIPPING_BOX ) == testBox );
+ actor.SetProperty(Layer::Property::CLIPPING_BOX, testBox);
+ DALI_TEST_CHECK(actor.GetProperty<Rect<int32_t> >(Layer::Property::CLIPPING_BOX) == testBox);
actor.SetProperty(Layer::Property::BEHAVIOR, Property::Value(Layer::LAYER_UI));
DALI_TEST_CHECK(Property::INTEGER == actor.GetPropertyType(Layer::Property::BEHAVIOR));
Property::Value behavior = actor.GetProperty(Layer::Property::BEHAVIOR);
- DALI_TEST_EQUALS( behavior.Get<Dali::Layer::Behavior>(), Layer::LAYER_UI, TEST_LOCATION );
+ DALI_TEST_EQUALS(behavior.Get<Dali::Layer::Behavior>(), Layer::LAYER_UI, TEST_LOCATION);
- behavior = actor.GetCurrentProperty( Layer::Property::BEHAVIOR );
- DALI_TEST_EQUALS( behavior.Get<Dali::Layer::Behavior>(), Layer::LAYER_UI, TEST_LOCATION );
+ behavior = actor.GetCurrentProperty(Layer::Property::BEHAVIOR);
+ DALI_TEST_EQUALS(behavior.Get<Dali::Layer::Behavior>(), Layer::LAYER_UI, TEST_LOCATION);
END_TEST;
}
// Note that Layer::Property::DEPTH_TEST does not depend on layer behavior,
// as 2D layers can still have depth tests performed on a per-renderer basis.
// Check default.
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Layer::Property::DEPTH_TEST ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Layer::Property::DEPTH_TEST));
// Check Set / Unset.
- actor.SetProperty(Layer::Property::DEPTH_TEST, true );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Layer::Property::DEPTH_TEST ) );
- actor.SetProperty(Layer::Property::DEPTH_TEST, false );
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Layer::Property::DEPTH_TEST ) );
+ actor.SetProperty(Layer::Property::DEPTH_TEST, true);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Layer::Property::DEPTH_TEST));
+ actor.SetProperty(Layer::Property::DEPTH_TEST, false);
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Layer::Property::DEPTH_TEST));
END_TEST;
}
{
tet_infoline("Testing Dali::Layer::CreateDestroy() ");
Layer* layer = new Layer;
- DALI_TEST_CHECK( layer );
+ DALI_TEST_CHECK(layer);
delete layer;
END_TEST;
}
int UtcDaliLayerPropertyIndices(void)
{
TestApplication application;
- Actor basicActor = Actor::New();
- Layer layer = Layer::New();
+ Actor basicActor = Actor::New();
+ Layer layer = Layer::New();
Property::IndexContainer indices;
- layer.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.Size() > basicActor.GetPropertyCount() );
- DALI_TEST_EQUALS( indices.Size(), layer.GetPropertyCount(), TEST_LOCATION );
+ layer.GetPropertyIndices(indices);
+ DALI_TEST_CHECK(indices.Size() > basicActor.GetPropertyCount());
+ DALI_TEST_EQUALS(indices.Size(), layer.GetPropertyCount(), TEST_LOCATION);
END_TEST;
}
int UtcDaliLayerTouchConsumed(void)
{
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
- DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_TOUCH ), false, TEST_LOCATION );
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
- DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_TOUCH ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<bool>(Layer::Property::CONSUMES_TOUCH), false, TEST_LOCATION);
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
+ DALI_TEST_EQUALS(layer.GetProperty<bool>(Layer::Property::CONSUMES_TOUCH), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliLayerHoverConsumed(void)
{
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
- DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_HOVER ), false, TEST_LOCATION );
- layer.SetProperty( Layer::Property::CONSUMES_HOVER, true );
- DALI_TEST_EQUALS( layer.GetProperty< bool >( Layer::Property::CONSUMES_HOVER ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<bool>(Layer::Property::CONSUMES_HOVER), false, TEST_LOCATION);
+ layer.SetProperty(Layer::Property::CONSUMES_HOVER, true);
+ DALI_TEST_EQUALS(layer.GetProperty<bool>(Layer::Property::CONSUMES_HOVER), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliLayerClippingGLCalls(void)
{
- TestApplication application;
- const TestGlAbstraction::ScissorParams& glScissorParams( application.GetGlAbstraction().GetScissorParams() );
- Integration::Scene scene( application.GetScene() );
+ TestApplication application;
+ const TestGlAbstraction::ScissorParams& glScissorParams(application.GetGlAbstraction().GetScissorParams());
+ Integration::Scene scene(application.GetScene());
- ClippingBox testBox( 5, 6, 77, 83 );
- Layer layer = application.GetScene().GetRootLayer();
- layer.SetProperty( Layer::Property::CLIPPING_ENABLE, true );
- layer.SetProperty( Layer::Property::CLIPPING_BOX, testBox );
+ ClippingBox testBox(5, 6, 77, 83);
+ Layer layer = application.GetScene().GetRootLayer();
+ layer.SetProperty(Layer::Property::CLIPPING_ENABLE, true);
+ layer.SetProperty(Layer::Property::CLIPPING_BOX, testBox);
// Add at least one renderable actor so the GL calls are actually made
- Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor actor = CreateRenderableActor( img );
- scene.Add( actor );
+ Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor actor = CreateRenderableActor(img);
+ scene.Add(actor);
// flush the queue and render once
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( testBox.x, glScissorParams.x, TEST_LOCATION );
- DALI_TEST_EQUALS( testBox.y, (int)(scene.GetSize().height - glScissorParams.y - testBox.height), TEST_LOCATION ); // GL Coordinates are from bottom left
- DALI_TEST_EQUALS( testBox.width, glScissorParams.width, TEST_LOCATION );
- DALI_TEST_EQUALS( testBox.height, glScissorParams.height, TEST_LOCATION );
+ DALI_TEST_EQUALS(testBox.x, glScissorParams.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(testBox.y, (int)(scene.GetSize().height - glScissorParams.y - testBox.height), TEST_LOCATION); // GL Coordinates are from bottom left
+ DALI_TEST_EQUALS(testBox.width, glScissorParams.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(testBox.height, glScissorParams.height, TEST_LOCATION);
END_TEST;
}
int UtcDaliLayerBehaviour(void)
{
TestApplication application;
- Layer layer = Layer::New();
+ Layer layer = Layer::New();
- DALI_TEST_EQUALS( layer.GetProperty<Layer::Behavior>( Layer::Property::BEHAVIOR ), Dali::Layer::LAYER_UI, TEST_LOCATION );
- layer.SetProperty( Layer::Property::BEHAVIOR, Dali::Layer::LAYER_3D );
- DALI_TEST_EQUALS( layer.GetProperty<Layer::Behavior>( Layer::Property::BEHAVIOR ), Dali::Layer::LAYER_3D, TEST_LOCATION );
+ DALI_TEST_EQUALS(layer.GetProperty<Layer::Behavior>(Layer::Property::BEHAVIOR), Dali::Layer::LAYER_UI, TEST_LOCATION);
+ layer.SetProperty(Layer::Property::BEHAVIOR, Dali::Layer::LAYER_3D);
+ DALI_TEST_EQUALS(layer.GetProperty<Layer::Behavior>(Layer::Property::BEHAVIOR), Dali::Layer::LAYER_3D, TEST_LOCATION);
END_TEST;
}
-Actor CreateActor( bool withAlpha )
+Actor CreateActor(bool withAlpha)
{
- Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u);
- Actor actor = CreateRenderableActor( texture );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER );
+ Actor actor = CreateRenderableActor(texture);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
return actor;
}
int UtcDaliLayer3DSort(void)
{
- tet_infoline( "Testing LAYER_3D sort coverage test" );
- TestApplication application;
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ tet_infoline("Testing LAYER_3D sort coverage test");
+ TestApplication application;
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- application.GetScene().GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
// Create an actor.
- Actor actor = CreateActor( false );
- application.GetScene().Add( actor );
+ Actor actor = CreateActor(false);
+ application.GetScene().Add(actor);
// Create child actors.
- Actor child1 = CreateActor( true );
- actor.Add( child1 );
- Actor child2 = CreateActor( false );
- child1.Add( child2 );
+ Actor child1 = CreateActor(true);
+ actor.Add(child1);
+ Actor child2 = CreateActor(false);
+ child1.Add(child2);
enabledDisableTrace.Reset();
- enabledDisableTrace.Enable( true );
+ enabledDisableTrace.Enable(true);
application.SendNotification();
application.Render();
- enabledDisableTrace.Enable( false );
+ enabledDisableTrace.Enable(false);
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "2929" ) ); // 2929 is GL_DEPTH_TEST
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "2929")); // 2929 is GL_DEPTH_TEST
END_TEST;
}
int UtcDaliLayerLowerBelowNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
Dali::Layer arg1;
int UtcDaliLayerRaiseAboveNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
Dali::Layer arg1;
int UtcDaliLayerRaiseToTopNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
instance.RaiseToTop();
int UtcDaliLayerLowerToBottomNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
instance.LowerToBottom();
int UtcDaliLayerSetSortFunctionNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
Layer::SortFunctionType function = nullptr;
int UtcDaliLayerLowerNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
instance.Lower();
int UtcDaliLayerRaiseNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
instance.Raise();
int UtcDaliLayerMoveAboveNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
Dali::Layer arg1;
int UtcDaliLayerMoveBelowNegative(void)
{
TestApplication application;
- Dali::Layer instance;
+ Dali::Layer instance;
try
{
Dali::Layer arg1;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/lockless-buffer.h>
#include <dali-test-suite-utils.h>
+#include <dali/integration-api/lockless-buffer.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
static bool ReadTest(Integration::LocklessBuffer& buf, const unsigned char exp[], size_t size)
{
- const unsigned char *res = buf.Read();
- for (size_t i=0; i<size; ++i, ++res)
+ const unsigned char* res = buf.Read();
+ for(size_t i = 0; i < size; ++i, ++res)
{
if(*res != exp[i])
{
}
} // anonymous namespace
-
// Simple write - read test
int UtcDaliLocklessBufferWriteRead01(void)
{
Integration::LocklessBuffer buf(10);
- unsigned char data[10];
+ unsigned char data[10];
- for( unsigned char i=0; i<10; ++i )
+ for(unsigned char i = 0; i < 10; ++i)
{
- data[i]=i;
+ data[i] = i;
}
- buf.Write( &data[0], 10 );
+ buf.Write(&data[0], 10);
- if( ReadTest( buf, data, 10 ) )
+ if(ReadTest(buf, data, 10))
{
tet_result(TET_PASS);
}
int UtcDaliLocklessBufferMultipleWrites01(void)
{
Integration::LocklessBuffer buf(10);
- unsigned char data[10];
+ unsigned char data[10];
- for( unsigned char i=0; i<10; ++i )
+ for(unsigned char i = 0; i < 10; ++i)
{
- data[i]=i;
+ data[i] = i;
}
// Write to a buffer
- buf.Write( &data[0], 10 );
+ buf.Write(&data[0], 10);
- for (unsigned char i=0; i<10; ++i)
+ for(unsigned char i = 0; i < 10; ++i)
{
- data[i]=i+4;
+ data[i] = i + 4;
}
// No reads from buffer, so will overwrite contents of same buffer
- buf.Write( &data[0], 10 );
+ buf.Write(&data[0], 10);
- if( ReadTest(buf, data, 10) )
+ if(ReadTest(buf, data, 10))
{
tet_result(TET_PASS);
}
int UtcDaliLocklessBufferGetSize01(void)
{
Integration::LocklessBuffer buf(10);
- unsigned int size = buf.GetSize();
- if( size == 10 )
+ unsigned int size = buf.GetSize();
+ if(size == 10)
{
tet_result(TET_PASS);
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/long-press-gesture-detector-devel.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/input-options.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali/devel-api/events/long-press-gesture-detector-devel.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <test-touch-event-utils.h>
+#include <iostream>
+
using namespace Dali;
void utc_dali_long_press_gesture_detector_startup(void)
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
- : functorCalled( false ),
- voidFunctorCalled( false ),
+ : functorCalled(false),
+ voidFunctorCalled(false),
receivedGesture(),
pressedActor()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pressedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
LongPressGesture receivedGesture;
- Actor pressedActor;
+ Actor pressedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const LongPressGesture& longPress)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = longPress;
- signalData.pressedActor = actor;
+ signalData.pressedActor = actor;
}
void operator()()
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
- : GestureReceivedFunctor( data ),
- stateToUnstage( stateToUnstage ),
- scene( scene )
+ UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene)
+ : GestureReceivedFunctor(data),
+ stateToUnstage(stateToUnstage),
+ scene(scene)
{
}
- void operator()( Actor actor, const LongPressGesture& longPress )
+ void operator()(Actor actor, const LongPressGesture& longPress)
{
- GestureReceivedFunctor::operator()( actor, longPress );
+ GestureReceivedFunctor::operator()(actor, longPress);
- if ( longPress.GetState() == stateToUnstage )
+ if(longPress.GetState() == stateToUnstage)
{
- scene.Remove( actor );
+ scene.Remove(actor);
}
}
- GestureState& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
{
//For line coverage
unsigned int points = touch.GetPointCount();
- if( points > 0)
+ if(points > 0)
{
tet_printf("Touch Point state = %d\n", touch.GetState(0));
}
}
};
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
// Positive test case for a method
int UtcDaliLongPressGestureDetectorConstructorP(void)
{
{
TestApplication application;
- LongPressGestureDetector detector = LongPressGestureDetector::New();;
+ LongPressGestureDetector detector = LongPressGestureDetector::New();
+ ;
- LongPressGestureDetector copy( detector );
- DALI_TEST_CHECK( detector );
+ LongPressGestureDetector copy(detector);
+ DALI_TEST_CHECK(detector);
END_TEST;
}
TestApplication application;
LongPressGestureDetector detector;
- detector = LongPressGestureDetector::New();;
+ detector = LongPressGestureDetector::New();
+ ;
LongPressGestureDetector copy;
copy = detector;
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(detector);
- DALI_TEST_CHECK( detector == copy );
+ DALI_TEST_CHECK(detector == copy);
END_TEST;
}
// Attach an actor and emit a touch event on the actor to ensure complete line coverage
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
actor.TouchedSignal().Connect(&application, touchFunctor);
Integration::TouchEvent touchEvent(1);
- Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ Integration::Point point;
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point);
application.ProcessEvent(touchEvent);
LongPressGestureDetector detector2 = LongPressGestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- LongPressGestureDetector detector3 = DownCast< LongPressGestureDetector >(object);
+ LongPressGestureDetector detector3 = DownCast<LongPressGestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
LongPressGestureDetector detector4 = LongPressGestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- LongPressGestureDetector detector5 = DownCast< LongPressGestureDetector >(unInitializedObject);
+ LongPressGestureDetector detector5 = DownCast<LongPressGestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
- GestureDetector detector6 = LongPressGestureDetector::New();
+ GestureDetector detector6 = LongPressGestureDetector::New();
LongPressGestureDetector detector7 = LongPressGestureDetector::DownCast(detector6);
DALI_TEST_CHECK(detector7);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do a long press outside actor's area
- TestGenerateLongPress( application, 112.0f, 112.0f );
- TestEndLongPress( application, 112.0f, 112.0f);
+ TestGenerateLongPress(application, 112.0f, 112.0f);
+ TestEndLongPress(application, 112.0f, 112.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do a long press inside actor's area
- TestGenerateLongPress( application, 50.0f, 50.0f );
+ TestGenerateLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
- TestEndLongPress( application, 50.0f, 50.0f);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
+ TestEndLongPress(application, 50.0f, 50.0f);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start long press within the actor's area
- TestGenerateLongPress( application, 20.0f, 20.0f );
+ TestGenerateLongPress(application, 20.0f, 20.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
- TestEndLongPress( application, 20.0f, 20.0f);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
+ TestEndLongPress(application, 20.0f, 20.0f);
// repeat the long press within the actor's area - we should still receive the signal
data.Reset();
- TestGenerateLongPress( application, 50.0f, 50.0f );
+ TestGenerateLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
- TestEndLongPress( application, 50.0f, 50.0f);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
+ TestEndLongPress(application, 50.0f, 50.0f);
// Detach actor
detector.DetachAll();
// Ensure we are no longer signalled
data.Reset();
- TestGenerateLongPress( application, 20.0f, 20.0f );
+ TestGenerateLongPress(application, 20.0f, 20.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- TestEndLongPress( application, 50.0f, 50.0f);
+ TestEndLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
// Actor lifetime is scoped
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
// Start long press within the actor's area
- TestGenerateLongPress( application, 20.0f, 20.0f );
+ TestGenerateLongPress(application, 20.0f, 20.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Remove the actor from stage and reset the data
// Actor should now have been destroyed
data.Reset();
- TestEndLongPress( application, 20.0f, 20.0f);
+ TestEndLongPress(application, 20.0f, 20.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion( Dali::Degree(90.0f), Vector3::ZAXIS ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do a long press
- TestGenerateLongPress( application, 5.0f, 5.0f );
- TestEndLongPress( application, 5.0f, 5.0f);
+ TestGenerateLongPress(application, 5.0f, 5.0f);
+ TestEndLongPress(application, 5.0f, 5.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do another long press, should still receive event
data.Reset();
- TestGenerateLongPress( application, 5.0f, 5.0f );
- TestEndLongPress( application, 5.0f, 5.0f);
+ TestGenerateLongPress(application, 5.0f, 5.0f);
+ TestEndLongPress(application, 5.0f, 5.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS));
application.SendNotification();
application.Render();
// Do a long press, inside where the actor used to be, Should not receive the event
data.Reset();
- TestGenerateLongPress( application, 70.0f, 70.0f );
- TestEndLongPress( application, 70.0f, 70.0f);
+ TestGenerateLongPress(application, 70.0f, 70.0f);
+ TestEndLongPress(application, 70.0f, 70.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
parent.Add(child);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do long press - hits child area but parent should still receive it
- TestGenerateLongPress( application, 50.0f, 50.0f );
- TestEndLongPress( application, 50.0f, 50.0f);
+ TestGenerateLongPress(application, 50.0f, 50.0f);
+ TestEndLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pressedActor, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
// Do an entire long press, only check finished value
data.Reset();
- TestGenerateLongPress( application, 51.0f, 51.0f );
- TestEndLongPress( application, 51.0f, 51.0f);
+ TestGenerateLongPress(application, 51.0f, 51.0f);
+ TestEndLongPress(application, 51.0f, 51.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pressedActor, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor first = Actor::New();
- first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- second.SetProperty( Actor::Property::POSITION_X, 100.0f);
- second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// LongPress within second actor's area
- TestGenerateLongPress( application, 120.0f, 10.0f );
- TestEndLongPress( application, 120.0f, 10.0f);
+ TestGenerateLongPress(application, 120.0f, 10.0f);
+ TestEndLongPress(application, 120.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.pressedActor, TEST_LOCATION);
// LongPress within first actor's area
data.Reset();
- TestGenerateLongPress( application, 20.0f, 10.0f );
- TestEndLongPress( application, 20.0f, 10.0f);
+ TestGenerateLongPress(application, 20.0f, 10.0f);
+ TestEndLongPress(application, 20.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.pressedActor, TEST_LOCATION);
// second actor shouldn't receive event
data.Reset();
- TestGenerateLongPress( application, 120.0f, 10.0f );
- TestEndLongPress( application, 120.0f, 10.0f);
+ TestGenerateLongPress(application, 120.0f, 10.0f);
+ TestEndLongPress(application, 120.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// first actor should continue receiving event
data.Reset();
- TestGenerateLongPress( application, 20.0f, 10.0f );
- TestEndLongPress( application, 20.0f, 10.0f);
+ TestGenerateLongPress(application, 20.0f, 10.0f);
+ TestEndLongPress(application, 20.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// LongPress in actor's area
- TestGenerateLongPress( application, 50.0f, 10.0f );
- TestEndLongPress( application, 50.0f, 10.0f);
+ TestGenerateLongPress(application, 50.0f, 10.0f);
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Actor becomes invisible - actor should not receive the next long press
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// Render and notify
application.SendNotification();
// LongPress in the same area, shouldn't receive event
data.Reset();
- TestGenerateLongPress( application, 50.0f, 10.0f );
- TestEndLongPress( application, 50.0f, 10.0f);
+ TestGenerateLongPress(application, 50.0f, 10.0f);
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to one detector
- SignalData firstData;
- GestureReceivedFunctor firstFunctor(firstData);
+ SignalData firstData;
+ GestureReceivedFunctor firstFunctor(firstData);
LongPressGestureDetector firstDetector = LongPressGestureDetector::New();
firstDetector.Attach(actor);
firstDetector.DetectedSignal().Connect(&application, firstFunctor);
// Attach actor to another detector
- SignalData secondData;
- GestureReceivedFunctor secondFunctor(secondData);
+ SignalData secondData;
+ GestureReceivedFunctor secondFunctor(secondData);
LongPressGestureDetector secondDetector = LongPressGestureDetector::New();
secondDetector.Attach(actor);
secondDetector.DetectedSignal().Connect(&application, secondFunctor);
// LongPress in actor's area - both detector's functors should be called
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// LongPress possible in actor's area.
- TestStartLongPress( application, 50.0f, 10.0f );
+ TestStartLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor somewhere else
- actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
// Render and notify
application.SendNotification();
application.Render();
// Emit Started event, we should not receive the long press.
- TestTriggerLongPress( application );
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestTriggerLongPress(application);
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// LongPress possible in empty area.
- TestStartLongPress( application, 50.0f, 10.0f );
+ TestStartLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor in to the long press position.
- actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
// Render and notify
application.SendNotification();
application.Render();
// Emit STARTED event, we should not receive the long press.
- TestTriggerLongPress( application );
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestTriggerLongPress(application);
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Normal long press in actor's area for completeness.
- TestGenerateLongPress( application, 50.0f, 10.0f );
- TestEndLongPress( application, 50.0f, 10.0f);
+ TestGenerateLongPress(application, 50.0f, 10.0f);
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Send a possible followed by a cancel, we should not be signalled
- TestStartLongPress( application, 50.0f, 10.0f );
+ TestStartLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- TestMovePan( application, Vector2( 50.0f, 10.0f ) );
+ TestMovePan(application, Vector2(50.0f, 10.0f));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit initial signal
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
detector.Detach(actor);
// Emit FINISHED, no signal
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit signals
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Render and notify
stateToUnstage = GestureState::FINISHED;
// Emit signals
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully.
+ tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully.
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Create and add a second actor so that GestureDetector destruction does not come into play.
- Actor dummyActor( Actor::New() );
- dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ Actor dummyActor(Actor::New());
+ dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(dummyActor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
detector.Attach(dummyActor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a finished state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
// Emit signals
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Here we delete an actor in started, we should not receive any subsequent signalling.
// Emit signals
- TestGenerateLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- SignalData data;
- GestureReceivedFunctor functor(data);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Add a layer to overlap the actor
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer );
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
layer.RaiseToTop();
// Render and notify
application.Render();
// Emit signals, should receive
- TestGenerateLongPress( application, 50.0f, 50.0f );
- TestEndLongPress( application, 50.0f, 50.0f );
+ TestGenerateLongPress(application, 50.0f, 50.0f);
+ TestEndLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
- TestGenerateLongPress( application, 50.0f, 50.0f );
- TestEndLongPress( application, 50.0f, 50.0f );
+ TestGenerateLongPress(application, 50.0f, 50.0f);
+ TestEndLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
const uint32_t kMinumumHolding1 = 5000;
const uint32_t kMinumumHolding2 = 3000;
- Integration::SetLongPressMinimumHoldingTime( kMinumumHolding1 );
+ Integration::SetLongPressMinimumHoldingTime(kMinumumHolding1);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
- DALI_TEST_EQUALS( DevelLongPressGestureDetector::GetMinimumHoldingTime( detector ), kMinumumHolding1, TEST_LOCATION );
+ DALI_TEST_EQUALS(DevelLongPressGestureDetector::GetMinimumHoldingTime(detector), kMinumumHolding1, TEST_LOCATION);
- Integration::SetLongPressMinimumHoldingTime( kMinumumHolding2 );
- DALI_TEST_EQUALS( DevelLongPressGestureDetector::GetMinimumHoldingTime( detector ), kMinumumHolding2, TEST_LOCATION );
+ Integration::SetLongPressMinimumHoldingTime(kMinumumHolding2);
+ DALI_TEST_EQUALS(DevelLongPressGestureDetector::GetMinimumHoldingTime(detector), kMinumumHolding2, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
- bool consume = false;
+ bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchedSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
LongPressGestureDetector detector = LongPressGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed
- TestGenerateLongPress( application, 50.0f, 50.0f );
+ TestGenerateLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndLongPress(application, 50.0f,50.0f);
+ TestEndLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Another gesture in the same location, this time we will not receive it as touch is being consumed
consume = true;
- TestGenerateLongPress( application, 50.0f, 50.0f );
+ TestGenerateLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndLongPress(application, 50.0f,50.0f);
+ TestEndLongPress(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- LongPressGestureDetector detector = LongPressGestureDetector::New();
- bool functorCalled = false;
- detector.Attach( actor );
+ LongPressGestureDetector detector = LongPressGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach(actor);
detector.DetectedSignal().Connect(
- &application,
- [&detector, &functorCalled](Actor actor, const LongPressGesture& gesture)
+ &application,
+ [&detector, &functorCalled](Actor actor, const LongPressGesture& gesture) {
+ if(gesture.GetState() == GestureState::FINISHED)
{
- if( gesture.GetState() == GestureState::FINISHED )
- {
- detector.Detach(actor);
- functorCalled = true;
- }
- });
+ detector.Detach(actor);
+ functorCalled = true;
+ }
+ });
// Render and notify
application.SendNotification();
// Try the gesture, should not crash
try
{
- TestGenerateLongPress( application, 50.0f, 10.0f );
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
+ TestEndLongPress(application, 50.0f, 10.0f);
- DALI_TEST_CHECK( true ); // No crash, test has passed
+ DALI_TEST_CHECK(true); // No crash, test has passed
DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
}
catch(...)
{
- DALI_TEST_CHECK( false ); // If we crash, the test has failed
+ DALI_TEST_CHECK(false); // If we crash, the test has failed
}
END_TEST;
}
-
-
*
*/
-#include <iostream>
-#include <thread>
-#include <chrono>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <chrono>
+#include <iostream>
+#include <thread>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pressedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
LongPressGesture receivedGesture;
- Actor pressedActor;
+ Actor pressedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const LongPressGesture& pan)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = pan;
- signalData.pressedActor = actor;
+ signalData.pressedActor = actor;
}
void operator()()
SignalData& signalData;
};
-
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
+ Integration::Point point;
+ point.SetState(state);
point.SetDeviceId(4);
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( stateA );
+ Integration::Point point;
+ point.SetState(stateA);
point.SetDeviceId(4);
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- point.SetState( stateB);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ point.SetState(stateB);
point.SetDeviceId(7);
- touchEvent.points.push_back( point );
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
int UtcDaliLongPressGestureRecognizerBasicNoAction(void)
{
TestApplication application;
LongPressGestureDetector detector = LongPressGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
LongPressGestureDetector detector = LongPressGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
application.GetPlatform().TriggerTimer();
LongPressGestureDetector detector = LongPressGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
application.SendNotification();
LongPressGestureDetector detector = LongPressGestureDetector::New();
- detector.SetTouchesRequired(2,2);
+ detector.SetTouchesRequired(2, 2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
// There should be no function to call
application.GetPlatform().TriggerTimer();
LongPressGestureDetector detector = LongPressGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 151 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 151));
// There should be no function to call as the double touch should have cancelled it
application.GetPlatform().TriggerTimer();
LongPressGestureDetector detector = LongPressGestureDetector::New();
- detector.SetTouchesRequired(2,2);
+ detector.SetTouchesRequired(2, 2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 0.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 151 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 10.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 153 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 155 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 157 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 50.0f ), 159 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 20.0f, 40.0f ), PointState::UP, Vector2( 20.0f, 50.0f ), 160 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 161 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 0.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 151));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 10.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 153));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 155));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 157));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 50.0f), 159));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(20.0f, 40.0f), PointState::UP, Vector2(20.0f, 50.0f), 160));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 161));
application.GetPlatform().TriggerTimer();
LongPressGestureDetector detector = LongPressGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
detector.Attach(actor);
- detector.SetTouchesRequired(2,2); // Set after we've attached forcing us to change things internally
+ detector.SetTouchesRequired(2, 2); // Set after we've attached forcing us to change things internally
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 40.0f ), 140 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 40.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 40.0f), 140));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 40.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
application.GetPlatform().TriggerTimer();
- application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 20.0f, 20.0f ), PointState::UP, Vector2( 20.0f, 90.0f ), 760 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 761 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(20.0f, 20.0f), PointState::UP, Vector2(20.0f, 90.0f), 760));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 761));
application.SendNotification();
{
TestApplication application;
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add(actor);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
- Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor2.SetProperty( Actor::Property::POSITION_X, 100.0f);
- application.GetScene().Add(actor2);
+ Actor actor2 = Actor::New();
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor2.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ application.GetScene().Add(actor2);
- // Render and notify
- application.SendNotification();
- application.Render();
+ // Render and notify
+ application.SendNotification();
+ application.Render();
- LongPressGestureDetector detector = LongPressGestureDetector::New();
- detector.Attach(actor);
+ LongPressGestureDetector detector = LongPressGestureDetector::New();
+ detector.Attach(actor);
- LongPressGestureDetector detector2 = LongPressGestureDetector::New(2);
- detector2.Attach(actor2);
+ LongPressGestureDetector detector2 = LongPressGestureDetector::New(2);
+ detector2.Attach(actor2);
- SignalData data;
- GestureReceivedFunctor functor(data);
- detector.DetectedSignal().Connect(&application, functor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- SignalData data2;
- GestureReceivedFunctor functor2(data2);
- detector2.DetectedSignal().Connect(&application, functor2);
+ SignalData data2;
+ GestureReceivedFunctor functor2(data2);
+ detector2.DetectedSignal().Connect(&application, functor2);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.GetPlatform().TriggerTimer();
+ application.GetPlatform().TriggerTimer();
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 700 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 700));
- application.SendNotification();
+ application.SendNotification();
- DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(true, actor == data.pressedActor, TEST_LOCATION);
- data.Reset();
- DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, actor == data.pressedActor, TEST_LOCATION);
+ data.Reset();
+ DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 120.0f, 40.0f ), 800 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 120.0f, 40.0f ), PointState::DOWN, Vector2( 120.0f, 90.0f ), 805 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(120.0f, 40.0f), 800));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(120.0f, 40.0f), PointState::DOWN, Vector2(120.0f, 90.0f), 805));
- application.GetPlatform().TriggerTimer();
+ application.GetPlatform().TriggerTimer();
- application.SendNotification();
+ application.SendNotification();
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(true, data2.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data2.functorCalled, TEST_LOCATION);
- END_TEST;
+ END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
try
{
- NextPowerOfTwo( (1u << (sizeof(unsigned) * 8 - 1)) + 1);
+ NextPowerOfTwo((1u << (sizeof(unsigned) * 8 - 1)) + 1);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "Return type cannot represent the next power of two greater than the argument.", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "Return type cannot represent the next power of two greater than the argument.", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
DALI_TEST_EQUALS(Clamp(0, -10, 10), 0, TEST_LOCATION);
DALI_TEST_EQUALS(Clamp(20, 0, 10), 10, TEST_LOCATION);
- float value=-10.0f, min=-2.0f, max=4.0f;
+ float value = -10.0f, min = -2.0f, max = 4.0f;
ClampInPlace(value, min, max);
DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION);
{
Dali::TestApplication testApp;
- float value=-10.0f, min=-2.0f, max=4.0f;
+ float value = -10.0f, min = -2.0f, max = 4.0f;
ClampInPlace(value, min, max);
DALI_TEST_EQUALS(value, min, 0.001, TEST_LOCATION);
{
Dali::TestApplication testApp;
- float offset=0.0f, low=-2.0f, high=4.0f;
+ float offset = 0.0f, low = -2.0f, high = 4.0f;
DALI_TEST_EQUALS(Lerp(offset, low, high), low, 0.001, TEST_LOCATION);
offset = 1.0f;
DALI_TEST_EQUALS(Lerp(offset, low, high), high, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(0.099f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(0.99f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(0.099f, 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(0.99f, 0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(0.99f, 0.98f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(1.05f, 0.99f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(1.99f, 1.05f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(2.0f, 1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(1.0f, 3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(2.0f, 1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(0.05f, 2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(1.0f, 3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(9.99f, 0.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(9.99f, 1.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(9.99f, 9.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(1e07f, 0.99e09f), Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION);
-
DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-0.099f, - 0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-0.99f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.099f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-0.099f, -0.02f), Dali::Math::MACHINE_EPSILON_0, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-0.99f, -0.5f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-0.99f, -0.98f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-1.05f, -0.99f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-1.99f, -1.05f), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-2.0f, - 1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
- DALI_TEST_EQUALS(GetRangedEpsilon(-1.0f, - 3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-2.0f, -1.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-0.05f, -2.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(GetRangedEpsilon(-1.0f, -3.0f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-9.99f, -0.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-9.99f, -1.5f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-9.99f, -9.99f), Dali::Math::MACHINE_EPSILON_10, TEST_LOCATION);
DALI_TEST_EQUALS(GetRangedEpsilon(-1e07f, -0.99e09f), Dali::Math::MACHINE_EPSILON_10000, TEST_LOCATION);
-
END_TEST;
}
int UtcDaliMathUtilsEqualsZeroP(void)
{
- float v=0.0f;
+ float v = 0.0f;
DALI_TEST_CHECK(EqualsZero(v));
- v = Math::PI;
+ v = Math::PI;
v -= (Math::PI_2 * 2.0f);
DALI_TEST_CHECK(EqualsZero(v));
int UtcDaliMathUtilsEquals01P(void)
{
- float w=100.0f;
- float x=w+1e-8f;
- DALI_TEST_CHECK( Equals(w, x, GetRangedEpsilon( w, x )) );
+ float w = 100.0f;
+ float x = w + 1e-8f;
+ DALI_TEST_CHECK(Equals(w, x, GetRangedEpsilon(w, x)));
END_TEST;
}
int UtcDaliMathUtilsEquals02P(void)
{
- float w=100.0f;
- float x=w+1e-8f;
- DALI_TEST_CHECK( Equals(w, x) );
+ float w = 100.0f;
+ float x = w + 1e-8f;
+ DALI_TEST_CHECK(Equals(w, x));
END_TEST;
}
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
#include <iostream>
#include <sstream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
using namespace Dali;
-
void utc_dali_matrix_startup(void)
{
test_return_value = TET_UNDEF;
test_return_value = TET_PASS;
}
-
int UtcDaliMatrixConstructor01P(void)
{
// State of memory cannot be guaranteed, so use
memset(buffer, 1, sizeof(Matrix));
- Matrix* m2 = new(&buffer) Matrix(false);
- bool initialisation_occured = false;
+ Matrix* m2 = new(&buffer) Matrix(false);
+ bool initialisation_occured = false;
{
float* els = m2->AsFloat();
- for(size_t idx=0; idx<16; ++idx, ++els)
+ for(size_t idx = 0; idx < 16; ++idx, ++els)
{
if(*els == 0.0f)
initialisation_occured = true;
int UtcDaliMatrixConstructor02P(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};
+ 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);
- float* els = m.AsFloat();
- float* init = r;
- bool initialised = true;
- for(size_t idx=0; idx<16; ++idx, ++els, ++init)
+ 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;
int UtcDaliMatrixConstructor03P(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};
+ 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 ma(r);
Matrix mb(ma);
- float* els = ma.AsFloat();
- float* init = mb.AsFloat();
- bool initialised = true;
- for(size_t idx=0; idx<16; ++idx, ++els, ++init)
+ 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;
int UtcDaliMatrixConstructor04P(void)
{
Quaternion q(Quaternion::IDENTITY);
- Matrix m(q);
+ Matrix m(q);
DALI_TEST_EQUALS(Matrix(Matrix::IDENTITY), m, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliMatrixCopyConstructor(void)
{
- Matrix m0( Matrix::IDENTITY );
- Matrix m1( m0 );
+ Matrix m0(Matrix::IDENTITY);
+ Matrix m1(m0);
DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
int UtcDaliMatrixMoveConstructor(void)
{
- Matrix m0( Matrix::IDENTITY );
- Matrix m1 = std::move( m0 );
+ Matrix m0(Matrix::IDENTITY);
+ Matrix m1 = std::move(m0);
DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
int UtcDaliMatrixCopyAssignment(void)
{
- Matrix m0( Matrix::IDENTITY );
+ Matrix m0(Matrix::IDENTITY);
Matrix m1;
m1 = m0;
DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
int UtcDaliMatrixMoveAssignment(void)
{
- Matrix m0( Matrix::IDENTITY );
+ Matrix m0(Matrix::IDENTITY);
Matrix m1;
- m1 = std::move( m0 );
+ m1 = std::move(m0);
DALI_TEST_EQUALS(m1, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
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 };
+ 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();
int UtcDaliMatrixSetIdentityAndScaleP(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 };
+ 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 };
+ 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);
int UtcDaliMatrixInvertTransformP(void)
{
- for (int i=0;i<1000;++i)
+ for(int i = 0; i < 1000; ++i)
{
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ 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);
+ 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 );
+ m0.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), center);
Matrix m1;
m0.InvertTransform(m1);
- Matrix m2( false );
- Matrix::Multiply( m2, m0, m1 );
+ Matrix m2(false);
+ Matrix::Multiply(m2, m0, m1);
DALI_TEST_EQUALS(m2, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
}
int UtcDaliMatrixInvertTransformN(void)
{
- std::string exceptionString( "EqualsZero( mMatrix[3] ) && EqualsZero( mMatrix[7] ) && EqualsZero( mMatrix[11] ) && Equals( mMatrix[15], 1.0f" );
+ std::string exceptionString("EqualsZero(mMatrix[3]) && EqualsZero(mMatrix[7]) && EqualsZero(mMatrix[11]) && Equals(mMatrix[15], 1.0f");
try
{
- 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 };
+ 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 it;
m.InvertTransform(it);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION);
}
try
{
- float els[] = { 0.0f, 1.0f, 2.0f, 0.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 };
+ float els[] = {0.0f, 1.0f, 2.0f, 0.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 it;
m.InvertTransform(it);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION);
}
try
{
- float els[] = { 0.0f, 1.0f, 2.0f, 0.0f,
- 4.0f, 5.0f, 6.0f, 0.0f,
- 8.0f, 9.0f, 10.0f, 11.0f,
- 12.0f, 13.0f, 14.0f, 15.0f };
+ float els[] = {0.0f, 1.0f, 2.0f, 0.0f, 4.0f, 5.0f, 6.0f, 0.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f};
Matrix m(els);
Matrix it;
m.InvertTransform(it);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION);
}
try
{
- float els[] = { 0.0f, 1.0f, 2.0f, 0.0f,
- 4.0f, 5.0f, 6.0f, 0.0f,
- 8.0f, 9.0f, 10.0f, 0.0f,
- 12.0f, 13.0f, 14.0f, 15.0f };
+ float els[] = {0.0f, 1.0f, 2.0f, 0.0f, 4.0f, 5.0f, 6.0f, 0.0f, 8.0f, 9.0f, 10.0f, 0.0f, 12.0f, 13.0f, 14.0f, 15.0f};
Matrix m(els);
Matrix it;
m.InvertTransform(it);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, exceptionString, TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, exceptionString, TEST_LOCATION);
}
END_TEST;
}
{
// 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)
+ for(int i = 0; i < 1000; ++i)
{
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ 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);
+ 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 );
+ m0.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), center);
Matrix m1(m0);
m1.Invert();
- Matrix m2( false );
- Matrix::Multiply( m2, m0, m1 );
+ 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
+ m1.Invert(); // doube invert - should be back to m0
DALI_TEST_EQUALS(m0, m1, 0.001f, TEST_LOCATION);
}
int UtcDaliMatrixTransposeP(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
- };
+ {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(floats);
m.Transpose();
bool success = true;
- for (int x=0;x<4;++x)
+ for(int x = 0; x < 4; ++x)
{
- for (int y=0;y<4;++y)
+ for(int y = 0; y < 4; ++y)
{
- success &= (m.AsFloat()[x+y*4] == floats[x*4+y]);
+ success &= (m.AsFloat()[x + y * 4] == floats[x * 4 + y]);
}
}
int UtcDaliMatrixGetXAxisP(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 };
+ 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.GetXAxis() == Vector3(0.0f, 1.0f, 2.0f));
+ DALI_TEST_CHECK(m.GetXAxis() == Vector3(0.0f, 1.0f, 2.0f));
END_TEST;
}
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 };
+ 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.GetYAxis() == Vector3(4.0f, 5.0f, 6.0f));
+ DALI_TEST_CHECK(m.GetYAxis() == Vector3(4.0f, 5.0f, 6.0f));
END_TEST;
}
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 };
+ 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));
+ DALI_TEST_CHECK(m.GetZAxis() == Vector3(8.0f, 9.0f, 10.0f));
END_TEST;
}
int UtcDaliMatrixSetXAxisP(void)
{
- Matrix m;
+ Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
m.SetXAxis(v);
int UtcDaliMatrixSetYAxisP(void)
{
- Matrix m;
+ Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
m.SetYAxis(v);
int UtcDaliMatrixSetZAxisP(void)
{
- Matrix m;
+ Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
m.SetZAxis(v);
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 };
+ 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);
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 };
+ 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);
int UtcDaliMatrixSetTranslationP(void)
{
- Matrix m;
+ Matrix m;
Vector4 v(2.0f, 3.0f, 4.0f, 5.0f);
m.SetTranslation(v);
int UtcDaliMatrixSetTranslation3P(void)
{
- Matrix m;
+ Matrix m;
Vector3 v(2.0f, 3.0f, 4.0f);
m.SetTranslation(v);
Matrix m;
m.SetIdentity();
- for (int i=0;i<1000;++i)
+ for(int i = 0; i < 1000; ++i)
{
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ 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.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), Vector3::ZERO);
m.OrthoNormalize();
}
int UtcDaliMatrixOrthoNormalize1P(void)
{
// OrthoNormalize is not flipping the axes and is maintaining the translation
- for (int i=0;i<1000;++i)
+ for(int i = 0; i < 1000; ++i)
{
- float f = i;
- Vector3 axis(cosf(f*0.001f), cosf(f*0.02f), cosf(f*0.03f));
+ 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 m0;
m0.SetIdentity();
- m0.SetTransformComponents( Vector3::ONE, Quaternion(Radian(1.0f), axis), center );
+ m0.SetTransformComponents(Vector3::ONE, Quaternion(Radian(1.0f), axis), center);
Matrix m1(m0);
m1.OrthoNormalize();
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};
+ 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)
+ const float* els = m.AsFloat();
+ const 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);
-
END_TEST;
}
int UtcDaliMatrixAsFloatP(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};
+ 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);
- float* els = m.AsFloat();
- float* init = r;
- bool initialised = true;
- for(size_t idx=0; idx<16; ++idx, ++els, ++init)
+ 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);
-
END_TEST;
}
{
Matrix m1 = Matrix::IDENTITY;
- float els[] = { 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.707f, 0.707f, 0.0f,
- 0.0f, -0.707f, 0.707f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
+ float els[] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.707f, 0.707f, 0.0f, 0.0f, -0.707f, 0.707f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
Matrix result(els);
Quaternion q(Radian(Degree(45.0f)), Vector3::XAXIS);
- Matrix m2(false);
+ Matrix m2(false);
Matrix::Multiply(m2, m1, q);
DALI_TEST_EQUALS(m2, result, 0.01f, TEST_LOCATION);
{
Vector4 v1(2.0f, 5.0f, 4.0f, 0.0f);
- float els[] = {2.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 3.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 4.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
+ float els[] = {2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
Matrix m1(els);
Vector4 v2 = m1 * v1;
{
TestApplication application;
- Vector3 position ( 30.f, 40.f, 50.f);
+ Vector3 position(30.f, 40.f, 50.f);
Matrix m1(false);
m1.SetIdentity();
m1.SetTranslation(-position);
Vector4 positionV4(position);
- positionV4.w=1.0f;
+ positionV4.w = 1.0f;
Vector4 output = m1 * positionV4;
output.w = 0.0f;
{
Matrix m1 = Matrix::IDENTITY;
- float els[] = { 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};
+ float els[] = {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 r2(els);
DALI_TEST_EQUALS(m1 == r2, true, TEST_LOCATION);
- float *f = m1.AsFloat();
- for(size_t i=0; i<16; i++)
+ float* f = m1.AsFloat();
+ for(size_t i = 0; i < 16; i++)
{
- f[15-i] = 1.2f;
+ f[15 - i] = 1.2f;
DALI_TEST_EQUALS(m1 == r2, false, TEST_LOCATION);
}
END_TEST;
int UtcDaliMatrixOperatorNotEqualsP(void)
{
- Matrix m1 = Matrix::IDENTITY;
- float els[] = {2.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 3.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 4.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
+ Matrix m1 = Matrix::IDENTITY;
+ float els[] = {2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f, 0.0f, 0.0f, 0.0f, 0.0f, 4.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
Matrix r1(els);
DALI_TEST_CHECK(m1 != r1);
int UtcDaliMatrixSetTransformComponents01P(void)
{
// Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=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)
+ for(float angle = 5.0f; angle <= 360.0f; angle += 15.0f)
{
Quaternion rotation1(Radian(Degree(angle)), vForward);
- Matrix m1(rotation1);
- Matrix result1(false);
+ Matrix m1(rotation1);
+ Matrix result1(false);
Vector3 vForward3(vForward.x, vForward.y, vForward.z);
- result1.SetTransformComponents( Vector3::ONE, Quaternion(Radian(Degree(angle)), vForward3), Vector3::ZERO );
+ result1.SetTransformComponents(Vector3::ONE, Quaternion(Radian(Degree(angle)), vForward3), Vector3::ZERO);
DALI_TEST_EQUALS(m1, result1, 0.001, TEST_LOCATION);
int UtcDaliMatrixSetInverseTransformComponent01P(void)
{
// Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=0.1f )
+ for(float z = -1.0f; z < 1.0f; z += 0.1f)
{
Vector3 vForward(x, y, z);
vForward.Normalize();
{
Quaternion rotation1(Quaternion::IDENTITY); // test no rotation branch
- Vector3 scale1(2.0f, 3.0f, 4.0f);
- Vector3 position1(1.0f, 2.0f, 3.0f);
+ Vector3 scale1(2.0f, 3.0f, 4.0f);
+ Vector3 position1(1.0f, 2.0f, 3.0f);
Matrix m1(false);
m1.SetTransformComponents(scale1, rotation1, position1);
int UtcDaliMatrixSetInverseTransformComponent02P(void)
{
// Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=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)
+ for(float angle = 5.0f; angle <= 360.0f; angle += 15.0f)
{
Quaternion rotation1(Radian(Degree(angle)), vForward);
- Matrix rotationMatrix(rotation1); // TEST RELIES ON THIS METHOD WORKING!!!
+ Matrix rotationMatrix(rotation1); // TEST RELIES ON THIS METHOD WORKING!!!
Vector3 position1(5.0f, -6.0f, 7.0f);
Matrix m1(false);
- m1.SetTransformComponents( Vector3::ONE, rotation1, position1 );
+ m1.SetTransformComponents(Vector3::ONE, rotation1, position1);
Matrix m2(false);
- m2.SetInverseTransformComponents( rotationMatrix.GetXAxis(),
- rotationMatrix.GetYAxis(),
- rotationMatrix.GetZAxis(),
- position1 );
+ m2.SetInverseTransformComponents(rotationMatrix.GetXAxis(),
+ rotationMatrix.GetYAxis(),
+ rotationMatrix.GetZAxis(),
+ position1);
Matrix result;
Matrix::Multiply(result, m1, m2);
int UtcDaliMatrixGetTransformComponents01P(void)
{
- Matrix m2(Matrix::IDENTITY.AsFloat());
- Vector3 pos2;
- Vector3 scale2;
+ 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);
END_TEST;
}
-
int UtcDaliMatrixGetTransformComponents02P(void)
{
// Create an arbitrary vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=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)
+ 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);
+ 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;
+ Vector3 position2;
Quaternion rotation2;
- Vector3 scale2;
+ Vector3 scale2;
m1.GetTransformComponents(position2, rotation2, scale2);
DALI_TEST_EQUALS(position1, position2, 0.001, TEST_LOCATION);
int UtcDaliMatrixGetTransformComponents03P(void)
{
- Matrix m2; // zero branch
- Vector3 pos2;
- Vector3 scale2;
+ Matrix m2; // zero branch
+ 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);
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);
+ DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+#include <iostream>
using namespace Dali;
namespace
{
-
Matrix3 m1(
- -18.6f, 1.88e-09f, -6.85e-09f,
- 0.0f,13.2f, 13.2f,
- -1.36e-08f,13.2f, -13.2f);
+ -18.6f, 1.88e-09f, -6.85e-09f, 0.0f, 13.2f, 13.2f, -1.36e-08f, 13.2f, -13.2f);
Matrix3 m2(
- -18.6f,6.91e-06f, 6.76e-06f,
- 8.04e-09f,13.2f, 13.2f,
- 3.01e-06f,13.2f, -13.2f);
+ -18.6f, 6.91e-06f, 6.76e-06f, 8.04e-09f, 13.2f, 13.2f, 3.01e-06f, 13.2f, -13.2f);
Matrix3 m3(
- 6.24f,-12.4f, -12.4f,
- -17.6f,-4.46f, -4.37f,
- -0.0641f,13.2f, -13.2f);
+ 6.24f, -12.4f, -12.4f, -17.6f, -4.46f, -4.37f, -0.0641f, 13.2f, -13.2f);
Matrix3 m4(
- -16.3f,6.42f, 6.38f,
- 9.05f,11.6f, 11.4f,
- -0.0371f,13.1f, -13.3f);
+ -16.3f, 6.42f, 6.38f, 9.05f, 11.6f, 11.4f, -0.0371f, 13.1f, -13.3f);
Matrix3 m5(
- -2.43f,13.2f, 12.9f,
- 18.5f,1.92f, 1.51f,
- -0.257f,13.0f, -13.4f);
+ -2.43f, 13.2f, 12.9f, 18.5f, 1.92f, 1.51f, -0.257f, 13.0f, -13.4f);
Matrix3 m6(
- -2.43f, -13.2f, -200.9f,
- 18.5f, 1.92f, 1.51f,
- 0.257f, 13.0f, 13.4f);
-
+ -2.43f, -13.2f, -200.9f, 18.5f, 1.92f, 1.51f, 0.257f, 13.0f, 13.4f);
Matrix3 i1(
- -0.05, -0.00, 0.00,
- -0.00, 0.04, 0.04,
- 0.00, 0.04, -0.04);
+ -0.05, -0.00, 0.00, -0.00, 0.04, 0.04, 0.00, 0.04, -0.04);
Matrix3 i2(
- -0.05, 0.00, -0.00,
- 0.00, 0.04, 0.04,
- 0.00, 0.04, -0.04);
+ -0.05, 0.00, -0.00, 0.00, 0.04, 0.04, 0.00, 0.04, -0.04);
Matrix3 i3(
- 0.02, -0.05, -0.00,
- -0.04, -0.01, 0.04,
- -0.04, -0.01, -0.04);
+ 0.02, -0.05, -0.00, -0.04, -0.01, 0.04, -0.04, -0.01, -0.04);
Matrix3 i4(
- -0.05, 0.03, -0.00,
- 0.02, 0.03, 0.04,
- 0.02, 0.03, -0.04);
+ -0.05, 0.03, -0.00, 0.02, 0.03, 0.04, 0.02, 0.03, -0.04);
Matrix3 i5(
- -0.01, 0.05, -0.00,
- 0.04, 0.01, 0.04,
- 0.04, 0.00, -0.04);
-
-
+ -0.01, 0.05, -0.00, 0.04, 0.01, 0.04, 0.04, 0.00, -0.04);
Matrix3 t1(
- -18.6f, 0.0f, -1.36e-08f,
- 1.88e-09f,13.2f, 13.2f,
- -6.85e-09f,13.2f, -13.2f);
+ -18.6f, 0.0f, -1.36e-08f, 1.88e-09f, 13.2f, 13.2f, -6.85e-09f, 13.2f, -13.2f);
Matrix3 t2(
- -18.6f,8.04e-09f, 3.01e-06f,
- 6.91e-06f,13.2f, 13.2f,
- 6.76e-06f,13.2f, -13.2f);
+ -18.6f, 8.04e-09f, 3.01e-06f, 6.91e-06f, 13.2f, 13.2f, 6.76e-06f, 13.2f, -13.2f);
Matrix3 t3(
- 6.24f,-17.6f, -0.0641f,
- -12.4f,-4.46f, 13.2f,
- -12.4f, -4.37f, -13.2f);
+ 6.24f, -17.6f, -0.0641f, -12.4f, -4.46f, 13.2f, -12.4f, -4.37f, -13.2f);
Matrix3 t4(
- -16.3f,9.05f, -0.0371f,
- 6.42f, 11.6f, 13.1f,
- 6.38f,11.4f, -13.3f);
+ -16.3f, 9.05f, -0.0371f, 6.42f, 11.6f, 13.1f, 6.38f, 11.4f, -13.3f);
Matrix3 t5(
- -2.43f,18.5f, -0.257f,
- 13.2f, 1.92f, 13.0f,
- 12.9f, 1.51f, -13.4f);
-
+ -2.43f, 18.5f, -0.257f, 13.2f, 1.92f, 13.0f, 12.9f, 1.51f, -13.4f);
-
-Matrix3* matrices[5] = { &m1, &m2, &m3, &m4, &m5 };
-Matrix3* inverseMatrices[5] = { &i1, &i2, &i3, &i4, &i5 };
-Matrix3* transposeMatrices[5] = { &t1, &t2, &t3, &t4, &t5 };
+Matrix3* matrices[5] = {&m1, &m2, &m3, &m4, &m5};
+Matrix3* inverseMatrices[5] = {&i1, &i2, &i3, &i4, &i5};
+Matrix3* transposeMatrices[5] = {&t1, &t2, &t3, &t4, &t5};
} // anonymous namespace
int UtcDaliMatrix3FromMatrix(void)
{
- float els0[] = { 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 m0(els0);
- Matrix3 m1(0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f);
+ float els0[] = {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 m0(els0);
+ Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f);
Matrix3 m2(m0);
int UtcDaliMatrix3CopyConstructor(void)
{
- Matrix3 m0( Matrix3::IDENTITY );
- Matrix3 m1( m0 );
+ Matrix3 m0(Matrix3::IDENTITY);
+ Matrix3 m1(m0);
DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
int UtcDaliMatrix3MoveConstructor(void)
{
- Matrix3 m0( Matrix3::IDENTITY );
- Matrix3 m1 = std::move( m0 );
+ Matrix3 m0(Matrix3::IDENTITY);
+ Matrix3 m1 = std::move(m0);
DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
int UtcDaliMatrix3CopyAssignment(void)
{
- Matrix3 m0( Matrix3::IDENTITY );
+ Matrix3 m0(Matrix3::IDENTITY);
Matrix3 m1;
m1 = m0;
DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION);
int UtcDaliMatrix3MoveAssignment(void)
{
- Matrix3 m0( Matrix3::IDENTITY );
+ Matrix3 m0(Matrix3::IDENTITY);
Matrix3 m1;
- m1 = std::move( m0 );
+ m1 = std::move(m0);
DALI_TEST_EQUALS(m1, Matrix3::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
int UtcDaliMatrix3OperatorAssign01(void)
{
- float els0[] = { 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};
+ float els0[] = {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 m0(els0);
- Matrix3 m1(0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f);
+ Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f);
Matrix3 m2;
m2 = m0;
END_TEST;
}
-
int UtcDaliMatrix3OperatorAssign02(void)
{
- Matrix3 m0(0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f);
+ Matrix3 m0(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f);
- Matrix3 m1(0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f);
+ Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f);
Matrix3 m2;
m2 = m0;
END_TEST;
}
-
-
// AsFloat
int UtcDaliMatrix3AsFloat(void)
{
- float values[] = {0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f };
+ float values[] = {0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f};
- Matrix3 m1(values[0], values[1], values[2], values[3],values[4], values[5], values[6], values[7],values[8]);
+ Matrix3 m1(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7], values[8]);
- for (int i=0;i<9;++i)
+ for(int i = 0; i < 9; ++i)
{
- DALI_TEST_EQUALS(m1.AsFloat()[i], values[i], TEST_LOCATION);
+ DALI_TEST_EQUALS(m1.AsFloat()[i], values[i], TEST_LOCATION);
}
END_TEST;
}
-
// Invert works
int UtcDaliMatrix3Invert(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<5;++i)
+ for(int i = 0; i < 5; ++i)
{
- Matrix3 m = *matrices[i];
+ Matrix3 m = *matrices[i];
Matrix3 inverseResult1 = *inverseMatrices[i];
// Convert to Mat4, perform inverse, and convert back to Mat3
- float* mf = m.AsFloat();
- float els[] = { mf[0], mf[1], mf[2], 0.0f,
- mf[3], mf[4], mf[5], 0.0f,
- mf[6], mf[7], mf[8], 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
+ float* mf = m.AsFloat();
+ float els[] = {mf[0], mf[1], mf[2], 0.0f, mf[3], mf[4], mf[5], 0.0f, mf[6], mf[7], mf[8], 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
Matrix mat4(els);
mat4.Invert();
Matrix3 inverseResult2 = mat4;
DALI_TEST_EQUALS(mInv, inverseResult2, 0.01f, TEST_LOCATION);
Matrix3 m2 = mInv;
- m2.Invert(); // double invert - should be back to m
+ m2.Invert(); // double invert - should be back to m
DALI_TEST_EQUALS(m, m2, 0.01f, TEST_LOCATION);
}
int UtcDaliMatrix3Transpose(void)
{
- for (int i=0;i<5;++i)
+ for(int i = 0; i < 5; ++i)
{
Matrix3 m0 = *matrices[i];
Matrix3 trans = *transposeMatrices[i];
// SetIdentity
int UtcDaliMatrix3SetIdentity(void)
{
- Matrix3 m( 0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f);
+ Matrix3 m(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f);
m.SetIdentity();
DALI_TEST_EQUALS(m, Matrix3::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliMatrix3Scale(void)
{
- Matrix3 m1( 0.0f, 1.0f, 2.0f,
- 4.0f, 5.0f, 6.0f,
- 8.0f, 9.0f, 10.0f);
+ Matrix3 m1(0.0f, 1.0f, 2.0f, 4.0f, 5.0f, 6.0f, 8.0f, 9.0f, 10.0f);
- Matrix3 m2( 0.0f, 3.0f, 6.0f,
- 12.0f, 15.0f, 18.0f,
- 24.0f, 27.0f, 30.0f);
+ Matrix3 m2(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f);
m1.Scale(3.0f);
int UtcDaliMatrix3Magnitude(void)
{
- Matrix3 m1( 0.0f, 1.0f, -2.0f,
- 3.0f, -4.0f, 5.0f,
- -6.0f, 7.0f, 8.0f);
+ Matrix3 m1(0.0f, 1.0f, -2.0f, 3.0f, -4.0f, 5.0f, -6.0f, 7.0f, 8.0f);
DALI_TEST_EQUALS(Matrix3::IDENTITY.Magnitude(), 1.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(m1.Magnitude(), 12.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliMatrix3ScaleInverseTranspose(void)
{
- Matrix3* matrices[6] = { &m1, &m2, &m3, &m4, &m5, &m6 };
+ Matrix3* matrices[6] = {&m1, &m2, &m3, &m4, &m5, &m6};
-
- for (int i=0;i<6;++i)
+ for(int i = 0; i < 6; ++i)
{
- Matrix3 m0 = *matrices[i];
+ Matrix3 m0 = *matrices[i];
Matrix3 m1 = m0;
m1.Invert();
m1.Transpose();
- m1.Scale(3.0f/(m1.Magnitude()));
+ m1.Scale(3.0f / (m1.Magnitude()));
Matrix3 m2 = m0;
m2.ScaledInverseTranspose();
{
std::ostringstream oss;
- Matrix3 matrix( 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f );
+ Matrix3 matrix(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f);
oss << matrix;
std::string expectedOutput = "[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
int UtcDaliMatrix3Multiply(void)
{
- Matrix3 m1( 0.0f, 3.0f, 6.0f,
- 12.0f, 15.0f, 18.0f,
- 24.0f, 27.0f, 30.0f);
+ Matrix3 m1(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f);
- Matrix3 m2( 0.0f, 1.0f, 0.0f,
- -1.0f, 0.0f, 0.0f,
- 0.0f, 0.0f, 1.0f);
+ Matrix3 m2(0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
- Matrix3 m3( -3.0f, 0.0f, 6.0f,
- -15.0f, 12.0f, 18.0f,
- -27.0f, 24.0f, 30.0f);
+ Matrix3 m3(-3.0f, 0.0f, 6.0f, -15.0f, 12.0f, 18.0f, -27.0f, 24.0f, 30.0f);
Matrix3 result;
Matrix3::Multiply(result, m1, m2);
int UtcDaliMatrix3EqualityOperator(void)
{
- Matrix3 m1( 0.0f, 3.0f, 6.0f,
- 12.0f, 15.0f, 18.0f,
- 24.0f, 27.0f, 30.0f);
+ Matrix3 m1(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f);
- Matrix3 m2( 0.0f, 3.0f, 6.0f,
- 12.0f, 15.0f, 18.0f,
- 24.0f, 27.0f, 30.0f);
+ Matrix3 m2(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f);
DALI_TEST_CHECK(m1 == m2);
END_TEST;
int UtcDaliMatrix3InequalityOperator(void)
{
- Matrix3 m1( 1.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 1.0f);
+ Matrix3 m1(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f);
- Matrix3 m2( 0.0f, 3.0f, 6.0f,
- 12.0f, 15.0f, 18.0f,
- 24.0f, 27.0f, 30.0f);
+ Matrix3 m2(0.0f, 3.0f, 6.0f, 12.0f, 15.0f, 18.0f, 24.0f, 27.0f, 30.0f);
DALI_TEST_CHECK(m1 != m2);
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/mutex.h>
+#include <dali/devel-api/threading/thread.h>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
#include <unistd.h>
+
+#include <iostream>
#include <type_traits>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/threading/mutex.h>
-#include <dali/devel-api/threading/thread.h>
-#include <dali-test-suite-utils.h>
using Dali::Mutex;
using Dali::Thread;
{
Mutex mutex1;
- DALI_TEST_EQUALS( false, mutex1.IsLocked(), TEST_LOCATION );
+ DALI_TEST_EQUALS(false, mutex1.IsLocked(), TEST_LOCATION);
}
{
- Mutex mutex2;
- Mutex::ScopedLock lock( mutex2 );
- DALI_TEST_EQUALS( true, mutex2.IsLocked(), TEST_LOCATION );
+ Mutex mutex2;
+ Mutex::ScopedLock lock(mutex2);
+ DALI_TEST_EQUALS(true, mutex2.IsLocked(), TEST_LOCATION);
}
Mutex mutex3;
{
- Mutex::ScopedLock lock( mutex3 );
+ Mutex::ScopedLock lock(mutex3);
}
- DALI_TEST_EQUALS( false, mutex3.IsLocked(), TEST_LOCATION );
+ DALI_TEST_EQUALS(false, mutex3.IsLocked(), TEST_LOCATION);
END_TEST;
}
namespace // for local variables to avoid name clashes
{
// make all these volatile to pre-empt any optimization screwing up the logic
-volatile int gGlobalValue = 0;
-volatile bool gWorkerThreadWait = true;
-volatile enum ThreadState { INIT, RUN, LOCKING, TERMINATE } gWorkerThreadState = INIT;
+volatile int gGlobalValue = 0;
+volatile bool gWorkerThreadWait = true;
+volatile enum ThreadState { INIT,
+ RUN,
+ LOCKING,
+ TERMINATE } gWorkerThreadState = INIT;
Mutex* volatile gGlobalValueMutex; // volatile pointer to a mutex object
class TestThread : public Thread
{
gWorkerThreadState = RUN;
{
- Mutex::ScopedLock lock( *gGlobalValueMutex );
+ Mutex::ScopedLock lock(*gGlobalValueMutex);
gWorkerThreadState = LOCKING;
- gGlobalValue = -1;
- while( gWorkerThreadWait ) // wait till we can exit
+ gGlobalValue = -1;
+ while(gWorkerThreadWait) // wait till we can exit
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
}
gWorkerThreadState = TERMINATE;
}
};
-}
+} // namespace
int UtcDaliMutexMultiThread(void)
{
TestThread thread1;
// initialize values
- gGlobalValue = 0;
+ gGlobalValue = 0;
gWorkerThreadWait = true;
- DALI_TEST_EQUALS( INIT, gWorkerThreadState, TEST_LOCATION );
- DALI_TEST_EQUALS( 0, gGlobalValue, TEST_LOCATION );
- DALI_TEST_EQUALS( false, gGlobalValueMutex->IsLocked(), TEST_LOCATION );
+ DALI_TEST_EQUALS(INIT, gWorkerThreadState, TEST_LOCATION);
+ DALI_TEST_EQUALS(0, gGlobalValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, gGlobalValueMutex->IsLocked(), TEST_LOCATION);
// lock the mutex
{
- Mutex::ScopedLock lock( *gGlobalValueMutex );
- DALI_TEST_EQUALS( true, gGlobalValueMutex->IsLocked(), TEST_LOCATION );
+ Mutex::ScopedLock lock(*gGlobalValueMutex);
+ DALI_TEST_EQUALS(true, gGlobalValueMutex->IsLocked(), TEST_LOCATION);
thread1.Start();
// wait till the thread is in run state
- while( RUN != gWorkerThreadState )
+ while(RUN != gWorkerThreadState)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
// now the thread is running and mutex is still locked by this thread so value is not changed
- DALI_TEST_EQUALS( true, gGlobalValueMutex->IsLocked(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0, gGlobalValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, gGlobalValueMutex->IsLocked(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, gGlobalValue, TEST_LOCATION);
// drop out of scope, releases our lock
}
// now child thread is allowed to change the value
// wait till the thread is in locking state
- while( LOCKING != gWorkerThreadState )
+ while(LOCKING != gWorkerThreadState)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
// mutex is locked, but not by us, by the child thread
- DALI_TEST_EQUALS( true, gGlobalValueMutex->IsLocked(), TEST_LOCATION );
+ DALI_TEST_EQUALS(true, gGlobalValueMutex->IsLocked(), TEST_LOCATION);
// value is changed
- DALI_TEST_EQUALS( -1, gGlobalValue, TEST_LOCATION );
+ DALI_TEST_EQUALS(-1, gGlobalValue, TEST_LOCATION);
// let worker finish
gWorkerThreadWait = false;
// wait till the thread is terminated state
- while( TERMINATE != gWorkerThreadState )
+ while(TERMINATE != gWorkerThreadState)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
- DALI_TEST_EQUALS( false, gGlobalValueMutex->IsLocked(), TEST_LOCATION );
+ DALI_TEST_EQUALS(false, gGlobalValueMutex->IsLocked(), TEST_LOCATION);
thread1.Join();
END_TEST;
{
// we want to make sure that mutex is not copyable (its copy constructor is not defined)
// this test will stop compiling if Mutex has compiler generated copy constructor
- static_assert( !__has_trivial_copy( Mutex ), "Mutex should NOT be copyable" );
+ static_assert(!__has_trivial_copy(Mutex), "Mutex should NOT be copyable");
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
-
-
*
*/
-#include <iostream>
-
-#include <stdlib.h>
#include <dali-test-suite-utils.h>
#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
// Functors to test whether Object created/destroyed signal is emitted for different types of Objects
struct TestObjectDestroyedCallback
}
}
- bool& mSignalVerified;
+ bool& mSignalVerified;
Dali::RefObject*& mObjectPointer;
};
TestApplication application;
ObjectRegistry registry; // like this for ctor code coverage
- registry= application.GetCore().GetObjectRegistry();
+ registry = application.GetCore().GetObjectRegistry();
- DALI_TEST_CHECK( registry );
+ DALI_TEST_CHECK(registry);
END_TEST;
}
TestApplication application;
ObjectRegistry myRegistry;
- ObjectRegistry anotherRegistry( myRegistry );
+ ObjectRegistry anotherRegistry(myRegistry);
- DALI_TEST_EQUALS( myRegistry, anotherRegistry, TEST_LOCATION );
+ DALI_TEST_EQUALS(myRegistry, anotherRegistry, TEST_LOCATION);
END_TEST;
}
TestApplication application;
ObjectRegistry registry = application.GetCore().GetObjectRegistry();
- DALI_TEST_CHECK( registry );
- DALI_TEST_EQUALS( 2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(registry);
+ DALI_TEST_EQUALS(2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- ObjectRegistry move = std::move( registry );
- DALI_TEST_CHECK( move );
+ ObjectRegistry move = std::move(registry);
+ DALI_TEST_CHECK(move);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !registry );
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!registry);
END_TEST;
}
TestApplication application;
ObjectRegistry registry = application.GetCore().GetObjectRegistry();
- DALI_TEST_CHECK( registry );
- DALI_TEST_EQUALS( 2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(registry);
+ DALI_TEST_EQUALS(2, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
ObjectRegistry move;
- move = std::move( registry );
- DALI_TEST_CHECK( move );
+ move = std::move(registry);
+ DALI_TEST_CHECK(move);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !registry );
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!registry);
END_TEST;
}
{
tet_infoline("Testing GetObjectRegistry()");
TestApplication application;
- ObjectRegistry registry = application.GetCore().GetObjectRegistry();
- DALI_TEST_CHECK( registry );
+ ObjectRegistry registry = application.GetCore().GetObjectRegistry();
+ DALI_TEST_CHECK(registry);
- bool verified = false;
+ bool verified = false;
TestActorCallback test(verified);
- Dali::RefObject* objectPointer = NULL;
+ Dali::RefObject* objectPointer = NULL;
TestObjectDestroyedCallback test2(verified, objectPointer);
registry.ObjectCreatedSignal().Connect(&application, test);
{
Actor actor = Actor::New();
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
- verified = false;
+ verified = false;
objectPointer = actor.GetObjectPtr();
}
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
END_TEST;
}
ObjectRegistry registry = application.GetCore().GetObjectRegistry();
- bool verified = false;
+ bool verified = false;
TestCameraActorCallback test(verified);
- Dali::RefObject* objectPointer = NULL;
+ Dali::RefObject* objectPointer = NULL;
TestObjectDestroyedCallback test2(verified, objectPointer);
registry.ObjectCreatedSignal().Connect(&application, test);
{
CameraActor actor = CameraActor::New();
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
- verified = false;
+ verified = false;
objectPointer = actor.GetObjectPtr();
}
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
END_TEST;
}
int UtcDaliObjectRegistrySignalLayerCreated(void)
{
TestApplication application;
- ObjectRegistry registry = application.GetCore().GetObjectRegistry();
+ ObjectRegistry registry = application.GetCore().GetObjectRegistry();
- bool verified = false;
+ bool verified = false;
TestLayerCallback test(verified);
- Dali::RefObject* objectPointer = NULL;
+ Dali::RefObject* objectPointer = NULL;
TestObjectDestroyedCallback test2(verified, objectPointer);
registry.ObjectCreatedSignal().Connect(&application, test);
{
Layer actor = Layer::New();
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
- verified = false;
+ verified = false;
objectPointer = actor.GetObjectPtr();
}
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
END_TEST;
}
int UtcDaliObjectRegistrySignalAnimationCreated(void)
{
TestApplication application;
- ObjectRegistry registry = application.GetCore().GetObjectRegistry();
+ ObjectRegistry registry = application.GetCore().GetObjectRegistry();
- bool verified = false;
+ bool verified = false;
TestAnimationCallback test(verified);
- Dali::RefObject* objectPointer = NULL;
+ Dali::RefObject* objectPointer = NULL;
TestObjectDestroyedCallback test2(verified, objectPointer);
registry.ObjectCreatedSignal().Connect(&application, test);
{
Animation animation = Animation::New(1.0f);
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
- verified = false;
+ verified = false;
objectPointer = animation.GetObjectPtr();
}
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
END_TEST;
}
int UtcDaliObjectRegistryObjectCreatedSignalNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::ObjectRegistry instance;
try
{
int UtcDaliObjectRegistryObjectDestroyedSignalNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::ObjectRegistry instance;
try
{
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/events/pan-gesture-devel.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
{
TestApplication application; // Reset all test adapter return codes
- PanGesture gesture = DevelPanGesture::New( GestureState::CLEAR );
+ PanGesture gesture = DevelPanGesture::New(GestureState::CLEAR);
DALI_TEST_EQUALS(GestureState::CLEAR, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION);
- PanGesture gesture2 = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture2 = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION);
- PanGesture gesture3 = DevelPanGesture::New( GestureState::CONTINUING );
+ PanGesture gesture3 = DevelPanGesture::New(GestureState::CONTINUING);
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture3.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture3.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, gesture3.GetType(), TEST_LOCATION);
- PanGesture gesture4 = DevelPanGesture::New( GestureState::FINISHED );
+ PanGesture gesture4 = DevelPanGesture::New(GestureState::FINISHED);
DALI_TEST_EQUALS(GestureState::FINISHED, gesture4.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture4.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, gesture4.GetType(), TEST_LOCATION);
// Test copy constructor
- DevelPanGesture::SetNumberOfTouches( gesture4, 3u );
+ DevelPanGesture::SetNumberOfTouches(gesture4, 3u);
PanGesture pan(gesture4);
DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION);
// Test move constructor
const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
- PanGesture gesture5( std::move( gesture ) );
+ PanGesture gesture5(std::move(gesture));
DALI_TEST_CHECK(!gesture);
DALI_TEST_EQUALS(GestureType::PAN, gesture5.GetType(), TEST_LOCATION);
DALI_TEST_EQUALS(gesture5.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
int UtcDaliPanGestureAssignmentP(void)
{
// Test Assignment operator
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION);
- PanGesture gesture2 = DevelPanGesture::New( GestureState::CONTINUING );
+ PanGesture gesture2 = DevelPanGesture::New(GestureState::CONTINUING);
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION);
- DevelPanGesture::SetNumberOfTouches( gesture2, 3u );
+ DevelPanGesture::SetNumberOfTouches(gesture2, 3u);
gesture = gesture2;
DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION);
int UtcDaliPanGestureGetSpeedP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
- DevelPanGesture::SetVelocity( gesture, Vector2( 3.0f, -4.0f ) );
+ DevelPanGesture::SetVelocity(gesture, Vector2(3.0f, -4.0f));
DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureGetDistanceP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(0.0f, gesture.GetDistance(), TEST_LOCATION);
- DevelPanGesture::SetDisplacement( gesture, Vector2( -30.0f, -40.0f ) );
+ DevelPanGesture::SetDisplacement(gesture, Vector2(-30.0f, -40.0f));
DALI_TEST_EQUALS(50.0f, gesture.GetDistance(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureGetScreenSpeedP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(0.0f, gesture.GetScreenSpeed(), TEST_LOCATION);
- DevelPanGesture::SetScreenVelocity( gesture, Vector2( 3.0f, -4.0f ) );
+ DevelPanGesture::SetScreenVelocity(gesture, Vector2(3.0f, -4.0f));
DALI_TEST_EQUALS(5.0f, gesture.GetScreenSpeed(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureGetScreenDistanceP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(0.0f, gesture.GetScreenDistance(), TEST_LOCATION);
- DevelPanGesture::SetScreenDisplacement( gesture, Vector2( -30.0f, -40.0f ) );
+ DevelPanGesture::SetScreenDisplacement(gesture, Vector2(-30.0f, -40.0f));
DALI_TEST_EQUALS(50.0f, gesture.GetScreenDistance(), TEST_LOCATION);
END_TEST;
GestureDetector detector = PanGestureDetector::New();
- Property::Index index = detector.RegisterProperty( "sceneProperty", 0 );
- DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
- detector.SetProperty( index, -99 );
+ Property::Index index = detector.RegisterProperty("sceneProperty", 0);
+ DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), 0, TEST_LOCATION);
+ detector.SetProperty(index, -99);
using Dali::Animation;
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( detector, index ), 99 );
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), -99, TEST_LOCATION );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(detector, index), 99);
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), -99, TEST_LOCATION);
// create another pan gesture
GestureDetector detector2 = PanGestureDetector::New();
- DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index ), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector2.GetProperty<int32_t>(index), 0, TEST_LOCATION);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( 500 /* 50% progress */);
- DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 0 /*half way*/, TEST_LOCATION );
+ application.Render(500 /* 50% progress */);
+ DALI_TEST_EQUALS(detector.GetCurrentProperty<int32_t>(index), 0 /*half way*/, TEST_LOCATION);
// register another pan gesture value
- Property::Index index2 = detector2.RegisterProperty( "sceneProperty2", 12 );
- DALI_TEST_EQUALS( index2, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index2 ), 12, TEST_LOCATION );
- DALI_TEST_EQUALS( detector2.GetCurrentProperty< int32_t >( index2 ), 12, TEST_LOCATION );
+ Property::Index index2 = detector2.RegisterProperty("sceneProperty2", 12);
+ DALI_TEST_EQUALS(index2, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector2.GetProperty<int32_t>(index2), 12, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector2.GetCurrentProperty<int32_t>(index2), 12, TEST_LOCATION);
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99 /*target*/, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), 99 /*target*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetCurrentProperty<int32_t>(index), 0, TEST_LOCATION);
- Animation animation2 = Animation::New( 1.0f );
- animation2.AnimateTo( Property( detector2, index2 ), -99 );
+ Animation animation2 = Animation::New(1.0f);
+ animation2.AnimateTo(Property(detector2, index2), -99);
// Start the animation
animation2.Play();
application.SendNotification();
- application.Render( 1000 /* 100% more progress */);
+ application.Render(1000 /* 100% more progress */);
- DALI_TEST_EQUALS( detector2.GetProperty< int32_t >( index2 ), -99, TEST_LOCATION );
- DALI_TEST_EQUALS( detector2.GetCurrentProperty< int32_t >( index2 ), -99, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector2.GetProperty<int32_t>(index2), -99, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector2.GetCurrentProperty<int32_t>(index2), -99, TEST_LOCATION);
- DALI_TEST_EQUALS( detector.GetProperty< int32_t >( index ), 99, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetCurrentProperty< int32_t >( index ), 99, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetProperty<int32_t>(index), 99, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetCurrentProperty<int32_t>(index), 99, TEST_LOCATION);
END_TEST;
}
int UtcDaliPanGestureSetGetTimeP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(0, gesture.GetTime(), TEST_LOCATION);
- DevelPanGesture::SetTime( gesture, 123123 );
+ DevelPanGesture::SetTime(gesture, 123123);
DALI_TEST_EQUALS(123123, gesture.GetTime(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetVelocityP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetVelocity(), TEST_LOCATION);
- DevelPanGesture::SetVelocity( gesture, Vector2(123.0f, 321.0f) );
+ DevelPanGesture::SetVelocity(gesture, Vector2(123.0f, 321.0f));
DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetVelocity(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetDisplacementP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetDisplacement(), TEST_LOCATION);
- DevelPanGesture::SetDisplacement( gesture, Vector2(123.0f, 321.0f) );
+ DevelPanGesture::SetDisplacement(gesture, Vector2(123.0f, 321.0f));
DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetDisplacement(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetPositionP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetPosition(), TEST_LOCATION);
- DevelPanGesture::SetPosition( gesture, Vector2(123.0f, 321.0f) );
+ DevelPanGesture::SetPosition(gesture, Vector2(123.0f, 321.0f));
DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetPosition(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetScreenVelocityP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenVelocity(), TEST_LOCATION);
- DevelPanGesture::SetScreenVelocity( gesture, Vector2(123.0f, 321.0f) );
+ DevelPanGesture::SetScreenVelocity(gesture, Vector2(123.0f, 321.0f));
DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenVelocity(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetScreenDisplacementP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenDisplacement(), TEST_LOCATION);
- DevelPanGesture::SetScreenDisplacement( gesture, Vector2(123.0f, 321.0f) );
+ DevelPanGesture::SetScreenDisplacement(gesture, Vector2(123.0f, 321.0f));
DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenDisplacement(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetScreenPositionP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenPosition(), TEST_LOCATION);
- DevelPanGesture::SetScreenPosition( gesture, Vector2(123.0f, 321.0f) );
+ DevelPanGesture::SetScreenPosition(gesture, Vector2(123.0f, 321.0f));
DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenPosition(), TEST_LOCATION);
END_TEST;
int UtcDaliPanGestureSetGetNumberOfTouchesP(void)
{
- PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ PanGesture gesture = DevelPanGesture::New(GestureState::STARTED);
DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
- DevelPanGesture::SetNumberOfTouches( gesture, 3123 );
+ DevelPanGesture::SetNumberOfTouches(gesture, 3123);
DALI_TEST_EQUALS(3123, gesture.GetNumberOfTouches(), TEST_LOCATION);
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <cmath>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/pan-gesture-devel.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/render-task-list-integ.h>
-#include <dali/integration-api/profiling.h>
#include <dali/integration-api/input-options.h>
-#include <dali-test-suite-utils.h>
+#include <dali/integration-api/profiling.h>
+#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <test-touch-event-utils.h>
-#include <dali/devel-api/events/pan-gesture-devel.h>
+
+#include <cmath>
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-const int PAN_EVENT_TIME_DELTA = 8;
+const int PAN_EVENT_TIME_DELTA = 8;
const int PAN_GESTURE_UPDATE_COUNT = 50;
// Stores data that is populated in the callback and will be read by the test cases
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pannedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
PanGesture receivedGesture;
- Actor pannedActor;
+ Actor pannedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const PanGesture& pan)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = pan;
- signalData.pannedActor = actor;
+ signalData.pannedActor = actor;
}
void operator()()
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
- : GestureReceivedFunctor( data ),
- stateToUnstage( stateToUnstage ),
- scene( scene )
+ UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene)
+ : GestureReceivedFunctor(data),
+ stateToUnstage(stateToUnstage),
+ scene(scene)
{
}
- void operator()( Actor actor, const PanGesture& pan )
+ void operator()(Actor actor, const PanGesture& pan)
{
- GestureReceivedFunctor::operator()( actor, pan );
+ GestureReceivedFunctor::operator()(actor, pan);
- if ( pan.GetState() == stateToUnstage )
+ if(pan.GetState() == stateToUnstage)
{
- scene.Remove( actor );
+ scene.Remove(actor);
}
}
- GestureState& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
struct ConstraintData
{
ConstraintData()
- : panning( false ),
- called( false )
+ : panning(false),
+ called(false)
{
}
Vector2 localPosition;
Vector2 localDisplacement;
Vector2 localVelocity;
- bool panning;
- bool called;
+ bool panning;
+ bool called;
void Reset()
{
screenPosition = screenDisplacement = screenVelocity = localPosition = localDisplacement = localVelocity = Vector2::ZERO;
- panning = false;
- called = false;
+ panning = false;
+ called = false;
}
};
// Constraint used with panning properties
struct PanConstraint
{
- PanConstraint( ConstraintData& data ) : constraintData(data) { }
+ PanConstraint(ConstraintData& data)
+ : constraintData(data)
+ {
+ }
- void operator()( Vector3& current, const PropertyInputContainer& inputs )
+ void operator()(Vector3& current, const PropertyInputContainer& inputs)
{
- constraintData.screenPosition = inputs[0]->GetVector2();
+ constraintData.screenPosition = inputs[0]->GetVector2();
constraintData.screenDisplacement = inputs[1]->GetVector2();
- constraintData.screenVelocity = inputs[2]->GetVector2();
- constraintData.localPosition = inputs[3]->GetVector2();
- constraintData.localDisplacement = inputs[4]->GetVector2();
- constraintData.localVelocity = inputs[5]->GetVector2();
- constraintData.panning = inputs[6]->GetBoolean();
- constraintData.called = true;
- current = Vector3::ZERO;
+ constraintData.screenVelocity = inputs[2]->GetVector2();
+ constraintData.localPosition = inputs[3]->GetVector2();
+ constraintData.localDisplacement = inputs[4]->GetVector2();
+ constraintData.localVelocity = inputs[5]->GetVector2();
+ constraintData.panning = inputs[6]->GetBoolean();
+ constraintData.called = true;
+ current = Vector3::ZERO;
}
ConstraintData& constraintData;
};
// Generate a PanGesture
-PanGesture GeneratePan( unsigned int time,
- GestureState state,
- Vector2 screenPosition,
- Vector2 localPosition,
- Vector2 screenDisplacement = Vector2::ONE,
- Vector2 localDisplacement = Vector2::ONE,
- Vector2 screenVelocity = Vector2::ONE,
- Vector2 localVelocity = Vector2::ONE,
- unsigned int numberOfTouches = 1 )
+PanGesture GeneratePan(unsigned int time,
+ GestureState state,
+ Vector2 screenPosition,
+ Vector2 localPosition,
+ Vector2 screenDisplacement = Vector2::ONE,
+ Vector2 localDisplacement = Vector2::ONE,
+ Vector2 screenVelocity = Vector2::ONE,
+ Vector2 localVelocity = Vector2::ONE,
+ unsigned int numberOfTouches = 1)
{
- Dali::PanGesture pan = DevelPanGesture::New( state );
+ Dali::PanGesture pan = DevelPanGesture::New(state);
- DevelPanGesture::SetTime( pan, time );
+ DevelPanGesture::SetTime(pan, time);
- DevelPanGesture::SetScreenPosition( pan, screenPosition );
- DevelPanGesture::SetPosition( pan, localPosition );
+ DevelPanGesture::SetScreenPosition(pan, screenPosition);
+ DevelPanGesture::SetPosition(pan, localPosition);
- DevelPanGesture::SetScreenDisplacement( pan, screenDisplacement );
- DevelPanGesture::SetDisplacement( pan, localDisplacement );
+ DevelPanGesture::SetScreenDisplacement(pan, screenDisplacement);
+ DevelPanGesture::SetDisplacement(pan, localDisplacement);
- DevelPanGesture::SetScreenVelocity( pan, screenVelocity );
- DevelPanGesture::SetVelocity( pan, localVelocity );
+ DevelPanGesture::SetScreenVelocity(pan, screenVelocity);
+ DevelPanGesture::SetVelocity(pan, localVelocity);
- DevelPanGesture::SetNumberOfTouches( pan, numberOfTouches );
+ DevelPanGesture::SetNumberOfTouches(pan, numberOfTouches);
return pan;
}
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
PanGestureDetector detector = PanGestureDetector::New();
- PanGestureDetector copy( detector );
- DALI_TEST_CHECK( detector );
+ PanGestureDetector copy(detector);
+ DALI_TEST_CHECK(detector);
END_TEST;
}
PanGestureDetector assign;
assign = detector;
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(detector);
- DALI_TEST_CHECK( detector == assign );
+ DALI_TEST_CHECK(detector == assign);
END_TEST;
}
// Attach an actor and emit a touch event on the actor to ensure complete line coverage
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
detector.Attach(actor);
application.GetScene().Add(actor);
application.Render();
// Use long press function for touch event
- TestStartLongPress( application );
+ TestStartLongPress(application);
END_TEST;
}
PanGestureDetector detector2 = PanGestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- PanGestureDetector detector3 = DownCast< PanGestureDetector >(object);
+ PanGestureDetector detector3 = DownCast<PanGestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
PanGestureDetector detector4 = PanGestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- PanGestureDetector detector5 = DownCast< PanGestureDetector >(unInitializedObject);
+ PanGestureDetector detector5 = DownCast<PanGestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
- GestureDetector detector6 = PanGestureDetector::New();
+ GestureDetector detector6 = PanGestureDetector::New();
PanGestureDetector detector7 = PanGestureDetector::DownCast(detector6);
DALI_TEST_CHECK(detector7);
END_TEST;
// Attach an actor and change the minimum touches
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.Attach(actor);
// Attach an actor and change the maximum touches
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.Attach(actor);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Do a pan outside actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2(110.0f, 110.0f), Vector2(121.0f, 121.0f), time );
+ TestStartPan(application, Vector2(110.0f, 110.0f), Vector2(121.0f, 121.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Continue pan into actor's area - we should still not receive the signal
data.Reset();
- TestMovePan( application, Vector2(20.0f, 20.0f), time );
+ TestMovePan(application, Vector2(20.0f, 20.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Stop panning - we should still not receive the signal
data.Reset();
- TestEndPan( application, Vector2(12.0f, 12.0f), time);
+ TestEndPan(application, Vector2(12.0f, 12.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start pan within the actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Pan Gesture leaves actor's area - we should still receive the signal
data.Reset();
- TestMovePan( application, Vector2(346.0f, 4.0f), time );
+ TestMovePan(application, Vector2(346.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Gesture ends - we would receive a finished state
data.Reset();
- TestEndPan( application, Vector2(314.0f, 4.0f), time );
+ TestEndPan(application, Vector2(314.0f, 4.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start pan within the actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Gesture ends within actor's area - we would receive a finished state
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start pan within the actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Ensure we are no longer signalled
data.Reset();
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start pan within the actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
application.SendNotification();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
{
TestApplication application;
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Attach a temporary actor to stop detector being removed from PanGestureProcessor when main actor
// is destroyed.
Actor tempActor = Actor::New();
- tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ tempActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ tempActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.GetScene().Add(tempActor);
detector.Attach(tempActor);
// Actor lifetime is scoped
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
// Start pan within the actor's area
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Gesture ends within the area where the actor used to be
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Do an entire pan, only check finished value
uint32_t time = 100;
- TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time );
+ TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time);
data.Reset();
- TestEndPan( application, Vector2(25.0f, 28.0f), time );
+ TestEndPan(application, Vector2(25.0f, 28.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Rotate actor again and render a couple of times
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do an entire pan, only check finished value
- TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time );
+ TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time);
data.Reset();
- TestEndPan( application, Vector2(25.0f, 28.0f), time );
+ TestEndPan(application, Vector2(25.0f, 28.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(2.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Rotate actor again and render a couple of times
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do an entire pan, only check finished value
- TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time );
+ TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time);
data.Reset();
- TestEndPan( application, Vector2(25.0f, 28.0f), time );
+ TestEndPan(application, Vector2(25.0f, 28.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(-16.0f, -2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
parent.Add(child);
-
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Do an entire pan, only check finished value - hits child area but parent should still receive it
uint32_t time = 100;
- TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time );
+ TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time);
data.Reset();
- TestEndPan( application, Vector2(25.0f, 28.0f), time );
+ TestEndPan(application, Vector2(25.0f, 28.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pannedActor, TEST_LOCATION);
detector.Detach(parent);
// Do an entire pan, only check finished value
- TestStartPan( application, Vector2( 11.0f, 12.0f ), Vector2( 27.0f, 12.0f ), time );
+ TestStartPan(application, Vector2(11.0f, 12.0f), Vector2(27.0f, 12.0f), time);
data.Reset();
- TestEndPan( application, Vector2(25.0f, 28.0f), time );
+ TestEndPan(application, Vector2(25.0f, 28.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pannedActor, TEST_LOCATION);
TestApplication application;
Actor first = Actor::New();
- first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- second.SetProperty( Actor::Property::POSITION_X, 100.0f);
- second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start pan within second actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2( 110.0f, 20.0f ), Vector2( 126.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(110.0f, 20.0f), Vector2(126.0f, 20.0f), time);
DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), first.GetParent(), TEST_LOCATION);
DALI_TEST_EQUALS(application.GetScene().GetRootLayer(), second.GetParent(), TEST_LOCATION);
// Pan moves into first actor's area - second actor should receive the pan
data.Reset();
- TestMovePan( application, Vector2(126.0f, 20.0f), time );
+ TestMovePan(application, Vector2(126.0f, 20.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestMovePan( application, Vector2(26.0f, 20.0f), time );
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start pan in actor's area
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Pan continues within actor's area
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Actor become invisible - actor should not receive the next pan
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// Render and notify
application.SendNotification();
// Gesture ends within actor's area
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.GetScene().Add(actor2);
// Render and notify
application.Render();
// Attach actor to one detector
- SignalData firstData;
+ SignalData firstData;
GestureReceivedFunctor firstFunctor(firstData);
- PanGestureDetector firstDetector = PanGestureDetector::New();
+ PanGestureDetector firstDetector = PanGestureDetector::New();
firstDetector.Attach(actor);
firstDetector.DetectedSignal().Connect(&application, firstFunctor);
// Attach actor to another detector
- SignalData secondData;
+ SignalData secondData;
GestureReceivedFunctor secondFunctor(secondData);
- PanGestureDetector secondDetector = PanGestureDetector::New();
+ PanGestureDetector secondDetector = PanGestureDetector::New();
secondDetector.Attach(actor);
secondDetector.DetectedSignal().Connect(&application, secondFunctor);
// Pan in actor's area - both detector's functors should be called
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
firstData.Reset();
secondData.Reset();
- TestMovePan( application, Vector2(10.0f, 20.0f), time );
+ TestMovePan(application, Vector2(10.0f, 20.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
firstData.Reset();
secondData.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
firstData.Reset();
secondData.Reset();
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
firstData.Reset();
secondData.Reset();
- TestMovePan( application, Vector2(10.0f, 20.0f), time );
+ TestMovePan(application, Vector2(10.0f, 20.0f), time);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION);
TestApplication application;
Actor actor1 = Actor::New();
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor1);
- SignalData data1;
+ SignalData data1;
GestureReceivedFunctor functor1(data1);
- PanGestureDetector detector1 = PanGestureDetector::New();
+ PanGestureDetector detector1 = PanGestureDetector::New();
detector1.Attach(actor1);
detector1.DetectedSignal().Connect(&application, functor1);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
- actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT);
application.GetScene().Add(actor2);
- SignalData data2;
+ SignalData data2;
GestureReceivedFunctor functor2(data2);
- PanGestureDetector detector2 = PanGestureDetector::New();
+ PanGestureDetector detector2 = PanGestureDetector::New();
detector2.Attach(actor2);
detector2.DetectedSignal().Connect(&application, functor2);
// Start pan in actor1's area, only data1 should be set
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data1.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
// Gesture possible in actor's area (using long-press)
uint32_t time = 100;
- TestStartLongPress( application, 10.0f, 20.0f, time );
+ TestStartLongPress(application, 10.0f, 20.0f, time);
time += TestGetFrameInterval();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- PanGestureDetector detector = PanGestureDetector::New();
- detector.DetectedSignal().Connect( &application, functor );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ PanGestureDetector detector = PanGestureDetector::New();
+ detector.DetectedSignal().Connect(&application, functor);
detector.Attach(actor);
// Start a pan, initially it'll only be possible, we shouldn't receive it
- TestMovePan( application, Vector2( 10.0f, 20.0f ), time );
+ TestMovePan(application, Vector2(10.0f, 20.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Now the pan truly starts, we should receive a signal
- TestMovePan( application, Vector2( 26.0f, 20.0f ), time );
+ TestMovePan(application, Vector2(26.0f, 20.0f), time);
time += TestGetFrameInterval();
- TestMovePan( application, Vector2( 32.0f, 32.0f ), time );
+ TestMovePan(application, Vector2(32.0f, 32.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Finish the pan, we should still receive a signal
data.Reset();
- TestEndPan( application, Vector2( 32.0f, 32.0f ), time );
+ TestEndPan(application, Vector2(32.0f, 32.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( parent );
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- parent.Add( child );
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ parent.Add(child);
// Create detector for parent and attach
- SignalData parentData;
- GestureReceivedFunctor parentFunctor( parentData );
- PanGestureDetector parentDetector = PanGestureDetector::New();
- parentDetector.DetectedSignal().Connect( &application, parentFunctor );
- parentDetector.Attach( parent );
+ SignalData parentData;
+ GestureReceivedFunctor parentFunctor(parentData);
+ PanGestureDetector parentDetector = PanGestureDetector::New();
+ parentDetector.DetectedSignal().Connect(&application, parentFunctor);
+ parentDetector.Attach(parent);
// Create detector for child but do not attach
- SignalData childData;
- GestureReceivedFunctor childFunctor( childData );
- PanGestureDetector childDetector = PanGestureDetector::New();
- childDetector.DetectedSignal().Connect( &application, childFunctor );
+ SignalData childData;
+ GestureReceivedFunctor childFunctor(childData);
+ PanGestureDetector childDetector = PanGestureDetector::New();
+ childDetector.DetectedSignal().Connect(&application, childFunctor);
// Render and notify
application.SendNotification();
// Do a full pan in both actors' area, only the parent's functor should be called
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- DALI_TEST_EQUALS( parentData.functorCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( childData.functorCalled, false, TEST_LOCATION );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ DALI_TEST_EQUALS(parentData.functorCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(childData.functorCalled, false, TEST_LOCATION);
parentData.Reset();
childData.Reset();
- TestEndPan( application, Vector2( 26.0f, 20.0f ), time );
- DALI_TEST_EQUALS( parentData.functorCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( childData.functorCalled, false, TEST_LOCATION );
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
+ DALI_TEST_EQUALS(parentData.functorCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(childData.functorCalled, false, TEST_LOCATION);
parentData.Reset();
childData.Reset();
// Gesture possible in both actors' area (using long-press), no functors called
- TestStartLongPress( application, 10.0f, 20.0f, time );
+ TestStartLongPress(application, 10.0f, 20.0f, time);
time += TestGetFrameInterval();
- DALI_TEST_EQUALS( parentData.functorCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( childData.functorCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(parentData.functorCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(childData.functorCalled, false, TEST_LOCATION);
// Attach the child as well now
- childDetector.Attach( child );
+ childDetector.Attach(child);
// Now the pan truly starts, we should receive a signal for the child only
- TestMovePan( application, Vector2( 26.0f, 20.0f ), time );
+ TestMovePan(application, Vector2(26.0f, 20.0f), time);
time += TestGetFrameInterval();
- TestMovePan( application, Vector2( 32.0f, 32.0f ), time );
+ TestMovePan(application, Vector2(32.0f, 32.0f), time);
time += TestGetFrameInterval();
- DALI_TEST_EQUALS( parentData.functorCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( childData.functorCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(parentData.functorCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(childData.functorCalled, true, TEST_LOCATION);
parentData.Reset();
childData.Reset();
// Finish the pan, again only the child should still receive a signal
- TestEndPan( application, Vector2( 32.0f, 32.0f ), time );
- DALI_TEST_EQUALS( parentData.functorCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( childData.functorCalled, true, TEST_LOCATION );
+ TestEndPan(application, Vector2(32.0f, 32.0f), time);
+ DALI_TEST_EQUALS(parentData.functorCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(childData.functorCalled, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- PanGestureDetector detector = PanGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Gesture possible in actor's area.
uint32_t time = 100;
- TestStartLongPress( application, 10.0f, 20.0f, time );
+ TestStartLongPress(application, 10.0f, 20.0f, time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor somewhere else
- actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
// Render and notify
application.SendNotification();
application.Render();
// Emit STARTED event, we should not receive the pan.
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestEndPan( application, Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// LONG_PRESS possible in empty area.
- TestStartLongPress( application, 10.0f, 20.0f, time );
+ TestStartLongPress(application, 10.0f, 20.0f, time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor in to the long press position.
- actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
// Render and notify
application.SendNotification();
application.Render();
// Emit STARTED event, we should be receiving the pan now.
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestEndPan( application, Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Normal pan in actor's area for completeness.
data.Reset();
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestEndPan( application, Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
- PanGestureDetector detector = PanGestureDetector::New();
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
+ PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit signals
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPan( application, Vector2(26.0f, 20.0f), time );
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
stateToUnstage = GestureState::CONTINUING;
// Emit signals
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
stateToUnstage = GestureState::FINISHED;
// Emit signals
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully.
+ tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully.
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Create and add a second actor so that GestureDetector destruction does not come into play.
- Actor dummyActor( Actor::New() );
- dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ Actor dummyActor(Actor::New());
+ dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(dummyActor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
- PanGestureDetector detector = PanGestureDetector::New();
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
+ PanGestureDetector detector = PanGestureDetector::New();
detector.Attach(actor);
detector.Attach(dummyActor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// Emit signals
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Here we delete an actor in started, we should not receive any subsequent signalling.
// Emit signals
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPan( application, Vector2(10.0f, 4.0f), time );
+ TestEndPan(application, Vector2(10.0f, 4.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION);
- detector.AddAngle( PanGestureDetector::DIRECTION_LEFT, Radian( Math::PI * 0.25 ) );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 1u, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_LEFT, Radian(Math::PI * 0.25));
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 1u, TEST_LOCATION);
bool found = false;
- for( size_t i = 0; i < detector.GetAngleCount(); i++)
+ for(size_t i = 0; i < detector.GetAngleCount(); i++)
{
- if( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT )
+ if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
found = true;
break;
}
}
- if(!found )
+ if(!found)
{
- tet_printf("%s, angle not added\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ tet_printf("%s, angle not added\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Radian( Math::PI * 0.25 ) );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Radian(Math::PI * 0.25));
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION);
// Remove something not in the container.
- detector.RemoveAngle( PanGestureDetector::DIRECTION_UP );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
+ detector.RemoveAngle(PanGestureDetector::DIRECTION_UP);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION);
- detector.RemoveAngle( PanGestureDetector::DIRECTION_RIGHT );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 1u, TEST_LOCATION );
- for ( size_t i = 0; i < detector.GetAngleCount(); i++)
+ detector.RemoveAngle(PanGestureDetector::DIRECTION_RIGHT);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 1u, TEST_LOCATION);
+ for(size_t i = 0; i < detector.GetAngleCount(); i++)
{
- if ( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT )
+ if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT)
{
- tet_printf("%s, angle not removed\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ tet_printf("%s, angle not removed\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
break;
}
}
detector.ClearAngles();
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION);
END_TEST;
}
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 0, TEST_LOCATION);
- detector.AddAngle( PanGestureDetector::DIRECTION_LEFT );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 1, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_LEFT);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 1, TEST_LOCATION);
- detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 2, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 2, TEST_LOCATION);
- detector.AddAngle( PanGestureDetector::DIRECTION_UP );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 3, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_UP);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 3, TEST_LOCATION);
- detector.AddAngle( PanGestureDetector::DIRECTION_DOWN );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 4, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_DOWN);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 4, TEST_LOCATION);
- DALI_TEST_EQUALS( detector.GetAngle(0).first, PanGestureDetector::DIRECTION_LEFT, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetAngle(1).first, PanGestureDetector::DIRECTION_RIGHT, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetAngle(2).first, PanGestureDetector::DIRECTION_UP, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetAngle(3).first, PanGestureDetector::DIRECTION_DOWN, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, PanGestureDetector::DIRECTION_LEFT, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetAngle(1).first, PanGestureDetector::DIRECTION_RIGHT, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetAngle(2).first, PanGestureDetector::DIRECTION_UP, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetAngle(3).first, PanGestureDetector::DIRECTION_DOWN, TEST_LOCATION);
END_TEST;
}
-inline float RadiansToDegrees( float radian )
+inline float RadiansToDegrees(float radian)
{
return radian * 180.0f / Math::PI;
}
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION);
//
// Angle
//
- detector.AddAngle( Degree(180.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-180.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(180.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-180.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( Degree(190.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-170.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(190.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-170.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( Degree(-190.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(170.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(-190.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(170.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( Degree(350.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(350.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-10.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( Degree(-350.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(-350.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(10.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( Degree(370.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(370.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(10.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( Degree(-370.0f) );
- DALI_TEST_EQUALS( detector.GetAngle(0).first, Radian( Degree(-10.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(Degree(-370.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).first, Radian(Degree(-10.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
//
// Threshold
//
- detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 0.0f ) );
- DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(0.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(0.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(0.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( -10.0f ) );
- DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(10.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(-10.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(10.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( -181.0f ) );
- DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(-181.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(180.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
- detector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 181.0f ) );
- DALI_TEST_EQUALS( detector.GetAngle(0).second, Radian( Degree(180.0f) ), 0.000001, TEST_LOCATION );
+ detector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(181.0f));
+ DALI_TEST_EQUALS(detector.GetAngle(0).second, Radian(Degree(180.0f)), 0.000001, TEST_LOCATION);
detector.ClearAngles();
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(child);
// Render and notify
// Parent detector only requires up pans
PanGestureDetector parentDetector = PanGestureDetector::New();
- parentDetector.Attach( parent );
- parentDetector.AddAngle( PanGestureDetector::DIRECTION_UP, Degree( 30.0f ) );
- SignalData parentData;
+ parentDetector.Attach(parent);
+ parentDetector.AddAngle(PanGestureDetector::DIRECTION_UP, Degree(30.0f));
+ SignalData parentData;
GestureReceivedFunctor parentFunctor(parentData);
parentDetector.DetectedSignal().Connect(&application, parentFunctor);
// Child detector only requires right pans
PanGestureDetector childDetector = PanGestureDetector::New();
- childDetector.Attach( child );
- childDetector.AddAngle( PanGestureDetector::DIRECTION_RIGHT, Degree( 30.0f ) );
- SignalData childData;
+ childDetector.Attach(child);
+ childDetector.AddAngle(PanGestureDetector::DIRECTION_RIGHT, Degree(30.0f));
+ SignalData childData;
GestureReceivedFunctor childFunctor(childData);
childDetector.DetectedSignal().Connect(&application, childFunctor);
// Generate an Up pan gesture, only parent should receive it.
uint32_t time = 100;
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 4.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 4.0f), time);
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 4.0f), time );
+ TestEndPan(application, Vector2(20.0f, 4.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a Right pan gesture, only child should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 36.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(36.0f, 20.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(4.0f, 20.0f), time );
+ TestEndPan(application, Vector2(4.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a Down pan gesture, no one should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 36.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 36.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 36.0f), time );
+ TestEndPan(application, Vector2(20.0f, 36.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a Left pan gesture, no one should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 4.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(4.0f, 20.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(4.0f, 20.0f), time );
+ TestEndPan(application, Vector2(4.0f, 20.0f), time);
parentData.Reset();
childData.Reset();
END_TEST;
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION);
- detector.AddDirection( PanGestureDetector::DIRECTION_LEFT, Radian( Math::PI * 0.25 ) );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
+ detector.AddDirection(PanGestureDetector::DIRECTION_LEFT, Radian(Math::PI * 0.25));
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION);
bool found = false;
- for ( size_t i = 0; detector.GetAngleCount(); i++)
+ for(size_t i = 0; detector.GetAngleCount(); i++)
{
- if ( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT )
+ if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_LEFT)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
found = true;
break;
}
-
}
- if (!found )
+ if(!found)
{
- tet_printf("%s, angle not added\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ tet_printf("%s, angle not added\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
found = false;
- for( size_t i = 0; i < detector.GetAngleCount(); i++)
+ for(size_t i = 0; i < detector.GetAngleCount(); i++)
{
- if( detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT )
+ if(detector.GetAngle(i).first == PanGestureDetector::DIRECTION_RIGHT)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
found = true;
break;
}
}
- if(!found )
+ if(!found)
{
- tet_printf("%s, angle not added\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ tet_printf("%s, angle not added\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
// Remove something not in the container.
- detector.RemoveDirection( PanGestureDetector::DIRECTION_UP );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 2u, TEST_LOCATION );
+ detector.RemoveDirection(PanGestureDetector::DIRECTION_UP);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 2u, TEST_LOCATION);
- detector.RemoveDirection( PanGestureDetector::DIRECTION_RIGHT );
- DALI_TEST_EQUALS( detector.GetAngleCount(), 0u, TEST_LOCATION );
+ detector.RemoveDirection(PanGestureDetector::DIRECTION_RIGHT);
+ DALI_TEST_EQUALS(detector.GetAngleCount(), 0u, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(child);
// Render and notify
// Parent detector only requires vertical panning
PanGestureDetector parentDetector = PanGestureDetector::New();
- parentDetector.Attach( parent );
- parentDetector.AddDirection( PanGestureDetector::DIRECTION_VERTICAL, Degree( 30.0f ) );
- SignalData parentData;
+ parentDetector.Attach(parent);
+ parentDetector.AddDirection(PanGestureDetector::DIRECTION_VERTICAL, Degree(30.0f));
+ SignalData parentData;
GestureReceivedFunctor parentFunctor(parentData);
parentDetector.DetectedSignal().Connect(&application, parentFunctor);
// Child detector only requires horizontal panning
PanGestureDetector childDetector = PanGestureDetector::New();
- childDetector.Attach( child );
- childDetector.AddDirection( PanGestureDetector::DIRECTION_HORIZONTAL, Degree( 30.0f ) );
- SignalData childData;
+ childDetector.Attach(child);
+ childDetector.AddDirection(PanGestureDetector::DIRECTION_HORIZONTAL, Degree(30.0f));
+ SignalData childData;
GestureReceivedFunctor childFunctor(childData);
childDetector.DetectedSignal().Connect(&application, childFunctor);
// Generate an Up pan gesture, only parent should receive it.
uint32_t time = 100;
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 4.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 4.0f), time);
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a Right pan gesture, only child should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 36.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(36.0f, 20.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a Down pan gesture, only parent should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 20.0f, 36.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(20.0f, 36.0f), time);
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a Left pan gesture, only child should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 4.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(4.0f, 20.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a pan at -45 degrees, no one should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 9.0f, 31.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(9.0f, 31.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a pan at 45 degrees, no one should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 31.0f, 31.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(31.0f, 31.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
time += TestGetFrameInterval();
parentData.Reset();
childData.Reset();
// Generate a pan at -135 degrees, no one should receive it.
- TestStartPan( application, Vector2( 20.0f, 20.0f ), Vector2( 4.0f, 4.0f ), time );
+ TestStartPan(application, Vector2(20.0f, 20.0f), Vector2(4.0f, 4.0f), time);
- DALI_TEST_EQUALS( false, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, childData.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, childData.functorCalled, TEST_LOCATION);
- TestEndPan( application, Vector2(20.0f, 20.0f), time );
+ TestEndPan(application, Vector2(20.0f, 20.0f), time);
parentData.Reset();
childData.Reset();
END_TEST;
Integration::SetPanGestureSmoothingMode(0);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 1.0f, 1.0f );
- Vector2 position( -14.0f, 1.0f );
- Vector2 direction(Vector2::XAXIS * -5.0f);
+ Vector2 startPosition(1.0f, 1.0f);
+ Vector2 position(-14.0f, 1.0f);
+ Vector2 direction(Vector2::XAXIS * -5.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 47; i++ )
+ for(int i = 0; i < 47; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, startPosition + (direction * PAN_GESTURE_UPDATE_COUNT), 0.1f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
Integration::SetPanGestureSmoothingMode(1);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 1.0f, 1.0f );
- Vector2 position( -14.0f, 1.0f );
- Vector2 direction(Vector2::XAXIS * -5.0f);
+ Vector2 startPosition(1.0f, 1.0f);
+ Vector2 position(-14.0f, 1.0f);
+ Vector2 direction(Vector2::XAXIS * -5.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 47; i++ )
+ for(int i = 0; i < 47; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
// Take into account resampling done when prediction is off.
- DALI_TEST_EQUALS( constraintData.screenPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION );
+ DALI_TEST_EQUALS(constraintData.screenPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, startPosition + (direction * (PAN_GESTURE_UPDATE_COUNT - 0.25f)), 0.15f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
Integration::SetPanGestureSmoothingMode(0);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 1.0f, 1.0f );
- Vector2 position( -1.0f, 1.0f );
- Vector2 direction(Vector2::XAXIS * -1.0f);
+ Vector2 startPosition(1.0f, 1.0f);
+ Vector2 position(-1.0f, 1.0f);
+ Vector2 direction(Vector2::XAXIS * -1.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 47; i++ )
+ for(int i = 0; i < 47; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
Integration::SetPanGestureSmoothingMode(1);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 1.0f, 1.0f );
- Vector2 position( -1.0f, 1.0f );
- Vector2 direction(Vector2::XAXIS * -1.0f);
+ Vector2 startPosition(1.0f, 1.0f);
+ Vector2 position(-1.0f, 1.0f);
+ Vector2 direction(Vector2::XAXIS * -1.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 47; i++ )
+ for(int i = 0; i < 47; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, Vector2(1.0f, 1.0f) + (direction * PAN_GESTURE_UPDATE_COUNT), 10.0f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
int UtcDaliPanGesturePredictionSmoothing02(void)
{
TestApplication application;
- Integration::SetPanGesturePredictionMode( 1 );
- Integration::SetPanGestureMaximumPredictionAmount( 1 );
- Integration::SetPanGesturePredictionAmountAdjustment( 2 );
- Integration::SetPanGestureSmoothingMode( 1 );
- Integration::SetPanGestureSmoothingAmount( 0.25f );
+ Integration::SetPanGesturePredictionMode(1);
+ Integration::SetPanGestureMaximumPredictionAmount(1);
+ Integration::SetPanGesturePredictionAmountAdjustment(2);
+ Integration::SetPanGestureSmoothingMode(1);
+ Integration::SetPanGestureSmoothingAmount(0.25f);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 2.0f, 2.0f );
- Vector2 position( 4.0f, 2.0f );
- Vector2 directionX(Vector2::XAXIS);
- Vector2 directionY(Vector2::YAXIS);
+ Vector2 startPosition(2.0f, 2.0f);
+ Vector2 position(4.0f, 2.0f);
+ Vector2 directionX(Vector2::XAXIS);
+ Vector2 directionY(Vector2::YAXIS);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 7; i++ )
+ for(int i = 0; i < 7; i++)
{
position += directionX;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
position += directionX * 10.0f;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- for(int i = 0; i < 2; i++ )
+ for(int i = 0; i < 2; i++)
{
- position += ( directionX * -1.0f );
- TestMovePan( application, position, time );
+ position += (directionX * -1.0f);
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += directionX;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += directionY;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
{
TestApplication application;
- Integration::SetPanGesturePredictionMode( 2 );
- Integration::SetPanGesturePredictionAmount( 57 );
- Integration::SetPanGestureSmoothingMode( 2 );
- Integration::SetPanGestureUseActualTimes( false );
- Integration::SetPanGestureInterpolationTimeRange( 10 );
- Integration::SetPanGestureScalarOnlyPredictionEnabled( false );
- Integration::SetPanGestureTwoPointPredictionEnabled( true );
- Integration::SetPanGestureTwoPointInterpolatePastTime( 42 );
- Integration::SetPanGestureTwoPointVelocityBias( 0.35f );
- Integration::SetPanGestureTwoPointAccelerationBias( 0.10f );
- Integration::SetPanGestureMultitapSmoothingRange( 34 );
+ Integration::SetPanGesturePredictionMode(2);
+ Integration::SetPanGesturePredictionAmount(57);
+ Integration::SetPanGestureSmoothingMode(2);
+ Integration::SetPanGestureUseActualTimes(false);
+ Integration::SetPanGestureInterpolationTimeRange(10);
+ Integration::SetPanGestureScalarOnlyPredictionEnabled(false);
+ Integration::SetPanGestureTwoPointPredictionEnabled(true);
+ Integration::SetPanGestureTwoPointInterpolatePastTime(42);
+ Integration::SetPanGestureTwoPointVelocityBias(0.35f);
+ Integration::SetPanGestureTwoPointAccelerationBias(0.10f);
+ Integration::SetPanGestureMultitapSmoothingRange(34);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 2.0f, 2.0f );
- Vector2 position( -1.0f, 2.0f );
- Vector2 direction(Vector2::XAXIS * -1.0f);
+ Vector2 startPosition(2.0f, 2.0f);
+ Vector2 position(-1.0f, 2.0f);
+ Vector2 direction(Vector2::XAXIS * -1.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 27; i++ )
+ for(int i = 0; i < 27; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
{
TestApplication application;
- Integration::SetPanGesturePredictionMode( 2 );
- Integration::SetPanGestureSmoothingMode( 2 );
- Integration::SetPanGestureUseActualTimes( true );
- Integration::SetPanGestureInterpolationTimeRange( 10 );
- Integration::SetPanGestureScalarOnlyPredictionEnabled( true );
- Integration::SetPanGestureTwoPointPredictionEnabled( true );
- Integration::SetPanGestureTwoPointInterpolatePastTime( 42 );
- Integration::SetPanGestureTwoPointVelocityBias( 0.35f );
- Integration::SetPanGestureTwoPointAccelerationBias( 0.10f );
- Integration::SetPanGestureMultitapSmoothingRange( 34 );
+ Integration::SetPanGesturePredictionMode(2);
+ Integration::SetPanGestureSmoothingMode(2);
+ Integration::SetPanGestureUseActualTimes(true);
+ Integration::SetPanGestureInterpolationTimeRange(10);
+ Integration::SetPanGestureScalarOnlyPredictionEnabled(true);
+ Integration::SetPanGestureTwoPointPredictionEnabled(true);
+ Integration::SetPanGestureTwoPointInterpolatePastTime(42);
+ Integration::SetPanGestureTwoPointVelocityBias(0.35f);
+ Integration::SetPanGestureTwoPointAccelerationBias(0.10f);
+ Integration::SetPanGestureMultitapSmoothingRange(34);
- Integration::EnableProfiling( Integration::PROFILING_TYPE_PAN_GESTURE );
+ Integration::EnableProfiling(Integration::PROFILING_TYPE_PAN_GESTURE);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 2.0f, 2.0f );
- Vector2 position( 17.0f, 2.0f );
- Vector2 direction(Vector2::XAXIS * -1.0f);
+ Vector2 startPosition(2.0f, 2.0f);
+ Vector2 position(17.0f, 2.0f);
+ Vector2 direction(Vector2::XAXIS * -1.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
{
TestApplication application;
- Integration::SetPanGesturePredictionMode( 2 );
- Integration::SetPanGesturePredictionAmount( 57 );
- Integration::SetPanGestureSmoothingMode( 1 );
- Integration::SetPanGestureUseActualTimes( false );
- Integration::SetPanGestureInterpolationTimeRange( 10 );
- Integration::SetPanGestureScalarOnlyPredictionEnabled( true );
- Integration::SetPanGestureTwoPointPredictionEnabled( true );
- Integration::SetPanGestureTwoPointInterpolatePastTime( 42 );
- Integration::SetPanGestureTwoPointVelocityBias( 0.35f );
- Integration::SetPanGestureTwoPointAccelerationBias( 0.10f );
- Integration::SetPanGestureMultitapSmoothingRange( 34 );
+ Integration::SetPanGesturePredictionMode(2);
+ Integration::SetPanGesturePredictionAmount(57);
+ Integration::SetPanGestureSmoothingMode(1);
+ Integration::SetPanGestureUseActualTimes(false);
+ Integration::SetPanGestureInterpolationTimeRange(10);
+ Integration::SetPanGestureScalarOnlyPredictionEnabled(true);
+ Integration::SetPanGestureTwoPointPredictionEnabled(true);
+ Integration::SetPanGestureTwoPointInterpolatePastTime(42);
+ Integration::SetPanGestureTwoPointVelocityBias(0.35f);
+ Integration::SetPanGestureTwoPointAccelerationBias(0.10f);
+ Integration::SetPanGestureMultitapSmoothingRange(34);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 startPosition( 2.0f, 2.0f );
- Vector2 position( 17.0f, 2.0f );
- Vector2 direction(Vector2::XAXIS * -1.0f);
+ Vector2 startPosition(2.0f, 2.0f);
+ Vector2 position(17.0f, 2.0f);
+ Vector2 direction(Vector2::XAXIS * -1.0f);
uint32_t time = 100;
- TestStartPan( application, startPosition, position, time );
+ TestStartPan(application, startPosition, position, time);
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
-
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- for(int i = 0; i < 5; i++ )
+ for(int i = 0; i < 5; i++)
{
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- for(int i = 0; i < 10; i++ )
+ for(int i = 0; i < 10; i++)
{
position += direction;
- TestMovePan( application, position, time );
+ TestMovePan(application, position, time);
time += TestGetFrameInterval();
application.SendNotification();
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
}
- TestEndPan( application, position, time );
+ TestEndPan(application, position, time);
application.Render(TestApplication::DEFAULT_RENDER_INTERVAL);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, Vector2(2.0f, 2.0f) + position, 10.0f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
int UtcDaliPanGestureSetProperties(void)
{
- TestApplication application;
- TestRenderController& renderController( application.GetRenderController() );
+ TestApplication application;
+ TestRenderController& renderController(application.GetRenderController());
Integration::SetPanGesturePredictionMode(0);
Integration::SetPanGestureSmoothingMode(0);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
- Property::Index animatableGestureProperty = detector.RegisterProperty( "Dummy Property", Vector3::ZERO ); // For code coverage
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
+ Property::Index animatableGestureProperty = detector.RegisterProperty("Dummy Property", Vector3::ZERO); // For code coverage
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
- constraint.AddSource( Source( detector, animatableGestureProperty ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
+ constraint.AddSource(Source(detector, animatableGestureProperty));
constraint.Apply();
// Render and notify
application.Render();
renderController.Initialize();
- DALI_TEST_EQUALS( renderController.WasCalled( TestRenderController::RequestUpdateFunc ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderController.WasCalled(TestRenderController::RequestUpdateFunc), false, TEST_LOCATION);
- Vector2 screenPosition( 20.0f, 20.0f );
- Vector2 screenDisplacement( 1.0f, 1.0f );
- Vector2 screenVelocity( 1.3f, 4.0f );
- Vector2 localPosition( 21.0f, 21.0f );
- Vector2 localDisplacement( 0.5f, 0.5f );
- Vector2 localVelocity( 1.5f, 2.5f );
+ Vector2 screenPosition(20.0f, 20.0f);
+ Vector2 screenDisplacement(1.0f, 1.0f);
+ Vector2 screenVelocity(1.3f, 4.0f);
+ Vector2 localPosition(21.0f, 21.0f);
+ Vector2 localDisplacement(0.5f, 0.5f);
+ Vector2 localVelocity(1.5f, 2.5f);
- PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity ) );
- DALI_TEST_EQUALS( renderController.WasCalled( TestRenderController::RequestUpdateFunc ), true, TEST_LOCATION );
+ PanGestureDetector::SetPanGestureProperties(GeneratePan(1u, GestureState::STARTED, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity));
+ DALI_TEST_EQUALS(renderController.WasCalled(TestRenderController::RequestUpdateFunc), true, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, screenPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, localPosition, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenDisplacement, screenDisplacement, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localDisplacement, localDisplacement, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenVelocity, screenVelocity, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localVelocity, localVelocity, TEST_LOCATION );
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, screenPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, localPosition, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenDisplacement, screenDisplacement, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localDisplacement, localDisplacement, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenVelocity, screenVelocity, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localVelocity, localVelocity, TEST_LOCATION);
constraintData.Reset();
END_TEST;
}
Integration::SetPanGesturePredictionMode(0);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
- Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
+ Property::Index property = actor.RegisterProperty("Dummy Property", Vector3::ZERO);
ConstraintData constraintData;
- Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
- constraint.AddSource( Source( detector, PanGestureDetector::Property::PANNING ) );
+ Constraint constraint = Constraint::New<Vector3>(actor, property, PanConstraint(constraintData));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::SCREEN_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_POSITION));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::LOCAL_VELOCITY));
+ constraint.AddSource(Source(detector, PanGestureDetector::Property::PANNING));
constraint.Apply();
// Render and notify
application.SendNotification();
application.Render();
- Vector2 currentPosition( 20.0f, 4.0f );
+ Vector2 currentPosition(20.0f, 4.0f);
uint32_t time = 100;
- TestStartPan( application, Vector2( 20.0f, 20.0f ), currentPosition, time );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ TestStartPan(application, Vector2(20.0f, 20.0f), currentPosition, time);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- Vector2 screenPosition( 100.0f, 20.0f );
- Vector2 localPosition( 110.0f, 110.0f );
+ Vector2 screenPosition(100.0f, 20.0f);
+ Vector2 localPosition(110.0f, 110.0f);
- PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition ) );
+ PanGestureDetector::SetPanGestureProperties(GeneratePan(1u, GestureState::STARTED, screenPosition, localPosition));
// Render and notify
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( constraintData.called, true, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.screenPosition, currentPosition, 0.1, TEST_LOCATION );
- DALI_TEST_EQUALS( constraintData.localPosition, currentPosition, 0.1f, TEST_LOCATION );
+ DALI_TEST_EQUALS(constraintData.called, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.screenPosition, currentPosition, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(constraintData.localPosition, currentPosition, 0.1f, TEST_LOCATION);
constraintData.Reset();
END_TEST;
}
int UtcDaliPanGesturePropertyIndices(void)
{
- TestApplication application;
+ TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
Property::IndexContainer indices;
- detector.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.Size() );
- DALI_TEST_EQUALS( indices.Size(), detector.GetPropertyCount(), TEST_LOCATION );
+ detector.GetPropertyIndices(indices);
+ DALI_TEST_CHECK(indices.Size());
+ DALI_TEST_EQUALS(indices.Size(), detector.GetPropertyCount(), TEST_LOCATION);
END_TEST;
}
{
struct PropertyStringIndex
{
- const char * const name;
+ const char* const name;
const Property::Index index;
- const Property::Type type;
+ const Property::Type type;
const Property::Value value;
};
const PropertyStringIndex PROPERTY_TABLE[] =
-{
- { "screenPosition", PanGestureDetector::Property::SCREEN_POSITION, Property::VECTOR2, Vector2::ZERO },
- { "screenDisplacement", PanGestureDetector::Property::SCREEN_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO },
- { "screenVelocity", PanGestureDetector::Property::SCREEN_VELOCITY, Property::VECTOR2, Vector2::ZERO },
- { "localPosition", PanGestureDetector::Property::LOCAL_POSITION, Property::VECTOR2, Vector2::ZERO },
- { "localDisplacement", PanGestureDetector::Property::LOCAL_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO },
- { "localVelocity", PanGestureDetector::Property::LOCAL_VELOCITY, Property::VECTOR2, Vector2::ZERO },
- { "panning", PanGestureDetector::Property::PANNING, Property::BOOLEAN, false },
+ {
+ {"screenPosition", PanGestureDetector::Property::SCREEN_POSITION, Property::VECTOR2, Vector2::ZERO},
+ {"screenDisplacement", PanGestureDetector::Property::SCREEN_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO},
+ {"screenVelocity", PanGestureDetector::Property::SCREEN_VELOCITY, Property::VECTOR2, Vector2::ZERO},
+ {"localPosition", PanGestureDetector::Property::LOCAL_POSITION, Property::VECTOR2, Vector2::ZERO},
+ {"localDisplacement", PanGestureDetector::Property::LOCAL_DISPLACEMENT, Property::VECTOR2, Vector2::ZERO},
+ {"localVelocity", PanGestureDetector::Property::LOCAL_VELOCITY, Property::VECTOR2, Vector2::ZERO},
+ {"panning", PanGestureDetector::Property::PANNING, Property::BOOLEAN, false},
};
-const unsigned int PROPERTY_TABLE_COUNT = sizeof( PROPERTY_TABLE ) / sizeof( PROPERTY_TABLE[0] );
+const unsigned int PROPERTY_TABLE_COUNT = sizeof(PROPERTY_TABLE) / sizeof(PROPERTY_TABLE[0]);
} // unnamed namespace
-
int UtcDaliPanGestureProperties(void)
{
- TestApplication application;
+ TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
{
- DALI_TEST_EQUALS( detector.GetPropertyName( PROPERTY_TABLE[ i ].index ), std::string( PROPERTY_TABLE[ i ].name ), TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetPropertyIndex( PROPERTY_TABLE[ i ].name ), PROPERTY_TABLE[ i ].index, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.GetPropertyType( PROPERTY_TABLE[ i ].index ), PROPERTY_TABLE[ i ].type, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.IsPropertyWritable( PROPERTY_TABLE[ i ].index ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.IsPropertyAnimatable( PROPERTY_TABLE[ i ].index ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( detector.IsPropertyAConstraintInput( PROPERTY_TABLE[ i ].index ), true, TEST_LOCATION );
- detector.SetProperty( PROPERTY_TABLE[ i ].index, Property::Value() ); // Just for Coverage
+ DALI_TEST_EQUALS(detector.GetPropertyName(PROPERTY_TABLE[i].index), std::string(PROPERTY_TABLE[i].name), TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetPropertyIndex(PROPERTY_TABLE[i].name), PROPERTY_TABLE[i].index, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.GetPropertyType(PROPERTY_TABLE[i].index), PROPERTY_TABLE[i].type, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.IsPropertyWritable(PROPERTY_TABLE[i].index), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.IsPropertyAnimatable(PROPERTY_TABLE[i].index), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(detector.IsPropertyAConstraintInput(PROPERTY_TABLE[i].index), true, TEST_LOCATION);
+ detector.SetProperty(PROPERTY_TABLE[i].index, Property::Value()); // Just for Coverage
}
END_TEST;
int UtcDaliPanGestureGetProperty(void)
{
- TestApplication application;
+ TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
- for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
{
- if( PROPERTY_TABLE[ i ].type == Property::VECTOR2 )
+ if(PROPERTY_TABLE[i].type == Property::VECTOR2)
{
- bool value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< bool >();
- DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< bool >(), value, TEST_LOCATION );
+ bool value = detector.GetProperty(PROPERTY_TABLE[i].index).Get<bool>();
+ DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get<bool>(), value, TEST_LOCATION);
}
- else if( PROPERTY_TABLE[ i ].type == Property::BOOLEAN )
+ else if(PROPERTY_TABLE[i].type == Property::BOOLEAN)
{
- Vector2 value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< Vector2 >();
- DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< Vector2 >(), value, TEST_LOCATION );
+ Vector2 value = detector.GetProperty(PROPERTY_TABLE[i].index).Get<Vector2>();
+ DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get<Vector2>(), value, TEST_LOCATION);
}
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
+ detector.Attach(actor);
// Render and notify
application.SendNotification();
application.Render();
- for( unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i )
+ for(unsigned int i = 0; i < PROPERTY_TABLE_COUNT; ++i)
{
- detector.SetProperty( PROPERTY_TABLE[ i ].index, Property::Value() ); // Just for Coverage
+ detector.SetProperty(PROPERTY_TABLE[i].index, Property::Value()); // Just for Coverage
- if( PROPERTY_TABLE[ i ].type == Property::VECTOR2 )
+ if(PROPERTY_TABLE[i].type == Property::VECTOR2)
{
- bool value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< bool >();
- DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< bool >(), value, TEST_LOCATION );
+ bool value = detector.GetProperty(PROPERTY_TABLE[i].index).Get<bool>();
+ DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get<bool>(), value, TEST_LOCATION);
}
- else if( PROPERTY_TABLE[ i ].type == Property::BOOLEAN )
+ else if(PROPERTY_TABLE[i].type == Property::BOOLEAN)
{
- Vector2 value = detector.GetProperty( PROPERTY_TABLE[ i ].index ).Get< Vector2 >();
- DALI_TEST_EQUALS( PROPERTY_TABLE[ i ].value.Get< Vector2 >(), value, TEST_LOCATION );
+ Vector2 value = detector.GetProperty(PROPERTY_TABLE[i].index).Get<Vector2>();
+ DALI_TEST_EQUALS(PROPERTY_TABLE[i].value.Get<Vector2>(), value, TEST_LOCATION);
}
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
// Add a layer to overlap the actor
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer );
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
layer.RaiseToTop();
// Render and notify
// Emit signals, should receive
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestEndPan( application, Vector2(26.0f, 20.0f), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestEndPan( application, Vector2(26.0f, 20.0f), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
PanGestureDetector detector = PanGestureDetector::New();
- detector.Attach( actor );
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
// Render and notify
application.SendNotification();
// As normal helper function adds intervals between presses we must generate the sequence
// using other helper functions
- TestStartLongPress( application, 10.0f, 20.0f, 100 ); // Used to send a down press event
- TestMovePan( application, Vector2(26.0f, 20.0f), 100 );
- TestMovePan( application, Vector2(26.0f, 20.0f), 100 ); // 2 motions required to trigger
- TestEndPan( application, Vector2(26.0f, 20.0f), 100 );
+ TestStartLongPress(application, 10.0f, 20.0f, 100); // Used to send a down press event
+ TestMovePan(application, Vector2(26.0f, 20.0f), 100);
+ TestMovePan(application, Vector2(26.0f, 20.0f), 100); // 2 motions required to trigger
+ TestEndPan(application, Vector2(26.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().x ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().y ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().x ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().y ) );
+ DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetVelocity().x));
+ DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetVelocity().y));
+ DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetScreenVelocity().x));
+ DALI_TEST_CHECK(!std::isinf(data.receivedGesture.GetScreenVelocity().y));
data.Reset();
data.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
- bool consume = false;
+ bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchedSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PanGestureDetector detector = PanGestureDetector::New();
// Start gesture within the actor's area, we should receive the pan as the touch is NOT being consumed
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
consume = true;
- TestMovePan( application, Vector2(26.0f, 4.0f), time );
+ TestMovePan(application, Vector2(26.0f, 4.0f), time);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a pan detector
- PanGestureDetector detector = PanGestureDetector::New();
- bool functorCalled = false;
- detector.Attach( actor );
+ PanGestureDetector detector = PanGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach(actor);
detector.DetectedSignal().Connect(
- &application,
- [&detector, &functorCalled](Actor actor, const PanGesture& pan)
+ &application,
+ [&detector, &functorCalled](Actor actor, const PanGesture& pan) {
+ if(pan.GetState() == GestureState::FINISHED)
{
- if( pan.GetState() == GestureState::FINISHED )
- {
- detector.Detach(actor);
- functorCalled = true;
- }
- });
+ detector.Detach(actor);
+ functorCalled = true;
+ }
+ });
// Render and notify
application.SendNotification();
try
{
uint32_t time = 100;
- TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
- TestEndPan( application, Vector2(26.0f, 20.0f) );
+ TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
+ TestEndPan(application, Vector2(26.0f, 20.0f));
- DALI_TEST_CHECK( true ); // No crash, test has passed
+ DALI_TEST_CHECK(true); // No crash, test has passed
DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
}
catch(...)
{
- DALI_TEST_CHECK( false ); // If we crash, the test has failed
+ DALI_TEST_CHECK(false); // If we crash, the test has failed
}
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/input-options.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/input-options.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pannedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
PanGesture receivedGesture;
- Actor pannedActor;
+ Actor pannedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const PanGesture& pan)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = pan;
- signalData.pannedActor = actor;
+ signalData.pannedActor = actor;
}
void operator()()
SignalData& signalData;
};
-
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( stateA );
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- point.SetState( stateB);
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(stateA);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ point.SetState(stateB);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
int UtcDaliPanGestureRecognizerBasicNoAction(void)
{
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 30.0f), 152));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 155 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 155));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 40.0f, 40.0f ), 153 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(40.0f, 40.0f), 153));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), 152 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::STATIONARY, Vector2( 20.0f, 50.0f ), 153 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), 154 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), 152));
+ application.ProcessEvent(GenerateSingleTouch(PointState::STATIONARY, Vector2(20.0f, 50.0f), 153));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), 154));
application.SendNotification();
detector.SetMinimumTouchesRequired(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152));
application.SendNotification();
detector.SetMinimumTouchesRequired(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
application.SendNotification();
detector.SetMinimumTouchesRequired(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::STATIONARY, Vector2( 50.0f, 50.0f ), 153 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
+ application.ProcessEvent(GenerateSingleTouch(PointState::STATIONARY, Vector2(50.0f, 50.0f), 153));
application.SendNotification();
detector.SetMinimumTouchesRequired(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 50.0f, 50.0f ), PointState::UP, Vector2( 50.0f, 40.0f ), 153 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(50.0f, 50.0f), PointState::UP, Vector2(50.0f, 40.0f), 153));
application.SendNotification();
detector.SetMinimumTouchesRequired(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 153 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 153));
application.SendNotification();
detector.SetMinimumTouchesRequired(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 60.0f, 50.0f ), PointState::MOTION, Vector2( 60.0f, 40.0f ), 153 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 70.0f, 50.0f ), PointState::MOTION, Vector2( 70.0f, 40.0f ), 154 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 70.0f, 50.0f ), 155 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(60.0f, 50.0f), PointState::MOTION, Vector2(60.0f, 40.0f), 153));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(70.0f, 50.0f), PointState::MOTION, Vector2(70.0f, 40.0f), 154));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(70.0f, 50.0f), 155));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 60.0f ), 153 ) ); // Exercise default case in STARTED case. Not sure if realistic
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 65.0f ), 154 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 60.0f), 153)); // Exercise default case in STARTED case. Not sure if realistic
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 65.0f), 154));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655));
application.SendNotification();
Integration::SetPanGestureMinimumPanEvents(8);
-
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655));
application.SendNotification();
PanGestureDetector detector = PanGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655));
application.SendNotification();
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
using namespace Dali::Internal;
namespace
{
// Knots fed into Allegro, which generates control points
-static void SetupPath( Dali::Path& path)
+static void SetupPath(Dali::Path& path)
{
- path.AddPoint(Vector3( 30.0, 80.0, 0.0));
- path.AddPoint(Vector3( 70.0, 120.0, 0.0));
+ path.AddPoint(Vector3(30.0, 80.0, 0.0));
+ path.AddPoint(Vector3(70.0, 120.0, 0.0));
path.AddPoint(Vector3(100.0, 100.0, 0.0));
//Control points for first segment
- path.AddControlPoint( Vector3( 39.0, 90.0, 0.0) );
- path.AddControlPoint(Vector3( 56.0, 119.0, 0.0) );
+ path.AddControlPoint(Vector3(39.0, 90.0, 0.0));
+ path.AddControlPoint(Vector3(56.0, 119.0, 0.0));
//Control points for second segment
- path.AddControlPoint(Vector3( 78.0, 120.0, 0.0) );
- path.AddControlPoint(Vector3( 93.0, 104.0, 0.0) );
+ path.AddControlPoint(Vector3(78.0, 120.0, 0.0));
+ path.AddControlPoint(Vector3(93.0, 104.0, 0.0));
}
} // anonymous namespace
TestApplication application;
Dali::Path path = Dali::Path::New();
- path.AddPoint(Vector3( 50.0, 50.0, 0.0));
- path.AddPoint(Vector3(120.0, 70.0, 0.0));
+ path.AddPoint(Vector3(50.0, 50.0, 0.0));
+ path.AddPoint(Vector3(120.0, 70.0, 0.0));
path.AddPoint(Vector3(190.0, 250.0, 0.0));
path.AddPoint(Vector3(260.0, 260.0, 0.0));
path.AddPoint(Vector3(330.0, 220.0, 0.0));
- path.AddPoint(Vector3(400.0, 50.0, 0.0));
+ path.AddPoint(Vector3(400.0, 50.0, 0.0));
- DALI_TEST_EQUALS(path.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION);
- DALI_TEST_EQUALS(path.GetPoint(1), Vector3(120.0, 70.0, 0.0), TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetPoint(1), Vector3(120.0, 70.0, 0.0), TEST_LOCATION);
DALI_TEST_EQUALS(path.GetPoint(2), Vector3(190.0, 250.0, 0.0), TEST_LOCATION);
DALI_TEST_EQUALS(path.GetPoint(3), Vector3(260.0, 260.0, 0.0), TEST_LOCATION);
DALI_TEST_EQUALS(path.GetPoint(4), Vector3(330.0, 220.0, 0.0), TEST_LOCATION);
- DALI_TEST_EQUALS(path.GetPoint(5), Vector3(400.0, 50.0, 0.0), TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetPoint(5), Vector3(400.0, 50.0, 0.0), TEST_LOCATION);
END_TEST;
}
TestApplication application;
Dali::Path path = Dali::Path::New();
- path.AddPoint(Vector3( 50.0, 50.0, 0.0f));
+ path.AddPoint(Vector3(50.0, 50.0, 0.0f));
try
{
path.GetPoint(1);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "index < mPoint.Size()", TEST_LOCATION);
}
END_TEST;
path.GetPoint(0);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "index < mPoint.Size()", TEST_LOCATION);
}
END_TEST;
TestApplication application;
Dali::Path path = Dali::Path::New();
- path.AddControlPoint( Vector3(0.0f, 0.0f, 0.0) );
- path.AddControlPoint( Vector3(108.0f, 57.0f, 0.0) );
+ path.AddControlPoint(Vector3(0.0f, 0.0f, 0.0));
+ path.AddControlPoint(Vector3(108.0f, 57.0f, 0.0));
DALI_TEST_EQUALS(path.GetControlPoint(0), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
DALI_TEST_EQUALS(path.GetControlPoint(1), Vector3(108.0f, 57.0f, 0.0f), TEST_LOCATION);
TestApplication application;
Dali::Path path = Dali::Path::New();
- path.AddControlPoint(Vector3(0.0f, 0.0f, 0.0) );
- path.AddControlPoint(Vector3(108.0f, 57.0f, 0.0) );
+ path.AddControlPoint(Vector3(0.0f, 0.0f, 0.0));
+ path.AddControlPoint(Vector3(108.0f, 57.0f, 0.0));
try
{
path.GetControlPoint(5);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "index < mControlPoint.Size()", TEST_LOCATION);
}
END_TEST;
path.GetControlPoint(0);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "index < mControlPoint.Size()", TEST_LOCATION);
}
END_TEST;
Dali::Path path = Dali::Path::New();
- path.AddPoint(Vector3( 50.0, 50.0, 0.0));
- path.AddPoint(Vector3(120.0, 70.0, 0.0));
+ path.AddPoint(Vector3(50.0, 50.0, 0.0));
+ path.AddPoint(Vector3(120.0, 70.0, 0.0));
path.AddPoint(Vector3(190.0, 250.0, 0.0));
path.AddPoint(Vector3(260.0, 260.0, 0.0));
path.AddPoint(Vector3(330.0, 220.0, 0.0));
- path.AddPoint(Vector3(400.0, 50.0, 0.0));
+ path.AddPoint(Vector3(400.0, 50.0, 0.0));
path.GenerateControlPoints(0.25);
- DALI_TEST_EQUALS(path.GetControlPoint(0), Vector3( 68.0, 55.0, 0.0), 1.0, TEST_LOCATION);
- DALI_TEST_EQUALS(path.GetControlPoint(1), Vector3(107.0, 58.0, 0.0), 1.0, TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetControlPoint(0), Vector3(68.0, 55.0, 0.0), 1.0, TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetControlPoint(1), Vector3(107.0, 58.0, 0.0), 1.0, TEST_LOCATION);
DALI_TEST_EQUALS(path.GetControlPoint(2), Vector3(156.0, 102.0, 0.0), 1.0, TEST_LOCATION);
DALI_TEST_EQUALS(path.GetControlPoint(3), Vector3(152.0, 220.0, 0.0), 1.0, TEST_LOCATION);
DALI_TEST_EQUALS(path.GetControlPoint(7), Vector3(317.0, 235.0, 0.0), 1.0, TEST_LOCATION);
DALI_TEST_EQUALS(path.GetControlPoint(8), Vector3(360.0, 185.0, 0.0), 1.0, TEST_LOCATION);
- DALI_TEST_EQUALS(path.GetControlPoint(9), Vector3(383.0, 93.0, 0.0), 1.0, TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetControlPoint(9), Vector3(383.0, 93.0, 0.0), 1.0, TEST_LOCATION);
END_TEST;
}
int utcDaliPathGetPointCount(void)
{
TestApplication application;
- Dali::Path path = Dali::Path::New();
+ Dali::Path path = Dali::Path::New();
DALI_TEST_EQUALS(path.GetPointCount(), 0u, TEST_LOCATION);
- path.AddPoint(Vector3( 50.0, 50.0, 0.0));
- path.AddPoint(Vector3(120.0, 70.0, 0.0));
+ path.AddPoint(Vector3(50.0, 50.0, 0.0));
+ path.AddPoint(Vector3(120.0, 70.0, 0.0));
path.AddPoint(Vector3(190.0, 250.0, 0.0));
path.AddPoint(Vector3(260.0, 260.0, 0.0));
DALI_TEST_EQUALS(path.GetPointCount(), 4u, TEST_LOCATION);
path.AddPoint(Vector3(330.0, 220.0, 0.0));
- path.AddPoint(Vector3(400.0, 50.0, 0.0));
+ path.AddPoint(Vector3(400.0, 50.0, 0.0));
DALI_TEST_EQUALS(path.GetPointCount(), 6u, TEST_LOCATION);
END_TEST;
path.GenerateControlPoints(0.25);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "numSegments > 0", TEST_LOCATION);
}
END_TEST;
TestApplication application;
Dali::Path path = Dali::Path::New();
- path.AddPoint(Vector3(400.0, 50.0, 0.0f));
+ path.AddPoint(Vector3(400.0, 50.0, 0.0f));
try
{
path.GenerateControlPoints(0.25);
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "numSegments > 0", TEST_LOCATION);
}
END_TEST;
int UtcDaliPathSample01(void)
{
TestApplication application;
- Dali::Path path = Dali::Path::New();
+ Dali::Path path = Dali::Path::New();
SetupPath(path);
//t = 0
Vector3 position, tangent;
- path.Sample(0.0f, position, tangent );
+ path.Sample(0.0f, position, tangent);
DALI_TEST_EQUALS(position.x, 30.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 80.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
//t = 0.25
- path.Sample(0.25f, position, tangent );
- DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION);
+ path.Sample(0.25f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 102.0f, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
// t = 0.5
- path.Sample(0.5f, position, tangent );
- DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION);
+ path.Sample(0.5f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 120.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION);
//t = 0.75
- path.Sample(0.75f, position, tangent );
- DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION);
+ path.Sample(0.75f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 112.0f, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION);
// t = 1
- path.Sample(1.0f, position, tangent );
+ path.Sample(1.0f, position, tangent);
DALI_TEST_EQUALS(position.x, 100.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 100.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Dali::Path path = Dali::Path::New();
- Handle handle = path;
+ Dali::Path path = Dali::Path::New();
+ Handle handle = path;
SetupPath(path);
Dali::Path path2 = Dali::Path::DownCast(handle);
//t = 0
Vector3 position, tangent;
- path2.Sample(0.0f, position, tangent );
+ path2.Sample(0.0f, position, tangent);
DALI_TEST_EQUALS(position.x, 30.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 80.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
//t = 0.25
- path2.Sample(0.25f, position, tangent );
- DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION);
+ path2.Sample(0.25f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 102.0f, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
// t = 0.5
- path2.Sample(0.5f, position, tangent );
- DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION);
+ path2.Sample(0.5f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 120.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION);
//t = 0.75
- path2.Sample(0.75f, position, tangent );
- DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION);
+ path2.Sample(0.75f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 112.0f, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION);
// t = 1
- path2.Sample(1.0f, position, tangent );
+ path2.Sample(1.0f, position, tangent);
DALI_TEST_EQUALS(position.x, 100.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 100.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION);
END_TEST;
}
//t = 0
Vector3 position, tangent;
- path2.Sample(0.0f, position, tangent );
+ path2.Sample(0.0f, position, tangent);
DALI_TEST_EQUALS(position.x, 30.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 80.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
//t = 0.25
- path2.Sample(0.25f, position, tangent );
- DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION);
+ path2.Sample(0.25f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 48.0f, 2.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 102.0f, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.7f, 0.1f, TEST_LOCATION);
// t = 0.5
- path2.Sample(0.5f, position, tangent );
- DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION);
+ path2.Sample(0.5f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 70.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 120.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(tangent.x, 1.0f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, 0.0f, 0.1f, TEST_LOCATION);
//t = 0.75
- path2.Sample(0.75f, position, tangent );
- DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION);
+ path2.Sample(0.75f, position, tangent);
+ DALI_TEST_EQUALS(position.x, 85.0f, 2.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 112.0f, 2.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.7f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, -0.6f, 0.1f, TEST_LOCATION);
// t = 1
- path2.Sample(1.0f, position, tangent );
+ path2.Sample(1.0f, position, tangent);
DALI_TEST_EQUALS(position.x, 100.0f, TEST_LOCATION);
DALI_TEST_EQUALS(position.y, 100.0f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION);
- DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.x, 0.8f, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(tangent.y, -0.4f, 0.1f, TEST_LOCATION);
END_TEST;
}
Dali::Path path = Dali::Path::New();
Dali::Property::Array points;
- points.Add( Vector3( 100.0f, 100.0f, 100.0f ) )
- .Add( Vector3( 200.0f, 200.0f, 200.0f ) )
- .Add( Vector3( 300.0f, 300.0f, 300.0f ) );
- path.SetProperty( Dali::Path::Property::POINTS, points );
+ points.Add(Vector3(100.0f, 100.0f, 100.0f))
+ .Add(Vector3(200.0f, 200.0f, 200.0f))
+ .Add(Vector3(300.0f, 300.0f, 300.0f));
+ path.SetProperty(Dali::Path::Property::POINTS, points);
{
- Property::Value value = path.GetProperty( Dali::Path::Property::POINTS );
+ Property::Value value = path.GetProperty(Dali::Path::Property::POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
{
- Property::Value value = path.GetCurrentProperty( Dali::Path::Property::POINTS );
+ Property::Value value = path.GetCurrentProperty(Dali::Path::Property::POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
Dali::Path path = Dali::Path::New();
Dali::Property::Array points;
- points.Add( Vector3( 0.1f, 0.1f, 0.1f ) )
- .Add( Vector3( 0.2f, 0.2f, 0.2f ) )
- .Add( Vector3( 0.3f, 0.3f, 0.3f ) );
- path.SetProperty( Dali::Path::Property::CONTROL_POINTS, points );
+ points.Add(Vector3(0.1f, 0.1f, 0.1f))
+ .Add(Vector3(0.2f, 0.2f, 0.2f))
+ .Add(Vector3(0.3f, 0.3f, 0.3f));
+ path.SetProperty(Dali::Path::Property::CONTROL_POINTS, points);
{
- Property::Value value = path.GetProperty( Dali::Path::Property::CONTROL_POINTS );
+ Property::Value value = path.GetProperty(Dali::Path::Property::CONTROL_POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
{
- Property::Value value = path.GetCurrentProperty( Dali::Path::Property::CONTROL_POINTS );
+ Property::Value value = path.GetCurrentProperty(Dali::Path::Property::CONTROL_POINTS);
Property::Array* array = value.GetArray();
- DALI_TEST_CHECK( array );
+ DALI_TEST_CHECK(array);
const unsigned int noOfPoints = points.Size();
- for( unsigned int i = 0; i < noOfPoints; ++i )
+ for(unsigned int i = 0; i < noOfPoints; ++i)
{
- DALI_TEST_EQUALS( ( *array )[i].Get< Vector3 >(), points[i].Get< Vector3 >(), TEST_LOCATION );
+ DALI_TEST_EQUALS((*array)[i].Get<Vector3>(), points[i].Get<Vector3>(), TEST_LOCATION);
}
}
Dali::Path path = Dali::Path::New();
- Property::Index index = path.RegisterProperty( "sceneProperty", 0.f );
- DALI_TEST_EQUALS( index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( path.GetProperty< float >( index ), 0.f, TEST_LOCATION );
+ Property::Index index = path.RegisterProperty("sceneProperty", 0.f);
+ DALI_TEST_EQUALS(index, (Property::Index)PROPERTY_CUSTOM_START_INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(path.GetProperty<float>(index), 0.f, TEST_LOCATION);
- path.SetProperty( index, -1 );
- DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION );
+ path.SetProperty(index, -1);
+ DALI_TEST_EQUALS(path.GetProperty<float>(index), -1.f, TEST_LOCATION);
using Dali::Animation;
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( path, index ), 100.f );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(path, index), 100.f);
- DALI_TEST_EQUALS( path.GetProperty< float >( index ), -1.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(path.GetProperty<float>(index), -1.f, TEST_LOCATION);
// Start the animation
animation.Play();
application.SendNotification();
- application.Render( 1000 /* 100% progress */);
- DALI_TEST_EQUALS( path.GetProperty< float >( index ), 100.0f, TEST_LOCATION );
+ application.Render(1000 /* 100% progress */);
+ DALI_TEST_EQUALS(path.GetProperty<float>(index), 100.0f, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Dali::Path path = Dali::Path::New();
- DALI_TEST_CHECK( path );
- DALI_TEST_EQUALS( 1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(path);
+ DALI_TEST_EQUALS(1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- path.AddPoint(Vector3( 50.0, 50.0, 0.0));
- DALI_TEST_EQUALS( path.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION );
+ path.AddPoint(Vector3(50.0, 50.0, 0.0));
+ DALI_TEST_EQUALS(path.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION);
- Dali::Path move = std::move( path );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION );
- DALI_TEST_CHECK( !path );
+ Dali::Path move = std::move(path);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION);
+ DALI_TEST_CHECK(!path);
END_TEST;
}
TestApplication application;
Dali::Path path = Dali::Path::New();
- DALI_TEST_CHECK( path );
- DALI_TEST_EQUALS( 1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(path);
+ DALI_TEST_EQUALS(1, path.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- path.AddPoint(Vector3( 50.0, 50.0, 0.0));
- DALI_TEST_EQUALS( path.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION );
+ path.AddPoint(Vector3(50.0, 50.0, 0.0));
+ DALI_TEST_EQUALS(path.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION);
Dali::Path move;
- move = std::move( path );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetPoint(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION );
- DALI_TEST_CHECK( !path );
+ move = std::move(path);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetPoint(0), Vector3(50.0, 50.0, 0.0), TEST_LOCATION);
+ DALI_TEST_CHECK(!path);
END_TEST;
}
int UtcDaliPathAddControlPointNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
Dali::Vector3 arg1;
int UtcDaliPathGetControlPointNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
unsigned long arg1(0u);
int UtcDaliPathGenerateControlPointsNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
float arg1(0.0f);
int UtcDaliPathAddPointNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
Dali::Vector3 arg1;
int UtcDaliPathGetPointNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
unsigned long arg1(0u);
int UtcDaliPathGetPointCountNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
instance.GetPointCount();
int UtcDaliPathSampleNegative(void)
{
TestApplication application;
- Dali::Path instance;
+ Dali::Path instance;
try
{
- float arg1(0.0f);
+ float arg1(0.0f);
Dali::Vector3 arg2;
Dali::Vector3 arg3;
- instance.Sample(arg1,arg2,arg3);
+ instance.Sample(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <test-touch-event-utils.h>
+#include <iostream>
+
using namespace Dali;
void utc_dali_pinch_gesture_detector_startup(void)
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pinchedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
PinchGesture receivedGesture;
- Actor pinchedActor;
+ Actor pinchedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const PinchGesture& pinch)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = pinch;
- signalData.pinchedActor = actor;
+ signalData.pinchedActor = actor;
}
void operator()()
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
- : GestureReceivedFunctor( data ),
- stateToUnstage( stateToUnstage ),
- scene( scene )
+ UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene)
+ : GestureReceivedFunctor(data),
+ stateToUnstage(stateToUnstage),
+ scene(scene)
{
}
- void operator()( Actor actor, const PinchGesture& pinch )
+ void operator()(Actor actor, const PinchGesture& pinch)
{
- GestureReceivedFunctor::operator()( actor, pinch );
+ GestureReceivedFunctor::operator()(actor, pinch);
- if ( pinch.GetState() == stateToUnstage )
+ if(pinch.GetState() == stateToUnstage)
{
- scene.Remove( actor );
+ scene.Remove(actor);
}
}
- GestureState& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
{
TestApplication application;
- PinchGestureDetector detector = PinchGestureDetector::New();;
+ PinchGestureDetector detector = PinchGestureDetector::New();
+ ;
- PinchGestureDetector copy( detector );
- DALI_TEST_CHECK( detector );
+ PinchGestureDetector copy(detector);
+ DALI_TEST_CHECK(detector);
END_TEST;
}
{
TestApplication application;
- PinchGestureDetector detector = PinchGestureDetector::New();;
+ PinchGestureDetector detector = PinchGestureDetector::New();
+ ;
PinchGestureDetector assign;
assign = detector;
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(detector);
- DALI_TEST_CHECK( detector == assign );
+ DALI_TEST_CHECK(detector == assign);
END_TEST;
}
// Attach an actor and emit a touch event on the actor to ensure complete line coverage
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
Integration::TouchEvent touchEvent(1);
- Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ Integration::Point point;
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point);
application.ProcessEvent(touchEvent);
Integration::Point point2;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point2);
application.ProcessEvent(touchEvent);
END_TEST;
PinchGestureDetector detector2 = PinchGestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- PinchGestureDetector detector3 = DownCast< PinchGestureDetector >(object);
+ PinchGestureDetector detector3 = DownCast<PinchGestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
PinchGestureDetector detector4 = PinchGestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- PinchGestureDetector detector5 = DownCast< PinchGestureDetector >(unInitializedObject);
+ PinchGestureDetector detector5 = DownCast<PinchGestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
- GestureDetector detector6 = PinchGestureDetector::New();
+ GestureDetector detector6 = PinchGestureDetector::New();
PinchGestureDetector detector7 = PinchGestureDetector::DownCast(detector6);
DALI_TEST_CHECK(detector7);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do a pinch outside actor's area
- TestStartPinch( application, Vector2( 112.0f, 62.0f ), Vector2( 112.0f, 162.0f ),
- Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), 100 );
+ TestStartPinch(application, Vector2(112.0f, 62.0f), Vector2(112.0f, 162.0f), Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Continue pinch into actor's area - we should still not receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ),
- Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
+ TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Stop pinching - we should still not receive the signal
data.Reset();
- TestEndPinch( application, Vector2( 6.0f, 6.0f ), Vector2( 18.0f, 18.0f ),
- Vector2( 10.0f, 8.0f ), Vector2( 14.0f, 16.0f ), 300 );
+ TestEndPinch(application, Vector2(6.0f, 6.0f), Vector2(18.0f, 18.0f), Vector2(10.0f, 8.0f), Vector2(14.0f, 16.0f), 300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start pan within the actor's area
- TestStartPinch( application, Vector2( 5.0f, 20.0f ), Vector2( 35.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(5.0f, 20.0f), Vector2(35.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), 400);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.2666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
// Pinch Gesture leaves actor's area - we should still receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 );
+ TestContinuePinch(application, Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(1.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
// Gesture ends - we would receive a finished state
data.Reset();
- TestEndPinch( application, Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ),
- Vector2( 305.0f, 10.0f ), Vector2( 315.0f, 10.0f ), 1500);
+ TestEndPinch(application, Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), Vector2(305.0f, 10.0f), Vector2(315.0f, 10.0f), 1500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start pinch within the actor's area
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.555f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.277f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
// Gesture ends within actor's area - we would receive a finished state
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start pinch within the actor's area
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
-
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
// Ensure we are no longer signalled
data.Reset();
- TestGeneratePinch( application );
+ TestGeneratePinch(application);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start pinch within the actor's area
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
// Attach a temporary actor to stop detector being removed from PinchGestureProcessor when main actor
// is destroyed.
Actor tempActor = Actor::New();
- tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ tempActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ tempActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.GetScene().Add(tempActor);
detector.Attach(tempActor);
// Actor lifetime is scoped
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
// Start pinch within the actor's area
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within the area where the actor used to be
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
application.GetScene().Add(actor);
// Render and notify a couple of times
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do an entire pinch, only check finished value
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(70.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do an entire pinch, only check finished value
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100);
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(30.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do an entire pinch, only check finished value
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 4100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 4100);
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 5000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 5000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
parent.Add(child);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do an entire pan, only check finished value - hits child area but parent should still receive it
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pinchedActor, TEST_LOCATION);
DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
detector.Detach(parent);
// Do an entire pan, only check finished value
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100);
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pinchedActor, TEST_LOCATION);
DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor first = Actor::New();
- first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- second.SetProperty( Actor::Property::POSITION_X, 100.0f);
- second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start pinch within second actor's area
- TestStartPinch( application, Vector2( 102.0f, 20.0f ), Vector2( 138.0f, 20.0f ),
- Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(102.0f, 20.0f), Vector2(138.0f, 20.0f), Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.pinchedActor, TEST_LOCATION);
// Pinch moves into first actor's area - second actor should receive the pinch
data.Reset();
- TestContinuePinch( application, Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.pinchedActor, TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 119.0f, 20.0f ), Vector2( 121.0f, 20.0f ), 3000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(119.0f, 20.0f), Vector2(121.0f, 20.0f), 3000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start pinch in actor's area
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Pan continues within actor's area
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Actor become invisible - actor should not receive the next pinch
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// Render and notify
application.SendNotification();
// Gesture ends within actor's area
data.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.GetScene().Add(actor2);
// Render and notify
application.Render();
// Attach actor to one detector
- SignalData firstData;
+ SignalData firstData;
GestureReceivedFunctor firstFunctor(firstData);
- PinchGestureDetector firstDetector = PinchGestureDetector::New();
+ PinchGestureDetector firstDetector = PinchGestureDetector::New();
firstDetector.Attach(actor);
firstDetector.DetectedSignal().Connect(&application, firstFunctor);
// Attach actor to another detector
- SignalData secondData;
+ SignalData secondData;
GestureReceivedFunctor secondFunctor(secondData);
- PinchGestureDetector secondDetector = PinchGestureDetector::New();
+ PinchGestureDetector secondDetector = PinchGestureDetector::New();
secondDetector.Attach(actor);
secondDetector.DetectedSignal().Connect(&application, secondFunctor);
secondDetector.Attach(actor2);
// Pinch in actor's area - both detector's functors should be called
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
// Pinch continues in actor's area - both detector's functors should be called
firstData.Reset();
secondData.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
firstDetector.Detach(actor);
firstData.Reset();
secondData.Reset();
- TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
// New pinch on actor, only secondDetector has actor attached
firstData.Reset();
secondData.Reset();
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
secondDetector.Detach(actor);
firstData.Reset();
secondData.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor1 = Actor::New();
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor1);
- SignalData data1;
+ SignalData data1;
GestureReceivedFunctor functor1(data1);
- PinchGestureDetector detector1 = PinchGestureDetector::New();
+ PinchGestureDetector detector1 = PinchGestureDetector::New();
detector1.Attach(actor1);
detector1.DetectedSignal().Connect(&application, functor1);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
- actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT);
application.GetScene().Add(actor2);
- SignalData data2;
+ SignalData data2;
GestureReceivedFunctor functor2(data2);
- PinchGestureDetector detector2 = PinchGestureDetector::New();
+ PinchGestureDetector detector2 = PinchGestureDetector::New();
detector2.Attach(actor2);
detector2.DetectedSignal().Connect(&application, functor2);
application.Render();
// Start pan in actor1's area, only data1 should be set
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data1.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
PinchGestureDetector detector = PinchGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit signals
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
stateToUnstage = GestureState::CONTINUING;
// Emit signals
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
stateToUnstage = GestureState::FINISHED;
// Emit signals
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully.
+ tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully.
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Create and add a second actor so that GestureDetector destruction does not come into play.
- Actor dummyActor( Actor::New() );
- dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ Actor dummyActor(Actor::New());
+ dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(dummyActor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
PinchGestureDetector detector = PinchGestureDetector::New();
detector.Attach(actor);
detector.Attach(dummyActor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
// Emit signals
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Here we delete an actor in started, we should not receive any subsequent signalling.
// Emit signals
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 );
+ TestContinuePinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
- PinchGestureDetector detector = PinchGestureDetector::New();
+ PinchGestureDetector detector = PinchGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Add a layer to overlap the actor
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer );
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
layer.RaiseToTop();
// Render and notify
application.Render();
// Emit signals, should receive
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 );
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 2000);
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 2000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
- bool consume = false;
+ bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchedSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
PinchGestureDetector detector = PinchGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start gesture within the actor's area, we should receive the pinch as the touch is NOT being consumed
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
consume = true;
- TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ),
- Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
+ TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Start another pinch, we should not even get the callback this time
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPinchGestureDisableDetectionDuringPinchN(void)
{
// Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- PinchGestureDetector detector = PinchGestureDetector::New();
- bool functorCalled = false;
- detector.Attach( actor );
+ PinchGestureDetector detector = PinchGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach(actor);
detector.DetectedSignal().Connect(
- &application,
- [&detector, &functorCalled](Actor actor, const PinchGesture& gesture)
+ &application,
+ [&detector, &functorCalled](Actor actor, const PinchGesture& gesture) {
+ if(gesture.GetState() == GestureState::FINISHED)
{
- if( gesture.GetState() == GestureState::FINISHED )
- {
- detector.Detach(actor);
- functorCalled = true;
- }
- });
+ detector.Detach(actor);
+ functorCalled = true;
+ }
+ });
// Render and notify
application.SendNotification();
// Try the gesture, should not crash
try
{
- TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
- TestContinuePinch( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ),
- Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
- TestEndPinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
-
- DALI_TEST_CHECK( true ); // No crash, test has passed
+ TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
+ TestContinuePinch(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200);
+ TestEndPinch(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
+
+ DALI_TEST_CHECK(true); // No crash, test has passed
DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
}
catch(...)
{
- DALI_TEST_CHECK( false ); // If we crash, the test has failed
+ DALI_TEST_CHECK(false); // If we crash, the test has failed
}
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/input-options.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/input-options.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pinchedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
PinchGesture receivedGesture;
- Actor pinchedActor;
+ Actor pinchedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const PinchGesture& pinch)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = pinch;
- signalData.pinchedActor = actor;
+ signalData.pinchedActor = actor;
}
void operator()()
SignalData& signalData;
};
-
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( stateA );
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- point.SetState( stateB);
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(stateA);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ point.SetState(stateB);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
int UtcDaliPinchGestureRecognizerBasicNoAction(void)
{
TestApplication application;
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 29.0f ), 165 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 29.0f), 165));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::UP, Vector2( 20.0f, 74.0f ), 173 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::DOWN, Vector2( 20.0f, 74.0f ), 178 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::UP, Vector2(20.0f, 74.0f), 173));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::DOWN, Vector2(20.0f, 74.0f), 178));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 56.0f ), PointState::UP, Vector2( 20.0f, 60.0f ), 150 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 56.0f), PointState::UP, Vector2(20.0f, 60.0f), 150));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 77.0f ), 127 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 47.0f ), PointState::MOTION, Vector2( 20.0f, 73.0f ), 133 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 47.0f ), PointState::MOTION, Vector2( 20.0f, 67.0f ), 137 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 53.0f ), PointState::MOTION, Vector2( 20.0f, 63.0f ), 143 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
-
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 77.0f), 127));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 47.0f), PointState::MOTION, Vector2(20.0f, 73.0f), 133));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 47.0f), PointState::MOTION, Vector2(20.0f, 67.0f), 137));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 53.0f), PointState::MOTION, Vector2(20.0f, 63.0f), 143));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145));
+
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155));
application.SendNotification();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor2.SetProperty( Actor::Property::POSITION_X, 100.0f);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor2.SetProperty(Actor::Property::POSITION_X, 100.0f);
application.GetScene().Add(actor2);
// Render and notify
PinchGestureDetector detector2 = PinchGestureDetector::New();
detector2.Attach(actor2);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- SignalData data2;
+ SignalData data2;
GestureReceivedFunctor functor2(data2);
detector2.DetectedSignal().Connect(&application, functor2);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), PointState::DOWN, Vector2( 120.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 28.0f ), PointState::MOTION, Vector2( 120.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 37.0f ), PointState::MOTION, Vector2( 120.0f, 74.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 46.0f ), PointState::MOTION, Vector2( 120.0f, 66.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 55.0f ), PointState::MOTION, Vector2( 120.0f, 58.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 120.0f, 55.0f ), PointState::UP, Vector2( 120.0f, 58.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(120.0f, 20.0f), PointState::DOWN, Vector2(120.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 28.0f), PointState::MOTION, Vector2(120.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 37.0f), PointState::MOTION, Vector2(120.0f, 74.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 46.0f), PointState::MOTION, Vector2(120.0f, 66.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(120.0f, 55.0f), PointState::MOTION, Vector2(120.0f, 58.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(120.0f, 55.0f), PointState::UP, Vector2(120.0f, 58.0f), 200));
application.SendNotification();
DALI_TEST_EQUALS(true, actor2 == data2.pinchedActor, TEST_LOCATION);
data2.Reset();
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 250 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 260 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 270 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 280 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 290 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 250));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 260));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 37.0f), PointState::MOTION, Vector2(20.0f, 74.0f), 270));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 46.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 280));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 58.0f), 290));
application.SendNotification();
END_TEST;
}
-
int UtcDaliPinchGestureRecognizerShortDistance01(void)
{
TestApplication application;
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 32.0f ), PointState::MOTION, Vector2( 20.0f, 78.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 34.0f ), PointState::MOTION, Vector2( 20.0f, 76.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 32.0f), PointState::MOTION, Vector2(20.0f, 78.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 34.0f), PointState::MOTION, Vector2(20.0f, 76.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
Integration::SetPinchGestureMinimumDistance(7.0f);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 32.0f ), PointState::MOTION, Vector2( 20.0f, 78.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 34.0f ), PointState::MOTION, Vector2( 20.0f, 76.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 28.0f), PointState::MOTION, Vector2(20.0f, 82.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 32.0f), PointState::MOTION, Vector2(20.0f, 78.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 34.0f), PointState::MOTION, Vector2(20.0f, 76.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 22.0f ), PointState::MOTION, Vector2( 20.0f, 88.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 24.0f ), PointState::MOTION, Vector2( 20.0f, 86.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 26.0f ), PointState::MOTION, Vector2( 20.0f, 84.0f ), 180 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 22.0f), PointState::MOTION, Vector2(20.0f, 88.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 24.0f), PointState::MOTION, Vector2(20.0f, 86.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 26.0f), PointState::MOTION, Vector2(20.0f, 84.0f), 180));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 38.0f ), PointState::MOTION, Vector2( 20.0f, 72.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 42.0f ), PointState::MOTION, Vector2( 20.0f, 68.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 44.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 38.0f), PointState::MOTION, Vector2(20.0f, 72.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 42.0f), PointState::MOTION, Vector2(20.0f, 68.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 44.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
Integration::SetPinchGestureMinimumDistance(14.0f);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 22.0f ), PointState::MOTION, Vector2( 20.0f, 88.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 24.0f ), PointState::MOTION, Vector2( 20.0f, 86.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 26.0f ), PointState::MOTION, Vector2( 20.0f, 84.0f ), 180 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 22.0f), PointState::MOTION, Vector2(20.0f, 88.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 24.0f), PointState::MOTION, Vector2(20.0f, 86.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 26.0f), PointState::MOTION, Vector2(20.0f, 84.0f), 180));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
Integration::SetPinchGestureMinimumDistance(14.0f);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 38.0f ), PointState::MOTION, Vector2( 20.0f, 72.0f ), 160 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 42.0f ), PointState::MOTION, Vector2( 20.0f, 68.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 44.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 190 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 38.0f), PointState::MOTION, Vector2(20.0f, 72.0f), 160));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 42.0f), PointState::MOTION, Vector2(20.0f, 68.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 44.0f), PointState::MOTION, Vector2(20.0f, 66.0f), 190));
application.SendNotification();
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- detector.Attach( actor );
+ detector.Attach(actor);
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
// Case 1
// 2 touch events make a gesture begin
- Integration::SetPinchGestureMinimumTouchEvents( 2 );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
+ Integration::SetPinchGestureMinimumTouchEvents(2);
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160));
- DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Case 2
// 4 touch events make a gesture begin
- Integration::SetPinchGestureMinimumTouchEvents( 4 );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
+ Integration::SetPinchGestureMinimumTouchEvents(4);
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160));
// Check the gesture is not detected unlike previous case
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
PinchGestureDetector detector = PinchGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- detector.Attach( actor );
+ detector.Attach(actor);
- SignalData data;
- GestureReceivedFunctor functor( data );
- detector.DetectedSignal().Connect( &application, functor );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
// Case 1
// > 2 touch events make a gesture begin
Integration::SetPinchGestureMinimumTouchEvents(2);
Integration::SetPinchGestureMinimumTouchEventsAfterStart(6);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160));
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 200));
// > Test : not enough touch events to make the gesture state "CONTINUING"
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 210 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 220 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 210));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 220));
// > Test : 6 touch events after start make the gesture state "CONTINUING"
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-#include <algorithm>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <algorithm>
+#include <iostream>
using std::max;
using namespace Dali;
-
static const float ROTATION_EPSILON = 0.0001f;
void utc_dali_pixel_startup(void)
static void TestPixelEnumSize(const int size)
{
- DALI_TEST_CHECK( (static_cast<int>( Pixel::LAST_VALID_PIXEL_FORMAT ) - static_cast<int>( Pixel::FIRST_VALID_PIXEL_FORMAT ) + 1 ) == size &&
- "The Pixel::Format enum may have had new formats added. Expand the test cases to include them.");
+ DALI_TEST_CHECK((static_cast<int>(Pixel::LAST_VALID_PIXEL_FORMAT) - static_cast<int>(Pixel::FIRST_VALID_PIXEL_FORMAT) + 1) == size &&
+ "The Pixel::Format enum may have had new formats added. Expand the test cases to include them.");
}
int UtcDaliPixelHasAlpha(void)
tet_infoline("UtcDaliPixelHasAlpha");
- TestPixelEnumSize( 59 );
-
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::INVALID ) == false ); // For completeness
-
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::L8 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB565 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB888 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB8888 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGR8888 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGR565 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_R11_EAC ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SIGNED_R11_EAC ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RG11_EAC ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SIGNED_RG11_EAC ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB8_ETC2 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ETC2 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB8_ETC1 ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 ) == false );
-
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::A8 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::LA88 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGBA5551 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGBA4444 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGBA8888 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGRA8888 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGRA5551 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::BGRA4444 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA8_ETC2_EAC ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC ) == true );
-
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR ) == true );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR ) == true );
-
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB16F ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::RGB32F ) == false );
-
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_UNSIGNED_INT ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_FLOAT ) == false );
- DALI_TEST_CHECK( Pixel::HasAlpha( Pixel::DEPTH_STENCIL ) == false );
+ TestPixelEnumSize(59);
+
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::INVALID) == false); // For completeness
+
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::L8) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB565) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB888) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB8888) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGR8888) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGR565) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_R11_EAC) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SIGNED_R11_EAC) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RG11_EAC) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SIGNED_RG11_EAC) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB8_ETC2) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ETC2) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB8_ETC1) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB_PVRTC_4BPPV1) == false);
+
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::A8) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::LA88) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGBA5551) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGBA4444) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGBA8888) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGRA8888) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGRA5551) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::BGRA4444) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA8_ETC2_EAC) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) == true);
+
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR) == true);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR) == true);
+
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB16F) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::RGB32F) == false);
+
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::DEPTH_UNSIGNED_INT) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::DEPTH_FLOAT) == false);
+ DALI_TEST_CHECK(Pixel::HasAlpha(Pixel::DEPTH_STENCIL) == false);
END_TEST;
}
int UtcDaliPixelHasAlphaN(void)
{
- DALI_TEST_EQUALS( Pixel::HasAlpha( Pixel::Format( 123123123123 ) ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(Pixel::HasAlpha(Pixel::Format(123123123123)), false, TEST_LOCATION);
END_TEST;
}
tet_infoline("UtcDaliPixelGetBytesPerPixel");
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize( 59 );
+ TestPixelEnumSize(59);
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::INVALID ) == 0 ); // For completeness
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::INVALID) == 0); // For completeness
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::L8 ) == 1 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::A8 ) == 1 );
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::L8) == 1);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::A8) == 1);
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::LA88 ) == 2 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB565 ) == 2 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGBA5551 ) == 2 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGBA4444 ) == 2 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGR565 ) == 2 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGRA5551 ) == 2 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGRA4444 ) == 2 );
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::LA88) == 2);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB565) == 2);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGBA5551) == 2);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGBA4444) == 2);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGR565) == 2);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGRA5551) == 2);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGRA4444) == 2);
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB888 ) == 3 );
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB888) == 3);
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB8888 ) == 4 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGR8888 ) == 4 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGBA8888 ) == 4 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::BGRA8888 ) == 4 );
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB8888) == 4);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGR8888) == 4);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGBA8888) == 4);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::BGRA8888) == 4);
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::L8 ) == 1 );
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::L8) == 1);
// Compressed formats are marked as 0 bytes per pixel.
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_R11_EAC ) == 0);
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SIGNED_R11_EAC ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RG11_EAC ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SIGNED_RG11_EAC ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB8_ETC2 ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ETC2 ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB8_ETC1 ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1 ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA8_ETC2_EAC ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR ) == 0 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR ) == 0 );
-
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB16F ) == 12 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::RGB32F ) == 24 );
-
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_UNSIGNED_INT ) == 4 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_FLOAT ) == 4 );
- DALI_TEST_CHECK( Pixel::GetBytesPerPixel( Pixel::DEPTH_STENCIL ) == 4 );
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_R11_EAC) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SIGNED_R11_EAC) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RG11_EAC) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SIGNED_RG11_EAC) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB8_ETC2) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ETC2) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB8_ETC1) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB_PVRTC_4BPPV1) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA8_ETC2_EAC) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR) == 0);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR) == 0);
+
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB16F) == 12);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::RGB32F) == 24);
+
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_UNSIGNED_INT) == 4);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_FLOAT) == 4);
+ DALI_TEST_CHECK(Pixel::GetBytesPerPixel(Pixel::DEPTH_STENCIL) == 4);
END_TEST;
}
int UtcDaliPixelGetBytesPerPixelN(void)
{
- DALI_TEST_EQUALS( Pixel::GetBytesPerPixel( Pixel::Format( 123123123123 ) ), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(Pixel::GetBytesPerPixel(Pixel::Format(123123123123)), 0u, TEST_LOCATION);
END_TEST;
}
tet_infoline("UtcDaliPixelGetAlphaOffsetAndMask");
int byteOffset = 0;
- int bitMask = 0;
+ int bitMask = 0;
// Be sure that the number of cases tested below is correct:
- TestPixelEnumSize( 59 );
-
- Pixel::GetAlphaOffsetAndMask( Pixel::INVALID, byteOffset, bitMask ); // For completeness
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
-
- Pixel::GetAlphaOffsetAndMask( Pixel::L8, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::A8, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0xff );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGB888, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGB565, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGB8888, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::BGR8888, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::LA88, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0xff );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGBA4444, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x0f );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGBA5551, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x01 );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGBA8888, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 3 && bitMask == 0xff );
- Pixel::GetAlphaOffsetAndMask( Pixel::BGRA8888, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 3 && bitMask == 0xff );
- Pixel::GetAlphaOffsetAndMask( Pixel::BGR565, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::BGRA4444, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x0f );
- Pixel::GetAlphaOffsetAndMask( Pixel::BGRA5551, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 1 && bitMask == 0x01 );
+ TestPixelEnumSize(59);
+
+ Pixel::GetAlphaOffsetAndMask(Pixel::INVALID, byteOffset, bitMask); // For completeness
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+
+ Pixel::GetAlphaOffsetAndMask(Pixel::L8, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::A8, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0xff);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGB888, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGB565, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGB8888, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::BGR8888, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::LA88, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0xff);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGBA4444, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x0f);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGBA5551, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x01);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGBA8888, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 3 && bitMask == 0xff);
+ Pixel::GetAlphaOffsetAndMask(Pixel::BGRA8888, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 3 && bitMask == 0xff);
+ Pixel::GetAlphaOffsetAndMask(Pixel::BGR565, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::BGRA4444, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x0f);
+ Pixel::GetAlphaOffsetAndMask(Pixel::BGRA5551, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 1 && bitMask == 0x01);
// Compressed formats with no meaningful result:
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_R11_EAC, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SIGNED_R11_EAC, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RG11_EAC, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SIGNED_RG11_EAC, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC2, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ETC2, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB8_ETC1, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA8_ETC2_EAC, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
-
- Pixel::GetAlphaOffsetAndMask( Pixel::RGB16F, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::RGB32F, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
-
- Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_UNSIGNED_INT, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_FLOAT, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
- Pixel::GetAlphaOffsetAndMask( Pixel::DEPTH_STENCIL, byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 0 && bitMask == 0 );
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_R11_EAC, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SIGNED_R11_EAC, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RG11_EAC, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SIGNED_RG11_EAC, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB8_ETC2, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ETC2, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB8_ETC1, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB_PVRTC_4BPPV1, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA8_ETC2_EAC, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGB16F, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::RGB32F, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+
+ Pixel::GetAlphaOffsetAndMask(Pixel::DEPTH_UNSIGNED_INT, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::DEPTH_FLOAT, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
+ Pixel::GetAlphaOffsetAndMask(Pixel::DEPTH_STENCIL, byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 0 && bitMask == 0);
END_TEST;
}
tet_infoline("UtcDaliPixelConvertGlFormat");
unsigned int pixelDataType, internalFormat;
- Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_UNSIGNED_INT, pixelDataType, internalFormat );
- DALI_TEST_CHECK( pixelDataType == GL_UNSIGNED_INT );
- DALI_TEST_CHECK( internalFormat == GL_DEPTH_COMPONENT );
+ Dali::Integration::ConvertToGlFormat(Pixel::Format::DEPTH_UNSIGNED_INT, pixelDataType, internalFormat);
+ DALI_TEST_CHECK(pixelDataType == GL_UNSIGNED_INT);
+ DALI_TEST_CHECK(internalFormat == GL_DEPTH_COMPONENT);
- Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_FLOAT, pixelDataType, internalFormat );
- DALI_TEST_CHECK( pixelDataType == GL_FLOAT );
- DALI_TEST_CHECK( internalFormat == GL_DEPTH_COMPONENT );
+ Dali::Integration::ConvertToGlFormat(Pixel::Format::DEPTH_FLOAT, pixelDataType, internalFormat);
+ DALI_TEST_CHECK(pixelDataType == GL_FLOAT);
+ DALI_TEST_CHECK(internalFormat == GL_DEPTH_COMPONENT);
- Dali::Integration::ConvertToGlFormat( Pixel::Format::DEPTH_STENCIL, pixelDataType, internalFormat );
- DALI_TEST_CHECK( pixelDataType == GL_UNSIGNED_INT_24_8 );
- DALI_TEST_CHECK( internalFormat == GL_DEPTH_STENCIL );
+ Dali::Integration::ConvertToGlFormat(Pixel::Format::DEPTH_STENCIL, pixelDataType, internalFormat);
+ DALI_TEST_CHECK(pixelDataType == GL_UNSIGNED_INT_24_8);
+ DALI_TEST_CHECK(internalFormat == GL_DEPTH_STENCIL);
END_TEST;
}
int UtcDaliPixelGetAlphaOffsetAndMaskN(void)
{
int byteOffset = 200;
- int bitMask = 200;
- Pixel::GetAlphaOffsetAndMask( Pixel::Format( 123123123123 ), byteOffset, bitMask );
- DALI_TEST_CHECK( byteOffset == 200 );
- DALI_TEST_CHECK( bitMask == 200 );
+ int bitMask = 200;
+ Pixel::GetAlphaOffsetAndMask(Pixel::Format(123123123123), byteOffset, bitMask);
+ DALI_TEST_CHECK(byteOffset == 200);
+ DALI_TEST_CHECK(bitMask == 200);
END_TEST;
}
*
*/
-#include <cstdlib>
#include <dali-test-suite-utils.h>
-
-#include <dali/public-api/images/pixel.h>
-#include <dali/public-api/images/pixel-data.h>
#include <dali/public-api/common/dali-vector.h>
+#include <dali/public-api/images/pixel-data.h>
+#include <dali/public-api/images/pixel.h>
+
+#include <cstdlib>
using namespace Dali;
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::RGB888 );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::RGB888);
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE);
- DALI_TEST_CHECK( pixelData );
- DALI_TEST_CHECK( pixelData.GetWidth() == width );
- DALI_TEST_CHECK( pixelData.GetHeight() == height );
- DALI_TEST_CHECK( pixelData.GetPixelFormat() == Pixel::RGB888 );
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_CHECK(pixelData.GetWidth() == width);
+ DALI_TEST_CHECK(pixelData.GetHeight() == height);
+ DALI_TEST_CHECK(pixelData.GetPixelFormat() == Pixel::RGB888);
END_TEST;
}
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 );
- unsigned char* buffer = new unsigned char [ bufferSize ];
- buffer[0] = 'a';
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ unsigned char* buffer = new unsigned char[bufferSize];
+ buffer[0] = 'a';
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY );
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY);
- DALI_TEST_CHECK( pixelData);
- DALI_TEST_CHECK( pixelData.GetWidth() == width );
- DALI_TEST_CHECK( pixelData.GetHeight() == height );
- DALI_TEST_CHECK( pixelData.GetPixelFormat() == Pixel::L8 );
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_CHECK(pixelData.GetWidth() == width);
+ DALI_TEST_CHECK(pixelData.GetHeight() == height);
+ DALI_TEST_CHECK(pixelData.GetPixelFormat() == Pixel::L8);
END_TEST;
}
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 );
- unsigned char* buffer = new unsigned char [ bufferSize ];
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ unsigned char* buffer = new unsigned char[bufferSize];
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY);
PixelData pixelDataCopy(pixelData);
- DALI_TEST_EQUALS( (bool)pixelDataCopy, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)pixelDataCopy, true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 );
- unsigned char* buffer = new unsigned char [ bufferSize ];
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY );
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ unsigned char* buffer = new unsigned char[bufferSize];
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY);
PixelData pixelData2;
- DALI_TEST_EQUALS( (bool)pixelData2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)pixelData2, false, TEST_LOCATION);
pixelData2 = pixelData;
- DALI_TEST_EQUALS( (bool)pixelData2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)pixelData2, true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 );
- unsigned char* buffer = new unsigned char [ bufferSize ];
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ unsigned char* buffer = new unsigned char[bufferSize];
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY );
- DALI_TEST_CHECK( pixelData );
- DALI_TEST_EQUALS( width, pixelData.GetWidth(), TEST_LOCATION );
- DALI_TEST_EQUALS( height, pixelData.GetHeight(), TEST_LOCATION );
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY);
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_EQUALS(width, pixelData.GetWidth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(height, pixelData.GetHeight(), TEST_LOCATION);
- PixelData moved = std::move( pixelData);
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( width, moved.GetWidth(), TEST_LOCATION );
- DALI_TEST_EQUALS( height, moved.GetHeight(), TEST_LOCATION );
- DALI_TEST_CHECK( !pixelData );
+ PixelData moved = std::move(pixelData);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(width, moved.GetWidth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(height, moved.GetHeight(), TEST_LOCATION);
+ DALI_TEST_CHECK(!pixelData);
END_TEST;
}
{
TestApplication application;
- unsigned int width = 10u;
- unsigned int height = 10u;
- unsigned int bufferSize = width*height*Pixel::GetBytesPerPixel( Pixel::L8 );
- unsigned char* buffer = new unsigned char [ bufferSize ];
+ unsigned int width = 10u;
+ unsigned int height = 10u;
+ unsigned int bufferSize = width * height * Pixel::GetBytesPerPixel(Pixel::L8);
+ unsigned char* buffer = new unsigned char[bufferSize];
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY );
- DALI_TEST_CHECK( pixelData );
- DALI_TEST_EQUALS( width, pixelData.GetWidth(), TEST_LOCATION );
- DALI_TEST_EQUALS( height, pixelData.GetHeight(), TEST_LOCATION );
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::L8, PixelData::DELETE_ARRAY);
+ DALI_TEST_CHECK(pixelData);
+ DALI_TEST_EQUALS(width, pixelData.GetWidth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(height, pixelData.GetHeight(), TEST_LOCATION);
PixelData moved;
- moved = std::move( pixelData);
- DALI_TEST_CHECK( moved );
- DALI_TEST_EQUALS( width, moved.GetWidth(), TEST_LOCATION );
- DALI_TEST_EQUALS( height, moved.GetHeight(), TEST_LOCATION );
- DALI_TEST_CHECK( !pixelData );
+ moved = std::move(pixelData);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(width, moved.GetWidth(), TEST_LOCATION);
+ DALI_TEST_EQUALS(height, moved.GetHeight(), TEST_LOCATION);
+ DALI_TEST_CHECK(!pixelData);
END_TEST;
}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/core.h>
#include <dali-test-suite-utils.h>
+#include <dali/integration-api/core.h>
#include <dali/integration-api/processor-interface.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
using namespace Dali;
-
class TestProcessor : public Integration::Processor
{
public:
-
TestProcessor()
: processRun(false)
{
bool processRun;
};
-
int UtcDaliCoreProcessorP(void)
{
TestApplication application;
- TestProcessor testProcessor;
+ TestProcessor testProcessor;
Integration::Core& core = application.GetCore();
- core.RegisterProcessor( testProcessor );
+ core.RegisterProcessor(testProcessor);
tet_infoline("Test that the processor has not been executed yet:");
- DALI_TEST_CHECK( testProcessor.processRun == false );
+ DALI_TEST_CHECK(testProcessor.processRun == false);
application.SendNotification();
tet_infoline("Test that the processor has been executed:");
- DALI_TEST_CHECK( testProcessor.processRun );
+ DALI_TEST_CHECK(testProcessor.processRun);
// Clear down for next part of test
testProcessor.processRun = false;
- core.UnregisterProcessor( testProcessor );
+ core.UnregisterProcessor(testProcessor);
application.SendNotification();
tet_infoline("Test that the processor has not been executed again:");
- DALI_TEST_CHECK( testProcessor.processRun == false );
+ DALI_TEST_CHECK(testProcessor.processRun == false);
END_TEST;
}
TestProcessor testProcessor3;
Integration::Core& core = application.GetCore();
- core.RegisterProcessor( testProcessor1 );
+ core.RegisterProcessor(testProcessor1);
tet_infoline("Test that the processor has not been executed yet:");
- DALI_TEST_CHECK( testProcessor1.processRun == false );
+ DALI_TEST_CHECK(testProcessor1.processRun == false);
application.SendNotification();
tet_infoline("Test that the processor has been executed:");
- DALI_TEST_CHECK( testProcessor1.processRun );
+ DALI_TEST_CHECK(testProcessor1.processRun);
// Clear down for next part of test
testProcessor1.processRun = false;
- core.RegisterProcessor( testProcessor2 );
- core.RegisterProcessor( testProcessor3 );
+ core.RegisterProcessor(testProcessor2);
+ core.RegisterProcessor(testProcessor3);
tet_infoline("Test that the processors have not been executed yet:");
- DALI_TEST_CHECK( testProcessor1.processRun == false );
- DALI_TEST_CHECK( testProcessor2.processRun == false );
- DALI_TEST_CHECK( testProcessor3.processRun == false );
+ DALI_TEST_CHECK(testProcessor1.processRun == false);
+ DALI_TEST_CHECK(testProcessor2.processRun == false);
+ DALI_TEST_CHECK(testProcessor3.processRun == false);
application.SendNotification();
tet_infoline("Test that the processors have been executed:");
- DALI_TEST_CHECK( testProcessor1.processRun );
- DALI_TEST_CHECK( testProcessor2.processRun );
- DALI_TEST_CHECK( testProcessor3.processRun );
+ DALI_TEST_CHECK(testProcessor1.processRun);
+ DALI_TEST_CHECK(testProcessor2.processRun);
+ DALI_TEST_CHECK(testProcessor3.processRun);
// Clear down for next part of test
testProcessor2.processRun = false;
- core.UnregisterProcessor( testProcessor2 );
+ core.UnregisterProcessor(testProcessor2);
application.SendNotification();
tet_infoline("Test that the unregistered processor has not been executed again but others have");
- DALI_TEST_CHECK( testProcessor1.processRun );
- DALI_TEST_CHECK( testProcessor2.processRun == false );
- DALI_TEST_CHECK( testProcessor3.processRun );
+ DALI_TEST_CHECK(testProcessor1.processRun);
+ DALI_TEST_CHECK(testProcessor2.processRun == false);
+ DALI_TEST_CHECK(testProcessor3.processRun);
END_TEST;
}
\ No newline at end of file
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
+
+#include <iostream>
#include <string>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
using namespace Dali;
{
Property::Array array;
- DALI_TEST_CHECK( 0 == array.Size() );
+ DALI_TEST_CHECK(0 == array.Size());
- array.PushBack( 1 );
+ array.PushBack(1);
- DALI_TEST_CHECK( 1 == array.Size() );
+ DALI_TEST_CHECK(1 == array.Size());
- DALI_TEST_CHECK( array[0].Get<int>() == 1 );
+ DALI_TEST_CHECK(array[0].Get<int>() == 1);
END_TEST;
}
{
Property::Array array;
- DALI_TEST_CHECK( 0 == array.Size() );
+ DALI_TEST_CHECK(0 == array.Size());
- array.Add( 1 );
+ array.Add(1);
- DALI_TEST_CHECK( 1 == array.Size() );
- DALI_TEST_CHECK( array[0].Get<int>() == 1 );
+ DALI_TEST_CHECK(1 == array.Size());
+ DALI_TEST_CHECK(array[0].Get<int>() == 1);
- array.Add( 2 )
- .Add( 3 )
- .Add( 4.f );
+ array.Add(2)
+ .Add(3)
+ .Add(4.f);
- DALI_TEST_EQUALS( 4u, array.Size(), TEST_LOCATION );
- DALI_TEST_EQUALS( array[1].Get<int>(), 2, TEST_LOCATION );
- DALI_TEST_EQUALS( array[2].Get<int>(), 3, TEST_LOCATION );
- DALI_TEST_EQUALS( array[3].Get<float>(), 4.f, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(4u, array.Size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(array[1].Get<int>(), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(array[2].Get<int>(), 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(array[3].Get<float>(), 4.f, Math::MACHINE_EPSILON_1, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyArrayCapacityP(void)
{
Property::Array array;
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
array.Reserve(3);
- DALI_TEST_CHECK( 3 == array.Capacity() );
+ DALI_TEST_CHECK(3 == array.Capacity());
END_TEST;
}
int UtcDaliPropertyArrayReserveP(void)
{
Property::Array array;
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
array.Reserve(3);
- DALI_TEST_CHECK( 3 == array.Capacity() );
- DALI_TEST_CHECK( 0 == array.Size() );
+ DALI_TEST_CHECK(3 == array.Capacity());
+ DALI_TEST_CHECK(0 == array.Size());
- array.PushBack( 1 );
- array.PushBack( "world" );
- array.PushBack( 3 );
+ array.PushBack(1);
+ array.PushBack("world");
+ array.PushBack(3);
END_TEST;
}
int UtcDaliPropertyArraySizeP(void)
{
Property::Array array;
- DALI_TEST_CHECK( 0 == array.Capacity() );
- DALI_TEST_CHECK( 0 == array.Size() );
+ DALI_TEST_CHECK(0 == array.Capacity());
+ DALI_TEST_CHECK(0 == array.Size());
array.Reserve(3);
- DALI_TEST_CHECK( 3 == array.Capacity() );
- DALI_TEST_CHECK( 0 == array.Size() );
+ DALI_TEST_CHECK(3 == array.Capacity());
+ DALI_TEST_CHECK(0 == array.Size());
- array.PushBack( 1 );
- array.PushBack( "world" );
- array.PushBack( 3 );
+ array.PushBack(1);
+ array.PushBack("world");
+ array.PushBack(3);
- DALI_TEST_CHECK( 3 == array.Size() );
+ DALI_TEST_CHECK(3 == array.Size());
END_TEST;
}
int UtcDaliPropertyArrayCountP(void)
{
Property::Array array;
- DALI_TEST_CHECK( 0 == array.Capacity() );
- DALI_TEST_CHECK( 0 == array.Count() );
+ DALI_TEST_CHECK(0 == array.Capacity());
+ DALI_TEST_CHECK(0 == array.Count());
array.Reserve(3);
- DALI_TEST_CHECK( 3 == array.Capacity() );
- DALI_TEST_CHECK( 0 == array.Count() );
+ DALI_TEST_CHECK(3 == array.Capacity());
+ DALI_TEST_CHECK(0 == array.Count());
- array.PushBack( 1 );
- array.PushBack( "world" );
- array.PushBack( 3 );
+ array.PushBack(1);
+ array.PushBack("world");
+ array.PushBack(3);
- DALI_TEST_CHECK( 3 == array.Count() );
+ DALI_TEST_CHECK(3 == array.Count());
END_TEST;
}
int UtcDaliPropertyArrayEmptyP(void)
{
Property::Array array;
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
array.Reserve(3);
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
- array.PushBack( 1 );
- array.PushBack( "world" );
- array.PushBack( 3 );
+ array.PushBack(1);
+ array.PushBack("world");
+ array.PushBack(3);
- DALI_TEST_CHECK( !array.Empty() );
+ DALI_TEST_CHECK(!array.Empty());
END_TEST;
}
int UtcDaliPropertyArrayClearP(void)
{
Property::Array array;
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
array.Reserve(3);
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
- array.PushBack( 1 );
- array.PushBack( "world" );
- array.PushBack( 3 );
+ array.PushBack(1);
+ array.PushBack("world");
+ array.PushBack(3);
- DALI_TEST_CHECK( !array.Empty() );
+ DALI_TEST_CHECK(!array.Empty());
array.Clear();
- DALI_TEST_CHECK( array.Empty() );
+ DALI_TEST_CHECK(array.Empty());
END_TEST;
}
Property::Array array;
array.Reserve(3);
- array.PushBack( 1 );
- array.PushBack( "world" );
- array.PushBack( 3 );
+ array.PushBack(1);
+ array.PushBack("world");
+ array.PushBack(3);
- DALI_TEST_CHECK( array[0].Get<int>() == 1 );
- DALI_TEST_CHECK( array[1].Get<std::string>() == "world" );
- DALI_TEST_CHECK( array[2].Get<int>() == 3 );
+ DALI_TEST_CHECK(array[0].Get<int>() == 1);
+ DALI_TEST_CHECK(array[1].Get<std::string>() == "world");
+ DALI_TEST_CHECK(array[2].Get<int>() == 3);
END_TEST;
}
Property::Array anArray;
anArray.Reserve(3);
- anArray.PushBack( 1 );
- anArray.PushBack( "world" );
- anArray.PushBack( 3 );
+ anArray.PushBack(1);
+ anArray.PushBack("world");
+ anArray.PushBack(3);
const Property::Array array(anArray);
- DALI_TEST_CHECK( array[0].Get<int>() == 1 );
- DALI_TEST_CHECK( array[1].Get<std::string>() == "world" );
- DALI_TEST_CHECK( array[2].Get<int>() == 3 );
+ DALI_TEST_CHECK(array[0].Get<int>() == 1);
+ DALI_TEST_CHECK(array[1].Get<std::string>() == "world");
+ DALI_TEST_CHECK(array[2].Get<int>() == 3);
END_TEST;
}
Property::Array anArray;
anArray.Reserve(3);
- anArray.PushBack( 1 );
- anArray.PushBack( "world" );
- anArray.PushBack( 3 );
+ anArray.PushBack(1);
+ anArray.PushBack("world");
+ anArray.PushBack(3);
Property::Array array = anArray;
- DALI_TEST_CHECK( array[0].Get<int>() == 1 );
- DALI_TEST_CHECK( array[1].Get<std::string>() == "world" );
- DALI_TEST_CHECK( array[2].Get<int>() == 3 );
+ DALI_TEST_CHECK(array[0].Get<int>() == 1);
+ DALI_TEST_CHECK(array[1].Get<std::string>() == "world");
+ DALI_TEST_CHECK(array[2].Get<int>() == 3);
END_TEST;
}
Property::Array array;
array.Resize(3);
- DALI_TEST_CHECK( array.Count() == 3 );
+ DALI_TEST_CHECK(array.Count() == 3);
array.Resize(5);
- DALI_TEST_CHECK( array.Count() == 5 );
+ DALI_TEST_CHECK(array.Count() == 5);
END_TEST;
}
std::ostringstream oss;
Property::Array array;
- array.PushBack( 0 );
- array.PushBack( 1 );
- array.PushBack( 2 );
+ array.PushBack(0);
+ array.PushBack(1);
+ array.PushBack(2);
oss << array;
- DALI_TEST_EQUALS( oss.str().compare("Array(3) = [0, 1, 2]"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(oss.str().compare("Array(3) = [0, 1, 2]"), 0, TEST_LOCATION);
END_TEST;
}
std::ostringstream oss;
Property::Array array1;
- array1.PushBack( 0 );
- array1.PushBack( 1 );
- array1.PushBack( 2 );
+ array1.PushBack(0);
+ array1.PushBack(1);
+ array1.PushBack(2);
Property::Array array2;
array2.PushBack(array1);
- array2.PushBack( 1 );
- array2.PushBack( 2 );
+ array2.PushBack(1);
+ array2.PushBack(2);
oss << array2;
- DALI_TEST_EQUALS( oss.str().compare("Array(3) = [Array(3) = [0, 1, 2], 1, 2]"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(oss.str().compare("Array(3) = [Array(3) = [0, 1, 2], 1, 2]"), 0, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyArrayCopyConstructor(void)
{
Property::Array array1;
- array1.PushBack( 0 );
- array1.PushBack( 1 );
- array1.PushBack( 2 );
- DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION );
+ array1.PushBack(0);
+ array1.PushBack(1);
+ array1.PushBack(2);
+ DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION);
- Property::Array array2( array1 );
- DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION );
+ Property::Array array2(array1);
+ DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyArrayAssignmentOperator(void)
{
Property::Array array1;
- array1.PushBack( 0 );
- array1.PushBack( 1 );
- array1.PushBack( 2 );
- DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION );
+ array1.PushBack(0);
+ array1.PushBack(1);
+ array1.PushBack(2);
+ DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION);
Property::Array array2;
- array2.PushBack( 4 );
- DALI_TEST_EQUALS( 1u, array2.Size(), TEST_LOCATION );
+ array2.PushBack(4);
+ DALI_TEST_EQUALS(1u, array2.Size(), TEST_LOCATION);
array2 = array1;
- DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION );
+ DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyArrayMoveConstructor(void)
{
Property::Array array1;
- array1.PushBack( 0 );
- array1.PushBack( 1 );
- array1.PushBack( 2 );
- DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION );
+ array1.PushBack(0);
+ array1.PushBack(1);
+ array1.PushBack(2);
+ DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION);
- Property::Array array2( std::move( array1 ) );
- DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION );
+ Property::Array array2(std::move(array1));
+ DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION);
// Calling any methods on array1 will debug assert
- const char * exceptionMessage = "Cannot use an object previously used as an r-value";
- DALI_TEST_ASSERTION( array1.Count(), exceptionMessage );
- DALI_TEST_ASSERTION( array1.PushBack( Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Count(), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Clear(), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Reserve( 1 ), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Resize( 1 ), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Capacity(), exceptionMessage );
- DALI_TEST_ASSERTION( array1[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( const_cast< const Property::Array& >( array1 )[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( Property::Array temp; array1 = temp, exceptionMessage );
+ const char* exceptionMessage = "Cannot use an object previously used as an r-value";
+ DALI_TEST_ASSERTION(array1.Count(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.PushBack(Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Count(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Clear(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Reserve(1), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Resize(1), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Capacity(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1[0], exceptionMessage);
+ DALI_TEST_ASSERTION(const_cast<const Property::Array&>(array1)[0], exceptionMessage);
+ DALI_TEST_ASSERTION(Property::Array temp; array1 = temp, exceptionMessage);
END_TEST;
}
int UtcDaliPropertyArrayMoveAssignmentOperator(void)
{
Property::Array array1;
- array1.PushBack( 0 );
- array1.PushBack( 1 );
- array1.PushBack( 2 );
- DALI_TEST_EQUALS( 3u, array1.Size(), TEST_LOCATION );
+ array1.PushBack(0);
+ array1.PushBack(1);
+ array1.PushBack(2);
+ DALI_TEST_EQUALS(3u, array1.Size(), TEST_LOCATION);
Property::Array array2;
- array2.PushBack( 4 );
- DALI_TEST_EQUALS( 1u, array2.Size(), TEST_LOCATION );
+ array2.PushBack(4);
+ DALI_TEST_EQUALS(1u, array2.Size(), TEST_LOCATION);
- array2 = std::move( array1 );
- DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION );
+ array2 = std::move(array1);
+ DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION);
// Calling any methods on array1 will debug assert
- const char * exceptionMessage = "Cannot use an object previously used as an r-value";
- DALI_TEST_ASSERTION( array1.Count(), exceptionMessage );
- DALI_TEST_ASSERTION( array1.PushBack( Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Count(), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Clear(), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Reserve( 1 ), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Resize( 1 ), exceptionMessage );
- DALI_TEST_ASSERTION( array1.Capacity(), exceptionMessage );
- DALI_TEST_ASSERTION( array1[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( const_cast< const Property::Array& >( array1 )[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( Property::Array temp; array1 = temp, exceptionMessage );
+ const char* exceptionMessage = "Cannot use an object previously used as an r-value";
+ DALI_TEST_ASSERTION(array1.Count(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.PushBack(Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Count(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Clear(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Reserve(1), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Resize(1), exceptionMessage);
+ DALI_TEST_ASSERTION(array1.Capacity(), exceptionMessage);
+ DALI_TEST_ASSERTION(array1[0], exceptionMessage);
+ DALI_TEST_ASSERTION(const_cast<const Property::Array&>(array1)[0], exceptionMessage);
+ DALI_TEST_ASSERTION(Property::Array temp; array1 = temp, exceptionMessage);
// Self assignemnt
- array2 = std::move( array2 );
- DALI_TEST_EQUALS( 3u, array2.Size(), TEST_LOCATION ); // still works, no debug assert
+ array2 = std::move(array2);
+ DALI_TEST_EQUALS(3u, array2.Size(), TEST_LOCATION); // still works, no debug assert
END_TEST;
}
int UtcDaliPropertyArrayInitializerListConstructor(void)
{
- Property::Array array{ 1, 2, "hello" };
- DALI_TEST_EQUALS( 3u, array.Size(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::INTEGER, array.GetElementAt( 0 ).GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::INTEGER, array.GetElementAt( 1 ).GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( Property::STRING, array.GetElementAt( 2 ).GetType(), TEST_LOCATION );
+ Property::Array array{1, 2, "hello"};
+ DALI_TEST_EQUALS(3u, array.Size(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::INTEGER, array.GetElementAt(0).GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::INTEGER, array.GetElementAt(1).GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Property::STRING, array.GetElementAt(2).GetType(), TEST_LOCATION);
END_TEST;
}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
#include <iostream>
#include <string>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
using namespace Dali;
int UtcDaliPropertyMapPopulate(void)
{
Property::Map map;
- DALI_TEST_CHECK( map.Empty() );
-
- map[ "hello" ] = 1;
- map[ 10 ] = "DALi";
- map[ "world" ] = "world";
- map[ 100 ] = 9;
- map[ "world" ] = 3; // same item as line above
- DALI_TEST_CHECK( !map.Empty() ); // Should no longer be empty
- DALI_TEST_CHECK( map.Count() == 4 ); // Should only have four items, not five!!
- DALI_TEST_CHECK( map["hello"].Get<int>() == 1 );
- DALI_TEST_CHECK( map["world"].Get<int>() == 3 );
- DALI_TEST_EQUALS( "DALi", map[ 10 ].Get<std::string>(), TEST_LOCATION );
- DALI_TEST_CHECK( map[100].Get<int>() == 9 );
+ DALI_TEST_CHECK(map.Empty());
+
+ map["hello"] = 1;
+ map[10] = "DALi";
+ map["world"] = "world";
+ map[100] = 9;
+ map["world"] = 3; // same item as line above
+ DALI_TEST_CHECK(!map.Empty()); // Should no longer be empty
+ DALI_TEST_CHECK(map.Count() == 4); // Should only have four items, not five!!
+ DALI_TEST_CHECK(map["hello"].Get<int>() == 1);
+ DALI_TEST_CHECK(map["world"].Get<int>() == 3);
+ DALI_TEST_EQUALS("DALi", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_CHECK(map[100].Get<int>() == 9);
map.Clear();
- DALI_TEST_CHECK( map.Empty() );
+ DALI_TEST_CHECK(map.Empty());
END_TEST;
}
int UtcDaliPropertyMapCopyAndAssignment(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ "world" ] = 2;
- map[ 10 ] = "DALi";
+ map["hello"] = 1;
+ map["world"] = 2;
+ map[10] = "DALi";
Property::Map assignedMap;
- assignedMap[ "foo" ] = 3;
- assignedMap[ 100 ] = 9;
- DALI_TEST_CHECK( assignedMap.Count() == 2 );
+ assignedMap["foo"] = 3;
+ assignedMap[100] = 9;
+ DALI_TEST_CHECK(assignedMap.Count() == 2);
assignedMap = map;
- DALI_TEST_CHECK( assignedMap.Count() == 3 );
+ DALI_TEST_CHECK(assignedMap.Count() == 3);
- Property::Map copiedMap( map );
- DALI_TEST_CHECK( copiedMap.Count() == 3 );
+ Property::Map copiedMap(map);
+ DALI_TEST_CHECK(copiedMap.Count() == 3);
// Self assignment
- DALI_TEST_CHECK( map.Count() == 3 );
+ DALI_TEST_CHECK(map.Count() == 3);
map = map;
- DALI_TEST_CHECK( map.Count() == 3 );
+ DALI_TEST_CHECK(map.Count() == 3);
END_TEST;
}
int UtcDaliPropertyMapMoveConstructor(void)
{
Property::Map map1;
- map1[ "hello" ] = 1;
- map1[ "world" ] = 2;
- map1[ 10 ] = "DALi";
- DALI_TEST_EQUALS( 3u, map1.Count(), TEST_LOCATION );
+ map1["hello"] = 1;
+ map1["world"] = 2;
+ map1[10] = "DALi";
+ DALI_TEST_EQUALS(3u, map1.Count(), TEST_LOCATION);
- Property::Map map2( std::move( map1 ) );
- DALI_TEST_EQUALS( 3u, map2.Count(), TEST_LOCATION );
+ Property::Map map2(std::move(map1));
+ DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION);
// Calling any methods on map1 will debug assert
- const char * exceptionMessage = "Cannot use an object previously used as an r-value";
- DALI_TEST_ASSERTION( map1.Count(), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Empty(), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Insert( (const char *)"key", Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Insert( std::string( "key" ), Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Insert( 0, Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetValue( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetKey( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetKeyAt( 1 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetPair( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetKeyValue( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( (const char *)"key" ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( std::string( "key" ) ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( 0, "key" ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( "key", Property::INTEGER ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( 0, Property::INTEGER ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Clear(), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Merge( Property::Map() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1[ "key" ], exceptionMessage );
- DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ "key" ], exceptionMessage );
- DALI_TEST_ASSERTION( map1[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( Property::Map temp; map1 = temp, exceptionMessage );
+ const char* exceptionMessage = "Cannot use an object previously used as an r-value";
+ DALI_TEST_ASSERTION(map1.Count(), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Empty(), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Insert((const char*)"key", Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Insert(std::string("key"), Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Insert(0, Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetValue(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetKey(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetKeyAt(1), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetPair(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetKeyValue(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find((const char*)"key"), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(std::string("key")), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(0, "key"), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find("key", Property::INTEGER), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(0, Property::INTEGER), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Clear(), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Merge(Property::Map()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1["key"], exceptionMessage);
+ DALI_TEST_ASSERTION(const_cast<const Property::Map&>(map1)["key"], exceptionMessage);
+ DALI_TEST_ASSERTION(map1[0], exceptionMessage);
+ DALI_TEST_ASSERTION(const_cast<const Property::Map&>(map1)[0], exceptionMessage);
+ DALI_TEST_ASSERTION(Property::Map temp; map1 = temp, exceptionMessage);
END_TEST;
}
int UtcDaliPropertyMapMoveAssignmentOperator(void)
{
Property::Map map1;
- map1[ "hello" ] = 1;
- map1[ "world" ] = 2;
- map1[ 10 ] = "DALi";
- DALI_TEST_EQUALS( 3u, map1.Count(), TEST_LOCATION );
+ map1["hello"] = 1;
+ map1["world"] = 2;
+ map1[10] = "DALi";
+ DALI_TEST_EQUALS(3u, map1.Count(), TEST_LOCATION);
Property::Map map2;
- map2[ 10 ] = "DALi again";
- DALI_TEST_EQUALS( 1u, map2.Count(), TEST_LOCATION );
+ map2[10] = "DALi again";
+ DALI_TEST_EQUALS(1u, map2.Count(), TEST_LOCATION);
- map2 = std::move( map1 );
- DALI_TEST_EQUALS( 3u, map2.Count(), TEST_LOCATION );
+ map2 = std::move(map1);
+ DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION);
// Calling any methods on map1 will debug assert
- const char * exceptionMessage = "Cannot use an object previously used as an r-value";
- DALI_TEST_ASSERTION( map1.Count(), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Empty(), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Insert( (const char *)"key", Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Insert( std::string( "key" ), Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Insert( 0, Property::Value() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetValue( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetKey( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetKeyAt( 1 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetPair( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.GetKeyValue( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( (const char *)"key" ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( std::string( "key" ) ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( 0 ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( 0, "key" ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( "key", Property::INTEGER ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Find( 0, Property::INTEGER ), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Clear(), exceptionMessage );
- DALI_TEST_ASSERTION( map1.Merge( Property::Map() ), exceptionMessage );
- DALI_TEST_ASSERTION( map1[ "key" ], exceptionMessage );
- DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ "key" ], exceptionMessage );
- DALI_TEST_ASSERTION( map1[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( const_cast< const Property::Map& >( map1 )[ 0 ], exceptionMessage );
- DALI_TEST_ASSERTION( Property::Map temp; map1 = temp, exceptionMessage );
+ const char* exceptionMessage = "Cannot use an object previously used as an r-value";
+ DALI_TEST_ASSERTION(map1.Count(), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Empty(), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Insert((const char*)"key", Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Insert(std::string("key"), Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Insert(0, Property::Value()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetValue(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetKey(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetKeyAt(1), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetPair(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.GetKeyValue(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find((const char*)"key"), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(std::string("key")), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(0), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(0, "key"), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find("key", Property::INTEGER), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Find(0, Property::INTEGER), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Clear(), exceptionMessage);
+ DALI_TEST_ASSERTION(map1.Merge(Property::Map()), exceptionMessage);
+ DALI_TEST_ASSERTION(map1["key"], exceptionMessage);
+ DALI_TEST_ASSERTION(const_cast<const Property::Map&>(map1)["key"], exceptionMessage);
+ DALI_TEST_ASSERTION(map1[0], exceptionMessage);
+ DALI_TEST_ASSERTION(const_cast<const Property::Map&>(map1)[0], exceptionMessage);
+ DALI_TEST_ASSERTION(Property::Map temp; map1 = temp, exceptionMessage);
// Self assignment
- map2 = std::move( map2 );
- DALI_TEST_EQUALS( 3u, map2.Count(), TEST_LOCATION ); // No debug assert as nothing should happen
+ map2 = std::move(map2);
+ DALI_TEST_EQUALS(3u, map2.Count(), TEST_LOCATION); // No debug assert as nothing should happen
END_TEST;
}
int UtcDaliPropertyMapConstOperator(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ 10 ] = "DALi";
- map[ "world" ] = 2;
- DALI_TEST_CHECK( map.Count() == 3 );
+ map["hello"] = 1;
+ map[10] = "DALi";
+ map["world"] = 2;
+ DALI_TEST_CHECK(map.Count() == 3);
- const Property::Map& constMap( map );
- DALI_TEST_CHECK( constMap[ "world" ].Get<int>() == 2 );
- DALI_TEST_CHECK( constMap.Count() == 3 ); // Ensure count hasn't gone up
+ const Property::Map& constMap(map);
+ DALI_TEST_CHECK(constMap["world"].Get<int>() == 2);
+ DALI_TEST_CHECK(constMap.Count() == 3); // Ensure count hasn't gone up
- DALI_TEST_EQUALS( "DALi", map[ 10 ].Get<std::string>(), TEST_LOCATION );
- DALI_TEST_CHECK( constMap.Count() == 3 ); // Ensure count hasn't gone up
+ DALI_TEST_EQUALS("DALi", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_CHECK(constMap.Count() == 3); // Ensure count hasn't gone up
// Invalid Key
try
{
- constMap[ "invalidKey" ];
- tet_result( TET_FAIL );
+ constMap["invalidKey"];
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "! \"Invalid Key\"", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "!\"Invalid Key\"", TEST_LOCATION);
}
END_TEST;
int UtcDaliPropertyMapGetValue(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ "world" ] = 2;
- map[ Actor::Property::COLOR ] = Color::MAGENTA;
+ map["hello"] = 1;
+ map["world"] = 2;
+ map[Actor::Property::COLOR] = Color::MAGENTA;
- Property::Value& value = map.GetValue( 0 );
- DALI_TEST_CHECK( value.Get<int>() == 1 );
+ Property::Value& value = map.GetValue(0);
+ DALI_TEST_CHECK(value.Get<int>() == 1);
value = 10; // Allows the actual changing of the value as we have a ref
- DALI_TEST_CHECK( map[ "hello" ].Get<int>() == 10 );
+ DALI_TEST_CHECK(map["hello"].Get<int>() == 10);
- Property::Value& value2 = map.GetValue( 2 );
- DALI_TEST_CHECK( value2.Get<Vector4>() == Color::MAGENTA );
+ Property::Value& value2 = map.GetValue(2);
+ DALI_TEST_CHECK(value2.Get<Vector4>() == Color::MAGENTA);
value2 = Color::CYAN;
- DALI_TEST_EQUALS( map[ Actor::Property::COLOR].Get<Vector4>(), Color::CYAN, TEST_LOCATION);
+ DALI_TEST_EQUALS(map[Actor::Property::COLOR].Get<Vector4>(), Color::CYAN, TEST_LOCATION);
// Out of bounds
try
{
- map.GetValue( 3 );
- tet_result( TET_FAIL );
+ map.GetValue(3);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
END_TEST;
int UtcDaliPropertyMapGetKey(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ "world" ] = 2;
- map[ Actor::Property::COLOR ] = Color::MAGENTA;
+ map["hello"] = 1;
+ map["world"] = 2;
+ map[Actor::Property::COLOR] = Color::MAGENTA;
- DALI_TEST_CHECK( map.GetKey( 0 ) == "hello" );
- DALI_TEST_CHECK( map.GetKey( 1 ) == "world" );
+ DALI_TEST_CHECK(map.GetKey(0) == "hello");
+ DALI_TEST_CHECK(map.GetKey(1) == "world");
// Wrong type
try
{
- map.GetKey( 2 );
- tet_result( TET_FAIL );
+ map.GetKey(2);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
// Out of bounds
try
{
- map.GetKey( 3 );
- tet_result( TET_FAIL );
+ map.GetKey(3);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliPropertyMapGetKeyAt(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ "world" ] = 2;
- map[ Actor::Property::COLOR ] = Color::MAGENTA;
+ map["hello"] = 1;
+ map["world"] = 2;
+ map[Actor::Property::COLOR] = Color::MAGENTA;
- DALI_TEST_CHECK( map.GetKeyAt( 0 ) == "hello" );
- DALI_TEST_CHECK( map.GetKeyAt( 1 ) == "world" );
- DALI_TEST_CHECK( map.GetKeyAt( 2 ) == Actor::Property::COLOR );
+ DALI_TEST_CHECK(map.GetKeyAt(0) == "hello");
+ DALI_TEST_CHECK(map.GetKeyAt(1) == "world");
+ DALI_TEST_CHECK(map.GetKeyAt(2) == Actor::Property::COLOR);
// Out of bounds
try
{
- map.GetKey( 3 );
- tet_result( TET_FAIL );
+ map.GetKey(3);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
END_TEST;
int UtcDaliPropertyMapGetPair(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ "world" ] = 2;
- map[ Actor::Property::COLOR ] = Color::MAGENTA;
+ map["hello"] = 1;
+ map["world"] = 2;
+ map[Actor::Property::COLOR] = Color::MAGENTA;
- DALI_TEST_CHECK( map.GetPair( 0 ).first == "hello" );
- DALI_TEST_CHECK( map.GetPair( 0 ).second.Get< int >() == 1 );
- DALI_TEST_CHECK( map.GetPair( 1 ).first == "world" );
- DALI_TEST_CHECK( map.GetPair( 1 ).second.Get< int >() == 2 );
+ DALI_TEST_CHECK(map.GetPair(0).first == "hello");
+ DALI_TEST_CHECK(map.GetPair(0).second.Get<int>() == 1);
+ DALI_TEST_CHECK(map.GetPair(1).first == "world");
+ DALI_TEST_CHECK(map.GetPair(1).second.Get<int>() == 2);
// Wrong Type
try
{
- map.GetPair( 2 );
- tet_result( TET_FAIL );
+ map.GetPair(2);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
// Out of bounds
try
{
- map.GetPair( 3 );
- tet_result( TET_FAIL );
+ map.GetPair(3);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
END_TEST;
int UtcDaliPropertyMapGetKeyValue(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ "world" ] = 2;
- map[ Actor::Property::COLOR ] = Color::MAGENTA;
+ map["hello"] = 1;
+ map["world"] = 2;
+ map[Actor::Property::COLOR] = Color::MAGENTA;
- DALI_TEST_CHECK( map.GetKeyValue( 0 ).first == "hello" );
- DALI_TEST_CHECK( map.GetKeyValue( 0 ).second.Get< int >() == 1 );
- DALI_TEST_CHECK( map.GetKeyValue( 1 ).first == "world" );
- DALI_TEST_CHECK( map.GetKeyValue( 1 ).second.Get< int >() == 2 );
- DALI_TEST_CHECK( map.GetKeyValue( 2 ).first == Actor::Property::COLOR );
- DALI_TEST_CHECK( map.GetKeyValue( 2 ).second.Get< Vector4 >() == Color::MAGENTA );
+ DALI_TEST_CHECK(map.GetKeyValue(0).first == "hello");
+ DALI_TEST_CHECK(map.GetKeyValue(0).second.Get<int>() == 1);
+ DALI_TEST_CHECK(map.GetKeyValue(1).first == "world");
+ DALI_TEST_CHECK(map.GetKeyValue(1).second.Get<int>() == 2);
+ DALI_TEST_CHECK(map.GetKeyValue(2).first == Actor::Property::COLOR);
+ DALI_TEST_CHECK(map.GetKeyValue(2).second.Get<Vector4>() == Color::MAGENTA);
// Out of bounds
try
{
- map.GetPair( 3 );
- tet_result( TET_FAIL );
+ map.GetPair(3);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "position", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "position", TEST_LOCATION);
}
END_TEST;
int UtcDaliPropertyMapFind(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ 10 ] = "DALi";
- map[ "world" ] = 2;
- map[ 100 ] = 9;
+ map["hello"] = 1;
+ map[10] = "DALi";
+ map["world"] = 2;
+ map[100] = 9;
Property::Value* value = NULL;
- value = map.Find( "hello" );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 1 );
+ value = map.Find("hello");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 1);
const std::string world("world");
- value = map.Find( world );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 2 );
+ value = map.Find(world);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 2);
- value = map.Find( 100 );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 9 );
+ value = map.Find(100);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 9);
- value = map.Find( 10, Property::STRING );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
+ value = map.Find(10, Property::STRING);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("DALi", value->Get<std::string>(), TEST_LOCATION);
- value = map.Find( 10, Property::INTEGER );
- DALI_TEST_CHECK( value == NULL );
+ value = map.Find(10, Property::INTEGER);
+ DALI_TEST_CHECK(value == NULL);
- value = map.Find( "invalidKey" );
- DALI_TEST_CHECK( !value );
+ value = map.Find("invalidKey");
+ DALI_TEST_CHECK(!value);
END_TEST;
}
int UtcDaliPropertyMapFindIndexThenString(void)
{
// Define the valid keys and values to test with.
- std::string stringKeyValid = "bar";
+ std::string stringKeyValid = "bar";
std::string stringKeyInvalid = "aardvark";
- int indexKeyValid = 100;
- int indexKeyInvalid = 101;
+ int indexKeyValid = 100;
+ int indexKeyInvalid = 101;
// Define invalid key and value to test with.
std::string stringValueValid = "DALi";
- int indexValueValid = 3;
+ int indexValueValid = 3;
// Set up a property map containing the valid keys and values defined above.
Property::Map map;
- map[ "foo" ] = 1;
- map[ 10 ] = "string";
- map[ stringKeyValid ] = stringValueValid;
- map[ indexKeyValid ] = indexValueValid;
+ map["foo"] = 1;
+ map[10] = "string";
+ map[stringKeyValid] = stringValueValid;
+ map[indexKeyValid] = indexValueValid;
Property::Value* value = NULL;
// TEST: If both index and string are valid, the Property::Value of the index is returned.
- value = map.Find( indexKeyValid, stringKeyValid );
-
- DALI_TEST_EQUALS( value->Get<int>(), indexValueValid, TEST_LOCATION );
+ value = map.Find(indexKeyValid, stringKeyValid);
+ DALI_TEST_EQUALS(value->Get<int>(), indexValueValid, TEST_LOCATION);
// TEST: If only the index is valid, the Property::Value of the index is returned.
- value = map.Find( indexKeyValid, stringKeyInvalid );
-
- DALI_TEST_EQUALS( value->Get<int>(), indexValueValid, TEST_LOCATION );
+ value = map.Find(indexKeyValid, stringKeyInvalid);
+ DALI_TEST_EQUALS(value->Get<int>(), indexValueValid, TEST_LOCATION);
// TEST: If only the string is valid, the Property::Value of the string is returned.
- value = map.Find( indexKeyInvalid, stringKeyValid );
-
- DALI_TEST_EQUALS( value->Get<std::string>(), stringValueValid, TEST_LOCATION );
+ value = map.Find(indexKeyInvalid, stringKeyValid);
+ DALI_TEST_EQUALS(value->Get<std::string>(), stringValueValid, TEST_LOCATION);
// TEST: If neither the index or string are valid, then a NULL pointer is returned.
- value = map.Find( indexKeyInvalid, stringKeyInvalid );
+ value = map.Find(indexKeyInvalid, stringKeyInvalid);
- DALI_TEST_CHECK( value == NULL );
+ DALI_TEST_CHECK(value == NULL);
END_TEST;
}
int UtcDaliPropertyMapOperatorIndex(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ 10 ] = "DALi";
- map[ "world" ] = 2;
- map[ 100 ] = 9;
+ map["hello"] = 1;
+ map[10] = "DALi";
+ map["world"] = 2;
+ map[100] = 9;
- const Property::Map map2 = map;
+ const Property::Map map2 = map;
const Property::Value& value10 = map2[10];
- DALI_TEST_EQUALS( value10.Get<std::string>(), "DALi", TEST_LOCATION );
+ DALI_TEST_EQUALS(value10.Get<std::string>(), "DALi", TEST_LOCATION);
const Property::Value& value100 = map2[100];
- DALI_TEST_EQUALS( value100.Get<int>(), 9, TEST_LOCATION );
+ DALI_TEST_EQUALS(value100.Get<int>(), 9, TEST_LOCATION);
const Property::Value& valueHello = map2["hello"];
- DALI_TEST_EQUALS( valueHello.Get<int>(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(valueHello.Get<int>(), 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyMapInsertP(void)
{
Property::Map map;
- DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION );
- map.Insert( "foo", "bar");
- DALI_TEST_EQUALS( 1u, map.Count(), TEST_LOCATION );
- Property::Value* value = map.Find( "foo" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
-
- map.Insert( std::string("foo2"), "testing" );
- DALI_TEST_EQUALS( 2u, map.Count(), TEST_LOCATION );
- value = map.Find( "foo2" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
-
- map.Insert( 10, "DALi" );
- DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION );
- value = map.Find( 10 );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
-
- map.Insert( 100, 9 );
- DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION );
- value = map.Find( 100 );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 9 );
+ DALI_TEST_EQUALS(0u, map.Count(), TEST_LOCATION);
+ map.Insert("foo", "bar");
+ DALI_TEST_EQUALS(1u, map.Count(), TEST_LOCATION);
+ Property::Value* value = map.Find("foo");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("bar", value->Get<std::string>(), TEST_LOCATION);
+
+ map.Insert(std::string("foo2"), "testing");
+ DALI_TEST_EQUALS(2u, map.Count(), TEST_LOCATION);
+ value = map.Find("foo2");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("testing", value->Get<std::string>(), TEST_LOCATION);
+
+ map.Insert(10, "DALi");
+ DALI_TEST_EQUALS(3u, map.Count(), TEST_LOCATION);
+ value = map.Find(10);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("DALi", value->Get<std::string>(), TEST_LOCATION);
+
+ map.Insert(100, 9);
+ DALI_TEST_EQUALS(4u, map.Count(), TEST_LOCATION);
+ value = map.Find(100);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 9);
END_TEST;
}
-
int UtcDaliPropertyMapAddP(void)
{
Property::Map map;
- DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION );
- map.Add( "foo", "bar");
- DALI_TEST_EQUALS( 1u, map.Count(), TEST_LOCATION );
- Property::Value* value = map.Find( "foo" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
-
- map.Add( std::string("foo2"), "testing" );
- DALI_TEST_EQUALS( 2u, map.Count(), TEST_LOCATION );
- value = map.Find( "foo2" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
-
- map.Add( 10, "DALi" );
- DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION );
- value = map.Find( 10 );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
-
- map.Add( 100, 9 );
- DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION );
- value = map.Find( 100 );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 9 );
+ DALI_TEST_EQUALS(0u, map.Count(), TEST_LOCATION);
+ map.Add("foo", "bar");
+ DALI_TEST_EQUALS(1u, map.Count(), TEST_LOCATION);
+ Property::Value* value = map.Find("foo");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("bar", value->Get<std::string>(), TEST_LOCATION);
+
+ map.Add(std::string("foo2"), "testing");
+ DALI_TEST_EQUALS(2u, map.Count(), TEST_LOCATION);
+ value = map.Find("foo2");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("testing", value->Get<std::string>(), TEST_LOCATION);
+
+ map.Add(10, "DALi");
+ DALI_TEST_EQUALS(3u, map.Count(), TEST_LOCATION);
+ value = map.Find(10);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("DALi", value->Get<std::string>(), TEST_LOCATION);
+
+ map.Add(100, 9);
+ DALI_TEST_EQUALS(4u, map.Count(), TEST_LOCATION);
+ value = map.Find(100);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 9);
END_TEST;
}
int UtcDaliPropertyMapAddChainP(void)
{
Property::Map map;
- DALI_TEST_EQUALS( 0u, map.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, map.Count(), TEST_LOCATION);
map
- .Add( "foo", "bar")
- .Add( std::string("foo2"), "testing" )
- .Add( 10, "DALi" )
- .Add( 100, 9 );
+ .Add("foo", "bar")
+ .Add(std::string("foo2"), "testing")
+ .Add(10, "DALi")
+ .Add(100, 9);
- DALI_TEST_EQUALS( 4u, map.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(4u, map.Count(), TEST_LOCATION);
- Property::Value* value = map.Find( "foo" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
+ Property::Value* value = map.Find("foo");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("bar", value->Get<std::string>(), TEST_LOCATION);
- value = map.Find( "foo2" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
+ value = map.Find("foo2");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("testing", value->Get<std::string>(), TEST_LOCATION);
- value = map.Find( 10 );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
+ value = map.Find(10);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("DALi", value->Get<std::string>(), TEST_LOCATION);
- value = map.Find( 100 );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 9 );
+ value = map.Find(100);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 9);
END_TEST;
}
Property::Map mMap;
};
- TestMap mapTest( Property::Map().Add( "foo", "bar")
- .Add( std::string("foo2"), "testing" )
- .Add( 10, "DALi" )
- .Add( 100, 9 ));
-
+ TestMap mapTest(Property::Map().Add("foo", "bar").Add(std::string("foo2"), "testing").Add(10, "DALi").Add(100, 9));
- Property::Value* value = mapTest.mMap.Find( "foo" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "bar", value->Get<std::string>(), TEST_LOCATION );
+ Property::Value* value = mapTest.mMap.Find("foo");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("bar", value->Get<std::string>(), TEST_LOCATION);
- value = mapTest.mMap.Find( "foo2" );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "testing", value->Get<std::string>(), TEST_LOCATION );
+ value = mapTest.mMap.Find("foo2");
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("testing", value->Get<std::string>(), TEST_LOCATION);
- value = mapTest.mMap.Find( 10 );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( "DALi", value->Get<std::string>(), TEST_LOCATION );
+ value = mapTest.mMap.Find(10);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS("DALi", value->Get<std::string>(), TEST_LOCATION);
- value = mapTest.mMap.Find( 100 );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( value->Get<int>() == 9 );
+ value = mapTest.mMap.Find(100);
+ DALI_TEST_CHECK(value);
+ DALI_TEST_CHECK(value->Get<int>() == 9);
END_TEST;
}
-
int UtcDaliPropertyMapMerge(void)
{
Property::Map map;
- map[ "hello" ] = 1;
- map[ 10 ] = "DALi";
- map[ "world" ] = 2;
+ map["hello"] = 1;
+ map[10] = "DALi";
+ map["world"] = 2;
- DALI_TEST_CHECK( map.Count() == 3 );
+ DALI_TEST_CHECK(map.Count() == 3);
// Create another map with the same keys but different values
Property::Map map2;
- map2[ "hello" ] = 3;
- map2[ "world" ] = 4;
- map[ 10 ] = "3DEngine";
+ map2["hello"] = 3;
+ map2["world"] = 4;
+ map[10] = "3DEngine";
// Merge map2 into map1, count should still be 2, map values should be from map2
- map.Merge( map2 );
- DALI_TEST_CHECK( map.Count() == 3 );
- DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
- DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
- DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
+ map.Merge(map2);
+ DALI_TEST_CHECK(map.Count() == 3);
+ DALI_TEST_CHECK(map["hello"].Get<int>() == 3);
+ DALI_TEST_CHECK(map["world"].Get<int>() == 4);
+ DALI_TEST_EQUALS("3DEngine", map[10].Get<std::string>(), TEST_LOCATION);
// Create another map with different keys
Property::Map map3;
- map3[ "foo" ] = 5;
- map3[ 100 ] = 6;
+ map3["foo"] = 5;
+ map3[100] = 6;
// Merge map3 into map1, count should increase, existing values should match previous and new values should match map3
- map.Merge( map3 );
- DALI_TEST_CHECK( map.Count() == 5 );
- DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
- DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
- DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 );
- DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
- DALI_TEST_CHECK( map[ 100].Get< int >() == 6 );
+ map.Merge(map3);
+ DALI_TEST_CHECK(map.Count() == 5);
+ DALI_TEST_CHECK(map["hello"].Get<int>() == 3);
+ DALI_TEST_CHECK(map["world"].Get<int>() == 4);
+ DALI_TEST_CHECK(map["foo"].Get<int>() == 5);
+ DALI_TEST_EQUALS("3DEngine", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_CHECK(map[100].Get<int>() == 6);
// Create an empty map and attempt to merge, should be successful, nothing should change
Property::Map map4;
- DALI_TEST_CHECK( map4.Empty() );
- map.Merge( map4 );
- DALI_TEST_CHECK( map4.Empty() );
- DALI_TEST_CHECK( map.Count() == 5 );
- DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
- DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
- DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 );
- DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
- DALI_TEST_CHECK( map[ 100 ].Get< int >() == 6 );
+ DALI_TEST_CHECK(map4.Empty());
+ map.Merge(map4);
+ DALI_TEST_CHECK(map4.Empty());
+ DALI_TEST_CHECK(map.Count() == 5);
+ DALI_TEST_CHECK(map["hello"].Get<int>() == 3);
+ DALI_TEST_CHECK(map["world"].Get<int>() == 4);
+ DALI_TEST_CHECK(map["foo"].Get<int>() == 5);
+ DALI_TEST_EQUALS("3DEngine", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_CHECK(map[100].Get<int>() == 6);
// Merge map into map4, map4 should be the same as map now.
- map4.Merge( map );
- DALI_TEST_CHECK( map4.Count() == 5 );
- DALI_TEST_CHECK( map4[ "hello" ].Get< int >() == 3 );
- DALI_TEST_CHECK( map4[ "world"].Get< int >() == 4 );
- DALI_TEST_CHECK( map4[ "foo"].Get< int >() == 5 );
- DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
- DALI_TEST_CHECK( map4[ 100 ].Get< int >() == 6 );
+ map4.Merge(map);
+ DALI_TEST_CHECK(map4.Count() == 5);
+ DALI_TEST_CHECK(map4["hello"].Get<int>() == 3);
+ DALI_TEST_CHECK(map4["world"].Get<int>() == 4);
+ DALI_TEST_CHECK(map4["foo"].Get<int>() == 5);
+ DALI_TEST_EQUALS("3DEngine", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_CHECK(map4[100].Get<int>() == 6);
// Attempt to merge into itself, should be successful, nothing should change
- map.Merge( map );
- DALI_TEST_CHECK( map.Count() == 5 );
- DALI_TEST_CHECK( map[ "hello" ].Get< int >() == 3 );
- DALI_TEST_CHECK( map[ "world"].Get< int >() == 4 );
- DALI_TEST_CHECK( map[ "foo"].Get< int >() == 5 );
- DALI_TEST_EQUALS( "3DEngine", map[ 10 ].Get<std::string>(), TEST_LOCATION );
- DALI_TEST_CHECK( map[ 100 ].Get< int >() == 6 );
+ map.Merge(map);
+ DALI_TEST_CHECK(map.Count() == 5);
+ DALI_TEST_CHECK(map["hello"].Get<int>() == 3);
+ DALI_TEST_CHECK(map["world"].Get<int>() == 4);
+ DALI_TEST_CHECK(map["foo"].Get<int>() == 5);
+ DALI_TEST_EQUALS("3DEngine", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_CHECK(map[100].Get<int>() == 6);
END_TEST;
}
Property::Map map;
map.Insert("duration", 5.0f);
- map.Insert( 10, "DALi" );
+ map.Insert(10, "DALi");
map.Insert("delay", 1.0f);
- map.Insert( 100, 9 );
+ map.Insert(100, 9);
map.Insert("value", 100);
std::ostringstream oss;
tet_printf("Testing ouput of map: %s\n", oss.str().c_str());
// string-value pairs first, then index-value pairs
- DALI_TEST_EQUALS( oss.str().compare("Map(5) = {duration:5, delay:1, value:100, 10:DALi, 100:9}"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(oss.str().compare("Map(5) = {duration:5, delay:1, value:100, 10:DALi, 100:9}"), 0, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPropertyMapOstream02(void)
{
Property::Map map, map2;
map2.Insert("duration", 5.0f);
map2.Insert("delay", 1.0f);
- map2.Insert( 10, "DALi" );
+ map2.Insert(10, "DALi");
map.Insert("timePeriod", map2);
- map.Insert( 100, 9 );
+ map.Insert(100, 9);
map.Insert("value", 100);
std::ostringstream oss;
tet_printf("Testing ouput of map: %s\n", oss.str().c_str());
// string-value pairs first, then index-value pairs
- DALI_TEST_EQUALS( oss.str().compare("Map(3) = {timePeriod:Map(3) = {duration:5, delay:1, 10:DALi}, value:100, 100:9}"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(oss.str().compare("Map(3) = {timePeriod:Map(3) = {duration:5, delay:1, 10:DALi}, value:100, 100:9}"), 0, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyKeyConstructorP(void)
{
- Property::Key key1( "aKey" );
- DALI_TEST_EQUALS( key1.type, Property::Key::STRING, TEST_LOCATION );
- DALI_TEST_EQUALS( key1.stringKey, "aKey", TEST_LOCATION );
- DALI_TEST_EQUALS( key1.indexKey, Property::INVALID_INDEX, TEST_LOCATION );
-
- Property::Key key2( Actor::Property::COLOR );
- DALI_TEST_EQUALS( key2.type, Property::Key::INDEX, TEST_LOCATION );
- DALI_TEST_EQUALS( key2.indexKey, (Dali::Property::Index)Actor::Property::COLOR, TEST_LOCATION );
+ Property::Key key1("aKey");
+ DALI_TEST_EQUALS(key1.type, Property::Key::STRING, TEST_LOCATION);
+ DALI_TEST_EQUALS(key1.stringKey, "aKey", TEST_LOCATION);
+ DALI_TEST_EQUALS(key1.indexKey, Property::INVALID_INDEX, TEST_LOCATION);
+
+ Property::Key key2(Actor::Property::COLOR);
+ DALI_TEST_EQUALS(key2.type, Property::Key::INDEX, TEST_LOCATION);
+ DALI_TEST_EQUALS(key2.indexKey, (Dali::Property::Index)Actor::Property::COLOR, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyKeyEqualityOperatorP(void)
{
- Property::Key key1( "aKey" );
- Property::Key key2( 113 );
+ Property::Key key1("aKey");
+ Property::Key key2(113);
- DALI_TEST_CHECK( key1 == "aKey" );
- DALI_TEST_CHECK( ! (key1 == "notTheKey") );
- DALI_TEST_CHECK( ! (key1 == 1) );
+ DALI_TEST_CHECK(key1 == "aKey");
+ DALI_TEST_CHECK(!(key1 == "notTheKey"));
+ DALI_TEST_CHECK(!(key1 == 1));
- DALI_TEST_CHECK( key2 == 113 );
- DALI_TEST_CHECK( ! (key2 == 0) );
- DALI_TEST_CHECK( ! (key2 == "One hundred and thirteen" ) );
+ DALI_TEST_CHECK(key2 == 113);
+ DALI_TEST_CHECK(!(key2 == 0));
+ DALI_TEST_CHECK(!(key2 == "One hundred and thirteen"));
- DALI_TEST_CHECK( ! (key1 == key2) );
- DALI_TEST_CHECK( key1 != key2 );
+ DALI_TEST_CHECK(!(key1 == key2));
+ DALI_TEST_CHECK(key1 != key2);
- Property::Key key1B( "aKey" );
- Property::Key key2B( 113 );
+ Property::Key key1B("aKey");
+ Property::Key key2B(113);
- DALI_TEST_CHECK( key1 == key1B );
- DALI_TEST_CHECK( key2 == key2B );
+ DALI_TEST_CHECK(key1 == key1B);
+ DALI_TEST_CHECK(key2 == key2B);
END_TEST;
}
int UtcDaliPropertyKeyInequalityOperatorP(void)
{
- Property::Key key1( "aKey" );
- Property::Key key2( 113 );
+ Property::Key key1("aKey");
+ Property::Key key2(113);
- DALI_TEST_CHECK( key1 != "notTheKey" );
- DALI_TEST_CHECK( key1 != 1 );
+ DALI_TEST_CHECK(key1 != "notTheKey");
+ DALI_TEST_CHECK(key1 != 1);
- DALI_TEST_CHECK( key2 != 0 );
- DALI_TEST_CHECK( key2 != "One hundred and thirteen" );
+ DALI_TEST_CHECK(key2 != 0);
+ DALI_TEST_CHECK(key2 != "One hundred and thirteen");
- DALI_TEST_CHECK( key1 != key2 );
+ DALI_TEST_CHECK(key1 != key2);
END_TEST;
}
-
int UtcDaliPropertyKeyOutputStream(void)
{
- Property::Key key1( "aKey" );
- Property::Key key2( 113 );
+ Property::Key key1("aKey");
+ Property::Key key2(113);
std::ostringstream oss;
oss << key1;
- DALI_TEST_EQUALS( oss.str(), "aKey", TEST_LOCATION );
+ DALI_TEST_EQUALS(oss.str(), "aKey", TEST_LOCATION);
std::ostringstream oss2;
oss2 << key2;
- DALI_TEST_EQUALS( oss2.str(), "113", TEST_LOCATION );
+ DALI_TEST_EQUALS(oss2.str(), "113", TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyMapInitializerListConstructor(void)
{
auto map = Property::Map{
- {"number mapped to string", 1},
- {10, "string mapped to number"},
- {"string mapped", "to string"},
- {100, 3},
+ {"number mapped to string", 1},
+ {10, "string mapped to number"},
+ {"string mapped", "to string"},
+ {100, 3},
};
- DALI_TEST_CHECK( !map.Empty() ); // Should not be empty
- DALI_TEST_EQUALS( 4, map.Count(), TEST_LOCATION ); // Should have four items
+ DALI_TEST_CHECK(!map.Empty()); // Should not be empty
+ DALI_TEST_EQUALS(4, map.Count(), TEST_LOCATION); // Should have four items
- DALI_TEST_EQUALS( 1, map[ "number mapped to string" ].Get< int >(), TEST_LOCATION );
- DALI_TEST_EQUALS( "string mapped to number", map[ 10 ].Get< std::string >(), TEST_LOCATION );
- DALI_TEST_EQUALS( "to string", map[ "string mapped" ].Get< std::string >(), TEST_LOCATION );
- DALI_TEST_EQUALS( 3, map[ 100 ].Get< int >(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, map["number mapped to string"].Get<int>(), TEST_LOCATION);
+ DALI_TEST_EQUALS("string mapped to number", map[10].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS("to string", map["string mapped"].Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3, map[100].Get<int>(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyMapNestedInitializerListConstructor(void)
{
- auto map = Property::Map
- {
+ auto map = Property::Map{
{1, 1},
{2, {{2, 2}}},
- {3, {{3, {{3, 3}}}}}
- };
+ {3, {{3, {{3, 3}}}}}};
- DALI_TEST_CHECK( !map.Empty() );
- DALI_TEST_EQUALS( 3, map.Count(), TEST_LOCATION );
+ DALI_TEST_CHECK(!map.Empty());
+ DALI_TEST_EQUALS(3, map.Count(), TEST_LOCATION);
// Check first item
{
- DALI_TEST_EQUALS( 1, map[ 1 ].Get< int >(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, map[1].Get<int>(), TEST_LOCATION);
}
// Check second item
{
- auto& value1 = map[ 2 ];
- DALI_TEST_EQUALS( Property::MAP, value1.GetType(), TEST_LOCATION );
+ auto& value1 = map[2];
+ DALI_TEST_EQUALS(Property::MAP, value1.GetType(), TEST_LOCATION);
auto& map2 = *(value1.GetMap());
- DALI_TEST_EQUALS( 1, map2.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, map2.Count(), TEST_LOCATION);
// check the value
- DALI_TEST_EQUALS( 2, map2[ 2 ].Get< int >(), TEST_LOCATION );
+ DALI_TEST_EQUALS(2, map2[2].Get<int>(), TEST_LOCATION);
}
// Check the third item
{
- auto& value1 = map[ 3 ];
- DALI_TEST_EQUALS( Property::MAP, value1.GetType(), TEST_LOCATION );
+ auto& value1 = map[3];
+ DALI_TEST_EQUALS(Property::MAP, value1.GetType(), TEST_LOCATION);
auto& map2 = *(value1.GetMap());
- DALI_TEST_EQUALS( 1, map2.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, map2.Count(), TEST_LOCATION);
- auto& value2 = map2[ 3 ];
- DALI_TEST_EQUALS( Property::MAP, value2.GetType(), TEST_LOCATION );
+ auto& value2 = map2[3];
+ DALI_TEST_EQUALS(Property::MAP, value2.GetType(), TEST_LOCATION);
auto& map3 = *(value2.GetMap());
- DALI_TEST_EQUALS( 1, map3.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, map3.Count(), TEST_LOCATION);
// check the value
- DALI_TEST_EQUALS( 3, map3[ 3 ].Get< int >(), TEST_LOCATION );
+ DALI_TEST_EQUALS(3, map3[3].Get<int>(), TEST_LOCATION);
}
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-namespace {
-
+namespace
+{
static bool gCallBackCalled;
static void TestCallback(PropertyNotification& source)
gCallBackCalled = true;
}
-const int RENDER_FRAME_INTERVAL(16); ///< Duration of each frame in ms. (at approx 60FPS)
-const int DEFAULT_WAIT_PERIOD(100); ///< Default waiting period for check.
-
+const int RENDER_FRAME_INTERVAL(16); ///< Duration of each frame in ms. (at approx 60FPS)
+const int DEFAULT_WAIT_PERIOD(100); ///< Default waiting period for check.
class TestClass : public ConnectionTracker
{
public:
-
- TestClass(Integration::Scene scene )
- : mScene( scene )
+ TestClass(Integration::Scene scene)
+ : mScene(scene)
{
}
void Initialize()
{
mActor = Actor::New();
- mScene.Add( mActor );
- mNotification = mActor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) );
- mNotification.NotifySignal().Connect( this, &TestClass::OnPropertyNotify );
+ mScene.Add(mActor);
+ mNotification = mActor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
+ mNotification.NotifySignal().Connect(this, &TestClass::OnPropertyNotify);
}
void RemovePropertyNotification()
{
- mActor.RemovePropertyNotification( mNotification );
+ mActor.RemovePropertyNotification(mNotification);
}
void RemovePropertyNotifications()
void Terminate()
{
- mScene.Remove( mActor );
+ mScene.Remove(mActor);
mActor.Reset();
mNotification.Reset();
}
- void OnPropertyNotify( PropertyNotification& source )
+ void OnPropertyNotify(PropertyNotification& source)
{
tet_infoline(" OnPropertyNotify");
gCallBackCalled = true;
}
- Actor mActor;
+ Actor mActor;
PropertyNotification mNotification;
- Integration::Scene mScene;
+ Integration::Scene mScene;
};
-
/*
* Simulate time passed by.
*
{
int time = 0;
- for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ for(int i = 0; i <= (duration / RENDER_FRAME_INTERVAL); i++)
{
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
} // unnamed namespace
-
// Positive test case for a method
int UtcDaliPropertyNotificationDownCast(void)
{
TestApplication application;
tet_infoline(" UtcDaliPropertyNotificationDownCast");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- BaseHandle handle = notification;
+ BaseHandle handle = notification;
PropertyNotification notificationHandle;
DALI_TEST_CHECK(notification);
DALI_TEST_CHECK(handle);
DALI_TEST_CHECK(!notificationHandle);
- notificationHandle = PropertyNotification::DownCast( handle );
+ notificationHandle = PropertyNotification::DownCast(handle);
DALI_TEST_CHECK(notificationHandle);
END_TEST;
}
-
// Negative test case for a method
int UtcDaliPropertyNotificationDownCastNegative(void)
{
Actor actor = Actor::New();
actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- BaseHandle handle = somethingElse;
+ BaseHandle handle = somethingElse;
PropertyNotification notificationHandle;
- notificationHandle = PropertyNotification::DownCast( handle );
+ notificationHandle = PropertyNotification::DownCast(handle);
DALI_TEST_CHECK(!notificationHandle);
END_TEST;
}
Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- DALI_TEST_CHECK( notification );
- DALI_TEST_EQUALS( 2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(notification);
+ DALI_TEST_EQUALS(2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- PropertyNotification movedNotification = std::move( notification );
- DALI_TEST_CHECK( movedNotification );
+ PropertyNotification movedNotification = std::move(notification);
+ DALI_TEST_CHECK(movedNotification);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !notification );
+ DALI_TEST_EQUALS(2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!notification);
PropertyCondition condition = movedNotification.GetCondition();
- DALI_TEST_CHECK( condition );
- DALI_TEST_EQUALS( 2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, condition.GetArgumentCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(condition);
+ DALI_TEST_EQUALS(2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, condition.GetArgumentCount(), TEST_LOCATION);
- PropertyCondition movedCondition = std::move( condition );
- DALI_TEST_CHECK( movedCondition );
+ PropertyCondition movedCondition = std::move(condition);
+ DALI_TEST_CHECK(movedCondition);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, movedCondition.GetArgumentCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !condition );
+ DALI_TEST_EQUALS(2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, movedCondition.GetArgumentCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!condition);
END_TEST;
}
Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- DALI_TEST_CHECK( notification );
- DALI_TEST_EQUALS( 2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(notification);
+ DALI_TEST_EQUALS(2, notification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
PropertyNotification movedNotification;
- movedNotification = std::move( notification );
- DALI_TEST_CHECK( movedNotification );
+ movedNotification = std::move(notification);
+ DALI_TEST_CHECK(movedNotification);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !notification );
+ DALI_TEST_EQUALS(2, movedNotification.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!notification);
PropertyCondition condition = movedNotification.GetCondition();
- DALI_TEST_CHECK( condition );
- DALI_TEST_EQUALS( 2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, condition.GetArgumentCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(condition);
+ DALI_TEST_EQUALS(2, condition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, condition.GetArgumentCount(), TEST_LOCATION);
PropertyCondition movedCondition;
- movedCondition = std::move( condition );
- DALI_TEST_CHECK( movedCondition );
+ movedCondition = std::move(condition);
+ DALI_TEST_CHECK(movedCondition);
// Check that object is moved (not copied, so ref count keeps the same)
- DALI_TEST_EQUALS( 2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1, movedCondition.GetArgumentCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !condition );
+ DALI_TEST_EQUALS(2, movedCondition.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, movedCondition.GetArgumentCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!condition);
END_TEST;
}
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
- PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ));
- DALI_TEST_CHECK( notification );
- DALI_TEST_CHECK( notification2 );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
+ PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
+ DALI_TEST_CHECK(notification);
+ DALI_TEST_CHECK(notification2);
END_TEST;
}
gCallBackCalled = false;
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Forcing notification condition true, should receive a notification");
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
gCallBackCalled = false;
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Forcing notification condition false, should not receive a notification");
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
gCallBackCalled = false;
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Deleting notification and it's owning object, should not receive a notification");
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
object->Terminate();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Removing notification and it's owning object, should not receive a notification");
object->Initialize();
object->RemovePropertyNotification();
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
tet_infoline(" UtcDaliAddPropertyNotificationCallback - Removing all notifications and it's owning object, should not receive a notification");
object->Initialize();
object->RemovePropertyNotifications();
- object->mActor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ object->mActor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_CHECK( !gCallBackCalled );
-
+ DALI_TEST_CHECK(!gCallBackCalled);
delete object;
END_TEST;
// Currently, Type registry properties cannot be animated
try
{
- actor.AddPropertyNotification( PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition( 100.0f ) );
+ actor.AddPropertyNotification(PROPERTY_REGISTRATION_START_INDEX, GreaterThanCondition(100.0f));
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property notification added to event side only property", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property notification added to event side only property", TEST_LOCATION);
}
END_TEST;
}
// Currently, Type registry properties cannot be animated
try
{
- actor.AddPropertyNotification( PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition( 100.0f ) );
+ actor.AddPropertyNotification(PROPERTY_REGISTRATION_MAX_INDEX - 1, GreaterThanCondition(100.0f));
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property notification added to event side only property", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property notification added to event side only property", TEST_LOCATION);
}
END_TEST;
}
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ));
- DALI_TEST_CHECK( notification );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
+ DALI_TEST_CHECK(notification);
END_TEST;
}
Actor actor = Actor::New();
- PropertyCondition condition = GreaterThanCondition(100.0f);
+ PropertyCondition condition = GreaterThanCondition(100.0f);
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
- DALI_TEST_CHECK( condition == notification.GetCondition() );
+ DALI_TEST_CHECK(condition == notification.GetCondition());
END_TEST;
}
class PropertyNotificationConstWrapper
{
public:
-
PropertyNotificationConstWrapper(PropertyNotification propertyNotification)
- :mPropertyNotification(propertyNotification)
+ : mPropertyNotification(propertyNotification)
{
-
}
/**
Actor actor = Actor::New();
- PropertyCondition condition = GreaterThanCondition(100.0f);
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
+ PropertyCondition condition = GreaterThanCondition(100.0f);
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, condition);
PropertyNotificationConstWrapper notificationConst(notification);
- const PropertyCondition& conditionReference1 = notificationConst.GetCondition();
- const PropertyCondition& conditionReference2 = notificationConst.GetCondition();
+ const PropertyCondition& conditionReference1 = notificationConst.GetCondition();
+ const PropertyCondition& conditionReference2 = notificationConst.GetCondition();
- DALI_TEST_CHECK( (&conditionReference1) == (&conditionReference2) );
- DALI_TEST_CHECK( conditionReference1 == condition );
+ DALI_TEST_CHECK((&conditionReference1) == (&conditionReference2));
+ DALI_TEST_CHECK(conditionReference1 == condition);
END_TEST;
}
TestApplication application;
tet_infoline(" UtcDaliPropertyNotificationGetTarget");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
Actor actor2 = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- Actor targetActor = Actor::DownCast( notification.GetTarget() );
+ Actor targetActor = Actor::DownCast(notification.GetTarget());
- DALI_TEST_CHECK( targetActor == actor );
+ DALI_TEST_CHECK(targetActor == actor);
END_TEST;
}
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- Property::Index targetProperty = notification.GetTargetProperty();
+ Property::Index targetProperty = notification.GetTargetProperty();
- DALI_TEST_EQUALS( targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION );
+ DALI_TEST_EQUALS(targetProperty, (Property::Index)Actor::Property::POSITION_X, TEST_LOCATION);
END_TEST;
}
notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
PropertyNotification::NotifyMode notifyMode = notification.GetNotifyMode();
- DALI_TEST_EQUALS( notifyMode, PropertyNotification::NOTIFY_ON_CHANGED, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyMode, PropertyNotification::NOTIFY_ON_CHANGED, TEST_LOCATION);
END_TEST;
}
GreaterThanCondition(100.0f));
notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
gCallBackCalled = false;
- notification.NotifySignal().Connect( &TestCallback );
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
bool notifyResult = notification.GetNotifyResult();
- DALI_TEST_EQUALS( notifyResult, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyResult, false, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move right to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move left to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move right to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, LessThanCondition(100.0f ) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, LessThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move left to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move right to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move left to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, InsideCondition(100.0f, 200.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move inside to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move outside (right) to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move inside to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X, OutsideCondition(100.0f, 200.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move outside (left) to satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move inside to un-satisfy condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(150.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
// Move outside (right) to satisfy condition again.
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(300.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, GreaterThanCondition(100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, GreaterThanCondition(0.5f) );
- notification.NotifySignal().Connect( &TestCallback );
-
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.0f));
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, GreaterThanCondition(100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, GreaterThanCondition(0.5f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move right to satisfy XAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move down to satisfy YAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move forward to satisfy ZAxis
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Change alpha Colour to satisfy w/alpha component condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, LessThanCondition(-100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, LessThanCondition(-100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, LessThanCondition(-100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, LessThanCondition(0.5f) );
- notification.NotifySignal().Connect( &TestCallback );
-
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, LessThanCondition(-100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, LessThanCondition(-100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, LessThanCondition(-100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, LessThanCondition(0.5f));
+ notification.NotifySignal().Connect(&TestCallback);
+
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move left to satisfy XAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move up to satisfy YAxis condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, -200.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, -200.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move back to satisfy ZAxis
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(-200.0f, -200.0f, -200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(-200.0f, -200.0f, -200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Change alpha Colour to satisfy w/alpha component condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, InsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, InsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, InsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, InsideCondition(0.25f, 0.75f));
+ notification.NotifySignal().Connect(&TestCallback);
// set outside all conditions
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move x to inside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 200.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move y to inside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move z to inside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// change alpha to inside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.5f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f) );
- notification.NotifySignal().Connect( &TestCallback );
- notification = actor.AddPropertyNotification( Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, OutsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 1, OutsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::POSITION, 2, OutsideCondition(-100.0f, 100.0f));
+ notification.NotifySignal().Connect(&TestCallback);
+ notification = actor.AddPropertyNotification(Actor::Property::COLOR, 3, OutsideCondition(0.25f, 0.75f));
+ notification.NotifySignal().Connect(&TestCallback);
// set inside all conditions
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 0.5f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 0.5f));
Wait(application, DEFAULT_WAIT_PERIOD);
// Move x to outside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move y to outside condition
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// Move z to outside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(200.0f, 200.0f, 200.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
// change alpha to outside condition
gCallBackCalled = false;
Wait(application, DEFAULT_WAIT_PERIOD);
- actor.SetProperty( Actor::Property::COLOR,Vector4(0.0f, 0.0f, 0.0f, 1.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(0.0f, 0.0f, 0.0f, 1.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
END_TEST;
}
int UtcDaliPropertyNotificationSetSizeResultP(void)
{
TestApplication application;
- bool notifyResult;
+ bool notifyResult;
tet_infoline(" UtcDaliPropertyNotificationSetSizeResultP");
Actor actor = Actor::New();
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::SIZE, StepCondition(1.0f, 1.0f));
notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
gCallBackCalled = false;
- notification.NotifySignal().Connect( &TestCallback );
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
notifyResult = notification.GetNotifyResult();
- DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyResult, true, TEST_LOCATION);
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 200.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(200.0f, 200.0f));
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
notifyResult = notification.GetNotifyResult();
- DALI_TEST_EQUALS( notifyResult, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(notifyResult, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline(" UtcDaliPropertyConditionGetArguments");
- PropertyCondition condition = GreaterThanCondition( 50.0f );
+ PropertyCondition condition = GreaterThanCondition(50.0f);
- DALI_TEST_EQUALS( condition.GetArgumentCount(), 1u, TEST_LOCATION );
- float value = condition.GetArgument( 0 );
- DALI_TEST_EQUALS( value, 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(condition.GetArgumentCount(), 1u, TEST_LOCATION);
+ float value = condition.GetArgument(0);
+ DALI_TEST_EQUALS(value, 50.0f, TEST_LOCATION);
- condition = InsideCondition( 125.0f, 250.0f );
+ condition = InsideCondition(125.0f, 250.0f);
- DALI_TEST_EQUALS( condition.GetArgumentCount(), 2u, TEST_LOCATION );
- float value1 = condition.GetArgument( 0 );
- float value2 = condition.GetArgument( 1 );
- DALI_TEST_EQUALS( value1, 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( value2, 250.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(condition.GetArgumentCount(), 2u, TEST_LOCATION);
+ float value1 = condition.GetArgument(0);
+ float value2 = condition.GetArgument(1);
+ DALI_TEST_EQUALS(value1, 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(value2, 250.0f, TEST_LOCATION);
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- const float step = 10.0f;
- float initValue = 5.0f;
+ const float step = 10.0f;
+ float initValue = 5.0f;
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::COLOR, StepCondition(step * 2, 0.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::COLOR, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// test both directions
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to positive
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue + (i++ * step), 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
initValue = -5.0f;
- actor.SetProperty( Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue, 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to negative
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::COLOR, Vector4(initValue -(i++ * step), 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue - (i++ * step), 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( Actor::Property::COLOR, Vector4(initValue -(i++ * step), 0.0f, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(initValue - (i++ * step), 0.0f, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- const float step = 10.0f;
- float initValue = 5.0f;
+ const float step = 10.0f;
+ float initValue = 5.0f;
// float
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, StepCondition(step * 2, 0.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
// set initial position
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// test both directions
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to positive
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
initValue = -5.0f;
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to negative
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue -(i++ * step), 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue -(i++ * step), 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- const float step = 10.0f;
- float initValue = 5.0f;
+ const float step = 10.0f;
+ float initValue = 5.0f;
- Property::Index propertyIndex = actor.RegisterProperty( "testProperty", Vector2::ZERO );
+ Property::Index propertyIndex = actor.RegisterProperty("testProperty", Vector2::ZERO);
- PropertyNotification notification = actor.AddPropertyNotification( propertyIndex, StepCondition(step * 2, 0.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(propertyIndex, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
- actor.SetProperty( propertyIndex, Vector2(initValue, 0.0f));
+ actor.SetProperty(propertyIndex, Vector2(initValue, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// test both directions
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to positive
gCallBackCalled = false;
- actor.SetProperty( propertyIndex, Vector2(initValue + (i++ * step), 0.0f));
+ actor.SetProperty(propertyIndex, Vector2(initValue + (i++ * step), 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( propertyIndex, Vector2(initValue + (i++ * step), 0.0f));
+ actor.SetProperty(propertyIndex, Vector2(initValue + (i++ * step), 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
initValue = -5.0f;
- actor.SetProperty( propertyIndex, Vector2(initValue, 0.0f));
+ actor.SetProperty(propertyIndex, Vector2(initValue, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to negative
gCallBackCalled = false;
- actor.SetProperty( propertyIndex, Vector2(initValue -(i++ * step), 0.0f));
+ actor.SetProperty(propertyIndex, Vector2(initValue - (i++ * step), 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( propertyIndex, Vector2(initValue -(i++ * step), 0.0f));
+ actor.SetProperty(propertyIndex, Vector2(initValue - (i++ * step), 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
- const float step = 10.0f;
- float initValue = 5.0f;
+ const float step = 10.0f;
+ float initValue = 5.0f;
// float
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, StepCondition(step * 2, 0.0f) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, StepCondition(step * 2, 0.0f));
+ notification.NotifySignal().Connect(&TestCallback);
// set initial position
- actor.SetProperty( Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
// test both directions
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to positive position
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3( initValue + (i++ * step), 0.0f, 0.0f) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( Actor::Property::POSITION, Vector3( initValue + (i++ * step), 0.0f, 0.0f) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue + (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
initValue = -5.0f;
- actor.SetProperty( Actor::Property::POSITION, Vector3( initValue, 0.0f, 0.0f) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( int i = 1 ; i < 10 ; )
+ for(int i = 1; i < 10;)
{
// Move x to negative position
gCallBackCalled = false;
- actor.SetProperty( Actor::Property::POSITION, Vector3( initValue -(i++ * step), 0.0f, 0.0f) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( !gCallBackCalled );
+ DALI_TEST_CHECK(!gCallBackCalled);
- actor.SetProperty( Actor::Property::POSITION, Vector3( initValue -(i++ * step), 0.0f, 0.0f) );
+ actor.SetProperty(Actor::Property::POSITION, Vector3(initValue - (i++ * step), 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
const float averageStep = 100.0f;
- for( int i = 1 ; i < 10 ; i++ )
+ for(int i = 1; i < 10; i++)
{
values.PushBack(i * averageStep + (i % 2 == 0 ? -(averageStep * 0.2f) : (averageStep * 0.2f)));
}
// float
- PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::POSITION, 0, VariableStepCondition(values) );
- notification.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION, 0, VariableStepCondition(values));
+ notification.NotifySignal().Connect(&TestCallback);
// set initial position lower than first position in list
- actor.SetProperty( Actor::Property::POSITION, Vector3(values[0] - averageStep, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(values[0] - averageStep, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- for( unsigned int i = 0 ; i < values.Count() - 1 ; ++i )
+ for(unsigned int i = 0; i < values.Count() - 1; ++i)
{
gCallBackCalled = false;
// set position half way between the current values
float position = values[i] + (0.5f * (values[i + 1] - values[i]));
- actor.SetProperty( Actor::Property::POSITION, Vector3(position, 0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(position, 0.0f, 0.0f));
Wait(application, DEFAULT_WAIT_PERIOD);
- DALI_TEST_CHECK( gCallBackCalled );
+ DALI_TEST_CHECK(gCallBackCalled);
}
END_TEST;
}
static bool gCallBack2Called = false;
-void TestCallback2(PropertyNotification& source)
+void TestCallback2(PropertyNotification& source)
{
gCallBack2Called = true;
}
Actor actor = Actor::New();
application.GetScene().Add(actor);
// this should complete in first frame
- PropertyNotification notification1 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(90.0f) );
- notification1.NotifySignal().Connect( &TestCallback );
+ PropertyNotification notification1 = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(90.0f));
+ notification1.NotifySignal().Connect(&TestCallback);
// this should complete in second frame
- PropertyNotification notification2 = actor.AddPropertyNotification( Actor::Property::POSITION_X, GreaterThanCondition(150.0f) );
- notification2.NotifySignal().Connect( &TestCallback2 );
- Animation animation = Animation::New( 0.032f ); // finishes in 32 ms
- animation.AnimateTo( Property(actor, Actor::Property::POSITION ), Vector3( 200.0f, 0.0f, 0.0f ), AlphaFunction::LINEAR );
+ PropertyNotification notification2 = actor.AddPropertyNotification(Actor::Property::POSITION_X, GreaterThanCondition(150.0f));
+ notification2.NotifySignal().Connect(&TestCallback2);
+ Animation animation = Animation::New(0.032f); // finishes in 32 ms
+ animation.AnimateTo(Property(actor, Actor::Property::POSITION), Vector3(200.0f, 0.0f, 0.0f), AlphaFunction::LINEAR);
animation.Play();
// flush the queue
// first frame
application.Render(RENDER_FRAME_INTERVAL);
// no notifications yet
- DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
- gCallBackCalled = false;
+ DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION);
+ gCallBackCalled = false;
gCallBack2Called = false;
// dont serve the notifications but run another update & render
// this simulates situation where there is a notification in event side but it's not been picked up by event thread
// second frame
application.Render(RENDER_FRAME_INTERVAL);
- DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION);
// serve the notifications
application.SendNotification();
- DALI_TEST_EQUALS( gCallBackCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( gCallBack2Called, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(gCallBackCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(gCallBack2Called, true, TEST_LOCATION);
- gCallBackCalled = false;
+ gCallBackCalled = false;
gCallBack2Called = false;
application.Render(RENDER_FRAME_INTERVAL);
application.SendNotification();
- DALI_TEST_EQUALS( gCallBackCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( gCallBack2Called, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(gCallBackCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(gCallBack2Called, false, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyConditionGetArgumentNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::PropertyCondition instance;
instance.Reset();
try
int UtcDaliPropertyConditionGetArgumentCountNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::PropertyCondition instance;
instance.Reset();
try
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-#include <iomanip>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iomanip>
+#include <iostream>
using namespace Dali;
int UtcDaliPropertyTypesGetNameP(void)
{
- DALI_TEST_EQUALS( "NONE", Dali::PropertyTypes::GetName(Property::NONE ), TEST_LOCATION );
- DALI_TEST_EQUALS( "BOOLEAN", Dali::PropertyTypes::GetName(Property::BOOLEAN ), TEST_LOCATION );
- DALI_TEST_EQUALS( "FLOAT", Dali::PropertyTypes::GetName(Property::FLOAT ), TEST_LOCATION );
- DALI_TEST_EQUALS( "INTEGER", Dali::PropertyTypes::GetName(Property::INTEGER ), TEST_LOCATION );
- DALI_TEST_EQUALS( "VECTOR2", Dali::PropertyTypes::GetName(Property::VECTOR2 ), TEST_LOCATION );
- DALI_TEST_EQUALS( "VECTOR3", Dali::PropertyTypes::GetName(Property::VECTOR3 ), TEST_LOCATION );
- DALI_TEST_EQUALS( "VECTOR4", Dali::PropertyTypes::GetName(Property::VECTOR4 ), TEST_LOCATION );
- DALI_TEST_EQUALS( "MATRIX3", Dali::PropertyTypes::GetName(Property::MATRIX3 ), TEST_LOCATION );
- DALI_TEST_EQUALS( "MATRIX", Dali::PropertyTypes::GetName(Property::MATRIX ), TEST_LOCATION );
- DALI_TEST_EQUALS( "RECTANGLE", Dali::PropertyTypes::GetName(Property::RECTANGLE ), TEST_LOCATION );
- DALI_TEST_EQUALS( "ROTATION", Dali::PropertyTypes::GetName(Property::ROTATION ), TEST_LOCATION );
- DALI_TEST_EQUALS( "STRING", Dali::PropertyTypes::GetName(Property::STRING ), TEST_LOCATION );
- DALI_TEST_EQUALS( "ARRAY", Dali::PropertyTypes::GetName(Property::ARRAY ), TEST_LOCATION );
- DALI_TEST_EQUALS( "MAP", Dali::PropertyTypes::GetName(Property::MAP ), TEST_LOCATION );
+ DALI_TEST_EQUALS("NONE", Dali::PropertyTypes::GetName(Property::NONE), TEST_LOCATION);
+ DALI_TEST_EQUALS("BOOLEAN", Dali::PropertyTypes::GetName(Property::BOOLEAN), TEST_LOCATION);
+ DALI_TEST_EQUALS("FLOAT", Dali::PropertyTypes::GetName(Property::FLOAT), TEST_LOCATION);
+ DALI_TEST_EQUALS("INTEGER", Dali::PropertyTypes::GetName(Property::INTEGER), TEST_LOCATION);
+ DALI_TEST_EQUALS("VECTOR2", Dali::PropertyTypes::GetName(Property::VECTOR2), TEST_LOCATION);
+ DALI_TEST_EQUALS("VECTOR3", Dali::PropertyTypes::GetName(Property::VECTOR3), TEST_LOCATION);
+ DALI_TEST_EQUALS("VECTOR4", Dali::PropertyTypes::GetName(Property::VECTOR4), TEST_LOCATION);
+ DALI_TEST_EQUALS("MATRIX3", Dali::PropertyTypes::GetName(Property::MATRIX3), TEST_LOCATION);
+ DALI_TEST_EQUALS("MATRIX", Dali::PropertyTypes::GetName(Property::MATRIX), TEST_LOCATION);
+ DALI_TEST_EQUALS("RECTANGLE", Dali::PropertyTypes::GetName(Property::RECTANGLE), TEST_LOCATION);
+ DALI_TEST_EQUALS("ROTATION", Dali::PropertyTypes::GetName(Property::ROTATION), TEST_LOCATION);
+ DALI_TEST_EQUALS("STRING", Dali::PropertyTypes::GetName(Property::STRING), TEST_LOCATION);
+ DALI_TEST_EQUALS("ARRAY", Dali::PropertyTypes::GetName(Property::ARRAY), TEST_LOCATION);
+ DALI_TEST_EQUALS("MAP", Dali::PropertyTypes::GetName(Property::MAP), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyTypesGet02P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<bool>() == Property::BOOLEAN );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<bool>() == Property::BOOLEAN);
END_TEST;
}
int UtcDaliPropertyTypesGet03P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<float>() == Property::FLOAT );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<float>() == Property::FLOAT);
END_TEST;
}
int UtcDaliPropertyTypesGet04P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<int>() == Property::INTEGER );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<int>() == Property::INTEGER);
END_TEST;
}
int UtcDaliPropertyTypesGet06P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Vector2>() == Property::VECTOR2 );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Vector2>() == Property::VECTOR2);
END_TEST;
}
int UtcDaliPropertyTypesGet07P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Vector3>() == Property::VECTOR3 );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Vector3>() == Property::VECTOR3);
END_TEST;
}
int UtcDaliPropertyTypesGet08P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Vector4>() == Property::VECTOR4 );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Vector4>() == Property::VECTOR4);
END_TEST;
}
int UtcDaliPropertyTypesGet09P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Matrix3>() == Property::MATRIX3 );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Matrix3>() == Property::MATRIX3);
END_TEST;
}
int UtcDaliPropertyTypesGet10(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Matrix>() == Property::MATRIX );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Matrix>() == Property::MATRIX);
END_TEST;
}
int UtcDaliPropertyTypesGet11P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::AngleAxis>() == Property::ROTATION );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::AngleAxis>() == Property::ROTATION);
END_TEST;
}
int UtcDaliPropertyTypesGet12P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Quaternion>() == Property::ROTATION );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Quaternion>() == Property::ROTATION);
END_TEST;
}
int UtcDaliPropertyTypesGet13P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<std::string>() == Property::STRING );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<std::string>() == Property::STRING);
END_TEST;
}
int UtcDaliPropertyTypesGet14P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Rect<int> >() == Property::RECTANGLE );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Rect<int> >() == Property::RECTANGLE);
END_TEST;
}
int UtcDaliPropertyTypesGet15P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Property::Map>() == Property::MAP );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Property::Map>() == Property::MAP);
END_TEST;
}
int UtcDaliPropertyTypesGet16P(void)
{
- DALI_TEST_CHECK( Dali::PropertyTypes::Get<Dali::Property::Array>() == Property::ARRAY );
+ DALI_TEST_CHECK(Dali::PropertyTypes::Get<Dali::Property::Array>() == Property::ARRAY);
END_TEST;
}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
-#include <iomanip>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iomanip>
+#include <iostream>
using namespace Dali;
namespace
{
-
-template <typename T>
+template<typename T>
struct CheckCopyCtorP
{
CheckCopyCtorP(Property::Value value)
{
- Property::Value copy( value );
- DALI_TEST_CHECK( value.Get<T>() == copy.Get<T>() );
+ Property::Value copy(value);
+ DALI_TEST_CHECK(value.Get<T>() == copy.Get<T>());
}
};
test_return_value = TET_PASS;
}
-
int UtcDaliPropertyValueConstructorsNoneP(void)
{
Property::Value value;
- DALI_TEST_CHECK( value.GetType() == Property::NONE );
+ DALI_TEST_CHECK(value.GetType() == Property::NONE);
END_TEST;
}
int UtcDaliPropertyValueConstructorsNoneTypeP(void)
{
- Property::Value value( Property::NONE );
+ Property::Value value(Property::NONE);
- DALI_TEST_CHECK( value.GetType() == Property::NONE );
+ DALI_TEST_CHECK(value.GetType() == Property::NONE);
END_TEST;
}
{
Property::Value value(true);
- DALI_TEST_CHECK( value.GetType() == Property::BOOLEAN );
- DALI_TEST_CHECK( value.Get<bool>() == true );
+ DALI_TEST_CHECK(value.GetType() == Property::BOOLEAN);
+ DALI_TEST_CHECK(value.Get<bool>() == true);
END_TEST;
}
{
Property::Value value(Property::BOOLEAN);
- DALI_TEST_CHECK( value.GetType() == Property::BOOLEAN );
- DALI_TEST_CHECK( value.Get<bool>() == false );
+ DALI_TEST_CHECK(value.GetType() == Property::BOOLEAN);
+ DALI_TEST_CHECK(value.Get<bool>() == false);
END_TEST;
}
{
Property::Value value(2.f);
- DALI_TEST_CHECK( value.GetType() == Property::FLOAT );
- DALI_TEST_CHECK( value.Get<float>() == 2.f );
+ DALI_TEST_CHECK(value.GetType() == Property::FLOAT);
+ DALI_TEST_CHECK(value.Get<float>() == 2.f);
END_TEST;
}
{
Property::Value value(Property::FLOAT);
- DALI_TEST_CHECK( value.GetType() == Property::FLOAT );
- DALI_TEST_CHECK( value.Get<float>() == 0.f );
+ DALI_TEST_CHECK(value.GetType() == Property::FLOAT);
+ DALI_TEST_CHECK(value.Get<float>() == 0.f);
END_TEST;
}
{
Property::Value value(1);
- DALI_TEST_CHECK( value.GetType() == Property::INTEGER );
- DALI_TEST_CHECK( value.Get<int>() == 1 );
+ DALI_TEST_CHECK(value.GetType() == Property::INTEGER);
+ DALI_TEST_CHECK(value.Get<int>() == 1);
END_TEST;
}
{
Property::Value value(Property::INTEGER);
- DALI_TEST_CHECK( value.GetType() == Property::INTEGER );
- DALI_TEST_CHECK( value.Get<int>() == 0 );
+ DALI_TEST_CHECK(value.GetType() == Property::INTEGER);
+ DALI_TEST_CHECK(value.Get<int>() == 0);
END_TEST;
}
int UtcDaliPropertyValueConstructorsVector2P(void)
{
- Vector2 v(1,1);
+ Vector2 v(1, 1);
Property::Value value(v);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR2 );
- DALI_TEST_CHECK( value.Get<Vector2>() == v );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR2);
+ DALI_TEST_CHECK(value.Get<Vector2>() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsVector2TypeP(void)
{
- Property::Value value( Property::VECTOR2 );
+ Property::Value value(Property::VECTOR2);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR2 );
- DALI_TEST_CHECK( value.Get<Vector2>() == Vector2::ZERO );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR2);
+ DALI_TEST_CHECK(value.Get<Vector2>() == Vector2::ZERO);
END_TEST;
}
int UtcDaliPropertyValueConstructorsVector3P(void)
{
- Vector3 v(1.f,2.f,3.f);
+ Vector3 v(1.f, 2.f, 3.f);
Property::Value value(v);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR3 );
- DALI_TEST_CHECK( value.Get<Vector3>() == v );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR3);
+ DALI_TEST_CHECK(value.Get<Vector3>() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsVector3TypeP(void)
{
- Property::Value value( Property::VECTOR3 );
+ Property::Value value(Property::VECTOR3);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR3 );
- DALI_TEST_CHECK( value.Get<Vector3>() == Vector3() );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR3);
+ DALI_TEST_CHECK(value.Get<Vector3>() == Vector3());
END_TEST;
}
int UtcDaliPropertyValueConstructorsVector4P(void)
{
- Vector4 v(1.f,1.f,1.f,0.9f);
+ Vector4 v(1.f, 1.f, 1.f, 0.9f);
Property::Value value(v);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR4 );
- DALI_TEST_CHECK( value.Get<Vector4>() == v );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR4);
+ DALI_TEST_CHECK(value.Get<Vector4>() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsVector4TypeP(void)
{
- Property::Value value( Property::VECTOR4 );
+ Property::Value value(Property::VECTOR4);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR4 );
- DALI_TEST_CHECK( value.Get<Vector4>() == Vector4() );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR4);
+ DALI_TEST_CHECK(value.Get<Vector4>() == Vector4());
END_TEST;
}
int UtcDaliPropertyValueConstructorsMatrix3P(void)
{
- Matrix3 v(1.0,1.0,1.0, 1.0,1.0,1.0, 1.0,1.0,1.0);
+ Matrix3 v(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
Property::Value value(v);
- DALI_TEST_CHECK( value.GetType() == Property::MATRIX3 );
- DALI_TEST_CHECK( value.Get<Matrix3>() == v );
+ DALI_TEST_CHECK(value.GetType() == Property::MATRIX3);
+ DALI_TEST_CHECK(value.Get<Matrix3>() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsMatrix3TypeP(void)
{
- Property::Value value( Property::MATRIX3 );
+ Property::Value value(Property::MATRIX3);
- DALI_TEST_CHECK( value.GetType() == Property::MATRIX3 );
- DALI_TEST_CHECK( value.Get<Matrix3>() == Matrix3() );
+ DALI_TEST_CHECK(value.GetType() == Property::MATRIX3);
+ DALI_TEST_CHECK(value.Get<Matrix3>() == Matrix3());
END_TEST;
}
int UtcDaliPropertyValueConstructorsMatrixP(void)
{
- 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);
+ 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);
- DALI_TEST_CHECK( value.GetType() == Property::MATRIX );
- DALI_TEST_CHECK( value.Get<Matrix>() == v );
+ DALI_TEST_CHECK(value.GetType() == Property::MATRIX);
+ DALI_TEST_CHECK(value.Get<Matrix>() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsMatrixTypeP(void)
{
- Property::Value value( Property::MATRIX );
+ Property::Value value(Property::MATRIX);
- DALI_TEST_CHECK( value.GetType() == Property::MATRIX );
- DALI_TEST_CHECK( value.Get<Matrix>() == Matrix() );
+ DALI_TEST_CHECK(value.GetType() == Property::MATRIX);
+ DALI_TEST_CHECK(value.Get<Matrix>() == Matrix());
END_TEST;
}
int UtcDaliPropertyValueConstructorsRectP(void)
{
- Rect<int> v(1.0,1.0,1.0,1.0);
+ Rect<int> v(1.0, 1.0, 1.0, 1.0);
Property::Value value(v);
- DALI_TEST_EQUALS( value.GetType(), Property::RECTANGLE, TEST_LOCATION );
- DALI_TEST_CHECK( value.Get<Rect<int> >() == v );
+ DALI_TEST_EQUALS(value.GetType(), Property::RECTANGLE, TEST_LOCATION);
+ DALI_TEST_CHECK(value.Get<Rect<int> >() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsRectTypeP(void)
{
- Property::Value value( Property::RECTANGLE );
+ Property::Value value(Property::RECTANGLE);
- DALI_TEST_CHECK( value.GetType() == Property::RECTANGLE );
- DALI_TEST_CHECK( value.Get<Rect<int> >() == Rect<int>(0,0,0,0) );
+ DALI_TEST_CHECK(value.GetType() == Property::RECTANGLE);
+ DALI_TEST_CHECK(value.Get<Rect<int> >() == Rect<int>(0, 0, 0, 0));
END_TEST;
}
int UtcDaliPropertyValueConstructorsAngleAxisP(void)
{
- AngleAxis input( Dali::ANGLE_90, Vector3::XAXIS );
- Property::Value value( input );
+ AngleAxis input(Dali::ANGLE_90, Vector3::XAXIS);
+ Property::Value value(input);
- DALI_TEST_CHECK( value.GetType() == Property::ROTATION );
+ DALI_TEST_CHECK(value.GetType() == Property::ROTATION);
AngleAxis result = value.Get<AngleAxis>();
- DALI_TEST_EQUALS( result.angle, input.angle, TEST_LOCATION );
- DALI_TEST_EQUALS( result.axis, input.axis, TEST_LOCATION );
+ DALI_TEST_EQUALS(result.angle, input.angle, TEST_LOCATION);
+ DALI_TEST_EQUALS(result.axis, input.axis, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueConstructorsQuaternionP(void)
{
- Quaternion v( Radian( Math::PI ), Vector3::ZAXIS );
+ Quaternion v(Radian(Math::PI), Vector3::ZAXIS);
Property::Value value(v);
- DALI_TEST_CHECK( value.GetType() == Property::ROTATION );
- DALI_TEST_EQUALS( v, value.Get<Quaternion>(), 0.001, TEST_LOCATION);
+ DALI_TEST_CHECK(value.GetType() == Property::ROTATION);
+ DALI_TEST_EQUALS(v, value.Get<Quaternion>(), 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueConstructorsRotationTypeP(void)
{
- Property::Value value( Property::ROTATION );
+ Property::Value value(Property::ROTATION);
- DALI_TEST_CHECK( value.GetType() == Property::ROTATION );
+ DALI_TEST_CHECK(value.GetType() == Property::ROTATION);
AngleAxis result = value.Get<AngleAxis>();
- DALI_TEST_EQUALS( result.angle, Radian(0.f), TEST_LOCATION );
- DALI_TEST_EQUALS( result.axis, Vector3::ZERO, TEST_LOCATION ); // identity quaternion returns a zero angle-axis
+ DALI_TEST_EQUALS(result.angle, Radian(0.f), TEST_LOCATION);
+ DALI_TEST_EQUALS(result.axis, Vector3::ZERO, TEST_LOCATION); // identity quaternion returns a zero angle-axis
END_TEST;
}
int UtcDaliPropertyValueConstructorsStringP(void)
{
- std::string v("1");
+ std::string v("1");
Property::Value value(v);
- DALI_TEST_CHECK( value.GetType() == Property::STRING );
- DALI_TEST_CHECK( value.Get<std::string>() == v );
+ DALI_TEST_CHECK(value.GetType() == Property::STRING);
+ DALI_TEST_CHECK(value.Get<std::string>() == v);
END_TEST;
}
int UtcDaliPropertyValueConstructorsStringTypeP(void)
{
- Property::Value value( Property::STRING );
+ Property::Value value(Property::STRING);
- DALI_TEST_CHECK( value.GetType() == Property::STRING );
- DALI_TEST_CHECK( value.Get<std::string>() == std::string() );
+ DALI_TEST_CHECK(value.GetType() == Property::STRING);
+ DALI_TEST_CHECK(value.Get<std::string>() == std::string());
END_TEST;
}
int UtcDaliPropertyValueConstructorsArrayP(void)
{
Property::Array foo;
- Property::Value value( foo );
+ Property::Value value(foo);
- DALI_TEST_CHECK( value.GetType() == Property::ARRAY );
- DALI_TEST_CHECK( value.Get<Property::Array>().Count() == 0 );
+ DALI_TEST_CHECK(value.GetType() == Property::ARRAY);
+ DALI_TEST_CHECK(value.Get<Property::Array>().Count() == 0);
END_TEST;
}
int UtcDaliPropertyValueConstructorsArray2P(void)
{
Property::Array foo;
- foo.PushBack( Property::Value() );
- Property::Value value( foo );
+ foo.PushBack(Property::Value());
+ Property::Value value(foo);
- DALI_TEST_CHECK( value.GetType() == Property::ARRAY );
- DALI_TEST_CHECK( value.Get<Property::Array>().Count() == 1 );
+ DALI_TEST_CHECK(value.GetType() == Property::ARRAY);
+ DALI_TEST_CHECK(value.Get<Property::Array>().Count() == 1);
END_TEST;
}
{
Property::Value value(Property::ARRAY);
- DALI_TEST_CHECK( value.GetType() == Property::ARRAY );
- DALI_TEST_CHECK( value.Get<Property::Array>().Count() == 0 );
+ DALI_TEST_CHECK(value.GetType() == Property::ARRAY);
+ DALI_TEST_CHECK(value.Get<Property::Array>().Count() == 0);
END_TEST;
}
int UtcDaliPropertyValueConstructorsMapP(void)
{
- Property::Map map;
- Property::Value value( map );
+ Property::Map map;
+ Property::Value value(map);
- DALI_TEST_CHECK( value.GetType() == Property::MAP );
- DALI_TEST_CHECK( value.Get<Property::Map>().Count() == 0 );
+ DALI_TEST_CHECK(value.GetType() == Property::MAP);
+ DALI_TEST_CHECK(value.Get<Property::Map>().Count() == 0);
END_TEST;
}
int UtcDaliPropertyValueConstructorsMap2P(void)
{
Property::Map map;
- map.Insert( "", "" );
- Property::Value value( map );
+ map.Insert("", "");
+ Property::Value value(map);
- DALI_TEST_CHECK( value.GetType() == Property::MAP );
- DALI_TEST_CHECK( value.Get<Property::Map>().Count() == 1 );
+ DALI_TEST_CHECK(value.GetType() == Property::MAP);
+ DALI_TEST_CHECK(value.Get<Property::Map>().Count() == 1);
END_TEST;
}
{
Property::Value value(Property::MAP);
- DALI_TEST_CHECK( value.GetType() == Property::MAP );
- DALI_TEST_CHECK( value.Get<Property::Map>().Count() == 0 );
+ DALI_TEST_CHECK(value.GetType() == Property::MAP);
+ DALI_TEST_CHECK(value.Get<Property::Map>().Count() == 0);
END_TEST;
}
int UtcDaliPropertyValueConstructorsExtentsTypeP(void)
{
- Property::Value value( Property::EXTENTS );
+ Property::Value value(Property::EXTENTS);
- DALI_TEST_CHECK( value.GetType() == Property::EXTENTS );
- DALI_TEST_CHECK( value.Get<Extents>() == Extents( 0u, 0u, 0u, 0u ) );
+ DALI_TEST_CHECK(value.GetType() == Property::EXTENTS);
+ DALI_TEST_CHECK(value.Get<Extents>() == Extents(0u, 0u, 0u, 0u));
END_TEST;
}
int UtcDaliPropertyValueConstructorsExtentsType2P(void)
{
- Property::Value value( Property::VECTOR4 );
+ Property::Value value(Property::VECTOR4);
- DALI_TEST_CHECK( value.GetType() == Property::VECTOR4 );
- DALI_TEST_CHECK( value.Get<Extents>() == Extents( 0u, 0u, 0u, 0u ) );
+ DALI_TEST_CHECK(value.GetType() == Property::VECTOR4);
+ DALI_TEST_CHECK(value.Get<Extents>() == Extents(0u, 0u, 0u, 0u));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorP(void)
{
Property::Value value;
- Property::Value value2( value );
- DALI_TEST_EQUALS( value.GetType(), value2.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( value.GetMap(), value2.GetMap(), TEST_LOCATION );
- DALI_TEST_EQUALS( value.GetArray(), value2.GetArray(), TEST_LOCATION );
+ Property::Value value2(value);
+ DALI_TEST_EQUALS(value.GetType(), value2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(value.GetMap(), value2.GetMap(), TEST_LOCATION);
+ DALI_TEST_EQUALS(value.GetArray(), value2.GetArray(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueCopyConstructoVector2P(void)
{
- CheckCopyCtorP<Vector2> check( Vector2(2,1) );
+ CheckCopyCtorP<Vector2> check(Vector2(2, 1));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorVector3P(void)
{
- CheckCopyCtorP<Vector3> check( Vector3(3.f,2.f,1.f) );
+ CheckCopyCtorP<Vector3> check(Vector3(3.f, 2.f, 1.f));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorVector4P(void)
{
- CheckCopyCtorP<Vector3> check( Vector4(4.f,3.f,2.f,1.f) );
+ CheckCopyCtorP<Vector3> check(Vector4(4.f, 3.f, 2.f, 1.f));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorMatrix3P(void)
{
- CheckCopyCtorP<Matrix3> check( Matrix3::IDENTITY );
+ CheckCopyCtorP<Matrix3> check(Matrix3::IDENTITY);
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorRectP(void)
{
- CheckCopyCtorP<Rect<int> > check( Rect<int>(1.0,1.0,1.0,1.0) );
+ CheckCopyCtorP<Rect<int> > check(Rect<int>(1.0, 1.0, 1.0, 1.0));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorAngleAxisP(void)
{
- CheckCopyCtorP<AngleAxis> check( AngleAxis(Degree(1.0), Vector3(1.0,1.0,1.0)) );
+ CheckCopyCtorP<AngleAxis> check(AngleAxis(Degree(1.0), Vector3(1.0, 1.0, 1.0)));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorQuaternionP(void)
{
- CheckCopyCtorP<Quaternion> check( Quaternion( Vector4(1.0, 1.0, 1.0, 1.0) ) );
+ CheckCopyCtorP<Quaternion> check(Quaternion(Vector4(1.0, 1.0, 1.0, 1.0)));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorStringP(void)
{
- CheckCopyCtorP<std::string> check( std::string("1") );
+ CheckCopyCtorP<std::string> check(std::string("1"));
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorArrayP(void)
{
- Property::Value value1(Property::ARRAY);
- Property::Array* array= value1.GetArray();
+ Property::Value value1(Property::ARRAY);
+ Property::Array* array = value1.GetArray();
array->PushBack(Property::Value(1));
- Property::Value value2( value1 );
- DALI_TEST_EQUALS( value1.GetType(), value2.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( value1.GetArray()->Count(), value2.GetArray()->Count(), TEST_LOCATION );
+ Property::Value value2(value1);
+ DALI_TEST_EQUALS(value1.GetType(), value2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(value1.GetArray()->Count(), value2.GetArray()->Count(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueCopyConstructorMapP(void)
{
Property::Value value1(Property::MAP);
- Property::Map* map = value1.GetMap();
- (*map)["1"] = Property::Value(1);
+ Property::Map* map = value1.GetMap();
+ (*map)["1"] = Property::Value(1);
- Property::Value value2( value1 );
- DALI_TEST_EQUALS( value1.GetType(), value2.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( value1.GetMap()->Count(), value2.GetMap()->Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( value1.GetMap()->GetKey( 0 ), value2.GetMap()->GetKey( 0 ), TEST_LOCATION );
+ Property::Value value2(value1);
+ DALI_TEST_EQUALS(value1.GetType(), value2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(value1.GetMap()->Count(), value2.GetMap()->Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(value1.GetMap()->GetKey(0), value2.GetMap()->GetKey(0), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueMoveConstructor(void)
{
- Property::Value value1( Vector4::ONE );
- DALI_TEST_EQUALS( Property::VECTOR4, value1.GetType(), TEST_LOCATION );
+ Property::Value value1(Vector4::ONE);
+ DALI_TEST_EQUALS(Property::VECTOR4, value1.GetType(), TEST_LOCATION);
Vector4 valueVector;
- DALI_TEST_EQUALS( true, value1.Get( valueVector ), TEST_LOCATION ); // Able to convert
- DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value1.Get(valueVector), TEST_LOCATION); // Able to convert
+ DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION);
- Property::Value value2( std::move( value1 ) );
- DALI_TEST_EQUALS( Property::NONE, value1.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value1.Get( valueVector ), TEST_LOCATION ); // Unable to convert, but no crash either
- DALI_TEST_EQUALS( Property::VECTOR4, value2.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value2.Get( valueVector ), TEST_LOCATION ); // Able to convert
- DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION );
+ Property::Value value2(std::move(value1));
+ DALI_TEST_EQUALS(Property::NONE, value1.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value1.Get(valueVector), TEST_LOCATION); // Unable to convert, but no crash either
+ DALI_TEST_EQUALS(Property::VECTOR4, value2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value2.Get(valueVector), TEST_LOCATION); // Able to convert
+ DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueMoveConstructorArray(void)
{
Property::Array array;
- array.PushBack( 1 );
- array.PushBack( 2 );
- array.PushBack( 3 );
- DALI_TEST_EQUALS( 3u, array.Size(), TEST_LOCATION );
+ array.PushBack(1);
+ array.PushBack(2);
+ array.PushBack(3);
+ DALI_TEST_EQUALS(3u, array.Size(), TEST_LOCATION);
- Property::Value value( std::move( array ) );
- DALI_TEST_ASSERTION( array.Size(), "Cannot use an object previously used as an r-value" ); // Our local variable should become invalid
+ Property::Value value(std::move(array));
+ DALI_TEST_ASSERTION(array.Size(), "Cannot use an object previously used as an r-value"); // Our local variable should become invalid
Property::Array* arrayPtr = value.GetArray();
- DALI_TEST_CHECK( arrayPtr );
- DALI_TEST_EQUALS( 3u, arrayPtr->Size(), TEST_LOCATION );
+ DALI_TEST_CHECK(arrayPtr);
+ DALI_TEST_EQUALS(3u, arrayPtr->Size(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueMoveConstructorMap(void)
{
Property::Map map;
- map[ 1 ] = 1;
- map[ 2 ] = 2;
- map[ 3 ] = 3;
- DALI_TEST_EQUALS( 3u, map.Count(), TEST_LOCATION );
+ map[1] = 1;
+ map[2] = 2;
+ map[3] = 3;
+ DALI_TEST_EQUALS(3u, map.Count(), TEST_LOCATION);
- Property::Value value( std::move( map ) );
- DALI_TEST_ASSERTION( map.Count(), "Cannot use an object previously used as an r-value" ); // Our local variable should become invalid
+ Property::Value value(std::move(map));
+ DALI_TEST_ASSERTION(map.Count(), "Cannot use an object previously used as an r-value"); // Our local variable should become invalid
Property::Map* mapPtr = value.GetMap();
- DALI_TEST_CHECK( mapPtr );
- DALI_TEST_EQUALS( 3u, mapPtr->Count(), TEST_LOCATION );
+ DALI_TEST_CHECK(mapPtr);
+ DALI_TEST_EQUALS(3u, mapPtr->Count(), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueAssignmentSelfP(void)
{
- Property::Value value;
+ Property::Value value;
Property::Value* self = &value;
- value = *self;
- DALI_TEST_EQUALS( value.GetType(), Property::NONE, TEST_LOCATION );
- DALI_TEST_CHECK( value.GetMap() == NULL );
- DALI_TEST_CHECK( value.GetArray() == NULL );
+ value = *self;
+ DALI_TEST_EQUALS(value.GetType(), Property::NONE, TEST_LOCATION);
+ DALI_TEST_CHECK(value.GetMap() == NULL);
+ DALI_TEST_CHECK(value.GetArray() == NULL);
END_TEST;
}
{
Property::Value value;
value = Property::Value(); // type match
- DALI_TEST_EQUALS( value.GetType(), Property::NONE, TEST_LOCATION );
- Property::Value copy( false );
+ DALI_TEST_EQUALS(value.GetType(), Property::NONE, TEST_LOCATION);
+ Property::Value copy(false);
copy = value; // type mismatch
- DALI_TEST_EQUALS( value.GetType(), Property::NONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(value.GetType(), Property::NONE, TEST_LOCATION);
END_TEST;
}
{
Property::Value value;
value = Property::Value(true); // type mismatch
- DALI_TEST_CHECK( true == value.Get<bool>() );
- Property::Value copy( false );
+ DALI_TEST_CHECK(true == value.Get<bool>());
+ Property::Value copy(false);
copy = value; // type match
- DALI_TEST_CHECK( true == copy.Get<bool>() );
+ DALI_TEST_CHECK(true == copy.Get<bool>());
END_TEST;
}
{
Property::Value value;
value = Property::Value(10); // type mismatch
- DALI_TEST_CHECK( 10 == value.Get<int>() );
- Property::Value copy( 99 );
+ DALI_TEST_CHECK(10 == value.Get<int>());
+ Property::Value copy(99);
copy = value; // type match
- DALI_TEST_CHECK( 10 == copy.Get<int>() );
+ DALI_TEST_CHECK(10 == copy.Get<int>());
END_TEST;
}
{
Property::Value value;
value = Property::Value(10.f); // mismatch
- DALI_TEST_CHECK( Dali::Equals(10.f, value.Get<float>() ) );
+ DALI_TEST_CHECK(Dali::Equals(10.f, value.Get<float>()));
Property::Value copy(321.f);
copy = value; // match
- DALI_TEST_CHECK( Dali::Equals(10.f, copy.Get<float>() ) );
+ DALI_TEST_CHECK(Dali::Equals(10.f, copy.Get<float>()));
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorVector2P(void)
{
Property::Value value;
- value = Property::Value( Vector2(1,2) ); // mismatch
- DALI_TEST_CHECK( Vector2(1,2) == value.Get<Vector2>() );
- Property::Value copy( Property::VECTOR2 );
+ value = Property::Value(Vector2(1, 2)); // mismatch
+ DALI_TEST_CHECK(Vector2(1, 2) == value.Get<Vector2>());
+ Property::Value copy(Property::VECTOR2);
copy = value; // match
- DALI_TEST_CHECK( Vector2(1,2) == copy.Get<Vector2>() );
+ DALI_TEST_CHECK(Vector2(1, 2) == copy.Get<Vector2>());
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorVector3P(void)
{
Property::Value value;
- value = Property::Value( Vector3(1.f,2.f,3.f) ); // mismatch
- DALI_TEST_CHECK( Vector3(1.f,2.f,3.f) == value.Get<Vector3>() );
- Property::Value copy( Property::VECTOR3 );
+ value = Property::Value(Vector3(1.f, 2.f, 3.f)); // mismatch
+ DALI_TEST_CHECK(Vector3(1.f, 2.f, 3.f) == value.Get<Vector3>());
+ Property::Value copy(Property::VECTOR3);
copy = value; // match
- DALI_TEST_CHECK( Vector3(1.f,2.f,3.f) == copy.Get<Vector3>() );
+ DALI_TEST_CHECK(Vector3(1.f, 2.f, 3.f) == copy.Get<Vector3>());
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorVector4P(void)
{
Property::Value value;
- value = Property::Value( Vector4(1,2,3,4) ); // mismatch
- DALI_TEST_CHECK( Vector4(1,2,3,4) == value.Get<Vector4>() );
- Property::Value copy( Vector4(0,1,2,3) );
+ value = Property::Value(Vector4(1, 2, 3, 4)); // mismatch
+ DALI_TEST_CHECK(Vector4(1, 2, 3, 4) == value.Get<Vector4>());
+ Property::Value copy(Vector4(0, 1, 2, 3));
copy = value; // match
- DALI_TEST_CHECK( Vector4(1,2,3,4) == copy.Get<Vector4>() );
+ DALI_TEST_CHECK(Vector4(1, 2, 3, 4) == copy.Get<Vector4>());
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorMatrix3P(void)
{
Property::Value value;
- value = Property::Value( Matrix3::IDENTITY ); // mismatch
- DALI_TEST_CHECK( Matrix3::IDENTITY == value.Get<Matrix3>() );
- Property::Value copy( Property::MATRIX3 );
+ value = Property::Value(Matrix3::IDENTITY); // mismatch
+ DALI_TEST_CHECK(Matrix3::IDENTITY == value.Get<Matrix3>());
+ Property::Value copy(Property::MATRIX3);
copy = value; // match
- DALI_TEST_CHECK( Matrix3::IDENTITY == copy.Get<Matrix3>() );
+ DALI_TEST_CHECK(Matrix3::IDENTITY == copy.Get<Matrix3>());
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorMatrixP(void)
{
Property::Value value;
- value = Property::Value( Matrix::IDENTITY ); // mismatch
- DALI_TEST_CHECK( Matrix::IDENTITY == value.Get<Matrix>() );
- Matrix foo;
- Property::Value copy( foo );
+ value = Property::Value(Matrix::IDENTITY); // mismatch
+ DALI_TEST_CHECK(Matrix::IDENTITY == value.Get<Matrix>());
+ Matrix foo;
+ Property::Value copy(foo);
copy = value; // match
- DALI_TEST_CHECK( Matrix::IDENTITY == copy.Get<Matrix>() );
+ DALI_TEST_CHECK(Matrix::IDENTITY == copy.Get<Matrix>());
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorRectP(void)
{
- Property::Value value;
+ Property::Value value;
typedef Dali::Rect<int> Rectangle;
- value = Property::Value( Rectangle(4,3,2,1) ); // mismatch
- DALI_TEST_CHECK( Rectangle(4,3,2,1) == value.Get<Rectangle>() );
- Property::Value copy( Property::RECTANGLE );
+ value = Property::Value(Rectangle(4, 3, 2, 1)); // mismatch
+ DALI_TEST_CHECK(Rectangle(4, 3, 2, 1) == value.Get<Rectangle>());
+ Property::Value copy(Property::RECTANGLE);
copy = value; // match
Rectangle copyRect;
copy.Get(copyRect);
- DALI_TEST_CHECK( Rectangle(4,3,2,1) == copyRect );
+ DALI_TEST_CHECK(Rectangle(4, 3, 2, 1) == copyRect);
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorQuaternionP(void)
{
Property::Value value;
- Quaternion result( Radian( Math::PI_2 ), Vector3::YAXIS );
- value = Property::Value( result );
+ Quaternion result(Radian(Math::PI_2), Vector3::YAXIS);
+ value = Property::Value(result);
- DALI_TEST_EQUALS( value.Get<Quaternion>(), result, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(value.Get<Quaternion>(), result, 0.001, TEST_LOCATION);
- Property::Value copy( Property::ROTATION );
+ Property::Value copy(Property::ROTATION);
copy = value; // match
- DALI_TEST_EQUALS( copy.Get<Quaternion>(), result, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(copy.Get<Quaternion>(), result, 0.001, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliPropertyValueAssignmentOperatorAngleAxisP(void)
{
Property::Value value;
- value = Property::Value( AngleAxis( Radian(Math::PI_2), Vector3::XAXIS ) ); // mismatch
- DALI_TEST_EQUALS( value.Get<AngleAxis>().axis, Vector3::XAXIS, TEST_LOCATION );
- DALI_TEST_EQUALS( value.Get<AngleAxis>().angle, Radian(Math::PI_2), TEST_LOCATION );
- Property::Value copy( Property::ROTATION );
+ value = Property::Value(AngleAxis(Radian(Math::PI_2), Vector3::XAXIS)); // mismatch
+ DALI_TEST_EQUALS(value.Get<AngleAxis>().axis, Vector3::XAXIS, TEST_LOCATION);
+ DALI_TEST_EQUALS(value.Get<AngleAxis>().angle, Radian(Math::PI_2), TEST_LOCATION);
+ Property::Value copy(Property::ROTATION);
copy = value; // match
- DALI_TEST_EQUALS( value.Get<AngleAxis>().axis, copy.Get<AngleAxis>().axis, TEST_LOCATION );
- DALI_TEST_EQUALS( value.Get<AngleAxis>().angle, copy.Get<AngleAxis>().angle, TEST_LOCATION );
+ DALI_TEST_EQUALS(value.Get<AngleAxis>().axis, copy.Get<AngleAxis>().axis, TEST_LOCATION);
+ DALI_TEST_EQUALS(value.Get<AngleAxis>().angle, copy.Get<AngleAxis>().angle, TEST_LOCATION);
END_TEST;
}
{
Property::Value value;
value = Property::Value("yes"); // mismatch
- DALI_TEST_CHECK( "yes" == value.Get<std::string>() );
+ DALI_TEST_CHECK("yes" == value.Get<std::string>());
Property::Value copy("no");
copy = value; // match
- DALI_TEST_CHECK( "yes" == copy.Get<std::string>() );
+ DALI_TEST_CHECK("yes" == copy.Get<std::string>());
END_TEST;
}
Property::Value value;
value = Property::Value(Property::ARRAY); // mismatch
value.GetArray()->PushBack(10);
- DALI_TEST_CHECK( value.GetArray() );
+ DALI_TEST_CHECK(value.GetArray());
Property::Value copy(Property::ARRAY);
copy = value; // match
Property::Array array;
- copy.Get( array );
+ copy.Get(array);
int getItem = 0;
- array[0].Get( getItem );
- DALI_TEST_CHECK( getItem == 10 );
+ array[0].Get(getItem);
+ DALI_TEST_CHECK(getItem == 10);
END_TEST;
}
Property::Value value;
value = Property::Value(Property::MAP); // mismatch
value.GetMap()->Insert("key", "value");
- Property::Value copy( Property::MAP ); // match
+ Property::Value copy(Property::MAP); // match
copy = value;
Property::Map map;
- copy.Get( map );
- DALI_TEST_CHECK( map.GetKey(0) == "key" );
+ copy.Get(map);
+ DALI_TEST_CHECK(map.GetKey(0) == "key");
END_TEST;
}
int UtcDaliPropertyValueAssignmentOperatorExtentsP(void)
{
Property::Value value;
- value = Property::Value( Extents( 4, 3, 2, 1 ) ); // mismatch
- DALI_TEST_CHECK( Extents( 4, 3, 2, 1 ) == value.Get<Extents>() );
- Property::Value copy( Property::EXTENTS );
+ value = Property::Value(Extents(4, 3, 2, 1)); // mismatch
+ DALI_TEST_CHECK(Extents(4, 3, 2, 1) == value.Get<Extents>());
+ Property::Value copy(Property::EXTENTS);
copy = value; // match
Extents copyExtents;
copy.Get(copyExtents);
- DALI_TEST_CHECK( Extents( 4, 3, 2, 1 ) == copyExtents );
+ DALI_TEST_CHECK(Extents(4, 3, 2, 1) == copyExtents);
END_TEST;
}
int UtcDaliPropertyValueMoveAssignmentOperator(void)
{
- Property::Value value1( Vector4::ONE );
- DALI_TEST_EQUALS( Property::VECTOR4, value1.GetType(), TEST_LOCATION );
+ Property::Value value1(Vector4::ONE);
+ DALI_TEST_EQUALS(Property::VECTOR4, value1.GetType(), TEST_LOCATION);
Vector4 valueVector;
- DALI_TEST_EQUALS( true, value1.Get( valueVector ), TEST_LOCATION ); // Able to convert
- DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value1.Get(valueVector), TEST_LOCATION); // Able to convert
+ DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION);
Property::Value value2;
- value2 = std::move( value1 );
- DALI_TEST_EQUALS( Property::NONE, value1.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value1.Get( valueVector ), TEST_LOCATION ); // Unable to convert, but no crash either
- DALI_TEST_EQUALS( Property::VECTOR4, value2.GetType(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value2.Get( valueVector ), TEST_LOCATION ); // Able to convert
- DALI_TEST_EQUALS( valueVector, Vector4::ONE, TEST_LOCATION );
+ value2 = std::move(value1);
+ DALI_TEST_EQUALS(Property::NONE, value1.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value1.Get(valueVector), TEST_LOCATION); // Unable to convert, but no crash either
+ DALI_TEST_EQUALS(Property::VECTOR4, value2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value2.Get(valueVector), TEST_LOCATION); // Able to convert
+ DALI_TEST_EQUALS(valueVector, Vector4::ONE, TEST_LOCATION);
// Change to another value type
- value2 = std::move( Property::Value( 1.0f ) );
- DALI_TEST_EQUALS( false, value2.Get( valueVector ), TEST_LOCATION ); // Should not be able to convert to a Vector4 now
+ value2 = std::move(Property::Value(1.0f));
+ DALI_TEST_EQUALS(false, value2.Get(valueVector), TEST_LOCATION); // Should not be able to convert to a Vector4 now
float valueFloat;
- DALI_TEST_EQUALS( true, value2.Get( valueFloat ), TEST_LOCATION ); // Should be able to convert to a float now
- DALI_TEST_EQUALS( valueFloat, 1.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value2.Get(valueFloat), TEST_LOCATION); // Should be able to convert to a float now
+ DALI_TEST_EQUALS(valueFloat, 1.0f, TEST_LOCATION);
// Ensure self assignment doesn't do anything silly
- value2 = std::move( value2 );
- DALI_TEST_EQUALS( true, value2.Get( valueFloat ), TEST_LOCATION );
- DALI_TEST_EQUALS( valueFloat, 1.0f, TEST_LOCATION );
+ value2 = std::move(value2);
+ DALI_TEST_EQUALS(true, value2.Get(valueFloat), TEST_LOCATION);
+ DALI_TEST_EQUALS(valueFloat, 1.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetTypeP(void)
{
Property::Value value;
- DALI_TEST_CHECK( value.GetType() == Property::NONE );
+ DALI_TEST_CHECK(value.GetType() == Property::NONE);
END_TEST;
}
int UtcDaliPropertyValueGetBoolP(void)
{
Property::Value value(true);
- bool boolean( false );
- DALI_TEST_CHECK( value.Get( boolean ) == true );
- DALI_TEST_CHECK( value.Get<bool>() == true );
+ bool boolean(false);
+ DALI_TEST_CHECK(value.Get(boolean) == true);
+ DALI_TEST_CHECK(value.Get<bool>() == true);
std::string string;
- DALI_TEST_CHECK( value.Get( string ) == false );
+ DALI_TEST_CHECK(value.Get(string) == false);
value = Property::Value(1.f);
- DALI_TEST_CHECK( value.Get<float>() == 1.f );
+ DALI_TEST_CHECK(value.Get<float>() == 1.f);
END_TEST;
}
int UtcDaliPropertyValueGetBoolN(void)
{
Property::Value value;
- DALI_TEST_CHECK( value.Get<bool>() == false );
- bool boolean( false );
- DALI_TEST_CHECK( value.Get( boolean ) == false );
+ DALI_TEST_CHECK(value.Get<bool>() == false);
+ bool boolean(false);
+ DALI_TEST_CHECK(value.Get(boolean) == false);
END_TEST;
}
int UtcDaliPropertyValueGetFloatP(void)
{
Property::Value value(1.1f);
- float flow( 0.0f );
- DALI_TEST_EQUALS( 1.1f, value.Get<float>(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( flow ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.1f, flow, TEST_LOCATION );
+ float flow(0.0f);
+ DALI_TEST_EQUALS(1.1f, value.Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(flow), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.1f, flow, TEST_LOCATION);
Property::Value intValue(100);
- DALI_TEST_EQUALS( 100.f, intValue.Get<float>(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, intValue.Get( flow ), TEST_LOCATION );
- DALI_TEST_EQUALS( 100.f, flow, TEST_LOCATION );
+ DALI_TEST_EQUALS(100.f, intValue.Get<float>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, intValue.Get(flow), TEST_LOCATION);
+ DALI_TEST_EQUALS(100.f, flow, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetFloatN(void)
{
Property::Value value;
- float result( 1.0f );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.0f, result, TEST_LOCATION ); // result is not modified
- Property::Value value2( "" );
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1.0f, result, TEST_LOCATION ); // result is not modified
+ float result(1.0f);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.0f, result, TEST_LOCATION); // result is not modified
+ Property::Value value2("");
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.0f, result, TEST_LOCATION); // result is not modified
END_TEST;
}
int UtcDaliPropertyValueGetIntP(void)
{
Property::Value value(123);
- int result( 10 );
- DALI_TEST_EQUALS( 123, value.Get<int>(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 123, result, TEST_LOCATION );
+ int result(10);
+ DALI_TEST_EQUALS(123, value.Get<int>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(123, result, TEST_LOCATION);
Property::Value floatValue(21.f);
- DALI_TEST_EQUALS( 21, floatValue.Get<int>(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, floatValue.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 21, result, TEST_LOCATION );
+ DALI_TEST_EQUALS(21, floatValue.Get<int>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, floatValue.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(21, result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetIntN(void)
{
Property::Value value;
- int result( 10 );
- DALI_TEST_EQUALS( 0, value.Get<int>(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 10, result, TEST_LOCATION ); // result is not modified
+ int result(10);
+ DALI_TEST_EQUALS(0, value.Get<int>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(10, result, TEST_LOCATION); // result is not modified
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 10, result, TEST_LOCATION ); // result is not modified
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(10, result, TEST_LOCATION); // result is not modified
END_TEST;
}
int UtcDaliPropertyValueGetRectP(void)
{
- Property::Value value( Rect<int>(1,2,3,4) );
- Rect<int> result(4,3,2,1);
- DALI_TEST_EQUALS( Rect<int>(1,2,3,4), value.Get< Rect<int> >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Rect<int>(1,2,3,4), result, TEST_LOCATION );
+ Property::Value value(Rect<int>(1, 2, 3, 4));
+ Rect<int> result(4, 3, 2, 1);
+ DALI_TEST_EQUALS(Rect<int>(1, 2, 3, 4), value.Get<Rect<int> >(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Rect<int>(1, 2, 3, 4), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetRectN(void)
{
Property::Value value;
- Rect<int> result(4,3,2,1);
- DALI_TEST_EQUALS( Rect<int>(0,0,0,0), value.Get< Rect<int> >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Rect<int>(4,3,2,1), result, TEST_LOCATION );
+ Rect<int> result(4, 3, 2, 1);
+ DALI_TEST_EQUALS(Rect<int>(0, 0, 0, 0), value.Get<Rect<int> >(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Rect<int>(4, 3, 2, 1), result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Rect<int>(4,3,2,1), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Rect<int>(4, 3, 2, 1), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector2P(void)
{
- Property::Value value( Vector2(1.0f,2.0f) );
- Vector2 result;
- DALI_TEST_EQUALS( Vector2(1.0f,2.0f), value.Get< Vector2 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2(1.0f,2.0f), result, TEST_LOCATION );
+ Property::Value value(Vector2(1.0f, 2.0f));
+ Vector2 result;
+ DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), value.Get<Vector2>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector2fromVector3P(void)
{
- Property::Value value( Vector3(1.f,2.f,3.f) );
- Vector2 result;
- DALI_TEST_EQUALS( Vector2(1.0f,2.0f), value.Get< Vector2 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2(1.0f,2.0f), result, TEST_LOCATION );
+ Property::Value value(Vector3(1.f, 2.f, 3.f));
+ Vector2 result;
+ DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), value.Get<Vector2>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector2fromVector4P(void)
{
- Property::Value value( Vector4(1.f,2.f,3.f,4.f) );
- Vector2 result;
- DALI_TEST_EQUALS( Vector2(1.0f,2.0f), value.Get< Vector2 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2(1.0f,2.0f), result, TEST_LOCATION );
+ Property::Value value(Vector4(1.f, 2.f, 3.f, 4.f));
+ Vector2 result;
+ DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), value.Get<Vector2>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(1.0f, 2.0f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector2N(void)
{
Property::Value value;
- Vector2 result;
- DALI_TEST_EQUALS( Vector2(0.f,0.f), value.Get< Vector2 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2(), result, TEST_LOCATION );
+ Vector2 result;
+ DALI_TEST_EQUALS(Vector2(0.f, 0.f), value.Get<Vector2>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(), result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2(), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector3P(void)
{
- Property::Value value( Vector3(1.0f,2.0f,-1.f) );
- Vector3 result;
- DALI_TEST_EQUALS( Vector3(1.0f,2.0f,-1.f), value.Get< Vector3 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3(1.0f,2.0f,-1.f), result, TEST_LOCATION );
+ Property::Value value(Vector3(1.0f, 2.0f, -1.f));
+ Vector3 result;
+ DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, -1.f), value.Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, -1.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector3FromVector2P(void)
{
- Property::Value value( Vector2(1.0f,2.0f) );
- Vector3 result(99.f,88.f,77.f);
- DALI_TEST_EQUALS( Vector3(1.0f,2.0f,0.f), value.Get< Vector3 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3(1.0f,2.0f,0.f), result, TEST_LOCATION );
+ Property::Value value(Vector2(1.0f, 2.0f));
+ Vector3 result(99.f, 88.f, 77.f);
+ DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, 0.f), value.Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(1.0f, 2.0f, 0.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector3FromVector4P(void)
{
- Property::Value value( Vector4(4.f,3.f,2.f,1.f) );
- Vector3 result;
- DALI_TEST_EQUALS( Vector3(4.f,3.f,2.f), value.Get< Vector3 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3(4.f,3.f,2.f), result, TEST_LOCATION );
+ Property::Value value(Vector4(4.f, 3.f, 2.f, 1.f));
+ Vector3 result;
+ DALI_TEST_EQUALS(Vector3(4.f, 3.f, 2.f), value.Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(4.f, 3.f, 2.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector3N(void)
{
Property::Value value;
- Vector3 result;
- DALI_TEST_EQUALS( Vector3(0.f,0.f,0.f), value.Get< Vector3 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3(), result, TEST_LOCATION );
+ Vector3 result;
+ DALI_TEST_EQUALS(Vector3(0.f, 0.f, 0.f), value.Get<Vector3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(), result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3(), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector4P(void)
{
- Property::Value value( Vector4(1.f,2.f,-1.f,-3.f) );
- Vector4 result;
- DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,-3.f), value.Get< Vector4 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,-3.f), result, TEST_LOCATION );
+ Property::Value value(Vector4(1.f, 2.f, -1.f, -3.f));
+ Vector4 result;
+ DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, -3.f), value.Get<Vector4>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, -3.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector4FromVector2P(void)
{
- Property::Value value( Vector2(-1.f,-3.f) );
- Vector4 result(99.f,88.f,77.f,66.f);
- DALI_TEST_EQUALS( Vector4(-1.f,-3.f,0.f,0.f), value.Get< Vector4 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector4(-1.f,-3.f,0.f,0.f), result, TEST_LOCATION );
+ Property::Value value(Vector2(-1.f, -3.f));
+ Vector4 result(99.f, 88.f, 77.f, 66.f);
+ DALI_TEST_EQUALS(Vector4(-1.f, -3.f, 0.f, 0.f), value.Get<Vector4>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4(-1.f, -3.f, 0.f, 0.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector4FromVector3P(void)
{
- Property::Value value( Vector3(1.f,2.f,-1.f) );
- Vector4 result(99.f,88.f,77.f,66.f);
- DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,0.f), value.Get< Vector4 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector4(1.f,2.f,-1.f,0.f), result, TEST_LOCATION );
+ Property::Value value(Vector3(1.f, 2.f, -1.f));
+ Vector4 result(99.f, 88.f, 77.f, 66.f);
+ DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, 0.f), value.Get<Vector4>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4(1.f, 2.f, -1.f, 0.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetVector4N(void)
{
Property::Value value;
- Vector4 result;
- DALI_TEST_EQUALS( Vector4(0.f,0.f,0.f,0.f), value.Get< Vector4 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector4(), result, TEST_LOCATION );
+ Vector4 result;
+ DALI_TEST_EQUALS(Vector4(0.f, 0.f, 0.f, 0.f), value.Get<Vector4>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4(), result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Vector4(), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector4(), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetMatrix3P(void)
{
- Property::Value value( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f) );
- Matrix3 result;
- DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), value.Get< Matrix3 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), result, TEST_LOCATION );
+ Property::Value value(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f));
+ Matrix3 result;
+ DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), value.Get<Matrix3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetMatrix3N(void)
{
Property::Value value;
- Matrix3 result(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f);
- DALI_TEST_EQUALS( Matrix3(), value.Get< Matrix3 >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), result, TEST_LOCATION );
+ Matrix3 result(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f);
+ DALI_TEST_EQUALS(Matrix3(), value.Get<Matrix3>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Matrix3(1.f,2.f,3.f,4.f,5.f,6.f,7.f,8.f,9.f), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Matrix3(1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, 8.f, 9.f), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetMatrixP(void)
{
- float matrixValues[16] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
- Matrix input( matrixValues );
- Property::Value value( input );
- Matrix result;
- DALI_TEST_EQUALS( input, value.Get< Matrix >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( input, result, TEST_LOCATION );
+ float matrixValues[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
+ Matrix input(matrixValues);
+ Property::Value value(input);
+ Matrix result;
+ DALI_TEST_EQUALS(input, value.Get<Matrix>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(input, result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetMatrixN(void)
{
Property::Value value;
- Matrix result( Matrix::IDENTITY );
- DALI_TEST_EQUALS( Matrix(), value.Get< Matrix >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Matrix::IDENTITY, result, TEST_LOCATION );
+ Matrix result(Matrix::IDENTITY);
+ DALI_TEST_EQUALS(Matrix(), value.Get<Matrix>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Matrix::IDENTITY, result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Matrix::IDENTITY, result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Matrix::IDENTITY, result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetAngleAxisP(void)
{
- AngleAxis input( Dali::ANGLE_90, Vector3::XAXIS );
- Property::Value value( input );
- AngleAxis result = value.Get<AngleAxis>();
- DALI_TEST_EQUALS( input.angle, result.angle, TEST_LOCATION );
- DALI_TEST_EQUALS( input.axis, result.axis, TEST_LOCATION );
+ AngleAxis input(Dali::ANGLE_90, Vector3::XAXIS);
+ Property::Value value(input);
+ AngleAxis result = value.Get<AngleAxis>();
+ DALI_TEST_EQUALS(input.angle, result.angle, TEST_LOCATION);
+ DALI_TEST_EQUALS(input.axis, result.axis, TEST_LOCATION);
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( input, result, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(input, result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetAngleAxisN(void)
{
Property::Value value;
- AngleAxis b = value.Get<AngleAxis>();
- AngleAxis result;
- DALI_TEST_EQUALS( (Radian)0.f, b.angle, TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3::ZERO, b.axis, TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( AngleAxis(), result, TEST_LOCATION );
+ AngleAxis b = value.Get<AngleAxis>();
+ AngleAxis result;
+ DALI_TEST_EQUALS((Radian)0.f, b.angle, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3::ZERO, b.axis, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(AngleAxis(), result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( AngleAxis(), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(AngleAxis(), result, TEST_LOCATION);
END_TEST;
}
Vector3 axis(1, 1, 0);
axis.Normalize();
- Quaternion result( Radian( 1.f ), axis );
- Property::Value value( result );
+ Quaternion result(Radian(1.f), axis);
+ Property::Value value(result);
- DALI_TEST_EQUALS( result, value.Get< Quaternion >(), TEST_LOCATION );
+ DALI_TEST_EQUALS(result, value.Get<Quaternion>(), TEST_LOCATION);
Quaternion test2;
- DALI_TEST_EQUALS( true, value.Get( test2 ), TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value.Get(test2), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetQuaternionN(void)
{
Property::Value value;
- Vector3 axis(1, 1, 0);
+ Vector3 axis(1, 1, 0);
axis.Normalize();
- Quaternion result( Radian( 1.f ), axis );
+ Quaternion result(Radian(1.f), axis);
Quaternion test(result);
- DALI_TEST_EQUALS( Quaternion(), value.Get< Quaternion >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( test ), TEST_LOCATION );
- DALI_TEST_EQUALS( test, result, TEST_LOCATION );
+ DALI_TEST_EQUALS(Quaternion(), value.Get<Quaternion>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(test), TEST_LOCATION);
+ DALI_TEST_EQUALS(test, result, TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( test ), TEST_LOCATION );
- DALI_TEST_EQUALS( test, result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(test), TEST_LOCATION);
+ DALI_TEST_EQUALS(test, result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetStringP(void)
{
- Property::Value value( std::string("hello") );
- std::string result;
- DALI_TEST_EQUALS( std::string("hello"), value.Get< std::string >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( std::string("hello"), result, TEST_LOCATION );
+ Property::Value value(std::string("hello"));
+ std::string result;
+ DALI_TEST_EQUALS(std::string("hello"), value.Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(std::string("hello"), result, TEST_LOCATION);
- Property::Value value2( "C hi!" );
- DALI_TEST_EQUALS( "C hi!", value2.Get< std::string >(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( "C hi!", result, TEST_LOCATION );
+ Property::Value value2("C hi!");
+ DALI_TEST_EQUALS("C hi!", value2.Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS("C hi!", result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetStringN(void)
{
Property::Value value;
- std::string result("doesn't change");
- DALI_TEST_EQUALS( std::string(), value.Get< std::string >(), TEST_LOCATION );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( "doesn't change", result, TEST_LOCATION );
+ std::string result("doesn't change");
+ DALI_TEST_EQUALS(std::string(), value.Get<std::string>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS("doesn't change", result, TEST_LOCATION);
Property::Value value2(10);
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( "doesn't change", result, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS("doesn't change", result, TEST_LOCATION);
Property::Value value3((char*)NULL);
- DALI_TEST_EQUALS( true, value3.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( std::string(), result, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value3.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(std::string(), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueGetArrayP(void)
{
- Property::Value value( Property::ARRAY );
- DALI_TEST_CHECK( NULL != value.GetArray() );
- value.GetArray()->PushBack( Property::Value(1) );
+ Property::Value value(Property::ARRAY);
+ DALI_TEST_CHECK(NULL != value.GetArray());
+ value.GetArray()->PushBack(Property::Value(1));
Property::Array got = value.Get<Property::Array>();
- DALI_TEST_CHECK( got[0].Get<int>() == 1);
+ DALI_TEST_CHECK(got[0].Get<int>() == 1);
Property::Array result;
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_CHECK( result[0].Get<int>() == 1);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_CHECK(result[0].Get<int>() == 1);
END_TEST;
}
int UtcDaliPropertyValueGetArrayN(void)
{
Property::Value value;
- DALI_TEST_CHECK( NULL == value.GetArray() );
+ DALI_TEST_CHECK(NULL == value.GetArray());
Property::Array result;
- result.PushBack( Property::Value( 10 ) );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); // array is not modified
+ result.PushBack(Property::Value(10));
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); // array is not modified
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); // array is not modified
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); // array is not modified
END_TEST;
}
int UtcDaliPropertyValueGetMapP(void)
{
Property::Value value(Property::MAP);
- DALI_TEST_CHECK( NULL == value.GetArray() );
- DALI_TEST_CHECK( NULL != value.GetMap() );
+ DALI_TEST_CHECK(NULL == value.GetArray());
+ DALI_TEST_CHECK(NULL != value.GetMap());
value.GetMap()->Insert("key", Property::Value(1));
Property::Map result = value.Get<Property::Map>();
DALI_TEST_CHECK(result.Find("key")->Get<int>() == 1);
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
DALI_TEST_CHECK(result.Find("key")->Get<int>() == 1);
END_TEST;
}
int UtcDaliPropertyValueGetMapN(void)
{
Property::Value value;
- DALI_TEST_CHECK( NULL == value.GetMap() );
- DALI_TEST_EQUALS( 0u, value.Get<Property::Map>().Count(), TEST_LOCATION );
+ DALI_TEST_CHECK(NULL == value.GetMap());
+ DALI_TEST_EQUALS(0u, value.Get<Property::Map>().Count(), TEST_LOCATION);
Property::Map result;
- result.Insert("key", "value" );
- DALI_TEST_EQUALS( false, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION );
+ result.Insert("key", "value");
+ DALI_TEST_EQUALS(false, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION);
Property::Value value2("");
- DALI_TEST_EQUALS( false, value2.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, result.Count(), TEST_LOCATION ); // array is not modified
+ DALI_TEST_EQUALS(false, value2.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, result.Count(), TEST_LOCATION); // array is not modified
END_TEST;
}
int UtcDaliPropertyValueGetExtentsP(void)
{
- Property::Value value( Extents( 1u, 2u, 3u, 4u ) );
- Extents result( 4u, 3u, 2u, 1u );
- DALI_TEST_EQUALS( Extents( 1u, 2u, 3u, 4u ), value.Get<Extents>(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( Extents( 1u, 2u, 3u, 4u ), result, TEST_LOCATION );
+ Property::Value value(Extents(1u, 2u, 3u, 4u));
+ Extents result(4u, 3u, 2u, 1u);
+ DALI_TEST_EQUALS(Extents(1u, 2u, 3u, 4u), value.Get<Extents>(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(Extents(1u, 2u, 3u, 4u), result, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyValueEnum(void)
{
- enum class E { zero, e };
- Property::Value value( E::e );
- DALI_TEST_EQUALS( static_cast<int>(E::e), static_cast<int>(value.Get<E>()), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<int>(E::e), value.Get<int>(), TEST_LOCATION );
+ enum class E
+ {
+ zero,
+ e
+ };
+ Property::Value value(E::e);
+ DALI_TEST_EQUALS(static_cast<int>(E::e), static_cast<int>(value.Get<E>()), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<int>(E::e), value.Get<int>(), TEST_LOCATION);
E result;
- DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<int>(E::e), static_cast<int>(result), TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value.Get(result), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<int>(E::e), static_cast<int>(result), TEST_LOCATION);
int result2;
- DALI_TEST_EQUALS( true, value.Get( result2 ), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<int>(E::e), result2, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, value.Get(result2), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<int>(E::e), result2, TEST_LOCATION);
END_TEST;
}
{
std::ostringstream stream;
stream << value;
- DALI_TEST_CHECK( stream.str() == "1" )
+ DALI_TEST_CHECK(stream.str() == "1")
}
{
- Property::Value empty;
+ Property::Value empty;
std::ostringstream stream;
stream << empty;
- DALI_TEST_EQUALS( stream.str(), "undefined type", TEST_LOCATION );
+ DALI_TEST_EQUALS(stream.str(), "undefined type", TEST_LOCATION);
}
{
- Property::Value empty( Property::NONE );
+ Property::Value empty(Property::NONE);
std::ostringstream stream;
stream << empty;
- DALI_TEST_CHECK( stream.str() == "undefined type" )
+ DALI_TEST_CHECK(stream.str() == "undefined type")
}
{
value = Property::Value(20.2f);
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "20.2" )
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "20.2")
}
{
value = Property::Value(-25);
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "-25" )
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "-25")
}
{
- value = Property::Value( Vector2(1.f,1.f) );
+ value = Property::Value(Vector2(1.f, 1.f));
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "[1, 1]" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "[1, 1]");
}
{
- value = Property::Value( Vector3(1.f,1.f,1.f) );
+ value = Property::Value(Vector3(1.f, 1.f, 1.f));
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "[1, 1, 1]" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "[1, 1, 1]");
}
{
- value = Property::Value( Vector4(-4.f,-3.f,-2.f,-1.f) );
+ value = Property::Value(Vector4(-4.f, -3.f, -2.f, -1.f));
std::ostringstream stream;
- stream << value;
- DALI_TEST_EQUALS( stream.str(), "[-4, -3, -2, -1]", TEST_LOCATION );
+ stream << value;
+ DALI_TEST_EQUALS(stream.str(), "[-4, -3, -2, -1]", TEST_LOCATION);
}
{
- value = Property::Value( Matrix3::IDENTITY );
+ value = Property::Value(Matrix3::IDENTITY);
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "[ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "[ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]");
}
{
- value = Property::Value( Matrix::IDENTITY );
+ value = Property::Value(Matrix::IDENTITY);
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]");
}
{
- value = Property::Value( Rectangle(1,2,3,4) );
+ value = Property::Value(Rectangle(1, 2, 3, 4));
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "[1, 2, 3, 4]" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "[1, 2, 3, 4]");
}
{
- value = Property::Value( AngleAxis( Dali::ANGLE_120, Vector3::XAXIS ) );
+ value = Property::Value(AngleAxis(Dali::ANGLE_120, Vector3::XAXIS));
std::ostringstream stream;
- stream << value;
- tet_printf("angle axis = %s \n", stream.str().c_str() );
- DALI_TEST_EQUALS( stream.str(), "[ Axis: [1, 0, 0], Angle: 120 degrees ]", TEST_LOCATION );
+ stream << value;
+ tet_printf("angle axis = %s \n", stream.str().c_str());
+ DALI_TEST_EQUALS(stream.str(), "[ Axis: [1, 0, 0], Angle: 120 degrees ]", TEST_LOCATION);
}
{
- value = Property::Value( std::string( "Foo" ) );
+ value = Property::Value(std::string("Foo"));
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "Foo" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "Foo");
}
{
map.Insert("duration", 10);
map.Insert("color", Vector4(1.0, 0.5, 1.0, 1.0));
- value = Property::Value( map );
+ value = Property::Value(map);
std::ostringstream stream;
stream << value;
tet_printf("Checking Property::Value is %s", stream.str().c_str());
- DALI_TEST_CHECK( !stream.str().compare("Map(3) = {key:value, duration:10, color:[1, 0.5, 1, 1]}"));
+ DALI_TEST_CHECK(!stream.str().compare("Map(3) = {key:value, duration:10, color:[1, 0.5, 1, 1]}"));
}
{
Property::Array array;
array.PushBack(0);
array.PushBack(2);
array.PushBack(3);
- value = Property::Value( array );
+ value = Property::Value(array);
std::ostringstream stream;
- stream << value;
+ stream << value;
tet_printf("Checking Property::Value is %s", stream.str().c_str());
- DALI_TEST_CHECK( !stream.str().compare("Array(3) = [0, 2, 3]") );
+ DALI_TEST_CHECK(!stream.str().compare("Array(3) = [0, 2, 3]"));
}
{
- Property::Map map;
- Property::Map map2;
+ Property::Map map;
+ Property::Map map2;
Property::Array array;
map2.Insert("key", "value");
array.PushBack(Vector2(1, 0));
array.PushBack(Vector2(0, 0.5));
map.Insert("texCoords", array);
- value = Property::Value( map );
+ value = Property::Value(map);
std::ostringstream stream;
stream << value;
tet_printf("Checking Property::Value is %s", stream.str().c_str());
- DALI_TEST_CHECK( !stream.str().compare("Map(3) = {color:[1, 0.5, 1, 1], timePeriod:Map(2) = {key:value, duration:10}, texCoords:Array(4) = [[1, 0], [0, 1], [1, 0], [0, 0.5]]}"));
+ DALI_TEST_CHECK(!stream.str().compare("Map(3) = {color:[1, 0.5, 1, 1], timePeriod:Map(2) = {key:value, duration:10}, texCoords:Array(4) = [[1, 0], [0, 1], [1, 0], [0, 0.5]]}"));
}
{
- value = Property::Value( Extents( 1u, 2u, 3u, 4u ) );
+ value = Property::Value(Extents(1u, 2u, 3u, 4u));
std::ostringstream stream;
- stream << value;
- DALI_TEST_CHECK( stream.str() == "[1, 2, 3, 4]" );
+ stream << value;
+ DALI_TEST_CHECK(stream.str() == "[1, 2, 3, 4]");
}
END_TEST;
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
#include <iostream>
#include <sstream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
using namespace Dali;
-
void utc_dali_quaternion_startup(void)
{
test_return_value = TET_UNDEF;
test_return_value = TET_PASS;
}
-
int UtcDaliQuaternionCtorDefaultP(void)
{
Quaternion q;
- DALI_TEST_EQUALS( q.AsVector().w, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().x, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().y, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().z, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q.AsVector().w, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().x, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().y, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().z, 0.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorCosSinThetaP(void)
{
- Quaternion q( 1.0f, 0.1f, 0.2f, 0.3f );
+ Quaternion q(1.0f, 0.1f, 0.2f, 0.3f);
- DALI_TEST_EQUALS( q.AsVector().w, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().x, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().y, 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().z, 0.3f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q.AsVector().w, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().x, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().y, 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().z, 0.3f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorVector4P(void)
{
- Quaternion q( Vector4( 1.0f, 0.1f, 0.2f, 0.3f ) );
+ Quaternion q(Vector4(1.0f, 0.1f, 0.2f, 0.3f));
- DALI_TEST_EQUALS( q.AsVector().x, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().y, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().z, 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().w, 0.3f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q.AsVector().x, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().y, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().z, 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().w, 0.3f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorAxisAngleVector3P(void)
{
- Quaternion q( Dali::ANGLE_90, Vector3( 1.0f, 2.0f, 3.0f ) );
+ Quaternion q(Dali::ANGLE_90, Vector3(1.0f, 2.0f, 3.0f));
// This will be normalised:
- DALI_TEST_EQUALS( q.AsVector().w, 0.707f, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().x, 0.189f, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().y, 0.378f, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( q.AsVector().z, 0.567f, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q.AsVector().w, 0.707f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().x, 0.189f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().y, 0.378f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(q.AsVector().z, 0.567f, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorEulerAngleP(void)
{
Quaternion q1(0.924f, 0.383f, 0.0f, 0.0f);
- Vector4 r1(Radian(Degree(45)), 0.0f, 0.0f, 0.0f);
+ Vector4 r1(Radian(Degree(45)), 0.0f, 0.0f, 0.0f);
Quaternion q2(0.793f, 0.0f, 0.609f, 0.0f);
- Vector4 r2(0.0f, Radian(Degree(75)), 0.0f, 0.0f);
+ Vector4 r2(0.0f, Radian(Degree(75)), 0.0f, 0.0f);
Quaternion q3(0.383f, 0.0f, 0.0f, 0.924f);
- Vector4 r3(0.0f, 0.0f, Radian(Degree(135)), 0.0f);
+ Vector4 r3(0.0f, 0.0f, Radian(Degree(135)), 0.0f);
Quaternion q4(0.795f, 0.478f, 0.374f, 0.006f);
- Vector4 r4(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)), 0.0f);
+ Vector4 r4(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)), 0.0f);
- Quaternion q5( -0.149f, -0.697f, 0.145f, -0.686f);
- Vector4 r5(Radian(Degree(148.0)), Radian(Degree(-88.2)), Radian(Degree(8.0)), 0.0f);
+ Quaternion q5(-0.149f, -0.697f, 0.145f, -0.686f);
+ Vector4 r5(Radian(Degree(148.0)), Radian(Degree(-88.2)), Radian(Degree(8.0)), 0.0f);
DALI_TEST_EQUALS(q1.EulerAngles(), r1, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(q2.EulerAngles(), r2, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(q3.EulerAngles(), r3, 0.001, TEST_LOCATION);
- DALI_TEST_EQUALS(q4.EulerAngles(), r4, 0.01, TEST_LOCATION);
- DALI_TEST_EQUALS(q5.EulerAngles(), r5, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(q4.EulerAngles(), r4, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(q5.EulerAngles(), r5, 0.01, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorMatrixP01(void)
{
// angle: 60 deg, axis: [1,2,3]
- float Mref_raw[16] = { 0.535714f, 0.765794f, -0.355767f, 0.0f,
- -0.622936f, 0.642857f, 0.445741f, 0.0f,
- 0.570053f, -0.0171693f, 0.821429f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f};
- Matrix Mref( Mref_raw );
+ float Mref_raw[16] = {0.535714f, 0.765794f, -0.355767f, 0.0f, -0.622936f, 0.642857f, 0.445741f, 0.0f, 0.570053f, -0.0171693f, 0.821429f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ Matrix Mref(Mref_raw);
- Quaternion q1( Radian(M_PI/3.0f), Vector3( 1.0f, 2.0f, 3.0f ) );
- Quaternion q2( Mref );
+ Quaternion q1(Radian(M_PI / 3.0f), Vector3(1.0f, 2.0f, 3.0f));
+ Quaternion q2(Mref);
- DALI_TEST_EQUALS( q1, q2, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q2, 0.001, TEST_LOCATION);
END_TEST;
}
// IDENTITY rotation
Quaternion q;
- Matrix m( q ); // Convert to matrix
+ Matrix m(q); // Convert to matrix
- Quaternion q2( m ); // and back to a quaternion
+ Quaternion q2(m); // and back to a quaternion
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( m, Matrix::IDENTITY, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(m, Matrix::IDENTITY, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorMatrixP03(void)
{
// Create an arbitrary forward vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=0.1f )
+ for(float z = -1.0f; z < 1.0f; z += 0.1f)
{
- Vector3 vForward( x, y, z );
+ Vector3 vForward(x, y, z);
vForward.Normalize();
// Construct an up vector from a sideways move
Vector3 vSide;
- Vector3 vUp = vForward.Cross( Vector3( vForward.x+1.0f, vForward.y, vForward.z ) );
- if( vUp.Length() > 0.01 )
+ Vector3 vUp = vForward.Cross(Vector3(vForward.x + 1.0f, vForward.y, vForward.z));
+ if(vUp.Length() > 0.01)
{
vUp.Normalize();
- vSide = vUp.Cross( vForward );
+ vSide = vUp.Cross(vForward);
vSide.Normalize();
}
else
{
- vSide = vForward.Cross( Vector3( vForward.x, vForward.y+1.0f, vForward.z ) );
+ vSide = vForward.Cross(Vector3(vForward.x, vForward.y + 1.0f, vForward.z));
vSide.Normalize();
- vUp = vForward.Cross( vSide );
+ vUp = vForward.Cross(vSide);
vUp.Normalize();
}
// Generate a matrix, and then a quaternion from it
- Matrix rotMatrix( Matrix::IDENTITY );
- rotMatrix.SetXAxis( vSide );
- rotMatrix.SetYAxis( vUp );
- rotMatrix.SetZAxis( vForward );
- Quaternion q( rotMatrix );
+ Matrix rotMatrix(Matrix::IDENTITY);
+ rotMatrix.SetXAxis(vSide);
+ rotMatrix.SetYAxis(vUp);
+ rotMatrix.SetZAxis(vForward);
+ Quaternion q(rotMatrix);
// Generate a matrix from the quaternion, check they are the same
- Matrix resultMatrix( q );
- DALI_TEST_EQUALS( resultMatrix, rotMatrix, 0.001f, TEST_LOCATION );
+ Matrix resultMatrix(q);
+ DALI_TEST_EQUALS(resultMatrix, rotMatrix, 0.001f, TEST_LOCATION);
// Rotate an arbitrary vector by both quaternion and rotation matrix,
// check the result is the same
- Vector4 aVector( -2.983f, -3.213f, 8.2239f, 1.0f );
- Vector3 aVectorRotatedByQ = q.Rotate( Vector3( aVector ) );
- Vector4 aVectorRotatedByR = rotMatrix*aVector;
- DALI_TEST_EQUALS( aVectorRotatedByQ, Vector3( aVectorRotatedByR ), 0.001f, TEST_LOCATION );
+ Vector4 aVector(-2.983f, -3.213f, 8.2239f, 1.0f);
+ Vector3 aVectorRotatedByQ = q.Rotate(Vector3(aVector));
+ Vector4 aVectorRotatedByR = rotMatrix * aVector;
+ DALI_TEST_EQUALS(aVectorRotatedByQ, Vector3(aVectorRotatedByR), 0.001f, TEST_LOCATION);
}
}
}
int UtcDaliQuaternionCopyConstructor(void)
{
- Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f );
- Quaternion q1( q0 );
- DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION );
+ Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f);
+ Quaternion q1(q0);
+ DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionMoveConstructor(void)
{
- Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f );
- Quaternion q1 = std::move( q0 );
- DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION );
+ Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f);
+ Quaternion q1 = std::move(q0);
+ DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCopyAssignment(void)
{
- Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f );
+ Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f);
Quaternion q1;
q1 = q0;
- DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionMoveAssignment(void)
{
- Quaternion q0( 1.0f, 0.1f, 0.2f, 0.3f );
+ Quaternion q0(1.0f, 0.1f, 0.2f, 0.3f);
Quaternion q1;
- q1 = std::move( q0 );
- DALI_TEST_EQUALS( q1.AsVector().w, 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().x, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().y, 0.2f, TEST_LOCATION );
- DALI_TEST_EQUALS( q1.AsVector().z, 0.3f, TEST_LOCATION );
+ q1 = std::move(q0);
+ DALI_TEST_EQUALS(q1.AsVector().w, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().x, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().y, 0.2f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q1.AsVector().z, 0.3f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorAxesP01(void)
{
// angle: 60 deg, axis: [1,2,3]
- float Mref_raw[16] = { 0.535714f, 0.765794f, -0.355767f, 0.0f,
- -0.622936f, 0.642857f, 0.445741f, 0.0f,
- 0.570053f, -0.0171693f, 0.821429f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f};
- Matrix Mref( Mref_raw );
+ float Mref_raw[16] = {0.535714f, 0.765794f, -0.355767f, 0.0f, -0.622936f, 0.642857f, 0.445741f, 0.0f, 0.570053f, -0.0171693f, 0.821429f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ Matrix Mref(Mref_raw);
- Quaternion q1( Radian(M_PI/3.0f), Vector3( 1.0f, 2.0f, 3.0f ) );
- Quaternion q2( Mref.GetXAxis(), Mref.GetYAxis(), Mref.GetZAxis() );
+ Quaternion q1(Radian(M_PI / 3.0f), Vector3(1.0f, 2.0f, 3.0f));
+ Quaternion q2(Mref.GetXAxis(), Mref.GetYAxis(), Mref.GetZAxis());
- DALI_TEST_EQUALS( q1, q2, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q2, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionCtorAxesP02(void)
{
- Vector3 xAxis( Vector3::XAXIS );
- Vector3 yAxis( Vector3::YAXIS );
- Vector3 zAxis( Vector3::ZAXIS );
+ Vector3 xAxis(Vector3::XAXIS);
+ Vector3 yAxis(Vector3::YAXIS);
+ Vector3 zAxis(Vector3::ZAXIS);
- Quaternion q1( xAxis, yAxis, zAxis );
+ Quaternion q1(xAxis, yAxis, zAxis);
- DALI_TEST_EQUALS( q1, Quaternion::IDENTITY, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, Quaternion::IDENTITY, TEST_LOCATION);
- xAxis = Vector3( 1.0f, 1.0f, 0.0f );
+ xAxis = Vector3(1.0f, 1.0f, 0.0f);
xAxis.Normalize();
- yAxis = Vector3( -1.0f, 1.0f, 0.0f ); // 45 degrees anticlockwise ( +ve ) around z
+ yAxis = Vector3(-1.0f, 1.0f, 0.0f); // 45 degrees anticlockwise ( +ve ) around z
yAxis.Normalize();
- zAxis = xAxis.Cross( yAxis );
+ zAxis = xAxis.Cross(yAxis);
zAxis.Normalize();
- Quaternion q2( xAxis, yAxis, zAxis );
+ Quaternion q2(xAxis, yAxis, zAxis);
- DALI_TEST_EQUALS( q2, Quaternion( Radian( Degree( 45 ) ), Vector3::ZAXIS ), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, Quaternion(Radian(Degree(45)), Vector3::ZAXIS), 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionCtorAxesP03(void)
{
// Create an arbitrary forward vector
- for( float x=-1.0f; x<=1.0f; x+=0.1f )
+ for(float x = -1.0f; x <= 1.0f; x += 0.1f)
{
- for( float y=-1.0f; y<1.0f; y+=0.1f )
+ for(float y = -1.0f; y < 1.0f; y += 0.1f)
{
- for( float z=-1.0f; z<1.0f; z+=0.1f )
+ for(float z = -1.0f; z < 1.0f; z += 0.1f)
{
- Vector3 vForward( x, y, z );
+ Vector3 vForward(x, y, z);
vForward.Normalize();
// Construct an up vector from a sideways move
Vector3 vSide;
- Vector3 vUp = vForward.Cross( Vector3( vForward.x+1.0f, vForward.y, vForward.z ) );
- if( vUp.Length() > 0.01 )
+ Vector3 vUp = vForward.Cross(Vector3(vForward.x + 1.0f, vForward.y, vForward.z));
+ if(vUp.Length() > 0.01)
{
vUp.Normalize();
- vSide = vUp.Cross( vForward );
+ vSide = vUp.Cross(vForward);
vSide.Normalize();
}
else
{
- vSide = vForward.Cross( Vector3( vForward.x, vForward.y+1.0f, vForward.z ) );
+ vSide = vForward.Cross(Vector3(vForward.x, vForward.y + 1.0f, vForward.z));
vSide.Normalize();
- vUp = vForward.Cross( vSide );
+ vUp = vForward.Cross(vSide);
vUp.Normalize();
}
// Generate a quaternion
- Quaternion q( vSide, vUp, vForward );
+ Quaternion q(vSide, vUp, vForward);
Matrix rotMatrix;
- rotMatrix.SetXAxis( vSide );
- rotMatrix.SetYAxis( vUp );
- rotMatrix.SetZAxis( vForward );
+ rotMatrix.SetXAxis(vSide);
+ rotMatrix.SetYAxis(vUp);
+ rotMatrix.SetZAxis(vForward);
// Generate a matrix from the quaternion, check they are the same
- Matrix m( q );
- DALI_TEST_EQUALS( m.GetXAxis(), vSide, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( m.GetYAxis(), vUp, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( m.GetZAxis(), vForward, 0.001f, TEST_LOCATION );
+ Matrix m(q);
+ DALI_TEST_EQUALS(m.GetXAxis(), vSide, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(m.GetYAxis(), vUp, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(m.GetZAxis(), vForward, 0.001f, TEST_LOCATION);
// Rotate an arbitrary vector by both quaternion and rotation matrix,
// check the result is the same
- Vector4 aVector( 2.043f, 12.8f, -3.872f, 1.0f );
- Vector3 aVectorRotatedByQ = q.Rotate( Vector3( aVector ) );
- Vector4 aVectorRotatedByR = rotMatrix*aVector;
- DALI_TEST_EQUALS( aVectorRotatedByQ, Vector3( aVectorRotatedByR ), 0.001f, TEST_LOCATION );
+ Vector4 aVector(2.043f, 12.8f, -3.872f, 1.0f);
+ Vector3 aVectorRotatedByQ = q.Rotate(Vector3(aVector));
+ Vector4 aVectorRotatedByR = rotMatrix * aVector;
+ DALI_TEST_EQUALS(aVectorRotatedByQ, Vector3(aVectorRotatedByR), 0.001f, TEST_LOCATION);
}
}
}
int UtcDaliQuaternionCtorTwoVectorsP(void)
{
- Vector3 v0( 1.0f, 2.0f, 3.0f );
- Vector3 v1( -2.0f, 10.0f, -1.0f );
+ Vector3 v0(1.0f, 2.0f, 3.0f);
+ Vector3 v1(-2.0f, 10.0f, -1.0f);
v0.Normalize();
v1.Normalize();
- Quaternion q( v0, v1 );
+ Quaternion q(v0, v1);
- DALI_TEST_EQUALS( q*v0, v1, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q * v0, v1, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionAsVectorP(void)
{
- Vector4 v( 1.0f, 0.1f, 0.2f, 0.3f );
- Quaternion q( v );
+ Vector4 v(1.0f, 0.1f, 0.2f, 0.3f);
+ Quaternion q(v);
- DALI_TEST_EQUALS( v, q.AsVector(), TEST_LOCATION );
+ DALI_TEST_EQUALS(v, q.AsVector(), TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionToAxisAngleVector3P(void)
{
- Quaternion q( 0.932f, 1.1f, 3.4f, 2.7f );
- Radian angle;
- Vector3 axis;
- bool converted = q.ToAxisAngle( axis, angle );
- DALI_TEST_EQUALS( converted, true, TEST_LOCATION );
- DALI_TEST_EQUALS( angle.radian, 0.74f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.x, 3.03f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.y, 9.38f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.z, 7.45f, 0.01f, TEST_LOCATION );
+ Quaternion q(0.932f, 1.1f, 3.4f, 2.7f);
+ Radian angle;
+ Vector3 axis;
+ bool converted = q.ToAxisAngle(axis, angle);
+ DALI_TEST_EQUALS(converted, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(angle.radian, 0.74f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.x, 3.03f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.y, 9.38f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.z, 7.45f, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionToAxisAngleVector3N(void)
{
- Quaternion q( 1, 2, 3, 4 );
- Radian angle;
- Vector3 axis;
- bool converted = q.ToAxisAngle( axis, angle );
- DALI_TEST_EQUALS( converted, false, TEST_LOCATION );
- DALI_TEST_EQUALS( angle.radian, 0.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.x, 0.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.y, 0.0f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.z, 0.0f, 0.01f, TEST_LOCATION );
+ Quaternion q(1, 2, 3, 4);
+ Radian angle;
+ Vector3 axis;
+ bool converted = q.ToAxisAngle(axis, angle);
+ DALI_TEST_EQUALS(converted, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(angle.radian, 0.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.x, 0.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.y, 0.0f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.z, 0.0f, 0.01f, TEST_LOCATION);
END_TEST;
}
{
// Test from euler angles
Quaternion e1;
- e1.SetEuler( Dali::ANGLE_45, Dali::ANGLE_0, Dali::ANGLE_0 );
- Vector4 r1( 0.383f, 0.0f, 0.0f, 0.924f );
+ e1.SetEuler(Dali::ANGLE_45, Dali::ANGLE_0, Dali::ANGLE_0);
+ Vector4 r1(0.383f, 0.0f, 0.0f, 0.924f);
Quaternion e2;
- e2.SetEuler( Dali::ANGLE_0, Radian( Degree( 75 ) ), Dali::ANGLE_0 );
- Vector4 r2( 0.0f, 0.609f, 0.0f, 0.793f );
+ e2.SetEuler(Dali::ANGLE_0, Radian(Degree(75)), Dali::ANGLE_0);
+ Vector4 r2(0.0f, 0.609f, 0.0f, 0.793f);
Quaternion e3;
- e3.SetEuler( Dali::ANGLE_0, Dali::ANGLE_0, Radian( Degree( 135 ) ) );
- Vector4 r3( 0.0f, 0.0f, 0.924f, 0.383f );
+ e3.SetEuler(Dali::ANGLE_0, Dali::ANGLE_0, Radian(Degree(135)));
+ Vector4 r3(0.0f, 0.0f, 0.924f, 0.383f);
Quaternion e4;
- e4.SetEuler( Radian( Degree( 71 ) ), Radian( Degree( 36 ) ), Radian( Degree( 27 ) ) );
- Vector4 r4( 0.478f, 0.374f, 0.006f, 0.795f );
+ e4.SetEuler(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)));
+ Vector4 r4(0.478f, 0.374f, 0.006f, 0.795f);
Quaternion e5;
- e5.SetEuler( Radian( Degree( -31 ) ), Radian( Degree( -91 ) ), Radian( Degree( -173 ) ) );
- Vector4 r5( -0.697f, 0.145f, -0.686f, -0.149f );
+ e5.SetEuler(Radian(Degree(-31)), Radian(Degree(-91)), Radian(Degree(-173)));
+ Vector4 r5(-0.697f, 0.145f, -0.686f, -0.149f);
- DALI_TEST_EQUALS( e1.AsVector(), r1, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( e2.AsVector(), r2, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( e3.AsVector(), r3, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( e4.AsVector(), r4, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( e5.AsVector(), r5, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(e1.AsVector(), r1, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(e2.AsVector(), r2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(e3.AsVector(), r3, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(e4.AsVector(), r4, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(e5.AsVector(), r5, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionEulerAnglesP(void)
{
- Quaternion q1( 0.924f, 0.383f, 0.0f, 0.0f );
- Vector4 r1( Radian( Degree( 45 ) ), 0.0f, 0.0f, 0.0f );
+ Quaternion q1(0.924f, 0.383f, 0.0f, 0.0f);
+ Vector4 r1(Radian(Degree(45)), 0.0f, 0.0f, 0.0f);
- Quaternion q2( 0.793f, 0.0f, 0.609f, 0.0f );
- Vector4 r2( 0.0f, Radian( Degree( 75 ) ), 0.0f, 0.0f );
+ Quaternion q2(0.793f, 0.0f, 0.609f, 0.0f);
+ Vector4 r2(0.0f, Radian(Degree(75)), 0.0f, 0.0f);
- Quaternion q3( 0.383f, 0.0f, 0.0f, 0.924f );
- Vector4 r3( 0.0f, 0.0f, Radian( Degree( 135 ) ), 0.0f );
+ Quaternion q3(0.383f, 0.0f, 0.0f, 0.924f);
+ Vector4 r3(0.0f, 0.0f, Radian(Degree(135)), 0.0f);
- Quaternion q4( 0.795f, 0.478f, 0.374f, 0.006f );
- Vector4 r4( Radian( Degree( 71 ) ), Radian( Degree( 36 ) ), Radian( Degree( 27 ) ), 0.0f );
+ Quaternion q4(0.795f, 0.478f, 0.374f, 0.006f);
+ Vector4 r4(Radian(Degree(71)), Radian(Degree(36)), Radian(Degree(27)), 0.0f);
- Quaternion q5( -0.149f, -0.697f, 0.145f, -0.686f );
- Vector4 r5( Radian( Degree( 148.0 ) ), Radian( Degree( -88.2 ) ), Radian( Degree( 8.0 ) ), 0.0f );
+ Quaternion q5(-0.149f, -0.697f, 0.145f, -0.686f);
+ Vector4 r5(Radian(Degree(148.0)), Radian(Degree(-88.2)), Radian(Degree(8.0)), 0.0f);
- DALI_TEST_EQUALS( q1.EulerAngles(), r1, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( q2.EulerAngles(), r2, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( q3.EulerAngles(), r3, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( q4.EulerAngles(), r4, 0.01, TEST_LOCATION );
- DALI_TEST_EQUALS( q5.EulerAngles(), r5, 0.01, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1.EulerAngles(), r1, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(q2.EulerAngles(), r2, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(q3.EulerAngles(), r3, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(q4.EulerAngles(), r4, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(q5.EulerAngles(), r5, 0.01, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionToMatrixP01(void)
{
- Quaternion q( Radian( 0.69813 ), Vector3( 1.0f, 0.0f, 0.0f ) ); // 40 degree rotation around X axis
+ Quaternion q(Radian(0.69813), Vector3(1.0f, 0.0f, 0.0f)); // 40 degree rotation around X axis
// Result calculated using a different maths library ( with appropriate row/col ordering )
- float els[] = { 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, 0.766f, 0.643f, 0.0f,
- 0.0f, -0.643f, 0.766f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f };
- Matrix mRes( els );
- Matrix m( q );
+ float els[] = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.766f, 0.643f, 0.0f, 0.0f, -0.643f, 0.766f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
+ Matrix mRes(els);
+ Matrix m(q);
- DALI_TEST_EQUALS( m, mRes, 0.01, TEST_LOCATION );
+ DALI_TEST_EQUALS(m, mRes, 0.01, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionToMatrixP02(void)
{
// rotation around arbitrary axis
- Quaternion q2( Radian( -1.23918f ), Vector3( 7.0f, -13.0f, 11.0f ) );
+ Quaternion q2(Radian(-1.23918f), Vector3(7.0f, -13.0f, 11.0f));
- float els[] = { 0.423f, -0.746f, -0.514f, 0.00f,
- 0.384f, 0.662f, -0.644f, 0.00f,
- 0.821f, 0.075f, 0.566f, 0.00f,
- 0.000f, 0.000f, 0.000f, 1.00f };
- Matrix mRes2( els );
+ float els[] = {0.423f, -0.746f, -0.514f, 0.00f, 0.384f, 0.662f, -0.644f, 0.00f, 0.821f, 0.075f, 0.566f, 0.00f, 0.000f, 0.000f, 0.000f, 1.00f};
+ Matrix mRes2(els);
- Matrix m2( q2 );
+ Matrix m2(q2);
- DALI_TEST_EQUALS( m2, mRes2, 0.01, TEST_LOCATION );
+ DALI_TEST_EQUALS(m2, mRes2, 0.01, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionOperatorAdditionP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion q2( 0.0f, 0.609f, 0.0f, 0.793f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion q2(0.0f, 0.609f, 0.0f, 0.793f);
- Quaternion r1( 0.383f, 0.609f, 0.0f, 1.717f );
+ Quaternion r1(0.383f, 0.609f, 0.0f, 1.717f);
- DALI_TEST_EQUALS( q1+q2, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1 + q2, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorSubtractionP(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- Quaternion q2( 0.383f, 0.690f, 0.234f, 1.917f );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ Quaternion q2(0.383f, 0.690f, 0.234f, 1.917f);
- Quaternion r1( 0.0f, 0.240f, 0.111f, 0.993f );
+ Quaternion r1(0.0f, 0.240f, 0.111f, 0.993f);
- DALI_TEST_EQUALS( q2-q1, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2 - q1, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionConjugateP(void)
{
- float s1 = 0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f );
- float s2 = 0.697f; Vector3 v2( 0.612, 0.344, -0.144 );
+ float s1 = 0.784f;
+ Vector3 v1(0.045f, 0.443f, 0.432f);
+ float s2 = 0.697f;
+ Vector3 v2(0.612, 0.344, -0.144);
- Quaternion q1( s1, v1.x, v1.y, v1.z );
- Quaternion q2( s2, v2.x, v2.y, v2.z );
+ Quaternion q1(s1, v1.x, v1.y, v1.z);
+ Quaternion q2(s2, v2.x, v2.y, v2.z);
q1.Conjugate();
q2.Conjugate();
- Quaternion r1( s1, -v1.x, -v1.y, -v1.z );
- Quaternion r2( s2, -v2.x, -v2.y, -v2.z );
+ Quaternion r1(s1, -v1.x, -v1.y, -v1.z);
+ Quaternion r2(s2, -v2.x, -v2.y, -v2.z);
- DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( q2, r2, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(q2, r2, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplicationQuaternionP(void)
{
- float s1=0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f );
- float s2=0.697f; Vector3 v2( 0.612, 0.344, -0.144 );
+ float s1 = 0.784f;
+ Vector3 v1(0.045f, 0.443f, 0.432f);
+ float s2 = 0.697f;
+ Vector3 v2(0.612, 0.344, -0.144);
- Quaternion q1( s1, v1.x, v1.y, v1.z );
- Quaternion q2( s2, v2.x, v2.y, v2.z );
+ Quaternion q1(s1, v1.x, v1.y, v1.z);
+ Quaternion q2(s2, v2.x, v2.y, v2.z);
- Vector3 vp = v1.Cross( v2 ) + v2*s1 + v1*s2;
- Quaternion r1( s1*s2-v1.Dot( v2 ), vp.x, vp.y, vp.z );
+ Vector3 vp = v1.Cross(v2) + v2 * s1 + v1 * s2;
+ Quaternion r1(s1 * s2 - v1.Dot(v2), vp.x, vp.y, vp.z);
- DALI_TEST_EQUALS( q1*q2, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1 * q2, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplicationVector3P(void)
{
// Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1
- Vector3 v( 2, 3, 4 );
- Quaternion q( Radian( Degree( 72 ) ), Vector3::ZAXIS );
+ Vector3 v(2, 3, 4);
+ Quaternion q(Radian(Degree(72)), Vector3::ZAXIS);
Quaternion qI = q;
qI.Invert();
- Quaternion qv( 0.0f, v.x, v.y, v.z );
- Quaternion r1 = ( q * qv ) * qI;
+ Quaternion qv(0.0f, v.x, v.y, v.z);
+ Quaternion r1 = (q * qv) * qI;
Vector3 r2 = q * v;
- DALI_TEST_EQUALS( r1.mVector.x, r2.x, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.y, r2.y, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.z, r2.z, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(r1.mVector.x, r2.x, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.y, r2.y, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.z, r2.z, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplicationFloatP01(void)
{
// Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1
- Quaternion q( Vector4( 0.1f, 0.2f, 0.3f, 1.0f ) );
+ Quaternion q(Vector4(0.1f, 0.2f, 0.3f, 1.0f));
Quaternion q2 = q * 2.f;
- Vector4 v2( 0.2f, 0.4f, 0.6f, 2.0f );
+ Vector4 v2(0.2f, 0.4f, 0.6f, 2.0f);
- DALI_TEST_EQUALS( q2.AsVector(), v2, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2.AsVector(), v2, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplicationFloatP02(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion r1( 2.0f* 0.383f, 0.0f, 0.0f, 2.0f * 0.924f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion r1(2.0f * 0.383f, 0.0f, 0.0f, 2.0f * 0.924f);
- DALI_TEST_EQUALS( q1 * 2.0f, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1 * 2.0f, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplicationFloatP03(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion r1( 0.5f* 0.383f, 0.0f, 0.0f, 0.5f * 0.924f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion r1(0.5f * 0.383f, 0.0f, 0.0f, 0.5f * 0.924f);
- DALI_TEST_EQUALS( q1 / 2.0f, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1 / 2.0f, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorDivisionQuaternionP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion q2( 0.0f, 0.609f, 0.0f, 0.793f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion q2(0.0f, 0.609f, 0.0f, 0.793f);
// q1 / q2 = q1 * q2^-1
// q2^-1 = q2* / ||q2||^2
Quaternion r1 = q2;
r1.Conjugate();
- r1 *= 1.0f/q2.LengthSquared();
+ r1 *= 1.0f / q2.LengthSquared();
Quaternion r2 = q1 * r1;
- DALI_TEST_EQUALS( q1 / q2, r2, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1 / q2, r2, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorDivisionFloatP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion r1( 2.0f* 0.383f, 0.0f, 0.0f, 2.0f * 0.924f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion r1(2.0f * 0.383f, 0.0f, 0.0f, 2.0f * 0.924f);
- DALI_TEST_EQUALS( q1, r1/2.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, r1 / 2.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorDivideAssignedFloatP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion r1( 2.0f* 0.383f, 0.0f, 0.0f, 2.0f * 0.924f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion r1(2.0f * 0.383f, 0.0f, 0.0f, 2.0f * 0.924f);
r1 /= 2.0f;
- DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorNegationP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion r1( -0.383f, -0.0f, -0.0f, -0.924f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion r1(-0.383f, -0.0f, -0.0f, -0.924f);
- DALI_TEST_EQUALS( -q1, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(-q1, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorAddAssignP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
- Quaternion q2( 0.0f, 0.609f, 0.0f, 0.793f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
+ Quaternion q2(0.0f, 0.609f, 0.0f, 0.793f);
- Quaternion r1( 0.383f, 0.609f, 0.0f, 1.717f );
+ Quaternion r1(0.383f, 0.609f, 0.0f, 1.717f);
q1 += q2;
- DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorSubtractAssignP(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- Quaternion q2( 0.383f, 0.690f, 0.234f, 1.917f );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ Quaternion q2(0.383f, 0.690f, 0.234f, 1.917f);
- Quaternion r1( 0.0f, 0.240f, 0.111f, 0.993f );
+ Quaternion r1(0.0f, 0.240f, 0.111f, 0.993f);
q2 -= q1;
- DALI_TEST_EQUALS( q2, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplyAssignQuaternionP(void)
{
- float s1=0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f );
- float s2=0.697f; Vector3 v2( 0.612, 0.344, -0.144 );
+ float s1 = 0.784f;
+ Vector3 v1(0.045f, 0.443f, 0.432f);
+ float s2 = 0.697f;
+ Vector3 v2(0.612, 0.344, -0.144);
- Quaternion q1( s1, v1.x, v1.y, v1.z );
- Quaternion q2( s2, v2.x, v2.y, v2.z );
+ Quaternion q1(s1, v1.x, v1.y, v1.z);
+ Quaternion q2(s2, v2.x, v2.y, v2.z);
Quaternion r3 = q2 * q1;
q2 *= q1;
- DALI_TEST_EQUALS( q2, r3, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, r3, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplyAssignFloatP01(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- float scale = 2.5f;
- Quaternion r1( scale*0.383f, scale*0.450f, scale*0.123f, scale*0.924f );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ float scale = 2.5f;
+ Quaternion r1(scale * 0.383f, scale * 0.450f, scale * 0.123f, scale * 0.924f);
q1 *= scale;
- DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorMultiplyAssignFloatP02(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- float scale = 2.5f;
- Quaternion r1( 0.383f/scale, 0.450f/scale, 0.123f/scale, 0.924f/scale );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ float scale = 2.5f;
+ Quaternion r1(0.383f / scale, 0.450f / scale, 0.123f / scale, 0.924f / scale);
q1 /= scale;
- DALI_TEST_EQUALS( q1, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionOperatorEqualityP(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- Quaternion q2( 0.383f, 0.450f, 0.123f, 0.924f );
- Quaternion q3( 0.383f, 0.450f, 0.123f, 0.800f );
- Quaternion q4( 0.383f, 0.450f, 0.100f, 0.800f );
- Quaternion q5( 0.383f, 0.100f, 0.100f, 0.800f );
- Quaternion q6( 0.100f, 0.100f, 0.100f, 0.800f );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ Quaternion q2(0.383f, 0.450f, 0.123f, 0.924f);
+ Quaternion q3(0.383f, 0.450f, 0.123f, 0.800f);
+ Quaternion q4(0.383f, 0.450f, 0.100f, 0.800f);
+ Quaternion q5(0.383f, 0.100f, 0.100f, 0.800f);
+ Quaternion q6(0.100f, 0.100f, 0.100f, 0.800f);
- Quaternion q7( -0.383f, -0.450f, -0.123f, -0.924f );
- Quaternion q8( -0.383f, -0.450f, -0.123f, 0.924f );
- Quaternion q9( -0.383f, -0.450f, 0.123f, 0.924f );
- Quaternion q10( -0.383f, 0.450f, 0.123f, 0.924f );
+ Quaternion q7(-0.383f, -0.450f, -0.123f, -0.924f);
+ Quaternion q8(-0.383f, -0.450f, -0.123f, 0.924f);
+ Quaternion q9(-0.383f, -0.450f, 0.123f, 0.924f);
+ Quaternion q10(-0.383f, 0.450f, 0.123f, 0.924f);
- DALI_TEST_CHECK( q1 == q2 );
- DALI_TEST_CHECK( !( q1 == q3 ) );
- DALI_TEST_CHECK( !( q1 == q4 ) );
- DALI_TEST_CHECK( !( q1 == q5 ) );
- DALI_TEST_CHECK( !( q1 == q6 ) );
- DALI_TEST_CHECK( ( q1 == q7 ) );
- DALI_TEST_CHECK( !( q1 == q8 ) );
- DALI_TEST_CHECK( !( q1 == q9 ) );
- DALI_TEST_CHECK( !( q1 == q10 ) );
+ DALI_TEST_CHECK(q1 == q2);
+ DALI_TEST_CHECK(!(q1 == q3));
+ DALI_TEST_CHECK(!(q1 == q4));
+ DALI_TEST_CHECK(!(q1 == q5));
+ DALI_TEST_CHECK(!(q1 == q6));
+ DALI_TEST_CHECK((q1 == q7));
+ DALI_TEST_CHECK(!(q1 == q8));
+ DALI_TEST_CHECK(!(q1 == q9));
+ DALI_TEST_CHECK(!(q1 == q10));
END_TEST;
}
int UtcDaliQuaternionOperatorInequalityP(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- Quaternion q2( 0.383f, 0.450f, 0.123f, 0.924f );
- Quaternion q3( -0.383f, -0.0f, -0.0f, -0.924f );
- DALI_TEST_CHECK( !( q1 != q2 ) );
- DALI_TEST_CHECK( q1 != q3 );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ Quaternion q2(0.383f, 0.450f, 0.123f, 0.924f);
+ Quaternion q3(-0.383f, -0.0f, -0.0f, -0.924f);
+ DALI_TEST_CHECK(!(q1 != q2));
+ DALI_TEST_CHECK(q1 != q3);
END_TEST;
}
int UtcDaliQuaternionLengthP(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- float length = sqrtf( 0.383f*0.383f + 0.450f*0.450f + 0.123f*0.123f + 0.924f*0.924f );
- DALI_TEST_EQUALS( q1.Length(), length, 0.001f, TEST_LOCATION );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ float length = sqrtf(0.383f * 0.383f + 0.450f * 0.450f + 0.123f * 0.123f + 0.924f * 0.924f);
+ DALI_TEST_EQUALS(q1.Length(), length, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionLengthSquaredP(void)
{
- Quaternion q1( 0.383f, 0.450f, 0.123f, 0.924f );
- float lengthSquared = 0.383f*0.383f + 0.450f*0.450f + 0.123f*0.123f + 0.924f*0.924f;
- DALI_TEST_EQUALS( q1.LengthSquared(), lengthSquared, 0.01f, TEST_LOCATION );
+ Quaternion q1(0.383f, 0.450f, 0.123f, 0.924f);
+ float lengthSquared = 0.383f * 0.383f + 0.450f * 0.450f + 0.123f * 0.123f + 0.924f * 0.924f;
+ DALI_TEST_EQUALS(q1.LengthSquared(), lengthSquared, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionNormalizeP(void)
{
- Quaternion q1( 0.118f, 0.692f, -0.127f, 0.701f );
+ Quaternion q1(0.118f, 0.692f, -0.127f, 0.701f);
Quaternion q2 = q1;
q2 *= 5.0f;
q2.Normalize();
- DALI_TEST_EQUALS( q1, q2, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q2, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionNormalizedP(void)
{
- Quaternion q1( 0.118f, 0.692f, -0.127f, 0.701f );
+ Quaternion q1(0.118f, 0.692f, -0.127f, 0.701f);
Quaternion q2 = q1;
q2 *= 5.0f;
- DALI_TEST_EQUALS( q1, q2.Normalized(), 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q2.Normalized(), 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionIsIdentityP(void)
{
- Quaternion q( 1.0f, 0.0f, 0.0f, 0.0f );
- DALI_TEST_EQUALS( q.IsIdentity(), true, TEST_LOCATION );
+ Quaternion q(1.0f, 0.0f, 0.0f, 0.0f);
+ DALI_TEST_EQUALS(q.IsIdentity(), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionIsIdentityN(void)
{
- Quaternion q( 1.0f, 0.1f, 0.0f, 0.0f );
- DALI_TEST_EQUALS( q.IsIdentity(), false, TEST_LOCATION );
+ Quaternion q(1.0f, 0.1f, 0.0f, 0.0f);
+ DALI_TEST_EQUALS(q.IsIdentity(), false, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionInvertP(void)
{
- Quaternion q1( 0.383f, 0.0f, 0.0f, 0.924f );
+ Quaternion q1(0.383f, 0.0f, 0.0f, 0.924f);
// q1^-1 = q1* / ||q1||^2
// = Conjugate of q1 / Square of Norm of q1
Quaternion r1 = q1;
r1.Conjugate();
- r1 *= 1.0f/q1.LengthSquared();
+ r1 *= 1.0f / q1.LengthSquared();
Quaternion q2 = q1;
q2.Invert();
- DALI_TEST_EQUALS( q2, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionDotP(void)
{
// q.q' = s*s' + v dot v'
- float s1 = 0.784f; Vector3 v1( 0.045f, 0.443f, 0.432f );
- float s2 = 0.697f; Vector3 v2( 0.612, 0.344, -0.144 );
+ float s1 = 0.784f;
+ Vector3 v1(0.045f, 0.443f, 0.432f);
+ float s2 = 0.697f;
+ Vector3 v2(0.612, 0.344, -0.144);
- Quaternion q1( s1, v1.x, v1.y, v1.z );
- Quaternion q2( s2, v2.x, v2.y, v2.z );
+ Quaternion q1(s1, v1.x, v1.y, v1.z);
+ Quaternion q2(s2, v2.x, v2.y, v2.z);
- float r1 = s1*s2 + v1.Dot( v2 );
+ float r1 = s1 * s2 + v1.Dot(v2);
- DALI_TEST_EQUALS( Quaternion::Dot( q1, q2 ), r1, TEST_LOCATION );
+ DALI_TEST_EQUALS(Quaternion::Dot(q1, q2), r1, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionRotateVector3P(void)
{
// Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1
- Vector3 v( 2, 3, 4 );
- Quaternion q( Radian( Degree( 72 ) ), Vector3::ZAXIS );
+ Vector3 v(2, 3, 4);
+ Quaternion q(Radian(Degree(72)), Vector3::ZAXIS);
Quaternion qI = q;
qI.Invert();
- Quaternion qv( 0.0f, v.x, v.y, v.z );
+ Quaternion qv(0.0f, v.x, v.y, v.z);
Quaternion r1 = q * qv * qI;
- Vector3 r2 = q.Rotate( v );
+ Vector3 r2 = q.Rotate(v);
- DALI_TEST_EQUALS( r1.mVector.x, r2.x, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.y, r2.y, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.z, r2.z, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(r1.mVector.x, r2.x, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.y, r2.y, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.z, r2.z, 0.001f, TEST_LOCATION);
- DALI_TEST_EQUALS( q.Rotate( v ), q*v, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q.Rotate(v), q * v, 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionRotateVector4P(void)
{
// Rotation of vector p = ( x,y,z ) by Quaternion q == q [0,p] q^-1
- Vector4 v( 2, 3, 4, 5 );
- Quaternion q( Radian( Degree( 72 ) ), Vector3::ZAXIS );
+ Vector4 v(2, 3, 4, 5);
+ Quaternion q(Radian(Degree(72)), Vector3::ZAXIS);
Quaternion qI = q;
qI.Invert();
- Quaternion qv( 0.0f, v.x, v.y, v.z );
+ Quaternion qv(0.0f, v.x, v.y, v.z);
Quaternion r1 = q * qv * qI;
- Vector4 r2 = q.Rotate( v );
+ Vector4 r2 = q.Rotate(v);
- DALI_TEST_EQUALS( r1.mVector.x, r2.x, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.y, r2.y, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.z, r2.z, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( r1.mVector.w, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(r1.mVector.x, r2.x, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.y, r2.y, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.z, r2.z, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(r1.mVector.w, 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionExpP01(void)
{
- Quaternion q1( 0.0f, 1.0f, 1.2f, 1.3f );
+ Quaternion q1(0.0f, 1.0f, 1.2f, 1.3f);
Quaternion q2 = q1.Exp();
- Quaternion r2( -0.4452, 0.4406, 0.5287, 0.5728 );
+ Quaternion r2(-0.4452, 0.4406, 0.5287, 0.5728);
- DALI_TEST_EQUALS( q2.Length(), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2.Length(), 1.0f, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS( q2, r2, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, r2, 0.001f, TEST_LOCATION);
// Note, this trick only works when |v| < pi, which it is!
Quaternion q3 = q2.Log();
- DALI_TEST_EQUALS( q1, q3, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q3, 0.01f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionExpP02(void)
{
- Quaternion q1( 0.0f, 0.0f, 0.0f, 0.0f );
+ Quaternion q1(0.0f, 0.0f, 0.0f, 0.0f);
Quaternion q2 = q1.Exp();
- Quaternion r2( 1.0f, 0.0f, 0.0f, 0.0f );
+ Quaternion r2(1.0f, 0.0f, 0.0f, 0.0f);
- DALI_TEST_EQUALS( q2.Length(), 1.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2.Length(), 1.0f, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS( q2, r2, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, r2, 0.001f, TEST_LOCATION);
// Note, this trick only works when |v| < pi, which it is!
Quaternion q3 = q2.Log();
- DALI_TEST_EQUALS( q1, q3, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q3, 0.01f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionExpN(void)
{
- Quaternion q( Radian( 0.0f ), Vector3(5.0f, 6.0f, 7.0f) );
+ Quaternion q(Radian(0.0f), Vector3(5.0f, 6.0f, 7.0f));
// q.w is non-zero. Should assert.
try
{
q.Exp();
- DALI_TEST_CHECK( false );
+ DALI_TEST_CHECK(false);
}
- catch( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
}
-
int UtcDaliQuaternionLogP01(void)
{
- Quaternion q( Radian( Math::PI*0.73f ), Vector3(2,3,4) );
+ Quaternion q(Radian(Math::PI * 0.73f), Vector3(2, 3, 4));
Quaternion q2 = q;
q2.Normalize();
Quaternion r = q2.Log();
- DALI_TEST_EQUALS( r.mVector.w, 0.0f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(r.mVector.w, 0.0f, 0.01f, TEST_LOCATION);
Quaternion r2 = r.Exp();
- DALI_TEST_EQUALS( r2, q2, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(r2, q2, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionLogP02(void)
{
- Quaternion q1( 1.0f, 0.0f, 0.0f, 0.0f );
- Quaternion r1( 0.0f, 0.0f, 0.0f, 0.0f );
+ Quaternion q1(1.0f, 0.0f, 0.0f, 0.0f);
+ Quaternion r1(0.0f, 0.0f, 0.0f, 0.0f);
Quaternion q2 = q1.Log();
- DALI_TEST_EQUALS( q2, r1, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q2, r1, 0.01f, TEST_LOCATION);
Quaternion q3 = q2.Exp();
- DALI_TEST_EQUALS( q1, q3, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(q1, q3, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionLerpP(void)
{
- Quaternion q1( Radian( Degree( -80 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
- Quaternion q2( Radian( Degree( 80 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
+ Quaternion q1(Radian(Degree(-80)), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q2(Radian(Degree(80)), Vector3(0.0f, 0.0f, 1.0f));
- Quaternion p = Quaternion::Lerp( q1, q2, 0.0f );
- DALI_TEST_EQUALS( p, q1, 0.001f, TEST_LOCATION );
+ Quaternion p = Quaternion::Lerp(q1, q2, 0.0f);
+ DALI_TEST_EQUALS(p, q1, 0.001f, TEST_LOCATION);
- p = Quaternion::Lerp( q1, q2, 1.0f );
- DALI_TEST_EQUALS( p, q2, 0.001f, TEST_LOCATION );
+ p = Quaternion::Lerp(q1, q2, 1.0f);
+ DALI_TEST_EQUALS(p, q2, 0.001f, TEST_LOCATION);
- p = Quaternion::Lerp( q1, q2, 0.5f );
- Quaternion r1 = ( q1 + q2 ) * 0.5f;
+ p = Quaternion::Lerp(q1, q2, 0.5f);
+ Quaternion r1 = (q1 + q2) * 0.5f;
r1.Normalize();
- DALI_TEST_EQUALS( p, r1, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(p, r1, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliQuaternionSlerpP01(void)
{
- Quaternion q1(Radian(M_PI/4.0f), Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q2(Radian(-M_PI/4.0f), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q1(Radian(M_PI / 4.0f), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q2(Radian(-M_PI / 4.0f), Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q = Quaternion::Slerp( q1, q2, 0.0f );
- DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION );
+ Quaternion q = Quaternion::Slerp(q1, q2, 0.0f);
+ DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION);
- q = Quaternion::Slerp( q1, q2, 1.0f );
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
+ q = Quaternion::Slerp(q1, q2, 1.0f);
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
// @ 25%, will be at M_PI/8
- q = Quaternion::Slerp( q1, q2, 0.25f );
+ q = Quaternion::Slerp(q1, q2, 0.25f);
Vector3 axis;
- Radian angle;
- bool converted = q.ToAxisAngle( axis, angle );
- DALI_TEST_EQUALS( converted, true, TEST_LOCATION );
- DALI_TEST_EQUALS( angle.radian, Math::PI/8.0f, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.x, 0.0f, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.y, 0.0f, 0.001, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.z, 1.0f, 0.001, TEST_LOCATION );
+ Radian angle;
+ bool converted = q.ToAxisAngle(axis, angle);
+ DALI_TEST_EQUALS(converted, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(angle.radian, Math::PI / 8.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.x, 0.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.y, 0.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.z, 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliQuaternionSlerpP02(void)
{
- Quaternion q1( Dali::ANGLE_30, Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q2( Dali::ANGLE_90, Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q1(Dali::ANGLE_30, Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q2(Dali::ANGLE_90, Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q = Quaternion::Slerp( q1, q2, 0.0f );
+ Quaternion q = Quaternion::Slerp(q1, q2, 0.0f);
- DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION);
- q = Quaternion::Slerp( q1, q2, 1.0f );
+ q = Quaternion::Slerp(q1, q2, 1.0f);
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
// @ 50%, will be at M_PI/3 around z
- q = Quaternion::Slerp( q1, q2, 0.5f );
+ q = Quaternion::Slerp(q1, q2, 0.5f);
- Quaternion r( Dali::ANGLE_60, Vector3( 0.0f, 0.0f, 1.0f));
- DALI_TEST_EQUALS( q, r, 0.001, TEST_LOCATION );
+ Quaternion r(Dali::ANGLE_60, Vector3(0.0f, 0.0f, 1.0f));
+ DALI_TEST_EQUALS(q, r, 0.001, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionSlerpP03(void)
{
- Quaternion q1( Radian( Degree( 125 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
- Quaternion q2( Radian( Degree( -125 ) ), Vector3( 0.002f, 0.001f, 1.001f ) );
+ Quaternion q1(Radian(Degree(125)), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q2(Radian(Degree(-125)), Vector3(0.002f, 0.001f, 1.001f));
- Quaternion q = Quaternion::Slerp( q1, q2, 0.0f );
- DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION );
+ Quaternion q = Quaternion::Slerp(q1, q2, 0.0f);
+ DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION);
- q = Quaternion::Slerp( q1, q2, 1.0f );
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
+ q = Quaternion::Slerp(q1, q2, 1.0f);
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
q = Quaternion::Slerp(q1, q2, 0.05f);
Vector3 axis;
- Radian angle;
- bool converted = q.ToAxisAngle(axis, angle);
+ Radian angle;
+ bool converted = q.ToAxisAngle(axis, angle);
DALI_TEST_EQUALS(converted, true, TEST_LOCATION);
- DALI_TEST_EQUALS( axis.x, 0.0f, 0.01, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.y, 0.0f, 0.01, TEST_LOCATION );
- DALI_TEST_EQUALS( axis.z, 1.0f, 0.01, TEST_LOCATION );
+ DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliQuaternionSlerpP04(void)
{
- Quaternion q1( Radian( Degree( 120 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
- Quaternion q2( Radian( Degree( 130 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
+ Quaternion q1(Radian(Degree(120)), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q2(Radian(Degree(130)), Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q = Quaternion::Slerp( q1, q2, 0.0f );
- DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION );
+ Quaternion q = Quaternion::Slerp(q1, q2, 0.0f);
+ DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION);
- q = Quaternion::Slerp( q1, q2, 1.0f );
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
+ q = Quaternion::Slerp(q1, q2, 1.0f);
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
q = Quaternion::Slerp(q1, q2, 0.5f);
Vector3 axis;
- Radian angle;
- bool converted = q.ToAxisAngle(axis, angle);
+ Radian angle;
+ bool converted = q.ToAxisAngle(axis, angle);
DALI_TEST_EQUALS(converted, true, TEST_LOCATION);
DALI_TEST_EQUALS(angle.radian, float(Radian(Degree(125))), 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION);
- DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION);
- DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION);
END_TEST;
}
-
-
int UtcDaliQuaternionSlerpNoInvertP01(void)
{
- Quaternion q1( Dali::ANGLE_45, Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q1(Dali::ANGLE_45, Vector3(0.0f, 0.0f, 1.0f));
Quaternion q2(-Dali::ANGLE_45, Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q = Quaternion::SlerpNoInvert( q1, q2, 0.0f );
- DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION );
+ Quaternion q = Quaternion::SlerpNoInvert(q1, q2, 0.0f);
+ DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION);
- q = Quaternion::SlerpNoInvert( q1, q2, 1.0f );
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
+ q = Quaternion::SlerpNoInvert(q1, q2, 1.0f);
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
// @ 25%, will be at M_PI/8
q = Quaternion::SlerpNoInvert(q1, q2, 0.25f);
Vector3 axis;
- Radian angle;
- bool converted = q.ToAxisAngle(axis, angle);
+ Radian angle;
+ bool converted = q.ToAxisAngle(axis, angle);
DALI_TEST_EQUALS(converted, true, TEST_LOCATION);
- DALI_TEST_EQUALS(angle.radian, Math::PI/8.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(angle.radian, Math::PI / 8.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(axis.x, 0.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(axis.y, 0.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(axis.z, 1.0f, 0.001, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionSlerpNoInvertP02(void)
{
- Quaternion q1( Radian( Degree( 120 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
- Quaternion q2( Radian( Degree( 130 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
+ Quaternion q1(Radian(Degree(120)), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q2(Radian(Degree(130)), Vector3(0.0f, 0.0f, 1.0f));
- Quaternion q = Quaternion::SlerpNoInvert( q1, q2, 0.0f );
- DALI_TEST_EQUALS( q, q1, 0.001, TEST_LOCATION );
+ Quaternion q = Quaternion::SlerpNoInvert(q1, q2, 0.0f);
+ DALI_TEST_EQUALS(q, q1, 0.001, TEST_LOCATION);
- q = Quaternion::SlerpNoInvert( q1, q2, 1.0f );
- DALI_TEST_EQUALS( q, q2, 0.001, TEST_LOCATION );
+ q = Quaternion::SlerpNoInvert(q1, q2, 1.0f);
+ DALI_TEST_EQUALS(q, q2, 0.001, TEST_LOCATION);
q = Quaternion::SlerpNoInvert(q1, q2, 0.5f);
Vector3 axis;
- Radian angle;
- bool converted = q.ToAxisAngle(axis, angle);
+ Radian angle;
+ bool converted = q.ToAxisAngle(axis, angle);
DALI_TEST_EQUALS(converted, true, TEST_LOCATION);
DALI_TEST_EQUALS(angle.radian, float(Radian(Degree(125))), 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION);
- DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION);
- DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.x, 0.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.y, 0.0f, 0.01, TEST_LOCATION);
+ DALI_TEST_EQUALS(axis.z, 1.0f, 0.01, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliQuaternionSquadP(void)
{
- Quaternion q1( Radian( Degree( 45 ) ), Vector3( 0.0f, 0.0f, 1.0f ) );
- Quaternion q1out( Radian( Degree( 40 ) ), Vector3( 0.0f, 1.0f, 2.0f ) );
- Quaternion q2in( Radian( Degree( 35 ) ), Vector3( 0.0f, 2.0f, 3.0f ) );
- Quaternion q2( Radian( Degree( 30 ) ), Vector3( 0.0f, 1.0f, 3.0f ) );
+ Quaternion q1(Radian(Degree(45)), Vector3(0.0f, 0.0f, 1.0f));
+ Quaternion q1out(Radian(Degree(40)), Vector3(0.0f, 1.0f, 2.0f));
+ Quaternion q2in(Radian(Degree(35)), Vector3(0.0f, 2.0f, 3.0f));
+ Quaternion q2(Radian(Degree(30)), Vector3(0.0f, 1.0f, 3.0f));
- Quaternion q = Quaternion::Squad( q1, q2, q1out, q2in, 0.0f );
- DALI_TEST_EQUALS( q, q1, 0.001f, TEST_LOCATION );
+ Quaternion q = Quaternion::Squad(q1, q2, q1out, q2in, 0.0f);
+ DALI_TEST_EQUALS(q, q1, 0.001f, TEST_LOCATION);
- q = Quaternion::Squad( q1, q2, q1out, q2in, 1.0f );
- DALI_TEST_EQUALS( q, q2, 0.001f, TEST_LOCATION );
+ q = Quaternion::Squad(q1, q2, q1out, q2in, 1.0f);
+ DALI_TEST_EQUALS(q, q2, 0.001f, TEST_LOCATION);
// Don't know what actual value should be, but can make some informed guesses.
q = Quaternion::Squad(q1, q2, q1out, q2in, 0.5f);
- Radian angle;
+ Radian angle;
Vector3 axis;
q.Normalize();
- q.ToAxisAngle( axis, angle );
+ q.ToAxisAngle(axis, angle);
- if( angle < 0.0f )
+ if(angle < 0.0f)
{
q = -q; // Might get negative quat
- q.ToAxisAngle( axis, angle );
+ q.ToAxisAngle(axis, angle);
}
float deg = Degree(angle).degree;
DALI_TEST_CHECK(deg >= 0 && deg <= 90);
int UtcDaliAngleBetweenP(void)
{
- Quaternion q1( ANGLE_45, ANGLE_0, ANGLE_0 );
- Quaternion q2(Radian(Degree(47)), ANGLE_0, ANGLE_0 );
+ Quaternion q1(ANGLE_45, ANGLE_0, ANGLE_0);
+ Quaternion q2(Radian(Degree(47)), ANGLE_0, ANGLE_0);
DALI_TEST_EQUALS(Quaternion::AngleBetween(q1, q2), fabsf(Radian(Degree(45)) - Radian(Degree(47))), 0.001f, TEST_LOCATION);
- Quaternion q3( Radian( Degree( 80 ) ), Vector3::YAXIS );
- Quaternion q4( Radian( Degree( 90 ) ), Vector3::YAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q3, q4 ), fabsf( Radian( Degree( 80 ) ) - Radian( Degree( 90 ) ) ), 0.001f, TEST_LOCATION );
+ Quaternion q3(Radian(Degree(80)), Vector3::YAXIS);
+ Quaternion q4(Radian(Degree(90)), Vector3::YAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q3, q4), fabsf(Radian(Degree(80)) - Radian(Degree(90))), 0.001f, TEST_LOCATION);
- Quaternion q5( Radian( Degree( 0 ) ), Vector3::YAXIS );
- Quaternion q6( Radian( Degree( 90 ) ), Vector3::XAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q5, q6 ), fabsf( Radian( Degree( 0 ) ) - Radian( Degree( 90 ) ) ), 0.001f, TEST_LOCATION );
+ Quaternion q5(Radian(Degree(0)), Vector3::YAXIS);
+ Quaternion q6(Radian(Degree(90)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q5, q6), fabsf(Radian(Degree(0)) - Radian(Degree(90))), 0.001f, TEST_LOCATION);
- Quaternion q7( Radian( Degree( 0 ) ), Vector3::YAXIS );
- Quaternion q8( Radian( Degree( 0 ) ), Vector3::XAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q7, q8 ), fabsf( Radian( Degree( 0 ) ) - Radian( Degree( 0 ) ) ), 0.001f, TEST_LOCATION );
+ Quaternion q7(Radian(Degree(0)), Vector3::YAXIS);
+ Quaternion q8(Radian(Degree(0)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q7, q8), fabsf(Radian(Degree(0)) - Radian(Degree(0))), 0.001f, TEST_LOCATION);
- Quaternion q9( Radian( Degree( 0 ) ), Vector3::XAXIS );
- Quaternion q10( Radian( Degree( 180 ) ), Vector3::XAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q9, q10 ), fabsf( Radian( Degree( 0 ) ) - Radian( Degree( 180 ) ) ), 0.001f, TEST_LOCATION );
+ Quaternion q9(Radian(Degree(0)), Vector3::XAXIS);
+ Quaternion q10(Radian(Degree(180)), Vector3::XAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q9, q10), fabsf(Radian(Degree(0)) - Radian(Degree(180))), 0.001f, TEST_LOCATION);
- Quaternion q11( Radian( Degree( 1 ) ), Vector3::YAXIS );
- Quaternion q12( Radian( Degree( 240 ) ), Vector3::YAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q11, q12 ), fabsf( Radian( Degree( 1 - 240 + 360 ) ) ), 0.001f, TEST_LOCATION );
+ Quaternion q11(Radian(Degree(1)), Vector3::YAXIS);
+ Quaternion q12(Radian(Degree(240)), Vector3::YAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q11, q12), fabsf(Radian(Degree(1 - 240 + 360))), 0.001f, TEST_LOCATION);
- Quaternion q13( Radian( Degree( 240 ) ), Vector3::YAXIS );
- Quaternion q14( Radian( Degree( 1 ) ), Vector3::YAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q13, q14 ), fabsf( Radian( Degree( 240 - 1 - 360 ) ) ), 0.001f, TEST_LOCATION );
+ Quaternion q13(Radian(Degree(240)), Vector3::YAXIS);
+ Quaternion q14(Radian(Degree(1)), Vector3::YAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q13, q14), fabsf(Radian(Degree(240 - 1 - 360))), 0.001f, TEST_LOCATION);
- Quaternion q15( Radian( Degree( 240 ) ), Vector3::YAXIS );
- Quaternion q16( Radian( Degree( 1 ) ), Vector3::ZAXIS );
- DALI_TEST_EQUALS( Quaternion::AngleBetween( q15, q16 ), Quaternion::AngleBetween( q16, q15 ), 0.001f, TEST_LOCATION );
+ Quaternion q15(Radian(Degree(240)), Vector3::YAXIS);
+ Quaternion q16(Radian(Degree(1)), Vector3::ZAXIS);
+ DALI_TEST_EQUALS(Quaternion::AngleBetween(q15, q16), Quaternion::AngleBetween(q16, q15), 0.001f, TEST_LOCATION);
END_TEST;
}
{
std::ostringstream oss;
- Quaternion quaternion( Dali::ANGLE_180, Vector3::YAXIS );
+ Quaternion quaternion(Dali::ANGLE_180, Vector3::YAXIS);
oss << quaternion;
std::string expectedOutput = "[ Axis: [0, 1, 0], Angle: 180 degrees ]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION );
+ DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-using namespace Dali;
+#include <iostream>
+using namespace Dali;
void utc_dali_radian_startup(void)
{
test_return_value = TET_PASS;
}
-
// Positive test case for constructors
int UtcDaliRadianConstructors01(void)
{
// Default constructor, does not initialise the value
- Radian radian0( 0.0f );
+ Radian radian0(0.0f);
// Test float assignment operator
radian0 = Math::PI;
- DALI_TEST_EQUALS( float(radian0), Math::PI, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(float(radian0), Math::PI, 0.001f, TEST_LOCATION);
// Constructor from float value
- Radian radian1( Math::PI );
- DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION );
+ Radian radian1(Math::PI);
+ DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION);
// Constructor from a Degree
- Radian radian2( Degree( 180.0f ) );
- DALI_TEST_EQUALS( float(radian2), Math::PI, 0.001f, TEST_LOCATION );
+ Radian radian2(Degree(180.0f));
+ DALI_TEST_EQUALS(float(radian2), Math::PI, 0.001f, TEST_LOCATION);
// Assignment from Degree
- Radian radian3( 0.0f );
- radian3 = Degree( 180.0f );
- DALI_TEST_EQUALS( float(radian3), Math::PI, 0.001f, TEST_LOCATION );
+ Radian radian3(0.0f);
+ radian3 = Degree(180.0f);
+ DALI_TEST_EQUALS(float(radian3), Math::PI, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliRadianCopyConstructor(void)
{
- Radian radian0( Math::PI );
- Radian radian1( radian0 );
- DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION );
+ Radian radian0(Math::PI);
+ Radian radian1(radian0);
+ DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliRadianMoveConstructor(void)
{
- Radian radian0( Math::PI );
- Radian radian1 = std::move( radian0 );
- DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION );
+ Radian radian0(Math::PI);
+ Radian radian1 = std::move(radian0);
+ DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliRadianCopyAssignment(void)
{
- Radian radian0( Math::PI );
+ Radian radian0(Math::PI);
Radian radian1;
radian1 = radian0;
- DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliRadianMoveAssignment(void)
{
- Radian radian0( Math::PI );
+ Radian radian0(Math::PI);
Radian radian1;
- radian1 = std::move( radian0 );
- DALI_TEST_EQUALS( float(radian1), Math::PI, 0.001f, TEST_LOCATION );
+ radian1 = std::move(radian0);
+ DALI_TEST_EQUALS(float(radian1), Math::PI, 0.001f, TEST_LOCATION);
END_TEST;
}
int UtcDaliRadianComparison01(void)
{
// Comparison between radians
- Radian radian0( Math::PI_2 );
- Radian radian1( Math::PI_2 );
- Radian radian2( Math::PI );
+ Radian radian0(Math::PI_2);
+ Radian radian1(Math::PI_2);
+ Radian radian2(Math::PI);
- DALI_TEST_CHECK( radian0 == radian1 );
- DALI_TEST_CHECK( radian0 != radian2 );
+ DALI_TEST_CHECK(radian0 == radian1);
+ DALI_TEST_CHECK(radian0 != radian2);
// Comparison between radian to degree
- Radian radian3( Math::PI );
- Radian radian4( Math::PI_2 );
- Degree degree0( 180.0f );
+ Radian radian3(Math::PI);
+ Radian radian4(Math::PI_2);
+ Degree degree0(180.0f);
- DALI_TEST_CHECK( radian3 == Radian(degree0) );
- DALI_TEST_CHECK( radian4 != Radian(degree0) );
+ DALI_TEST_CHECK(radian3 == Radian(degree0));
+ DALI_TEST_CHECK(radian4 != Radian(degree0));
// Comparison with float
- Radian radian5( Math::PI_2 );
+ Radian radian5(Math::PI_2);
- DALI_TEST_CHECK( radian5 == Math::PI_2 );
- DALI_TEST_CHECK( radian5 != Math::PI );
+ DALI_TEST_CHECK(radian5 == Math::PI_2);
+ DALI_TEST_CHECK(radian5 != Math::PI);
END_TEST;
}
-
// test case for cast operators
int UtcDaliRadianCastOperators01(void)
{
- Radian radian0( Math::PI );
+ Radian radian0(Math::PI);
- const float& value0( radian0.radian );
- DALI_TEST_EQUALS( value0, Math::PI, 0.001f, TEST_LOCATION );
+ const float& value0(radian0.radian);
+ DALI_TEST_EQUALS(value0, Math::PI, 0.001f, TEST_LOCATION);
radian0 = Math::PI_2;
- DALI_TEST_EQUALS( value0, Math::PI_2, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(value0, Math::PI_2, 0.001f, TEST_LOCATION);
- float value1( radian0 );
- DALI_TEST_EQUALS( value1, Math::PI_2, 0.001f, TEST_LOCATION );
+ float value1(radian0);
+ DALI_TEST_EQUALS(value1, Math::PI_2, 0.001f, TEST_LOCATION);
radian0 = Math::PI;
- DALI_TEST_EQUALS( float(radian0), Math::PI, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(float(radian0), Math::PI, 0.001f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRadianCastOperatorEquals(void)
{
Radian a(Math::PI_2);
Radian b(Math::PI_2);
Radian c(Math::PI);
- DALI_TEST_EQUALS( a == a, true, TEST_LOCATION );
- DALI_TEST_EQUALS( a == b, true, TEST_LOCATION );
- DALI_TEST_EQUALS( a == c, false, TEST_LOCATION );
- DALI_TEST_EQUALS( Degree(c) == c, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(a == a, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(a == b, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(a == c, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(Degree(c) == c, true, TEST_LOCATION);
END_TEST;
}
Radian b(Math::PI_2);
Radian c(Math::PI);
- DALI_TEST_EQUALS( a != a, false, TEST_LOCATION );
- DALI_TEST_EQUALS( a != b, false, TEST_LOCATION );
- DALI_TEST_EQUALS( a != c, true, TEST_LOCATION );
- DALI_TEST_EQUALS( Degree(a) != c, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(a != a, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(a != b, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(a != c, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Degree(a) != c, true, TEST_LOCATION);
END_TEST;
}
Radian a(Math::PI_4);
Radian b(Math::PI_2);
Radian c(Math::PI);
- Radian d(2.0f*Math::PI);
+ Radian d(2.0f * Math::PI);
Radian e(-Math::PI);
DALI_TEST_EQUALS(a < a, false, TEST_LOCATION);
DALI_TEST_EQUALS(d < b, false, TEST_LOCATION);
DALI_TEST_EQUALS(e < b, true, TEST_LOCATION);
- DALI_TEST_EQUALS( Radian(Math::PI_2) < Degree(180.0f), true, TEST_LOCATION);
- DALI_TEST_EQUALS( Radian(Math::PI_2) < Degree(90.0f), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Radian(Math::PI_2) > Degree(45.0f), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Radian(Math::PI_2) < Degree(180.0f), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Radian(Math::PI_2) < Degree(90.0f), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(Radian(Math::PI_2) > Degree(45.0f), true, TEST_LOCATION);
- DALI_TEST_EQUALS( Degree(180.0f) > Radian(Math::PI_2), true, TEST_LOCATION);
- DALI_TEST_EQUALS( Degree(90.0f) > Radian(Math::PI_2), false, TEST_LOCATION);
- DALI_TEST_EQUALS( Degree(45.0f) < Radian(Math::PI_2), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Degree(180.0f) > Radian(Math::PI_2), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(Degree(90.0f) > Radian(Math::PI_2), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(Degree(45.0f) < Radian(Math::PI_2), true, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-using namespace Dali;
+#include <iostream>
+using namespace Dali;
int UtcDaliRandomRangeMethod(void)
{
TestApplication application; // Reset all test adapter return codes
- float a=0, b=1;
- for(size_t i=0; i<100; i++)
+ float a = 0, b = 1;
+ for(size_t i = 0; i < 100; i++)
{
float r = Dali::Random::Range(a, b);
DALI_TEST_CHECK(r >= a && r <= b);
}
- a=100; b=-100;
- for(size_t i=0; i<100; i++)
+ a = 100;
+ b = -100;
+ for(size_t i = 0; i < 100; i++)
{
float r = Dali::Random::Range(a, b);
DALI_TEST_CHECK(r >= b && r <= a);
END_TEST;
}
-
int UtcDaliRandomAxisMethod(void)
{
TestApplication application; // Reset all test adapter return codes
- for(size_t i=0; i<100; i++)
+ for(size_t i = 0; i < 100; i++)
{
Vector4 axis = Dali::Random::Axis();
DALI_TEST_EQUALS(axis.Length(), 1.0f, 0.0001f, TEST_LOCATION);
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
test_return_value = TET_PASS;
}
-
// Positive test case for a method
int UtcDaliRectCons01(void)
{
Rect<float> rect(10.0f, 20.0f, 400.0f, 200.0f);
- Rect<float> r2 = std::move( rect );
+ Rect<float> r2 = std::move(rect);
DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION);
Rect<float> rect(10.0f, 20.0f, 400.0f, 200.0f);
Rect<float> r2;
- r2 = std::move( rect );
+ r2 = std::move(rect);
DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION);
{
TestApplication application;
- Rect<int> ri;
- Rect<float> rf(10.0f, 20.0f, 400.0f, 200.0f);
- Rect<float> rf2;
- Rect<float> rf3(10.0f, 20.0f, 0.0f, 200.0f);
- Rect<float> rf4(10.0f, 20.0f, 400.0f, 0.0f);
- Rect<double> rd(10.0, 20.0, 0.0, 200.0);
+ Rect<int> ri;
+ Rect<float> rf(10.0f, 20.0f, 400.0f, 200.0f);
+ Rect<float> rf2;
+ Rect<float> rf3(10.0f, 20.0f, 0.0f, 200.0f);
+ Rect<float> rf4(10.0f, 20.0f, 400.0f, 0.0f);
+ Rect<double> rd(10.0, 20.0, 0.0, 200.0);
Rect<unsigned int> ru(0u, 0u, 4u, 0u);
DALI_TEST_CHECK(!rf.IsEmpty());
END_TEST;
}
-
int UtcDaliRectArea(void)
{
TestApplication application;
END_TEST;
}
-
int UtcDaliRectIntersects(void)
{
TestApplication application;
- Rect<float> rf1( 10.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf2( 10.0f, 120.0f, 200.0f, 200.0f);
- Rect<float> rf3( 10.0f, -80.0f, 200.0f, 200.0f);
- Rect<float> rf4(110.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf5(-90.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf1(10.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf2(10.0f, 120.0f, 200.0f, 200.0f);
+ Rect<float> rf3(10.0f, -80.0f, 200.0f, 200.0f);
+ Rect<float> rf4(110.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf5(-90.0f, 20.0f, 200.0f, 200.0f);
Rect<float> rf6(1000.0f, 1200.0f, 10.0f, 10.0f);
DALI_TEST_CHECK(rf1.Intersects(rf2));
END_TEST;
}
-
-
int UtcDaliRectContains(void)
{
TestApplication application;
- Rect<float> rf1( 10.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf1(10.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf2( 10.0f, 120.0f, 200.0f, 200.0f);
- Rect<float> rf3( 10.0f, -80.0f, 200.0f, 200.0f);
- Rect<float> rf4(110.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf5(-90.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf2(10.0f, 120.0f, 200.0f, 200.0f);
+ Rect<float> rf3(10.0f, -80.0f, 200.0f, 200.0f);
+ Rect<float> rf4(110.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf5(-90.0f, 20.0f, 200.0f, 200.0f);
Rect<float> rf6(1000.0f, 1200.0f, 10.0f, 10.0f);
- Rect<float> rf7( 50.0f, 70.0f, 50.0f, 50.0f);
+ Rect<float> rf7(50.0f, 70.0f, 50.0f, 50.0f);
- Rect<float> rf8( 10.0f, 20.0f, 100.0f, 100.0f);
- Rect<float> rf9( 110.0f, 20.0f, 100.0f, 100.0f);
- Rect<float> rf10( 110.0f, 120.0f, 100.0f, 100.0f);
- Rect<float> rf11( 10.0f, 120.0f, 100.0f, 100.0f);
+ Rect<float> rf8(10.0f, 20.0f, 100.0f, 100.0f);
+ Rect<float> rf9(110.0f, 20.0f, 100.0f, 100.0f);
+ Rect<float> rf10(110.0f, 120.0f, 100.0f, 100.0f);
+ Rect<float> rf11(10.0f, 120.0f, 100.0f, 100.0f);
DALI_TEST_CHECK(rf1.Contains(rf1));
DALI_TEST_CHECK(!rf1.Contains(rf2));
END_TEST;
}
-
int UtcDaliRectOperatorNotEquals(void)
{
TestApplication application;
- Rect<float> rf1( 10.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf2( 10.0f, 120.0f, 200.0f, 200.0f);
- Rect<float> rf3( 10.0f, -80.0f, 200.0f, 200.0f);
- Rect<float> rf4(110.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf5(-90.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf1(10.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf2(10.0f, 120.0f, 200.0f, 200.0f);
+ Rect<float> rf3(10.0f, -80.0f, 200.0f, 200.0f);
+ Rect<float> rf4(110.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf5(-90.0f, 20.0f, 200.0f, 200.0f);
Rect<float> rf6(1000.0f, 1200.0f, 10.0f, 10.0f);
- Rect<float> rf7( 50.0f, 70.0f, 50.0f, 50.0f);
- Rect<float> rf8( 10.0f, 20.0f, 100.0f, 100.0f);
- Rect<float> rf9( 110.0f, 20.0f, 100.0f, 100.0f);
- Rect<float> rf10( 110.0f, 120.0f, 100.0f, 100.0f);
- Rect<float> rf11( 10.0f, 120.0f, 100.0f, 100.0f);
+ Rect<float> rf7(50.0f, 70.0f, 50.0f, 50.0f);
+ Rect<float> rf8(10.0f, 20.0f, 100.0f, 100.0f);
+ Rect<float> rf9(110.0f, 20.0f, 100.0f, 100.0f);
+ Rect<float> rf10(110.0f, 120.0f, 100.0f, 100.0f);
+ Rect<float> rf11(10.0f, 120.0f, 100.0f, 100.0f);
DALI_TEST_CHECK(rf1 != rf2);
DALI_TEST_CHECK(rf1 != rf3);
END_TEST;
}
-
int UtcDaliRectOperatorEquals(void)
{
TestApplication application;
- Rect<float> rf1( 10.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf1p( 10.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf1(10.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf1p(10.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf2(110.0f, 20.0f, 200.0f, 200.0f);
- Rect<float> rf3( 10.0f, 120.0f, 200.0f, 200.0f);
- Rect<float> rf4( 10.0f, 20.0f, 300.0f, 200.0f);
- Rect<float> rf5( 10.0f, 20.0f, 200.0f, 500.0f);
+ Rect<float> rf2(110.0f, 20.0f, 200.0f, 200.0f);
+ Rect<float> rf3(10.0f, 120.0f, 200.0f, 200.0f);
+ Rect<float> rf4(10.0f, 20.0f, 300.0f, 200.0f);
+ Rect<float> rf5(10.0f, 20.0f, 200.0f, 500.0f);
- Rect<float> rf6( 0.0f, 0.0f, 9.0f, 10.0f);
+ Rect<float> rf6(0.0f, 0.0f, 9.0f, 10.0f);
DALI_TEST_CHECK(rf1 == rf1p);
DALI_TEST_CHECK(rf1 == rf1);
DALI_TEST_CHECK(!(rf1 == rf5));
DALI_TEST_CHECK(!(rf1 == rf6));
-
// integers
- Rect<int> ri1( 10, 20, 200, 200 );
- Rect<int> ri1p( 10, 20, 200, 200 );
+ Rect<int> ri1(10, 20, 200, 200);
+ Rect<int> ri1p(10, 20, 200, 200);
DALI_TEST_CHECK(ri1 == ri1p);
END_TEST;
int UtcDaliRectOStreamOperatorP(void)
{
- TestApplication application;
+ TestApplication application;
std::ostringstream oss;
- Rect<int> rect( 1, 2, 10, 10 );
+ Rect<int> rect(1, 2, 10, 10);
oss << rect;
std::string expectedOutput = "[1, 2, 10, 10]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/dali-core.h>
+#include <mesh-builder.h>
+#include <stdlib.h>
#include <test-native-image.h>
-#include <mesh-builder.h>
+#include <iostream>
-#define BOOLSTR(x) ((x)?"T":"F")
+#define BOOLSTR(x) ((x) ? "T" : "F")
//& set: DaliRenderTask
namespace // unnamed namespace
{
-
-const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
+const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
/*
* Simulate time passed by.
{
int time = 0;
- for(int i = 0; i <= ( duration / RENDER_FRAME_INTERVAL); i++)
+ for(int i = 0; i <= (duration / RENDER_FRAME_INTERVAL); i++)
{
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
struct RenderTaskFinished
{
- RenderTaskFinished( bool& finished )
- : finished( finished )
+ RenderTaskFinished(bool& finished)
+ : finished(finished)
{
}
- void operator()( RenderTask& renderTask )
+ void operator()(RenderTask& renderTask)
{
finished = true;
}
struct RenderTaskFinishedRemoveSource
{
- RenderTaskFinishedRemoveSource( bool& finished )
- : finished( finished ),
+ RenderTaskFinishedRemoveSource(bool& finished)
+ : finished(finished),
finishedOnce(false)
{
}
- void operator()( RenderTask& renderTask )
+ void operator()(RenderTask& renderTask)
{
DALI_TEST_CHECK(finishedOnce == false);
- finished = true;
- finishedOnce = true;
+ finished = true;
+ finishedOnce = true;
Actor srcActor = renderTask.GetSourceActor();
UnparentAndReset(srcActor);
}
bool& finished;
- bool finishedOnce;
+ bool finishedOnce;
};
struct RenderTaskFinishedRenderAgain
{
- RenderTaskFinishedRenderAgain( bool& finished )
- : finished( finished ),
+ RenderTaskFinishedRenderAgain(bool& finished)
+ : finished(finished),
finishedOnce(false)
{
}
- void operator()( RenderTask& renderTask )
+ void operator()(RenderTask& renderTask)
{
DALI_TEST_CHECK(finishedOnce == false);
- finished = true;
+ finished = true;
finishedOnce = true;
renderTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
}
bool& finished;
- bool finishedOnce;
+ bool finishedOnce;
};
-
-bool TestScreenToFrameBufferFunction( Vector2& coordinates )
+bool TestScreenToFrameBufferFunction(Vector2& coordinates)
{
- coordinates = coordinates + Vector2( 1, 2 );
+ coordinates = coordinates + Vector2(1, 2);
return true;
}
Actor CreateRenderableActorSuccess(TestApplication& application, std::string filename)
{
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 80.0f, 80.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(80.0f, 80.0f));
return actor;
}
}
RenderTask CreateRenderTask(TestApplication& application,
- CameraActor offscreenCamera,
- Actor rootActor, // Reset default render task to point at this actor
- Actor secondRootActor, // Source actor
- unsigned int refreshRate,
- bool glSync)
+ CameraActor offscreenCamera,
+ Actor rootActor, // Reset default render task to point at this actor
+ Actor secondRootActor, // Source actor
+ unsigned int refreshRate,
+ bool glSync)
{
// Change main render task to use a different root
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- taskList.GetTask(0u).SetSourceActor( rootActor );
+ taskList.GetTask(0u).SetSourceActor(rootActor);
- FrameBuffer frameBuffer = FrameBuffer::New(10,10);
- if( glSync )
+ FrameBuffer frameBuffer = FrameBuffer::New(10, 10);
+ if(glSync)
{
NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10);
- Texture texture = Texture::New(*testNativeImagePtr);
+ Texture texture = Texture::New(*testNativeImagePtr);
frameBuffer.AttachColorTexture(texture);
}
// Don't draw output framebuffer // '
RenderTask newTask = taskList.CreateTask();
- newTask.SetCameraActor( offscreenCamera );
- newTask.SetSourceActor( secondRootActor );
- newTask.SetInputEnabled( false );
- newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) );
- newTask.SetClearEnabled( true );
- newTask.SetExclusive( true );
- newTask.SetRefreshRate( refreshRate );
- newTask.SetFrameBuffer( frameBuffer );
- newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, glSync );
+ newTask.SetCameraActor(offscreenCamera);
+ newTask.SetSourceActor(secondRootActor);
+ newTask.SetInputEnabled(false);
+ newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
+ newTask.SetClearEnabled(true);
+ newTask.SetExclusive(true);
+ newTask.SetRefreshRate(refreshRate);
+ newTask.SetFrameBuffer(frameBuffer);
+ newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, glSync);
return newTask;
}
-bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool testDrawn, bool& finishedSig, bool testFinished, bool testKeepUpdating, int lineNumber )
+bool UpdateRender(TestApplication& application, TraceCallStack& callStack, bool testDrawn, bool& finishedSig, bool testFinished, bool testKeepUpdating, int lineNumber)
{
finishedSig = false;
callStack.Reset();
application.SendNotification();
bool sigPassed = false;
- if( testFinished )
+ if(testFinished)
{
sigPassed = finishedSig;
}
else
{
- sigPassed = ! finishedSig;
+ sigPassed = !finishedSig;
}
bool drawResult = callStack.FindMethod("DrawElements") || callStack.FindMethod("DrawArrays");
bool drawPassed = false;
- if( testDrawn )
+ if(testDrawn)
{
drawPassed = drawResult;
}
drawPassed = !drawResult;
}
- bool keepUpdating = (application.GetUpdateStatus() != 0);
+ bool keepUpdating = (application.GetUpdateStatus() != 0);
bool keepUpdatingPassed = false;
- if( testKeepUpdating )
+ if(testKeepUpdating)
{
keepUpdatingPassed = keepUpdating;
}
bool result = (sigPassed && drawPassed && keepUpdatingPassed);
tet_printf("UpdateRender: Expected: Draw:%s Signal:%s KeepUpdating: %s Actual: Draw:%s Signal:%s KeepUpdating: %s %s, line %d\n",
- BOOLSTR(testDrawn), BOOLSTR(testFinished), BOOLSTR(testKeepUpdating),
- BOOLSTR(drawResult), BOOLSTR(finishedSig), BOOLSTR(keepUpdating),
- result ? "Passed":"Failed",
- lineNumber );
+ BOOLSTR(testDrawn),
+ BOOLSTR(testFinished),
+ BOOLSTR(testKeepUpdating),
+ BOOLSTR(drawResult),
+ BOOLSTR(finishedSig),
+ BOOLSTR(keepUpdating),
+ result ? "Passed" : "Failed",
+ lineNumber);
return result;
}
} // unnamed namespace
-
/****************************************************************************************************/
/****************************************************************************************************/
/******************************** TEST CASES BELOW **********************************************/
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- BaseHandle base = taskList.GetTask( 0u );
- DALI_TEST_CHECK( base );
+ BaseHandle base = taskList.GetTask(0u);
+ DALI_TEST_CHECK(base);
- RenderTask task = RenderTask::DownCast( base );
- DALI_TEST_CHECK( task );
+ RenderTask task = RenderTask::DownCast(base);
+ DALI_TEST_CHECK(task);
// Try calling a method
- DALI_TEST_CHECK( task.GetSourceActor() );
+ DALI_TEST_CHECK(task.GetSourceActor());
END_TEST;
}
Actor actor = Actor::New();
- RenderTask task = RenderTask::DownCast( actor );
- DALI_TEST_CHECK( ! task );
+ RenderTask task = RenderTask::DownCast(actor);
+ DALI_TEST_CHECK(!task);
END_TEST;
}
Actor srcActor;
- RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask renderTask = taskList.CreateTask();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTask renderTask = taskList.CreateTask();
renderTask.SetSourceActor(srcActor);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( ! renderTask.GetSourceActor() );
+ DALI_TEST_CHECK(!renderTask.GetSourceActor());
END_TEST;
}
-
int UtcDaliRenderTaskSetSourceActorP01(void)
{
TestApplication application;
tet_infoline("Testing RenderTask::SetSourceActor() Positive - check that setting a non-renderable actor stops existing source actor being rendered ");
- Integration::Scene stage = application.GetScene();
- RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ Integration::Scene stage = application.GetScene();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetSourceActor();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
- Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor newActor = CreateRenderableActor( img );
- newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- stage.Add( newActor );
+ Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor newActor = CreateRenderableActor(img);
+ newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ stage.Add(newActor);
Actor nonRenderableActor = Actor::New();
- stage.Add( nonRenderableActor );
+ stage.Add(nonRenderableActor);
// Stop the newActor from being rendered by changing the source actor
- DALI_TEST_CHECK( nonRenderableActor );
- task.SetSourceActor( nonRenderableActor );
- DALI_TEST_CHECK( task.GetSourceActor() != actor );
- DALI_TEST_CHECK( task.GetSourceActor() == nonRenderableActor );
+ DALI_TEST_CHECK(nonRenderableActor);
+ task.SetSourceActor(nonRenderableActor);
+ DALI_TEST_CHECK(task.GetSourceActor() != actor);
+ DALI_TEST_CHECK(task.GetSourceActor() == nonRenderableActor);
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& drawTrace = gl.GetDrawTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
drawTrace.Enable(true);
// Update & Render nothing!
application.Render();
// Check that nothing was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRenderTaskSetSourceActorP02(void)
{
TestApplication application;
RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetSourceActor();
- DALI_TEST_CHECK( actor );
-
+ DALI_TEST_CHECK(actor);
- Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor newActor = CreateRenderableActor( img );
- newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- stage.Add( newActor );
+ Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor newActor = CreateRenderableActor(img);
+ newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ stage.Add(newActor);
Actor nonRenderableActor = Actor::New();
- stage.Add( nonRenderableActor );
+ stage.Add(nonRenderableActor);
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& drawTrace = gl.GetDrawTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
drawTrace.Enable(true);
// Stop the newActor from being rendered by changing the source actor
- DALI_TEST_CHECK( nonRenderableActor );
- task.SetSourceActor( nonRenderableActor );
- DALI_TEST_CHECK( task.GetSourceActor() != actor );
- DALI_TEST_CHECK( task.GetSourceActor() == nonRenderableActor );
+ DALI_TEST_CHECK(nonRenderableActor);
+ task.SetSourceActor(nonRenderableActor);
+ DALI_TEST_CHECK(task.GetSourceActor() != actor);
+ DALI_TEST_CHECK(task.GetSourceActor() == nonRenderableActor);
// Update & Render nothing!
application.GetGlAbstraction().ClearBoundTextures();
application.Render();
// Check that nothing was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
drawTrace.Reset();
// Set newActor as the new source Actor
- task.SetSourceActor( newActor );
- DALI_TEST_CHECK( task.GetSourceActor() != actor );
- DALI_TEST_CHECK( task.GetSourceActor() == newActor );
+ task.SetSourceActor(newActor);
+ DALI_TEST_CHECK(task.GetSourceActor() != actor);
+ DALI_TEST_CHECK(task.GetSourceActor() == newActor);
// Update & Render the newActor
application.GetGlAbstraction().ClearBoundTextures();
application.Render();
// Check that the newActor was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing RenderTask::SetSourceActor (on/off stage testing)");
- Integration::Scene stage = application.GetScene();
- RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ Integration::Scene stage = application.GetScene();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetSourceActor();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& drawTrace = gl.GetDrawTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
drawTrace.Enable(true);
- Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor newActor = CreateRenderableActor( img );
- newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- task.SetSourceActor( newActor );
+ Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor newActor = CreateRenderableActor(img);
+ newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ task.SetSourceActor(newActor);
// Don't add newActor to stage yet //'
// Update & Render with the actor initially off-stage
application.Render();
// Check that nothing was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
// Now add to stage
- stage.Add( newActor );
+ stage.Add(newActor);
// Update & Render with the actor on-stage
application.GetGlAbstraction().ClearBoundTextures();
application.Render();
// Check that the newActor was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
drawTrace.Reset();
// Now remove from stage
- stage.Remove( newActor );
+ stage.Remove(newActor);
// Update & Render with the actor off-stage
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing RenderTask::SetSourceActor (empty handle case)");
- Integration::Scene stage = application.GetScene();
- RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ Integration::Scene stage = application.GetScene();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetSourceActor();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
- Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor newActor = CreateRenderableActor( img );
- newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- stage.Add( newActor );
+ Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor newActor = CreateRenderableActor(img);
+ newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ stage.Add(newActor);
Actor nonRenderableActor = Actor::New();
- stage.Add( nonRenderableActor );
+ stage.Add(nonRenderableActor);
// Set with empty handle
- task.SetSourceActor( Actor() );
- DALI_TEST_CHECK( ! task.GetSourceActor() );
+ task.SetSourceActor(Actor());
+ DALI_TEST_CHECK(!task.GetSourceActor());
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& drawTrace = gl.GetDrawTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
drawTrace.Enable(true);
// Update & Render nothing!
application.Render();
// Check that nothing was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 0, TEST_LOCATION);
// Set with non-empty handle
- task.SetSourceActor( newActor );
- DALI_TEST_CHECK( task.GetSourceActor() == newActor );
+ task.SetSourceActor(newActor);
+ DALI_TEST_CHECK(task.GetSourceActor() == newActor);
// Update & Render the newActor
application.GetGlAbstraction().ClearBoundTextures();
application.Render();
// Check that the newActor was rendered
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Testing RenderTask::SetSourceActor - Set a source actor and destroy the source actor" );
+ tet_infoline("Testing RenderTask::SetSourceActor - Set a source actor and destroy the source actor");
- Integration::Scene stage = application.GetScene();
- RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ Integration::Scene stage = application.GetScene();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetSourceActor();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
- Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
+ Texture img = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
- Actor newActor = CreateRenderableActor( img );
- newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- stage.Add( newActor );
+ Actor newActor = CreateRenderableActor(img);
+ newActor.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ stage.Add(newActor);
- task.SetSourceActor( newActor );
+ task.SetSourceActor(newActor);
- DALI_TEST_CHECK( task.GetSourceActor() != actor );
- DALI_TEST_CHECK( task.GetSourceActor() == newActor );
+ DALI_TEST_CHECK(task.GetSourceActor() != actor);
+ DALI_TEST_CHECK(task.GetSourceActor() == newActor);
application.SendNotification();
application.Render();
// Destroy the source actor
- stage.Remove( newActor );
+ stage.Remove(newActor);
newActor.Reset();
- DALI_TEST_CHECK( !task.GetSourceActor() ); // The source actor should be an empty handle.
+ DALI_TEST_CHECK(!task.GetSourceActor()); // The source actor should be an empty handle.
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetSourceActor();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
// By default the entire scene should be rendered
- Actor root = application.GetScene().GetLayer( 0 );
- DALI_TEST_CHECK( root == actor );
+ Actor root = application.GetScene().GetLayer(0);
+ DALI_TEST_CHECK(root == actor);
END_TEST;
}
tet_infoline("Testing RenderTask::GetSourceActor() Create a new render task, Add a new actor to the stage and set it as the source of the new render task. Get its source actor and check that it is equivalent to what was set.");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.CreateTask();
- Actor actor = Actor::New();
+ RenderTask task = taskList.CreateTask();
+ Actor actor = Actor::New();
application.GetScene().Add(actor);
- task.SetSourceActor( actor );
+ task.SetSourceActor(actor);
- DALI_TEST_EQUALS( actor, task.GetSourceActor(), TEST_LOCATION );
+ DALI_TEST_EQUALS(actor, task.GetSourceActor(), TEST_LOCATION);
END_TEST;
}
{
Actor actor = task.GetSourceActor();
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
// Manipulate the GenTextures behaviour, to identify different actors
std::vector<GLuint> ids;
- ids.push_back( 8 ); // 8 = actor1
- ids.push_back( 9 ); // 9 = actor2
- ids.push_back( 10 ); // 10 = actor3
- application.GetGlAbstraction().SetNextTextureIds( ids );
+ ids.push_back(8); // 8 = actor1
+ ids.push_back(9); // 9 = actor2
+ ids.push_back(10); // 10 = actor3
+ application.GetGlAbstraction().SetNextTextureIds(ids);
- Texture img1 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor actor1 = CreateRenderableActor( img1 );
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- application.GetScene().Add( actor1 );
+ Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor actor1 = CreateRenderableActor(img1);
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ application.GetScene().Add(actor1);
// Update & Render actor1
application.SendNotification();
application.Render();
// Check that the actor1 was rendered
- const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures( GL_TEXTURE0 );
- DALI_TEST_GREATER( boundTextures.size(), static_cast<std::vector<GLuint>::size_type>( 0 ), TEST_LOCATION );
+ const std::vector<GLuint>& boundTextures = application.GetGlAbstraction().GetBoundTextures(GL_TEXTURE0);
+ DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::size_type>(0), TEST_LOCATION);
- if ( boundTextures.size() )
+ if(boundTextures.size())
{
int c = 0;
- DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
- if( boundTextures.size() > 1 )
+ DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION);
+ if(boundTextures.size() > 1)
{
- DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION);
}
}
- Texture img2 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
+ Texture img2 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
- Actor actor2 = CreateRenderableActor( img2 );
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
+ Actor actor2 = CreateRenderableActor(img2);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
// Force actor2 to be rendered before actor1
Layer layer = Layer::New();
- application.GetScene().Add( layer );
- layer.Add( actor2 );
+ application.GetScene().Add(layer);
+ layer.Add(actor2);
layer.LowerToBottom();
// Update & Render
application.Render();
// Check that the actors were rendered
- DALI_TEST_GREATER( boundTextures.size(), static_cast<std::vector<GLuint>::size_type>( 1 ), TEST_LOCATION );
+ DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::size_type>(1), TEST_LOCATION);
- if ( boundTextures.size() )
+ if(boundTextures.size())
{
int c = 0;
- DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor2*/, TEST_LOCATION );
- if( boundTextures.size() > 2 )
+ DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION);
+ if(boundTextures.size() > 2)
{
- DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor1*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor1*/, TEST_LOCATION);
}
- DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION);
}
- Texture img3 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor actor3 = CreateRenderableActor( img3 );
- actor3.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
+ Texture img3 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor actor3 = CreateRenderableActor(img3);
+ actor3.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
// Force actor3 to be rendered before actor2
layer = Layer::New();
- application.GetScene().Add( layer );
- layer.Add( actor3 );
+ application.GetScene().Add(layer);
+ layer.Add(actor3);
layer.LowerToBottom();
// Update & Render all actors
application.Render();
// Check that the actors were rendered
- DALI_TEST_GREATER( boundTextures.size(), static_cast<std::vector<GLuint>::size_type>( 2 ), TEST_LOCATION );
+ DALI_TEST_GREATER(boundTextures.size(), static_cast<std::vector<GLuint>::size_type>(2), TEST_LOCATION);
- if ( boundTextures.size() )
+ if(boundTextures.size())
{
int c = 0;
- DALI_TEST_EQUALS( boundTextures[c++], 10u/*unique to actor3*/, TEST_LOCATION );
- if( boundTextures.size() > 3 )
+ DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor3*/, TEST_LOCATION);
+ if(boundTextures.size() > 3)
{
- DALI_TEST_EQUALS( boundTextures[c++], 10u/*unique to actor2*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures[c++], 10u /*unique to actor2*/, TEST_LOCATION);
}
- DALI_TEST_EQUALS( boundTextures[c++], 9u/*unique to actor2*/, TEST_LOCATION );
- DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures[c++], 9u /*unique to actor2*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(boundTextures[c++], 8u /*unique to actor1*/, TEST_LOCATION);
}
// Both actors are now connected to the root node
// Setup 2 render-tasks - the first will render from the root-node, and the second from actor2
// Not exclusive is the default
- RenderTask task1 = taskList.GetTask( 0u );
- DALI_TEST_CHECK( false == task1.IsExclusive() );
+ RenderTask task1 = taskList.GetTask(0u);
+ DALI_TEST_CHECK(false == task1.IsExclusive());
RenderTask task2 = taskList.CreateTask();
- DALI_TEST_CHECK( false == task2.IsExclusive() );
- task2.SetSourceActor( actor2 );
+ DALI_TEST_CHECK(false == task2.IsExclusive());
+ task2.SetSourceActor(actor2);
// Task1 should render all actors, and task 2 should render only actor2
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( boundTextures.size(), 4u, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures.size(), 4u, TEST_LOCATION);
- if ( boundTextures.size() == 4 )
+ if(boundTextures.size() == 4)
{
// Test that task 1 renders actor3, then actor2 & then actor1
- DALI_TEST_CHECK( boundTextures[0] == 10u );
- DALI_TEST_CHECK( boundTextures[1] == 9u );
- DALI_TEST_CHECK( boundTextures[2] == 8u );
+ DALI_TEST_CHECK(boundTextures[0] == 10u);
+ DALI_TEST_CHECK(boundTextures[1] == 9u);
+ DALI_TEST_CHECK(boundTextures[2] == 8u);
// Test that task 2 renders actor2
- DALI_TEST_EQUALS( boundTextures[3], 9u, TEST_LOCATION );
+ DALI_TEST_EQUALS(boundTextures[3], 9u, TEST_LOCATION);
}
// Make actor2 exclusive to task2
- task2.SetExclusive( true );
- DALI_TEST_CHECK( true == task2.IsExclusive() );
+ task2.SetExclusive(true);
+ DALI_TEST_CHECK(true == task2.IsExclusive());
// Task1 should render only actor1, and task 2 should render only actor2
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( boundTextures.size(), 3u, TEST_LOCATION );
- if ( boundTextures.size() == 3 )
+ DALI_TEST_EQUALS(boundTextures.size(), 3u, TEST_LOCATION);
+ if(boundTextures.size() == 3)
{
// Test that task 1 renders actor3 & actor1
- DALI_TEST_CHECK( boundTextures[0] == 10u );
- DALI_TEST_CHECK( boundTextures[1] == 8u );
+ DALI_TEST_CHECK(boundTextures[0] == 10u);
+ DALI_TEST_CHECK(boundTextures[1] == 8u);
// Test that task 2 renders actor2
- DALI_TEST_CHECK( boundTextures[2] == 9u );
+ DALI_TEST_CHECK(boundTextures[2] == 9u);
}
// Create a renderable actor and replace the source actor in task2
auto actor4 = CreateRenderableActor();
- task2.SetSourceActor( actor3 );
- DALI_TEST_EQUALS( actor3, task2.GetSourceActor(), TEST_LOCATION );
+ task2.SetSourceActor(actor3);
+ DALI_TEST_EQUALS(actor3, task2.GetSourceActor(), TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing RenderTask::SetExclusive() Check that changing from exclusive to not-exclusive works");
std::vector<GLuint> ids;
- ids.push_back( 8 ); // 8 = actor1
- application.GetGlAbstraction().SetNextTextureIds( ids );
+ ids.push_back(8); // 8 = actor1
+ application.GetGlAbstraction().SetNextTextureIds(ids);
- Texture img1 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 );
- Actor actor1 = CreateRenderableActor( img1 );
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) );
- application.GetScene().Add( actor1 );
+ Texture img1 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1);
+ Actor actor1 = CreateRenderableActor(img1);
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(1.0f, 1.0f));
+ application.GetScene().Add(actor1);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.CreateTask();
+ RenderTask task = taskList.CreateTask();
- task.SetSourceActor( actor1 );
+ task.SetSourceActor(actor1);
task.SetExclusive(true); // Actor should only render once
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& drawTrace = gl.GetDrawTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
drawTrace.Enable(true);
// Update & Render actor1
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
// Set task to non-exclusive - actor1 should render twice:
drawTrace.Reset();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 2, TEST_LOCATION);
END_TEST;
}
{
task.SetExclusive(true);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
// Not exclusive is the default
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( false == task.IsExclusive() );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(false == task.IsExclusive());
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_CHECK( false == newTask.IsExclusive() );
+ DALI_TEST_CHECK(false == newTask.IsExclusive());
END_TEST;
}
// Not exclusive is the default
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_EQUALS( newTask.IsExclusive(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(newTask.IsExclusive(), false, TEST_LOCATION);
newTask.SetExclusive(true);
- DALI_TEST_EQUALS( newTask.IsExclusive(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(newTask.IsExclusive(), true, TEST_LOCATION);
END_TEST;
}
try
{
bool x = task.IsExclusive();
- (void) x;
+ (void)x;
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
// Input is enabled by default
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( true == task.GetInputEnabled() );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(true == task.GetInputEnabled());
- task.SetInputEnabled( false );
- DALI_TEST_CHECK( false == task.GetInputEnabled() );
+ task.SetInputEnabled(false);
+ DALI_TEST_CHECK(false == task.GetInputEnabled());
- task.SetInputEnabled( true );
- DALI_TEST_CHECK( true == task.GetInputEnabled() );
+ task.SetInputEnabled(true);
+ DALI_TEST_CHECK(true == task.GetInputEnabled());
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
// Input is enabled by default
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_EQUALS( true, task.GetInputEnabled(), TEST_LOCATION );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_EQUALS(true, task.GetInputEnabled(), TEST_LOCATION);
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_EQUALS( true, newTask.GetInputEnabled(), TEST_LOCATION );
+ DALI_TEST_EQUALS(true, newTask.GetInputEnabled(), TEST_LOCATION);
newTask.SetInputEnabled(false);
- DALI_TEST_EQUALS( false, newTask.GetInputEnabled(), TEST_LOCATION );
+ DALI_TEST_EQUALS(false, newTask.GetInputEnabled(), TEST_LOCATION);
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
Actor defaultCameraActor = task.GetCameraActor();
- DALI_TEST_CHECK( defaultCameraActor );
+ DALI_TEST_CHECK(defaultCameraActor);
CameraActor newCameraActor = CameraActor::New();
- DALI_TEST_CHECK( newCameraActor );
+ DALI_TEST_CHECK(newCameraActor);
- task.SetCameraActor( newCameraActor );
- DALI_TEST_CHECK( task.GetCameraActor() != defaultCameraActor );
- DALI_TEST_EQUALS( task.GetCameraActor(), newCameraActor, TEST_LOCATION );
+ task.SetCameraActor(newCameraActor);
+ DALI_TEST_CHECK(task.GetCameraActor() != defaultCameraActor);
+ DALI_TEST_EQUALS(task.GetCameraActor(), newCameraActor, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRenderTaskSetCameraActorN(void)
{
TestApplication application;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
Actor actor = task.GetCameraActor();
- DALI_TEST_CHECK( actor );
+ DALI_TEST_CHECK(actor);
CameraActor cameraActor;
- task.SetCameraActor( cameraActor );
- DALI_TEST_EQUALS( (bool)task.GetCameraActor(), false, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCameraActor(), cameraActor, TEST_LOCATION );
+ task.SetCameraActor(cameraActor);
+ DALI_TEST_EQUALS((bool)task.GetCameraActor(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCameraActor(), cameraActor, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Testing RenderTask::SetCameraActor - Set a camera actor and destroy the camera actor" );
+ tet_infoline("Testing RenderTask::SetCameraActor - Set a camera actor and destroy the camera actor");
- Integration::Scene stage = application.GetScene();
- RenderTaskList taskList = stage.GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ Integration::Scene stage = application.GetScene();
+ RenderTaskList taskList = stage.GetRenderTaskList();
+ RenderTask task = taskList.GetTask(0u);
CameraActor newCameraActor = CameraActor::New();
- task.SetCameraActor( newCameraActor );
+ task.SetCameraActor(newCameraActor);
- DALI_TEST_EQUALS( task.GetCameraActor(), newCameraActor, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCameraActor(), newCameraActor, TEST_LOCATION);
// Destroy the camera actor
newCameraActor.Reset();
CameraActor camera = task.GetCameraActor();
- DALI_TEST_CHECK( !camera ); // The camera actor should be an empty handle.
+ DALI_TEST_CHECK(!camera); // The camera actor should be an empty handle.
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
CameraActor actor = task.GetCameraActor();
- DALI_TEST_CHECK( actor );
- DALI_TEST_EQUALS( actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION );
- DALI_TEST_GREATER( actor.GetFieldOfView(), 0.0f, TEST_LOCATION );
+ DALI_TEST_CHECK(actor);
+ DALI_TEST_EQUALS(actor.GetProjectionMode(), Dali::Camera::PERSPECTIVE_PROJECTION, TEST_LOCATION);
+ DALI_TEST_GREATER(actor.GetFieldOfView(), 0.0f, TEST_LOCATION);
END_TEST;
}
{
Actor actor = task.GetCameraActor();
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
- FrameBuffer newFrameBuffer = FrameBuffer::New( 128u, 128u, FrameBuffer::Attachment::NONE );
- task.SetFrameBuffer( newFrameBuffer );
- DALI_TEST_CHECK( task.GetFrameBuffer() == newFrameBuffer );
+ FrameBuffer newFrameBuffer = FrameBuffer::New(128u, 128u, FrameBuffer::Attachment::NONE);
+ task.SetFrameBuffer(newFrameBuffer);
+ DALI_TEST_CHECK(task.GetFrameBuffer() == newFrameBuffer);
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
FrameBuffer newFrameBuffer; // Empty handle
- task.SetFrameBuffer( newFrameBuffer );
- DALI_TEST_EQUALS( (bool)task.GetFrameBuffer(), false, TEST_LOCATION );
+ task.SetFrameBuffer(newFrameBuffer);
+ DALI_TEST_EQUALS((bool)task.GetFrameBuffer(), false, TEST_LOCATION);
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
- FrameBuffer newFrameBuffer = FrameBuffer::New( 1u, 1u, FrameBuffer::Attachment::NONE );
- task.SetFrameBuffer( newFrameBuffer );
- DALI_TEST_CHECK( task.GetFrameBuffer() == newFrameBuffer );
+ FrameBuffer newFrameBuffer = FrameBuffer::New(1u, 1u, FrameBuffer::Attachment::NONE);
+ task.SetFrameBuffer(newFrameBuffer);
+ DALI_TEST_CHECK(task.GetFrameBuffer() == newFrameBuffer);
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
// By default render-tasks do not render off-screen
FrameBuffer frameBuffer = task.GetFrameBuffer();
- DALI_TEST_CHECK( !frameBuffer );
+ DALI_TEST_CHECK(!frameBuffer);
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
- task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction );
+ task.SetScreenToFrameBufferFunction(TestScreenToFrameBufferFunction);
- Vector2 coordinates( 5, 10 );
- Vector2 convertedCoordinates( 6, 12 ); // + Vector(1, 2)
+ Vector2 coordinates(5, 10);
+ Vector2 convertedCoordinates(6, 12); // + Vector(1, 2)
RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction();
- DALI_TEST_CHECK( func( coordinates ) );
- DALI_TEST_CHECK( coordinates == convertedCoordinates );
+ DALI_TEST_CHECK(func(coordinates));
+ DALI_TEST_CHECK(coordinates == convertedCoordinates);
- task.SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
+ task.SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION);
func = task.GetScreenToFrameBufferFunction();
- DALI_TEST_CHECK( func( coordinates ) );
+ DALI_TEST_CHECK(func(coordinates));
- task.SetScreenToFrameBufferFunction( RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION );
+ task.SetScreenToFrameBufferFunction(RenderTask::DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION);
func = task.GetScreenToFrameBufferFunction();
- DALI_TEST_CHECK( ! func( coordinates ) );
+ DALI_TEST_CHECK(!func(coordinates));
END_TEST;
}
RenderTask task; // Empty handle
try
{
- task.SetScreenToFrameBufferFunction( TestScreenToFrameBufferFunction );
+ task.SetScreenToFrameBufferFunction(TestScreenToFrameBufferFunction);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
- Vector2 originalCoordinates( 5, 10 );
- Vector2 coordinates( 5, 10 );
+ Vector2 originalCoordinates(5, 10);
+ Vector2 coordinates(5, 10);
RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction();
- DALI_TEST_CHECK( !func( coordinates ) ); // conversion should fail by default
- DALI_TEST_CHECK( coordinates == originalCoordinates ); // coordinates should not be modified
+ DALI_TEST_CHECK(!func(coordinates)); // conversion should fail by default
+ DALI_TEST_CHECK(coordinates == originalCoordinates); // coordinates should not be modified
END_TEST;
}
try
{
RenderTask::ScreenToFrameBufferFunction func = task.GetScreenToFrameBufferFunction();
- (void) func;
+ (void)func;
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorP(void)
{
TestApplication application;
tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor ");
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask renderTask = taskList.CreateTask();
- Actor mappingActor = Actor::New();
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTask renderTask = taskList.CreateTask();
+ Actor mappingActor = Actor::New();
renderTask.SetScreenToFrameBufferMappingActor(mappingActor);
- DALI_TEST_EQUALS( mappingActor, renderTask.GetScreenToFrameBufferMappingActor(), TEST_LOCATION );
+ DALI_TEST_EQUALS(mappingActor, renderTask.GetScreenToFrameBufferMappingActor(), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorN(void)
{
TestApplication application;
Actor mappingActor;
task.SetScreenToFrameBufferMappingActor(mappingActor);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
TestApplication application;
tet_infoline("Testing RenderTask::GetScreenToFrameBufferMappingActor with empty task handle");
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask renderTask = taskList.CreateTask();
- Actor actor;
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTask renderTask = taskList.CreateTask();
+ Actor actor;
renderTask.SetScreenToFrameBufferMappingActor(actor);
- DALI_TEST_EQUALS( (bool)renderTask.GetScreenToFrameBufferMappingActor(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)renderTask.GetScreenToFrameBufferMappingActor(), false, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing RenderTask::GetViewport() on default task");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- Viewport viewport = task.GetViewport();
+ RenderTask task = taskList.GetTask(0u);
+ Viewport viewport = task.GetViewport();
// By default the viewport should match the stage width/height
- Vector2 stageSize = application.GetScene().GetSize();
- Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height );
- DALI_TEST_CHECK( viewport == expectedViewport );
+ Vector2 stageSize = application.GetScene().GetSize();
+ Viewport expectedViewport(0, 0, stageSize.width, stageSize.height);
+ DALI_TEST_CHECK(viewport == expectedViewport);
END_TEST;
}
tet_infoline("Testing RenderTask::GetViewport() on new task");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.CreateTask();
- Viewport viewport = task.GetViewport();
+ RenderTask task = taskList.CreateTask();
+ Viewport viewport = task.GetViewport();
// By default the viewport should match the stage width/height
- Vector2 stageSize = application.GetScene().GetSize();
- Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height );
- DALI_TEST_CHECK( viewport == expectedViewport );
+ Vector2 stageSize = application.GetScene().GetSize();
+ Viewport expectedViewport(0, 0, stageSize.width, stageSize.height);
+ DALI_TEST_CHECK(viewport == expectedViewport);
END_TEST;
}
try
{
Viewport viewport = task.GetViewport();
- (void) viewport;
+ (void)viewport;
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliRenderTaskSetViewportP(void)
{
TestApplication application;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- Vector2 stageSize = application.GetScene().GetSize();
- Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f );
- task.SetViewport( newViewport );
+ RenderTask task = taskList.GetTask(0u);
+ Vector2 stageSize = application.GetScene().GetSize();
+ Viewport newViewport(0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f);
+ task.SetViewport(newViewport);
// Update (viewport is a property)
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( task.GetViewport() == newViewport );
+ DALI_TEST_CHECK(task.GetViewport() == newViewport);
END_TEST;
}
RenderTask task;
try
{
- Vector2 stageSize = application.GetScene().GetSize();
- Viewport newViewport( 0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f );
- task.SetViewport( newViewport );
+ Vector2 stageSize = application.GetScene().GetSize();
+ Viewport newViewport(0, 0, stageSize.width * 0.5f, stageSize.height * 0.5f);
+ task.SetViewport(newViewport);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliRenderTaskSetViewportPosition(void)
{
TestApplication application;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
Viewport viewport = task.GetViewport();
// By default the viewport should match the stage width/height
- Vector2 stageSize = application.GetScene().GetSize();
- Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height );
- DALI_TEST_CHECK( viewport == expectedViewport );
+ Vector2 stageSize = application.GetScene().GetSize();
+ Viewport expectedViewport(0, 0, stageSize.width, stageSize.height);
+ DALI_TEST_CHECK(viewport == expectedViewport);
// 'Setter' test
Vector2 newPosition(25.0f, 50.0f);
- task.SetViewportPosition( newPosition );
+ task.SetViewportPosition(newPosition);
// Update (viewport is a property)
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition, Math::MACHINE_EPSILON_1, TEST_LOCATION);
// Set by Property test
Vector2 newPosition2(32.0f, 32.0f);
- task.SetProperty( RenderTask::Property::VIEWPORT_POSITION, newPosition2 );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition, TEST_LOCATION ); // still the old position
+ task.SetProperty(RenderTask::Property::VIEWPORT_POSITION, newPosition2);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition, TEST_LOCATION); // still the old position
// Update
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition2, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition2, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION);
- Vector2 newPosition3(64.0f, 0.0f);
+ Vector2 newPosition3(64.0f, 0.0f);
Animation animation = Animation::New(1.0f);
- animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_POSITION ), newPosition3, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(task, RenderTask::Property::VIEWPORT_POSITION), newPosition3, AlphaFunction::LINEAR);
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition2, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition2, TEST_LOCATION);
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
- DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
// Create another animation which animates by a certain value
- const Vector2 newPosition4( 75.0f, 45.0f );
- const Vector2 relativePosition( newPosition4 - newPosition3 );
- animation = Animation::New( 1.0f );
- animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_POSITION ), relativePosition );
+ const Vector2 newPosition4(75.0f, 45.0f);
+ const Vector2 relativePosition(newPosition4 - newPosition3);
+ animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(task, RenderTask::Property::VIEWPORT_POSITION), relativePosition);
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition3, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition3, TEST_LOCATION);
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
- DALI_TEST_EQUALS( task.GetCurrentViewportPosition(), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_POSITION ), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportPosition(), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_POSITION), newPosition4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
Viewport viewport = task.GetViewport();
// By default the viewport should match the stage width/height
- Vector2 stageSize = application.GetScene().GetSize();
- Viewport expectedViewport( 0, 0, stageSize.width, stageSize.height );
- DALI_TEST_CHECK( viewport == expectedViewport );
+ Vector2 stageSize = application.GetScene().GetSize();
+ Viewport expectedViewport(0, 0, stageSize.width, stageSize.height);
+ DALI_TEST_CHECK(viewport == expectedViewport);
Vector2 newSize(128.0f, 64.0f);
- task.SetViewportSize( newSize );
+ task.SetViewportSize(newSize);
// Update (viewport is a property)
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize, Math::MACHINE_EPSILON_1, TEST_LOCATION);
// Set by Property test
Vector2 newSize2(50.0f, 50.0f);
- task.SetProperty( RenderTask::Property::VIEWPORT_SIZE, newSize2 );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize, TEST_LOCATION ); // still the old position
+ task.SetProperty(RenderTask::Property::VIEWPORT_SIZE, newSize2);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize, TEST_LOCATION); // still the old position
// Update
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize2, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize2, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION);
- Vector2 newSize3(10.0f, 10.0f);
+ Vector2 newSize3(10.0f, 10.0f);
Animation animation = Animation::New(1.0f);
- animation.AnimateTo( Property( task, RenderTask::Property::VIEWPORT_SIZE ), newSize3, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(task, RenderTask::Property::VIEWPORT_SIZE), newSize3, AlphaFunction::LINEAR);
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize2, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize2, TEST_LOCATION);
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
- DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
// Create another animation which animates by a certain value
- const Vector2 newSize4( 75.0f, 45.0f );
- const Vector2 relativeSize( newSize4 - newSize3 );
- animation = Animation::New( 1.0f );
- animation.AnimateBy( Property( task, RenderTask::Property::VIEWPORT_SIZE ), relativeSize );
+ const Vector2 newSize4(75.0f, 45.0f);
+ const Vector2 relativeSize(newSize4 - newSize3);
+ animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(task, RenderTask::Property::VIEWPORT_SIZE), relativeSize);
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize3, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize3, TEST_LOCATION);
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
- DALI_TEST_EQUALS( task.GetCurrentViewportSize(), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector2 >( RenderTask::Property::VIEWPORT_SIZE ), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentViewportSize(), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector2>(RenderTask::Property::VIEWPORT_SIZE), newSize4, Math::MACHINE_EPSILON_1, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing RenderTask::SetClearColor()");
- Vector4 testColor( 1.0f, 2.0f, 3.0f, 4.0f );
- Vector4 testColor2( 5.0f, 6.0f, 7.0f, 8.0f );
+ Vector4 testColor(1.0f, 2.0f, 3.0f, 4.0f);
+ Vector4 testColor2(5.0f, 6.0f, 7.0f, 8.0f);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( task.GetClearColor() != testColor );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(task.GetClearColor() != testColor);
- task.SetClearColor( testColor );
+ task.SetClearColor(testColor);
// Wait a frame.
Wait(application);
- DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetClearColor(), testColor, TEST_LOCATION);
- task.SetProperty( RenderTask::Property::CLEAR_COLOR, testColor2 );
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor, TEST_LOCATION ); // still the old color
+ task.SetProperty(RenderTask::Property::CLEAR_COLOR, testColor2);
+ DALI_TEST_EQUALS(task.GetProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), testColor, TEST_LOCATION); // still the old color
// Wait a frame.
Wait(application);
- DALI_TEST_EQUALS( task.GetClearColor(), testColor2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetClearColor(), testColor2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION);
- Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f);
+ Vector4 newColor3(10.0f, 10.0f, 20.0f, 30.0f);
Animation animation = Animation::New(1.0f);
- animation.AnimateTo( Property( task, RenderTask::Property::CLEAR_COLOR ), newColor3, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(task, RenderTask::Property::CLEAR_COLOR), newColor3, AlphaFunction::LINEAR);
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), testColor2, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), testColor2, TEST_LOCATION);
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_1, TEST_LOCATION);
// Create another animation which animates by a certain value
- const Vector4 newColor4( 0.45f, 0.35f, 0.25f, 0.1f );
- const Vector4 relativeColor( newColor4 - newColor3 );
- animation = Animation::New( 1.0f );
- animation.AnimateBy( Property( task, RenderTask::Property::CLEAR_COLOR ), relativeColor );
+ const Vector4 newColor4(0.45f, 0.35f, 0.25f, 0.1f);
+ const Vector4 relativeColor(newColor4 - newColor3);
+ animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(task, RenderTask::Property::CLEAR_COLOR), relativeColor);
animation.Play();
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor3, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor3, Math::MACHINE_EPSILON_10, TEST_LOCATION);
// Perform 1000ms worth of updates at which point animation should have completed.
Wait(application, 1000);
- DALI_TEST_EQUALS( task.GetCurrentProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
- DALI_TEST_EQUALS( task.GetProperty< Vector4 >( RenderTask::Property::CLEAR_COLOR ), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCurrentProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION);
+ DALI_TEST_EQUALS(task.GetProperty<Vector4>(RenderTask::Property::CLEAR_COLOR), newColor4, Math::MACHINE_EPSILON_10, TEST_LOCATION);
END_TEST;
}
RenderTask task;
try
{
- task.SetClearColor( Vector4::ZERO );
+ task.SetClearColor(Vector4::ZERO);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
tet_infoline("Testing RenderTask::GetClearColor()");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_EQUALS( task.GetClearColor(), RenderTask::DEFAULT_CLEAR_COLOR, TEST_LOCATION );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_EQUALS(task.GetClearColor(), RenderTask::DEFAULT_CLEAR_COLOR, TEST_LOCATION);
END_TEST;
}
try
{
Vector4 color = task.GetClearColor();
- (void) color;
+ (void)color;
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( task.GetClearEnabled() ); // defaults to true
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(task.GetClearEnabled()); // defaults to true
- task.SetClearEnabled( false );
- DALI_TEST_EQUALS( task.GetClearEnabled(), false, TEST_LOCATION );
+ task.SetClearEnabled(false);
+ DALI_TEST_EQUALS(task.GetClearEnabled(), false, TEST_LOCATION);
- task.SetClearEnabled( true );
- DALI_TEST_EQUALS( task.GetClearEnabled(), true, TEST_LOCATION );
+ task.SetClearEnabled(true);
+ DALI_TEST_EQUALS(task.GetClearEnabled(), true, TEST_LOCATION);
END_TEST;
}
{
task.SetClearEnabled(true);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( task.GetClearEnabled() ); // defaults to true
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(task.GetClearEnabled()); // defaults to true
END_TEST;
}
-
int UtcDaliRenderTaskGetClearEnabledN(void)
{
TestApplication application;
try
{
bool x = task.GetClearEnabled();
- (void) x;
+ (void)x;
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
tet_infoline("Testing RenderTask::SetCullMode()");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_EQUALS( task.GetCullMode(), true, TEST_LOCATION );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_EQUALS(task.GetCullMode(), true, TEST_LOCATION);
- task.SetCullMode( false );
+ task.SetCullMode(false);
- DALI_TEST_EQUALS( task.GetCullMode(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetCullMode(), false, TEST_LOCATION);
END_TEST;
}
RenderTask task;
try
{
- task.SetCullMode( false );
+ task.SetCullMode(false);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
tet_infoline("Testing RenderTask::GetCullMode()");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_EQUALS( task.GetCullMode(), true, TEST_LOCATION );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_EQUALS(task.GetCullMode(), true, TEST_LOCATION);
END_TEST;
}
try
{
bool x = task.GetCullMode();
- (void) x;
+ (void)x;
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "RenderTask handle is empty", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliRenderTaskSetRefreshRate(void)
{
TestApplication application;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
// By default tasks will be processed every frame
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == task.GetRefreshRate());
- task.SetRefreshRate( 2u ); // every-other frame
- DALI_TEST_CHECK( 2u == task.GetRefreshRate() );
+ task.SetRefreshRate(2u); // every-other frame
+ DALI_TEST_CHECK(2u == task.GetRefreshRate());
- task.SetRefreshRate( RenderTask::REFRESH_ALWAYS );
- DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() );
+ task.SetRefreshRate(RenderTask::REFRESH_ALWAYS);
+ DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == task.GetRefreshRate());
END_TEST;
}
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
// By default tasks will be processed every frame
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == task.GetRefreshRate() );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == task.GetRefreshRate());
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_CHECK( RenderTask::REFRESH_ALWAYS == newTask.GetRefreshRate() );
+ DALI_TEST_CHECK(RenderTask::REFRESH_ALWAYS == newTask.GetRefreshRate());
END_TEST;
}
tet_infoline("Testing RenderTask::SignalFinished()");
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
CameraActor offscreenCameraActor = CameraActor::New();
- application.GetScene().Add( offscreenCameraActor );
+ application.GetScene().Add(offscreenCameraActor);
- Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 );
- Actor rootActor = CreateRenderableActor( image );
- rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) );
- application.GetScene().Add( rootActor );
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10);
+ Actor rootActor = CreateRenderableActor(image);
+ rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ application.GetScene().Add(rootActor);
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10);
- Texture frameBufferTexture = Texture::New( *testNativeImagePtr );
- FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(),frameBufferTexture.GetHeight());
+ Texture frameBufferTexture = Texture::New(*testNativeImagePtr);
+ FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight());
frameBuffer.AttachColorTexture(frameBufferTexture);
RenderTask newTask = taskList.CreateTask();
- newTask.SetCameraActor( offscreenCameraActor );
- newTask.SetSourceActor( rootActor );
- newTask.SetInputEnabled( false );
- newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) );
- newTask.SetClearEnabled( true );
- newTask.SetExclusive( true );
- newTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
- newTask.SetFrameBuffer( frameBuffer );
- newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true );
-
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ newTask.SetCameraActor(offscreenCameraActor);
+ newTask.SetSourceActor(rootActor);
+ newTask.SetInputEnabled(false);
+ newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
+ newTask.SetClearEnabled(true);
+ newTask.SetExclusive(true);
+ newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ newTask.SetFrameBuffer(frameBuffer);
+ newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, true);
+
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
// Flush the queue and render.
application.SendNotification();
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( !finished );
+ DALI_TEST_CHECK(!finished);
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
+ DALI_TEST_CHECK(lastSyncObj != NULL);
application.Render();
- DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION);
application.SendNotification();
- DALI_TEST_CHECK( !finished );
+ DALI_TEST_CHECK(!finished);
application.Render();
- DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION);
application.SendNotification();
- DALI_TEST_CHECK( ! finished );
+ DALI_TEST_CHECK(!finished);
- sync.SetObjectSynced( lastSyncObj, true );
+ sync.SetObjectSynced(lastSyncObj, true);
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( !finished );
+ DALI_TEST_CHECK(!finished);
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( finished );
+ DALI_TEST_CHECK(finished);
- DALI_TEST_EQUALS( application.GetUpdateStatus(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(application.GetUpdateStatus(), 0, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRenderTaskContinuous01(void)
{
TestApplication application;
tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: render task not ready (source actor not staged)\nPOST:continuous renders, no Finished signal");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
application.SendNotification();
// START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, false, __LINE__));
application.GetPlatform().ClearReadyResources();
// ADD SOURCE ACTOR TO STAGE - expect continuous renders to start, no finished signal
application.SendNotification();
// CONTINUE PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
END_TEST;
}
-
int UtcDaliRenderTaskContinuous02(void)
{
TestApplication application;
tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: render task not ready (source actor not visible)\nPOST:continuous renders, no Finished signal");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- secondRootActor.SetProperty( Actor::Property::VISIBLE,false);
+ secondRootActor.SetProperty(Actor::Property::VISIBLE, false);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
// START PROCESS/RENDER Input, Expected Input, Expected, KeepUpdating
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, false, __LINE__));
application.GetPlatform().ClearReadyResources();
// MAKE SOURCE ACTOR VISIBLE - expect continuous renders to start, no finished signal
- secondRootActor.SetProperty( Actor::Property::VISIBLE,true);
+ secondRootActor.SetProperty(Actor::Property::VISIBLE, true);
application.SendNotification();
// CONTINUE PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
END_TEST;
}
tet_infoline("Testing RenderTask Render Continuous using loading image\nPRE: render task not ready (camera actor not staged)\nPOST:continuous renders, no Finished signal");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
// START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, false, __LINE__));
application.GetPlatform().ClearReadyResources();
// ADD CAMERA ACTOR TO STAGE - expect continuous renders to start, no finished signal
- application.GetScene().Add( offscreenCameraActor );
+ application.GetScene().Add(offscreenCameraActor);
application.SendNotification();
// CONTINUE PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
END_TEST;
}
-
int UtcDaliRenderTaskContinuous04(void)
{
TestApplication application;
tet_infoline("Testing RenderTask Render Continuous using loaded image");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
// START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
END_TEST;
}
tet_infoline("Testing RenderTask Render Once GlSync, using loaded image");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
- sync.SetObjectSynced( lastSyncObj, true );
+ DALI_TEST_CHECK(lastSyncObj != NULL);
+ sync.SetObjectSynced(lastSyncObj, true);
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
END_TEST;
}
tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
- Shader shader = CreateShader();
- Texture image = CreateTexture();
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = CreateShader();
+ Texture image = CreateTexture();
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetTextures( textureSet );
+ renderer.SetTextures(textureSet);
Actor secondRootActor = Actor::New();
secondRootActor.AddRenderer(renderer);
- secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
- sync.SetObjectSynced( lastSyncObj, true );
+ DALI_TEST_CHECK(lastSyncObj != NULL);
+ sync.SetObjectSynced(lastSyncObj, true);
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
- END_TEST;
+ END_TEST;
}
int UtcDaliRenderTaskOnce03(void)
tet_infoline("Testing RenderTask Render Once GlSync, using loaded image. Switch from render always after ready to render once\n");
// SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
- sync.SetObjectSynced( lastSyncObj, true );
+ DALI_TEST_CHECK(lastSyncObj != NULL);
+ sync.SetObjectSynced(lastSyncObj, true);
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
END_TEST;
}
-
int UtcDaliRenderTaskOnce04(void)
{
TestApplication application;
- tet_infoline("Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n"
- "Switch from render always after ready to render once\n"
- );
+ tet_infoline(
+ "Testing RenderTask Render Once GlSync, using Mesh which accesses texture through sampler with loaded image.\n"
+ "Switch from render always after ready to render once\n");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
- TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
- Shader shader = CreateShader();
- Texture image = CreateTexture();
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = CreateShader();
+ Texture image = CreateTexture();
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetTextures( textureSet );
+ renderer.SetTextures(textureSet);
Actor secondRootActor = Actor::New();
secondRootActor.AddRenderer(renderer);
- secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
- sync.SetObjectSynced( lastSyncObj, true );
+ DALI_TEST_CHECK(lastSyncObj != NULL);
+ sync.SetObjectSynced(lastSyncObj, true);
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
END_TEST;
}
tet_infoline("Testing RenderTask Render Once, \nPRE: Resources ready\nPOST: Finished signal sent once only");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
END_TEST;
}
{
TestApplication application;
- tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loaded image.\n"
- "PRE: Resources ready\nPOST: Finished signal sent once only");
+ tet_infoline(
+ "Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loaded image.\n"
+ "PRE: Resources ready\nPOST: Finished signal sent once only");
// SETUP AN OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
- Shader shader = CreateShader();
- Texture image = CreateTexture();
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = CreateShader();
+ Texture image = CreateTexture();
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetTextures( textureSet );
+ renderer.SetTextures(textureSet);
Actor secondRootActor = Actor::New();
secondRootActor.AddRenderer(renderer);
- secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
application.GetPlatform().ClearReadyResources();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
END_TEST;
}
{
TestApplication application;
- tet_infoline("Testing RenderTask Render Once, using loaded image. Switch from render always after ready to render once\n"
- "PRE: Render task ready, Image loaded\n"
- "POST: Finished signal sent only once");
+ tet_infoline(
+ "Testing RenderTask Render Once, using loaded image. Switch from render always after ready to render once\n"
+ "PRE: Render task ready, Image loaded\n"
+ "POST: Finished signal sent only once");
// SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
application.SendNotification(); // Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
END_TEST;
}
{
TestApplication application;
- tet_infoline("Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n"
- "Switch from render always after ready to render once\n"
- "PRE: Render task ready, Image not loaded\n"
- "POST: Finished signal sent only once");
+ tet_infoline(
+ "Testing RenderTask Render Once, using Mesh which accesses texture through sampler with loading image.\n"
+ "Switch from render always after ready to render once\n"
+ "PRE: Render task ready, Image not loaded\n"
+ "POST: Finished signal sent only once");
// SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
- Shader shader = CreateShader();
- Texture image = CreateTexture();
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = CreateShader();
+ Texture image = CreateTexture();
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetTextures( textureSet );
+ renderer.SetTextures(textureSet);
Actor secondRootActor = Actor::New();
secondRootActor.AddRenderer(renderer);
- secondRootActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ secondRootActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.GetScene().Add(secondRootActor);
-
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
- TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
+ TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj == NULL );
+ DALI_TEST_CHECK(lastSyncObj == NULL);
newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
application.SendNotification(); // Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, finished, true, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, true, __LINE__));
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, finished, true, false, __LINE__));
lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj == NULL );
+ DALI_TEST_CHECK(lastSyncObj == NULL);
END_TEST;
}
{
TestApplication application;
- tet_infoline("Testing RenderTask Render Once\n"
- "SetRefreshRate(ONCE), resource load failed, completes render task.\n"
- "PRE: resources failed to load\n"
- "POST: No finished signal sent.");
+ tet_infoline(
+ "Testing RenderTask Render Once\n"
+ "SetRefreshRate(ONCE), resource load failed, completes render task.\n"
+ "PRE: resources failed to load\n"
+ "POST: No finished signal sent.");
// SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(secondRootActor);
- RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false);
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
application.SendNotification();
// START PROCESS/RENDER Input, Expected Input, Expected
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
// CHANGE TO RENDER ONCE,
newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, finished, false, false, __LINE__ ) );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, finished, false, false, __LINE__));
END_TEST;
}
-
-
int UtcDaliRenderTaskOnceChain01(void)
{
TestApplication application;
- tet_infoline("Testing RenderTask Render Once Chained render tasks\n"
- "SetRefreshRate(ONCE), resource load completes, both render tasks render.\n"
- "PRE: resources ready\n"
- "POST: 2 finished signals sent.");
+ tet_infoline(
+ "Testing RenderTask Render Once Chained render tasks\n"
+ "SetRefreshRate(ONCE), resource load completes, both render tasks render.\n"
+ "PRE: resources ready\n"
+ "POST: 2 finished signals sent.");
// SETUP A CONTINUOUS OFFSCREEN RENDER TASK
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TraceCallStack& drawTrace = application.GetGlAbstraction().GetDrawTrace();
drawTrace.Enable(true);
Actor defaultRootActor = Actor::New(); // Root for default RT
- application.GetScene().Add( defaultRootActor );
+ application.GetScene().Add(defaultRootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
Actor firstRootActor = CreateRenderableActorSuccess(application, "aFile.jpg");
application.GetScene().Add(firstRootActor);
// first render task
- RenderTask firstTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, firstRootActor, RenderTask::REFRESH_ONCE, false);
- bool firstFinished = false;
- RenderTaskFinished renderTask1Finished( firstFinished );
- firstTask.FinishedSignal().Connect( &application, renderTask1Finished );
+ RenderTask firstTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, firstRootActor, RenderTask::REFRESH_ONCE, false);
+ bool firstFinished = false;
+ RenderTaskFinished renderTask1Finished(firstFinished);
+ firstTask.FinishedSignal().Connect(&application, renderTask1Finished);
// Second render task
- FrameBuffer fbo = firstTask.GetFrameBuffer();
- Actor secondRootActor = CreateRenderableActor( fbo.GetColorTexture() );
+ FrameBuffer fbo = firstTask.GetFrameBuffer();
+ Actor secondRootActor = CreateRenderableActor(fbo.GetColorTexture());
application.GetScene().Add(secondRootActor);
- RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
- bool secondFinished = false;
- RenderTaskFinished renderTask2Finished( secondFinished );
- secondTask.FinishedSignal().Connect( &application, renderTask2Finished );
+ RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
+ bool secondFinished = false;
+ RenderTaskFinished renderTask2Finished(secondFinished);
+ secondTask.FinishedSignal().Connect(&application, renderTask2Finished);
application.SendNotification();
//Both render tasks are executed.
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__ ) );
- DALI_TEST_CHECK( firstFinished == false );
- DALI_TEST_CHECK( secondFinished == false );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, true, firstFinished, false, true, __LINE__));
+ DALI_TEST_CHECK(firstFinished == false);
+ DALI_TEST_CHECK(secondFinished == false);
//Nothing else to render and both render task should have finished now
- DALI_TEST_CHECK( UpdateRender(application, drawTrace, false, firstFinished, true, false, __LINE__ ) );
- DALI_TEST_CHECK( firstFinished == true );
- DALI_TEST_CHECK( secondFinished == true );
+ DALI_TEST_CHECK(UpdateRender(application, drawTrace, false, firstFinished, true, false, __LINE__));
+ DALI_TEST_CHECK(firstFinished == true);
+ DALI_TEST_CHECK(secondFinished == true);
END_TEST;
}
RenderTask task = application.GetScene().GetRenderTaskList().CreateTask();
Property::IndexContainer indices;
- task.GetPropertyIndices( indices );
- DALI_TEST_CHECK( indices.Size() );
- DALI_TEST_EQUALS( indices.Size(), task.GetPropertyCount(), TEST_LOCATION );
+ task.GetPropertyIndices(indices);
+ DALI_TEST_CHECK(indices.Size());
+ DALI_TEST_EQUALS(indices.Size(), task.GetPropertyCount(), TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing RenderTask::FinishInvisibleSourceActor()");
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TestGlSyncAbstraction& sync = application.GetGlSyncAbstraction();
CameraActor offscreenCameraActor = CameraActor::New();
- application.GetScene().Add( offscreenCameraActor );
+ application.GetScene().Add(offscreenCameraActor);
- Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 );
- Actor rootActor = CreateRenderableActor( image );
- rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) );
- rootActor.SetProperty( Actor::Property::VISIBLE,false);
- application.GetScene().Add( rootActor );
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10);
+ Actor rootActor = CreateRenderableActor(image);
+ rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ rootActor.SetProperty(Actor::Property::VISIBLE, false);
+ application.GetScene().Add(rootActor);
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10);
- Texture frameBufferTexture = Texture::New( *testNativeImagePtr );
- FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight());
+ Texture frameBufferTexture = Texture::New(*testNativeImagePtr);
+ FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight());
frameBuffer.AttachColorTexture(frameBufferTexture);
// Flush all outstanding messages
application.Render();
RenderTask newTask = taskList.CreateTask();
- newTask.SetCameraActor( offscreenCameraActor );
- newTask.SetSourceActor( rootActor );
- newTask.SetInputEnabled( false );
- newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) );
- newTask.SetClearEnabled( true );
- newTask.SetExclusive( true );
- newTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
- newTask.SetFrameBuffer( frameBuffer );
- newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true );
+ newTask.SetCameraActor(offscreenCameraActor);
+ newTask.SetSourceActor(rootActor);
+ newTask.SetInputEnabled(false);
+ newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
+ newTask.SetClearEnabled(true);
+ newTask.SetExclusive(true);
+ newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
+ newTask.SetFrameBuffer(frameBuffer);
+ newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, true);
// Framebuffer doesn't actually get created until Connected, i.e. by previous line
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
// Flush the queue and render.
application.SendNotification();
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( !finished );
+ DALI_TEST_CHECK(!finished);
Integration::GlSyncAbstraction::SyncObject* lastSyncObj = sync.GetLastSyncObject();
- DALI_TEST_CHECK( lastSyncObj != NULL );
+ DALI_TEST_CHECK(lastSyncObj != NULL);
application.Render();
- DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION);
application.SendNotification();
- DALI_TEST_CHECK( !finished );
+ DALI_TEST_CHECK(!finished);
application.Render();
- DALI_TEST_EQUALS( (Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION );
+ DALI_TEST_EQUALS((Integration::KeepUpdating::Reasons)(application.GetUpdateStatus() & Integration::KeepUpdating::RENDER_TASK_SYNC), Integration::KeepUpdating::RENDER_TASK_SYNC, TEST_LOCATION);
application.SendNotification();
- DALI_TEST_CHECK( ! finished );
+ DALI_TEST_CHECK(!finished);
- sync.SetObjectSynced( lastSyncObj, true );
+ sync.SetObjectSynced(lastSyncObj, true);
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( !finished );
+ DALI_TEST_CHECK(!finished);
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( finished );
+ DALI_TEST_CHECK(finished);
finished = false;
application.Render(); // Double check no more finished signal
application.SendNotification();
- DALI_TEST_CHECK( ! finished );
+ DALI_TEST_CHECK(!finished);
END_TEST;
}
Integration::Scene stage = application.GetScene();
- Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 );
- Actor rootActor = CreateRenderableActor( image );
- rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) );
- stage.Add( rootActor );
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10);
+ Actor rootActor = CreateRenderableActor(image);
+ rootActor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ stage.Add(rootActor);
- Actor actorWithMissingImage = CreateRenderableActor( Texture() );
- actorWithMissingImage.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) );
- stage.Add( actorWithMissingImage );
+ Actor actorWithMissingImage = CreateRenderableActor(Texture());
+ actorWithMissingImage.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
+ stage.Add(actorWithMissingImage);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask newTask = taskList.CreateTask();
- newTask.SetInputEnabled( false );
- newTask.SetClearColor( Vector4( 0.f, 0.f, 0.f, 0.f ) );
- newTask.SetClearEnabled( true );
- newTask.SetExclusive( true );
- newTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
+ RenderTask newTask = taskList.CreateTask();
+ newTask.SetInputEnabled(false);
+ newTask.SetClearColor(Vector4(0.f, 0.f, 0.f, 0.f));
+ newTask.SetClearEnabled(true);
+ newTask.SetExclusive(true);
+ newTask.SetRefreshRate(RenderTask::REFRESH_ONCE);
- bool finished = false;
- RenderTaskFinished renderTaskFinished( finished );
- newTask.FinishedSignal().Connect( &application, renderTaskFinished );
+ bool finished = false;
+ RenderTaskFinished renderTaskFinished(finished);
+ newTask.FinishedSignal().Connect(&application, renderTaskFinished);
// 1 render to process render task, then 1 before finished msg is sent from update to the event thread.
application.SendNotification();
application.Render();
application.SendNotification();
- DALI_TEST_CHECK( finished );
+ DALI_TEST_CHECK(finished);
END_TEST;
}
int UtcDaliRenderTaskWorldToViewport(void)
{
- TestApplication application( 400u, 400u ); // square surface
+ TestApplication application(400u, 400u); // square surface
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0));
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.5) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.5) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.5));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.5));
application.GetScene().Add(actor);
application.Render();
application.SendNotification();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
CameraActor camera = task.GetCameraActor();
float screenX = 0.0;
float screenY = 0.0;
- bool ok = task.WorldToViewport(actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), screenX, screenY);
+ bool ok = task.WorldToViewport(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), screenX, screenY);
DALI_TEST_CHECK(ok == true);
- DALI_TEST_EQUALS(screenX, screenSize.x/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
- DALI_TEST_EQUALS(screenY, screenSize.y/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenX, screenSize.x / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenY, screenSize.y / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
- Actor actor2 = Actor::New();
+ Actor actor2 = Actor::New();
float actor2Size = 100.f;
- actor2.SetProperty( Actor::Property::SIZE, Vector2( actor2Size, actor2Size ) );
- actor2.SetProperty( Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0) );
- actor2.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.0) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.0) );
- application.GetScene().Add( actor2 );
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(actor2Size, actor2Size));
+ actor2.SetProperty(Actor::Property::POSITION, Vector3(0.0, 0.0, 0.0));
+ actor2.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0.5, 0.5, 0.0));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, Vector3(0.5, 0.5, 0.0));
+ application.GetScene().Add(actor2);
actor2.Add(actor);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, Vector3(0,0,0) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, Vector3(0, 0, 0));
application.SendNotification();
application.Render();
application.SendNotification();
- ok = task.WorldToViewport(actor.GetCurrentProperty< Vector3 >( Actor::Property::WORLD_POSITION ), screenX, screenY);
+ ok = task.WorldToViewport(actor.GetCurrentProperty<Vector3>(Actor::Property::WORLD_POSITION), screenX, screenY);
DALI_TEST_CHECK(ok == true);
- DALI_TEST_EQUALS(screenX, screenSize.x/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
- DALI_TEST_EQUALS(screenY, screenSize.y/2 - actor2Size/2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenX, screenSize.x / 2 - actor2Size / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenY, screenSize.y / 2 - actor2Size / 2, Math::MACHINE_EPSILON_10000, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRenderTaskViewportToLocal(void)
{
TestApplication application;
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::POSITION, Vector2(10.0f, 10.0f));
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
application.GetScene().Add(actor);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
+ RenderTask task = taskList.GetTask(0u);
// flush the queue and render once
application.SendNotification();
float screenX = 50.0f;
float screenY = 50.0f;
- DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, screenX, screenY) );
+ DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, screenX, screenY));
- DALI_TEST_CHECK( task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY ) );
+ DALI_TEST_CHECK(task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY));
DALI_TEST_EQUALS(localX, rtLocalX, 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(localY, rtLocalY, 0.01f, TEST_LOCATION);
END_TEST;
-
}
int UtcDaliRenderTaskOffscreenViewportToLocal(void)
{
TestApplication application;
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::POSITION, Vector2( 10.0f, 10.0f ));
- application.GetScene().Add( actor );
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(10.0f, 10.0f));
+ application.GetScene().Add(actor);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.CreateTask();
+ RenderTask task = taskList.CreateTask();
FrameBuffer newFrameBuffer = FrameBuffer::New(10, 10);
- task.SetFrameBuffer( newFrameBuffer );
- task.SetSourceActor( actor );
- task.SetScreenToFrameBufferMappingActor( actor );
+ task.SetFrameBuffer(newFrameBuffer);
+ task.SetSourceActor(actor);
+ task.SetScreenToFrameBufferMappingActor(actor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
- task.SetCameraActor( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
+ task.SetCameraActor(offscreenCameraActor);
// flush the queue and render once
application.SendNotification();
float screenX = 50.0f;
float screenY = 50.0f;
- DALI_TEST_CHECK( actor.ScreenToLocal(localX, localY, screenX, screenY) );
+ DALI_TEST_CHECK(actor.ScreenToLocal(localX, localY, screenX, screenY));
- DALI_TEST_CHECK( task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY ) );
+ DALI_TEST_CHECK(task.ViewportToLocal(actor, screenX, screenY, rtLocalX, rtLocalY));
DALI_TEST_EQUALS(localX, rtLocalX, 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(localY, rtLocalY, 0.01f, TEST_LOCATION);
int UtcDaliRenderTaskRequiresSync(void)
{
TestApplication application;
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
RenderTask newTask = taskList.CreateTask();
- newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, false );
+ newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, false);
- DALI_TEST_EQUALS( newTask.GetProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( newTask.GetCurrentProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(newTask.GetProperty<bool>(RenderTask::Property::REQUIRES_SYNC), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(newTask.GetCurrentProperty<bool>(RenderTask::Property::REQUIRES_SYNC), false, TEST_LOCATION);
- newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true );
+ newTask.SetProperty(RenderTask::Property::REQUIRES_SYNC, true);
- DALI_TEST_EQUALS( newTask.GetProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( newTask.GetCurrentProperty< bool >( RenderTask::Property::REQUIRES_SYNC ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(newTask.GetProperty<bool>(RenderTask::Property::REQUIRES_SYNC), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(newTask.GetCurrentProperty<bool>(RenderTask::Property::REQUIRES_SYNC), true, TEST_LOCATION);
END_TEST;
}
tet_infoline("UtcDaliRenderTaskSetClearEnabled");
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE);
TestGlAbstraction& gl = application.GetGlAbstraction();
- Actor renderableActor = CreateRenderableActorSuccess( application, "aFile.jpg" );
- application.GetScene().Add( renderableActor );
+ Actor renderableActor = CreateRenderableActorSuccess(application, "aFile.jpg");
+ application.GetScene().Add(renderableActor);
Actor rootActor = Actor::New();
- application.GetScene().Add( rootActor );
+ application.GetScene().Add(rootActor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT));
+ application.GetScene().Add(offscreenCameraActor);
- Actor sourceActor = CreateRenderableActorSuccess( application, "aFile.jpg" );
- application.GetScene().Add( sourceActor );
+ Actor sourceActor = CreateRenderableActorSuccess(application, "aFile.jpg");
+ application.GetScene().Add(sourceActor);
- RenderTask newTask = CreateRenderTask( application, offscreenCameraActor, rootActor, sourceActor, RenderTask::REFRESH_ALWAYS, false );
+ RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, sourceActor, RenderTask::REFRESH_ALWAYS, false);
- DALI_TEST_EQUALS( gl.GetClearCountCalled(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(gl.GetClearCountCalled(), 0, TEST_LOCATION);
application.SendNotification();
application.Render();
// glClear should be called twice - default task and the new task.
- DALI_TEST_EQUALS( gl.GetClearCountCalled(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(gl.GetClearCountCalled(), 2, TEST_LOCATION);
- newTask.SetClearEnabled( false );
+ newTask.SetClearEnabled(false);
application.SendNotification();
application.Render();
// The count should increase by 1 - default task only.
- DALI_TEST_EQUALS( gl.GetClearCountCalled(), 3, TEST_LOCATION );
+ DALI_TEST_EQUALS(gl.GetClearCountCalled(), 3, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Vector4 testColor( 1.0f, 2.0f, 3.0f, 4.0f );
+ Vector4 testColor(1.0f, 2.0f, 3.0f, 4.0f);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( task );
- DALI_TEST_EQUALS( 2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( task.GetClearColor() != testColor );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(task);
+ DALI_TEST_EQUALS(2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(task.GetClearColor() != testColor);
- task.SetClearColor( testColor );
+ task.SetClearColor(testColor);
// Wait a frame.
Wait(application);
- DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetClearColor(), testColor, TEST_LOCATION);
- RenderTask move = std::move( task );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetClearColor(), testColor, TEST_LOCATION );
- DALI_TEST_CHECK( !task );
+ RenderTask move = std::move(task);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetClearColor(), testColor, TEST_LOCATION);
+ DALI_TEST_CHECK(!task);
END_TEST;
}
{
TestApplication application;
- Vector4 testColor( 1.0f, 2.0f, 3.0f, 4.0f );
+ Vector4 testColor(1.0f, 2.0f, 3.0f, 4.0f);
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( task );
- DALI_TEST_EQUALS( 2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( task.GetClearColor() != testColor );
+ RenderTask task = taskList.GetTask(0u);
+ DALI_TEST_CHECK(task);
+ DALI_TEST_EQUALS(2, task.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(task.GetClearColor() != testColor);
- task.SetClearColor( testColor );
+ task.SetClearColor(testColor);
// Wait a frame.
Wait(application);
- DALI_TEST_EQUALS( task.GetClearColor(), testColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(task.GetClearColor(), testColor, TEST_LOCATION);
RenderTask move;
- move = std::move( task );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetClearColor(), testColor, TEST_LOCATION );
- DALI_TEST_CHECK( !task );
+ move = std::move(task);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetClearColor(), testColor, TEST_LOCATION);
+ DALI_TEST_CHECK(!task);
END_TEST;
}
int UtcDaliRenderTaskSetCullModeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetViewportNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetExclusiveNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetClearColorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskFinishedSignalNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetCameraActorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetFrameBufferNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetRefreshRateNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetSourceActorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetClearEnabledNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetInputEnabledNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetViewportSizeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetViewportPositionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetScreenToFrameBufferFunctionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskSetScreenToFrameBufferMappingActorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetCullModeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetViewportNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskIsExclusiveNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetClearColorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetCameraActorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetFrameBufferNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetRefreshRateNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetSourceActorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetClearEnabledNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetInputEnabledNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskViewportToLocalNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
Dali::Actor arg1(Actor::New());
- float arg2(0.0f);
- float arg3(0.0f);
- float arg4(0.0f);
- float arg5(0.0f);
- instance.ViewportToLocal(arg1,arg2,arg3,arg4,arg5);
+ float arg2(0.0f);
+ float arg3(0.0f);
+ float arg4(0.0f);
+ float arg5(0.0f);
+ instance.ViewportToLocal(arg1, arg2, arg3, arg4, arg5);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliRenderTaskWorldToViewportNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
Dali::Vector3 arg1;
- float arg2(0.0f);
- float arg3(0.0f);
- instance.WorldToViewport(arg1,arg2,arg3);
+ float arg2(0.0f);
+ float arg3(0.0f);
+ instance.WorldToViewport(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliRenderTaskGetCurrentViewportSizeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetCurrentViewportPositionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetScreenToFrameBufferFunctionNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
int UtcDaliRenderTaskGetScreenToFrameBufferMappingActorNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTask instance;
try
{
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
RenderTaskList taskList;
- DALI_TEST_CHECK( ! taskList );
+ DALI_TEST_CHECK(!taskList);
END_TEST;
}
RenderTaskList taskList1;
- RenderTaskList taskList2( taskList1 );
+ RenderTaskList taskList2(taskList1);
- DALI_TEST_CHECK( ! taskList2 );
+ DALI_TEST_CHECK(!taskList2);
END_TEST;
}
taskList1 = taskList2;
- DALI_TEST_CHECK( ! taskList1 );
+ DALI_TEST_CHECK(!taskList1);
END_TEST;
}
TestApplication application;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- DALI_TEST_CHECK( taskList );
- DALI_TEST_EQUALS( 2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(taskList);
+ DALI_TEST_EQUALS(2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
- RenderTaskList move = std::move( taskList );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( 1u == move.GetTaskCount() );
- DALI_TEST_CHECK( !taskList );
+ RenderTaskList move = std::move(taskList);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(1u == move.GetTaskCount());
+ DALI_TEST_CHECK(!taskList);
END_TEST;
}
TestApplication application;
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- DALI_TEST_CHECK( taskList );
- DALI_TEST_EQUALS( 2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(taskList);
+ DALI_TEST_EQUALS(2, taskList.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
RenderTaskList move;
- move = std::move( taskList );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( 1u == move.GetTaskCount() );
- DALI_TEST_CHECK( !taskList );
+ move = std::move(taskList);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(2, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(1u == move.GetTaskCount());
+ DALI_TEST_CHECK(!taskList);
END_TEST;
}
BaseHandle base = application.GetScene().GetRenderTaskList();
- RenderTaskList taskList = RenderTaskList::DownCast( base );
+ RenderTaskList taskList = RenderTaskList::DownCast(base);
- DALI_TEST_CHECK( taskList );
+ DALI_TEST_CHECK(taskList);
// Try calling a method
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
END_TEST;
}
tet_infoline("Testing RenderTaskList::CreateTask()");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
taskList.CreateTask();
- DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(2u == taskList.GetTaskCount());
END_TEST;
}
tet_infoline("Testing RenderTaskList::RemoveTask()");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(2u == taskList.GetTaskCount());
- taskList.RemoveTask( newTask );
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ taskList.RemoveTask(newTask);
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
END_TEST;
}
tet_infoline("Testing RenderTaskList::RemoveTask() which has an exclusive actor set");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(2u == taskList.GetTaskCount());
auto actor = CreateRenderableActor();
- newTask.SetSourceActor( actor );
- newTask.SetExclusive( true );
- DALI_TEST_EQUALS( actor, newTask.GetSourceActor(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, newTask.IsExclusive(), TEST_LOCATION );
- taskList.RemoveTask( newTask );
+ newTask.SetSourceActor(actor);
+ newTask.SetExclusive(true);
+ DALI_TEST_EQUALS(actor, newTask.GetSourceActor(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, newTask.IsExclusive(), TEST_LOCATION);
+ taskList.RemoveTask(newTask);
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
END_TEST;
}
tet_infoline("Testing RenderTaskList::GetTaskCount()");
RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
- taskList.RemoveTask( taskList.GetTask(0u) );
- DALI_TEST_CHECK( 0u == taskList.GetTaskCount() );
+ taskList.RemoveTask(taskList.GetTask(0u));
+ DALI_TEST_CHECK(0u == taskList.GetTaskCount());
END_TEST;
}
tet_infoline("Testing RenderTaskList::GetTask()");
- RenderTaskList taskList = application.GetScene().GetRenderTaskList();
- RenderTask defaultTask = taskList.GetTask( 0u );
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
- DALI_TEST_CHECK( defaultTask );
- DALI_TEST_CHECK( defaultTask == taskList.GetTask( 0u ) );
+ RenderTaskList taskList = application.GetScene().GetRenderTaskList();
+ RenderTask defaultTask = taskList.GetTask(0u);
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
+ DALI_TEST_CHECK(defaultTask);
+ DALI_TEST_CHECK(defaultTask == taskList.GetTask(0u));
RenderTask newTask = taskList.CreateTask();
- DALI_TEST_CHECK( 2u == taskList.GetTaskCount() );
+ DALI_TEST_CHECK(2u == taskList.GetTaskCount());
- RenderTask temp = taskList.GetTask( 0u );
- RenderTask temp2 = taskList.GetTask( 1u );
+ RenderTask temp = taskList.GetTask(0u);
+ RenderTask temp2 = taskList.GetTask(1u);
- DALI_TEST_CHECK( newTask );
- DALI_TEST_CHECK( defaultTask != newTask );
- DALI_TEST_CHECK( taskList.GetTask( 0u ) == defaultTask );
- DALI_TEST_CHECK( taskList.GetTask( 1u ) == newTask );
- DALI_TEST_CHECK( taskList.GetTask( 1u ) != defaultTask );
+ DALI_TEST_CHECK(newTask);
+ DALI_TEST_CHECK(defaultTask != newTask);
+ DALI_TEST_CHECK(taskList.GetTask(0u) == defaultTask);
+ DALI_TEST_CHECK(taskList.GetTask(1u) == newTask);
+ DALI_TEST_CHECK(taskList.GetTask(1u) != defaultTask);
- taskList.RemoveTask( taskList.GetTask(0u) );
- DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
- DALI_TEST_CHECK( taskList.GetTask( 0u ) != defaultTask );
- DALI_TEST_CHECK( taskList.GetTask( 0u ) == newTask );
+ taskList.RemoveTask(taskList.GetTask(0u));
+ DALI_TEST_CHECK(1u == taskList.GetTaskCount());
+ DALI_TEST_CHECK(taskList.GetTask(0u) != defaultTask);
+ DALI_TEST_CHECK(taskList.GetTask(0u) == newTask);
END_TEST;
}
int UtcDaliRenderTaskListCreateTaskNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTaskList instance;
try
{
int UtcDaliRenderTaskListRemoveTaskNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTaskList instance;
try
{
int UtcDaliRenderTaskListGetTaskCountNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTaskList instance;
try
{
int UtcDaliRenderTaskListGetTaskNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::RenderTaskList instance;
try
{
// EXTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/devel-api/common/stage.h>
-
-#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/public-api/dali-core.h>
+
#include <cstdio>
#include <string>
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
-#include <test-trace-call-stack.h>
#include <mesh-builder.h>
+#include <test-trace-call-stack.h>
using namespace Dali;
namespace // unnamed namespace
{
+const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_RGB(BlendFactor::SRC_ALPHA);
+const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_RGB(BlendFactor::ONE_MINUS_SRC_ALPHA);
+const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_ALPHA(BlendFactor::ONE);
+const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_ALPHA(BlendFactor::ONE_MINUS_SRC_ALPHA);
-const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_RGB( BlendFactor::SRC_ALPHA );
-const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_RGB( BlendFactor::ONE_MINUS_SRC_ALPHA );
-const BlendFactor::Type DEFAULT_BLEND_FACTOR_SRC_ALPHA( BlendFactor::ONE );
-const BlendFactor::Type DEFAULT_BLEND_FACTOR_DEST_ALPHA( BlendFactor::ONE_MINUS_SRC_ALPHA );
-
-const BlendEquation::Type DEFAULT_BLEND_EQUATION_RGB( BlendEquation::ADD );
-const BlendEquation::Type DEFAULT_BLEND_EQUATION_ALPHA( BlendEquation::ADD );
+const BlendEquation::Type DEFAULT_BLEND_EQUATION_RGB(BlendEquation::ADD);
+const BlendEquation::Type DEFAULT_BLEND_EQUATION_ALPHA(BlendEquation::ADD);
/**
* @brief Get GL stencil test enumeration value as a string.
return stream.str();
}
-void ResetDebugAndFlush( TestApplication& application, TraceCallStack& glEnableDisableStack, TraceCallStack& glStencilFunctionStack )
+void ResetDebugAndFlush(TestApplication& application, TraceCallStack& glEnableDisableStack, TraceCallStack& glStencilFunctionStack)
{
glEnableDisableStack.Reset();
glStencilFunctionStack.Reset();
application.Render();
}
-void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
+void TestConstraintNoBlue(Vector4& current, const PropertyInputContainer& inputs)
{
current.b = 0.0f;
}
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS( (bool)renderer, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)renderer, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliRendererNew02(void)
{
TestApplication application;
- Renderer renderer;
- DALI_TEST_EQUALS( (bool)renderer, false, TEST_LOCATION );
+ Renderer renderer;
+ DALI_TEST_EQUALS((bool)renderer, false, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Renderer rendererCopy( renderer );
- DALI_TEST_EQUALS( (bool)rendererCopy, true, TEST_LOCATION );
+ Renderer rendererCopy(renderer);
+ DALI_TEST_EQUALS((bool)rendererCopy, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
Renderer renderer2;
- DALI_TEST_EQUALS( (bool)renderer2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)renderer2, false, TEST_LOCATION);
renderer2 = renderer;
- DALI_TEST_EQUALS( (bool)renderer2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)renderer2, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
- DALI_TEST_CHECK( renderer );
- DALI_TEST_EQUALS( 1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
+ DALI_TEST_CHECK(renderer);
+ DALI_TEST_EQUALS(1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION);
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA );
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
- Renderer move = std::move( renderer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION );
- DALI_TEST_CHECK( !renderer );
+ Renderer move = std::move(renderer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_CHECK(!renderer);
END_TEST;
}
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
- DALI_TEST_CHECK( renderer );
- DALI_TEST_EQUALS( 1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
+ DALI_TEST_CHECK(renderer);
+ DALI_TEST_EQUALS(1, renderer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION);
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA );
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
Renderer move;
- move = std::move( renderer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION );
- DALI_TEST_CHECK( !renderer );
+ move = std::move(renderer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_CHECK(!renderer);
END_TEST;
}
TestApplication application;
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
BaseHandle handle(renderer);
- Renderer renderer2 = Renderer::DownCast(handle);
- DALI_TEST_EQUALS( (bool)renderer2, true, TEST_LOCATION );
+ Renderer renderer2 = Renderer::DownCast(handle);
+ DALI_TEST_EQUALS((bool)renderer2, true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Handle handle = Handle::New(); // Create a custom object
+ Handle handle = Handle::New(); // Create a custom object
Renderer renderer = Renderer::DownCast(handle);
- DALI_TEST_EQUALS( (bool)renderer, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)renderer, false, TEST_LOCATION);
END_TEST;
}
// using a template to auto deduce the parameter types
-template< typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
-void TEST_RENDERER_PROPERTY( P1 renderer, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION )
+template<typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
+void TEST_RENDERER_PROPERTY(P1 renderer, P2 stringName, P3 type, P4 isWriteable, P5 isAnimateable, P6 isConstraintInput, P7 enumName, P8 LOCATION)
{
- DALI_TEST_EQUALS( renderer.GetPropertyName( enumName ), stringName, LOCATION );
- DALI_TEST_EQUALS( renderer.GetPropertyIndex( stringName ), static_cast<Property::Index>(enumName), LOCATION );
- DALI_TEST_EQUALS( renderer.GetPropertyType( enumName ), type, LOCATION );
- DALI_TEST_EQUALS( renderer.IsPropertyWritable( enumName ), isWriteable, LOCATION );
- DALI_TEST_EQUALS( renderer.IsPropertyAnimatable( enumName ), isAnimateable, LOCATION );
- DALI_TEST_EQUALS( renderer.IsPropertyAConstraintInput( enumName ), isConstraintInput, LOCATION );
+ DALI_TEST_EQUALS(renderer.GetPropertyName(enumName), stringName, LOCATION);
+ DALI_TEST_EQUALS(renderer.GetPropertyIndex(stringName), static_cast<Property::Index>(enumName), LOCATION);
+ DALI_TEST_EQUALS(renderer.GetPropertyType(enumName), type, LOCATION);
+ DALI_TEST_EQUALS(renderer.IsPropertyWritable(enumName), isWriteable, LOCATION);
+ DALI_TEST_EQUALS(renderer.IsPropertyAnimatable(enumName), isAnimateable, LOCATION);
+ DALI_TEST_EQUALS(renderer.IsPropertyAConstraintInput(enumName), isConstraintInput, LOCATION);
}
int UtcDaliRendererDefaultProperties(void)
{
TestApplication application;
-/* from renderer-impl.cpp
+ /* from renderer-impl.cpp
DALI_PROPERTY( "depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX )
DALI_PROPERTY( "faceCullingMode", INTEGER, true, false, false, Dali::Renderer::Property::FACE_CULLING_MODE )
DALI_PROPERTY( "blendMode", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_MODE )
*/
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS( renderer.GetPropertyCount(), 26, TEST_LOCATION );
-
- TEST_RENDERER_PROPERTY( renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendMode", Property::INTEGER, true, false, false, Renderer::Property::BLEND_MODE, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendEquationRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_RGB, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendEquationAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_ALPHA, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendFactorSrcRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_RGB, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendFactorDestRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_RGB, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendFactorSrcAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendFactorDestAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendColor", Property::VECTOR4, true, false, false, Renderer::Property::BLEND_COLOR, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "blendPreMultipliedAlpha", Property::BOOLEAN, true, false, false, Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "indexRangeFirst", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_FIRST, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "indexRangeCount", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_COUNT, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "depthWriteMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_WRITE_MODE, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "depthFunction", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_FUNCTION, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "depthTestMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_TEST_MODE, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "renderMode", Property::INTEGER, true, false, false, Renderer::Property::RENDER_MODE, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilFunction", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilFunctionMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_MASK, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilFunctionReference",Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_REFERENCE, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_MASK, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilOperationOnFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_FAIL, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilOperationOnZFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "stencilOperationOnZPass", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "opacity", Property::FLOAT, true, true, true, DevelRenderer::Property::OPACITY, TEST_LOCATION );
- TEST_RENDERER_PROPERTY( renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetPropertyCount(), 26, TEST_LOCATION);
+
+ TEST_RENDERER_PROPERTY(renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendMode", Property::INTEGER, true, false, false, Renderer::Property::BLEND_MODE, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendEquationRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_RGB, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendEquationAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_EQUATION_ALPHA, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendFactorSrcRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_RGB, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendFactorDestRgb", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_RGB, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendFactorSrcAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendFactorDestAlpha", Property::INTEGER, true, false, false, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendColor", Property::VECTOR4, true, false, false, Renderer::Property::BLEND_COLOR, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "blendPreMultipliedAlpha", Property::BOOLEAN, true, false, false, Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "indexRangeFirst", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_FIRST, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "indexRangeCount", Property::INTEGER, true, false, false, Renderer::Property::INDEX_RANGE_COUNT, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "depthWriteMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_WRITE_MODE, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "depthFunction", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_FUNCTION, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "depthTestMode", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_TEST_MODE, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "renderMode", Property::INTEGER, true, false, false, Renderer::Property::RENDER_MODE, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilFunction", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilFunctionMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_MASK, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilFunctionReference", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_FUNCTION_REFERENCE, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilMask", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_MASK, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_FAIL, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZPass", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "opacity", Property::FLOAT, true, true, true, DevelRenderer::Property::OPACITY, TEST_LOCATION);
+ TEST_RENDERER_PROPERTY(renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION);
END_TEST;
}
int UtcDaliRendererSetGetGeometry(void)
{
TestApplication application;
- tet_infoline( "Test SetGeometry, GetGeometry" );
+ tet_infoline("Test SetGeometry, GetGeometry");
Geometry geometry1 = CreateQuadGeometry();
Geometry geometry2 = CreateQuadGeometry();
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry1, shader);
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetGeometry(), geometry1, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetGeometry(), geometry1, TEST_LOCATION);
// Set geometry2 to the renderer
- renderer.SetGeometry( geometry2 );
+ renderer.SetGeometry(geometry2);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetGeometry(), geometry2, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetGeometry(), geometry2, TEST_LOCATION);
END_TEST;
}
int UtcDaliRendererSetGetShader(void)
{
TestApplication application;
- tet_infoline( "Test SetShader, GetShader" );
+ tet_infoline("Test SetShader, GetShader");
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableCullFaceCallTrace(true);
Shader shader1 = CreateShader();
- shader1.RegisterProperty( "uFadeColor", Color::RED );
+ shader1.RegisterProperty("uFadeColor", Color::RED);
Shader shader2 = CreateShader();
- shader2.RegisterProperty( "uFadeColor", Color::GREEN );
+ shader2.RegisterProperty("uFadeColor", Color::GREEN);
Geometry geometry = CreateQuadGeometry();
Renderer renderer = Renderer::New(geometry, shader1);
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Expect that the first shaders's fade color property is accessed
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::RED, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::RED, TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetShader(), shader1, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetShader(), shader1, TEST_LOCATION);
// set the second shader to the renderer
- renderer.SetShader( shader2 );
+ renderer.SetShader(shader2);
application.SendNotification();
application.Render(0);
// Expect that the second shader's fade color property is accessed
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
- DALI_TEST_EQUALS( renderer.GetShader(), shader2, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetShader(), shader2, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test SetDepthIndex, GetDepthIndex");
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Geometry geometry = CreateQuadGeometry();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION);
- renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 1 );
+ renderer.SetProperty(Renderer::Property::DEPTH_INDEX, 1);
- DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION);
- renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 10 );
+ renderer.SetProperty(Renderer::Property::DEPTH_INDEX, 10);
- DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test SetFaceCullingMode(cullingMode)");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
// By default, none of the faces should be culled
- unsigned int cullFace = renderer.GetProperty<int>( Renderer::Property::FACE_CULLING_MODE );
- DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::NONE );
+ unsigned int cullFace = renderer.GetProperty<int>(Renderer::Property::FACE_CULLING_MODE);
+ DALI_TEST_CHECK(static_cast<FaceCullingMode::Type>(cullFace) == FaceCullingMode::NONE);
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& cullFaceStack = gl.GetCullFaceTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& cullFaceStack = gl.GetCullFaceTrace();
gl.EnableCullFaceCallTrace(true);
{
cullFaceStack.Reset();
- renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT_AND_BACK );
+ renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT_AND_BACK);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 1, TEST_LOCATION);
std::ostringstream cullModeString;
cullModeString << GL_FRONT_AND_BACK;
- DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) );
- cullFace = renderer.GetProperty<int>( Renderer::Property::FACE_CULLING_MODE );
- DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::FRONT_AND_BACK );
+ DALI_TEST_CHECK(cullFaceStack.FindMethodAndParams("CullFace", cullModeString.str()));
+ cullFace = renderer.GetProperty<int>(Renderer::Property::FACE_CULLING_MODE);
+ DALI_TEST_CHECK(static_cast<FaceCullingMode::Type>(cullFace) == FaceCullingMode::FRONT_AND_BACK);
}
{
cullFaceStack.Reset();
- renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
+ renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 1, TEST_LOCATION);
std::ostringstream cullModeString;
cullModeString << GL_BACK;
- DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) );
- cullFace = renderer.GetProperty<int>( Renderer::Property::FACE_CULLING_MODE );
- DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::BACK );
+ DALI_TEST_CHECK(cullFaceStack.FindMethodAndParams("CullFace", cullModeString.str()));
+ cullFace = renderer.GetProperty<int>(Renderer::Property::FACE_CULLING_MODE);
+ DALI_TEST_CHECK(static_cast<FaceCullingMode::Type>(cullFace) == FaceCullingMode::BACK);
}
{
cullFaceStack.Reset();
- renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT );
+ renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::FRONT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 1, TEST_LOCATION);
std::ostringstream cullModeString;
cullModeString << GL_FRONT;
- DALI_TEST_CHECK( cullFaceStack.FindMethodAndParams( "CullFace", cullModeString.str() ) );
- cullFace = renderer.GetProperty<int>( Renderer::Property::FACE_CULLING_MODE );
- DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::FRONT );
+ DALI_TEST_CHECK(cullFaceStack.FindMethodAndParams("CullFace", cullModeString.str()));
+ cullFace = renderer.GetProperty<int>(Renderer::Property::FACE_CULLING_MODE);
+ DALI_TEST_CHECK(static_cast<FaceCullingMode::Type>(cullFace) == FaceCullingMode::FRONT);
}
{
cullFaceStack.Reset();
- renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE );
+ renderer.SetProperty(Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( cullFaceStack.CountMethod( "CullFace" ), 0, TEST_LOCATION );
- cullFace = renderer.GetProperty<int>( Renderer::Property::FACE_CULLING_MODE );
- DALI_TEST_CHECK( static_cast< FaceCullingMode::Type >( cullFace ) == FaceCullingMode::NONE );
+ DALI_TEST_EQUALS(cullFaceStack.CountMethod("CullFace"), 0, TEST_LOCATION);
+ cullFace = renderer.GetProperty<int>(Renderer::Property::FACE_CULLING_MODE);
+ DALI_TEST_CHECK(static_cast<FaceCullingMode::Type>(cullFace) == FaceCullingMode::NONE);
}
END_TEST;
tet_infoline("Test BLEND_FACTOR properties ");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
// set a transparent actor color so that blending is enabled
- actor.SetProperty( Actor::Property::OPACITY, 0.5f );
+ actor.SetProperty(Actor::Property::OPACITY, 0.5f);
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE_MINUS_SRC_COLOR );
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::SRC_ALPHA_SATURATE );
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_COLOR );
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::SRC_ALPHA_SATURATE );
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::ONE_MINUS_SRC_COLOR);
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::SRC_ALPHA_SATURATE);
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE_MINUS_SRC_COLOR);
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::SRC_ALPHA_SATURATE);
// Test that Set was successful:
- int srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
- int destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
- int srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
- int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ int srcFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_RGB);
+ int destFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_RGB);
+ int srcFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_ALPHA);
+ int destFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_ALPHA);
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::SRC_ALPHA_SATURATE, destFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::SRC_ALPHA_SATURATE, destFactorAlpha, TEST_LOCATION);
application.SendNotification();
application.Render();
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
+ DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_SRC_COLOR, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_SRC_ALPHA_SATURATE, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION);
END_TEST;
}
tet_infoline("Test BLEND_FACTOR properties ");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::OPACITY, 0.5f ); // enable blending
+ actor.SetProperty(Actor::Property::OPACITY, 0.5f); // enable blending
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::CONSTANT_COLOR );
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_CONSTANT_COLOR );
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::CONSTANT_ALPHA );
- renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_CONSTANT_ALPHA );
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::CONSTANT_COLOR);
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_CONSTANT_COLOR);
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::CONSTANT_ALPHA);
+ renderer.SetProperty(Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_CONSTANT_ALPHA);
// Test that Set was successful:
{
- int srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
- int destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
- int srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
- int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
-
- DALI_TEST_EQUALS( (int)BlendFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION );
+ int srcFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_RGB);
+ int destFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_RGB);
+ int srcFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_ALPHA);
+ int destFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_ALPHA);
+
+ DALI_TEST_EQUALS((int)BlendFactor::CONSTANT_COLOR, srcFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_CONSTANT_COLOR, destFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::CONSTANT_ALPHA, srcFactorAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_CONSTANT_ALPHA, destFactorAlpha, TEST_LOCATION);
}
application.SendNotification();
application.Render();
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_ONE_MINUS_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION );
+ DALI_TEST_EQUALS((GLenum)GL_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncSrcRgb(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_CONSTANT_COLOR, glAbstraction.GetLastBlendFuncDstRgb(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncSrcAlpha(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_ONE_MINUS_CONSTANT_ALPHA, glAbstraction.GetLastBlendFuncDstAlpha(), TEST_LOCATION);
END_TEST;
}
tet_infoline("Test GetBlendEquation() defaults ");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
// Test the defaults as documented in blending.h
- int equationRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_EQUATION_RGB );
- int equationAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_EQUATION_ALPHA );
+ int equationRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_EQUATION_RGB);
+ int equationAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_EQUATION_ALPHA);
- DALI_TEST_EQUALS( (int)BlendEquation::ADD, equationRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendEquation::ADD, equationAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS((int)BlendEquation::ADD, equationRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendEquation::ADD, equationAlpha, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test SetBlendEquation() ");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::OPACITY, 0.1f );
+ actor.SetProperty(Actor::Property::OPACITY, 0.1f);
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
// Test the single blending equation setting
{
- renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT );
- int equationRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_EQUATION_RGB );
- DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION );
+ renderer.SetProperty(Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT);
+ int equationRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_EQUATION_RGB);
+ DALI_TEST_EQUALS((int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION);
}
- renderer.SetProperty( Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT );
- renderer.SetProperty( Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::REVERSE_SUBTRACT );
+ renderer.SetProperty(Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::REVERSE_SUBTRACT);
+ renderer.SetProperty(Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::REVERSE_SUBTRACT);
// Test that Set was successful
{
- int equationRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_EQUATION_RGB );
- int equationAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_EQUATION_ALPHA );
- DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION );
+ int equationRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_EQUATION_RGB);
+ int equationAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_EQUATION_ALPHA);
+ DALI_TEST_EQUALS((int)BlendEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION);
}
// Render & check GL commands
application.Render();
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION );
- DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION );
+ DALI_TEST_EQUALS((GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION);
+ DALI_TEST_EQUALS((GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION);
END_TEST;
}
tet_infoline("Test setting the blend mode to on with an opaque color renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::OPACITY, 0.98f );
+ actor.SetProperty(Actor::Property::OPACITY, 0.98f);
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to on with an transparent color renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::OPACITY, 0.0f );
+ actor.SetProperty(Actor::Property::OPACITY, 0.0f);
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
- glAbstraction.EnableDrawCallTrace( true );
+ glAbstraction.EnableDrawCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( !glEnableStack.FindMethod( "Enable" ) );
+ DALI_TEST_CHECK(!glEnableStack.FindMethod("Enable"));
- DALI_TEST_CHECK( !glAbstraction.GetDrawTrace().FindMethod( "DrawElements" ) );
+ DALI_TEST_CHECK(!glAbstraction.GetDrawTrace().FindMethod("DrawElements"));
END_TEST;
}
tet_infoline("Test setting the blend mode to off with a transparent color renders with blending disabled (and not enabled)");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::OPACITY, 0.15f );
+ actor.SetProperty(Actor::Property::OPACITY, 0.15f);
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::OFF);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with a transparent color renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::OPACITY, 0.75f );
+ actor.SetProperty(Actor::Property::OPACITY, 0.75f);
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with an opaque color renders with blending disabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with a transparent actor color renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with an opaque opaque actor color renders with blending disabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Color::MAGENTA );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Color::MAGENTA);
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with an opaque color and an image with an alpha channel renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40);
- Shader shader = CreateShader();
- TextureSet textureSet = CreateTextureSet( image );
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Shader shader = CreateShader();
+ TextureSet textureSet = CreateTextureSet(image);
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_TRANSPARENT renders with blending enabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::Hint::OUTPUT_IS_TRANSPARENT );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc", Shader::Hint::OUTPUT_IS_TRANSPARENT);
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.SendNotification();
application.Render();
- TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
+ TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
std::ostringstream blendStr;
blendStr << GL_BLEND;
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
+ DALI_TEST_CHECK(glEnableStack.FindMethodAndParams("Enable", blendStr.str().c_str()));
END_TEST;
}
tet_infoline("Test setting the blend mode to auto with an opaque color and an image without an alpha channel and a shader with the hint OUTPUT_IS_OPAQUE renders with blending disabled");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 50, 50);
- TextureSet textureSet = CreateTextureSet( image );
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 50, 50);
+ TextureSet textureSet = CreateTextureSet(image);
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::AUTO);
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::AUTO);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
application.Render();
TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", "GL_BLEND" ) );
+ DALI_TEST_CHECK(!glEnableStack.FindMethodAndParams("Enable", "GL_BLEND"));
END_TEST;
}
tet_infoline("Test GetBlendMode()");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
// default value
- unsigned int mode = renderer.GetProperty<int>( Renderer::Property::BLEND_MODE );
- DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::AUTO, TEST_LOCATION );
+ unsigned int mode = renderer.GetProperty<int>(Renderer::Property::BLEND_MODE);
+ DALI_TEST_EQUALS(static_cast<BlendMode::Type>(mode), BlendMode::AUTO, TEST_LOCATION);
// ON
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
- mode = renderer.GetProperty<int>( Renderer::Property::BLEND_MODE );
- DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::ON, TEST_LOCATION );
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ mode = renderer.GetProperty<int>(Renderer::Property::BLEND_MODE);
+ DALI_TEST_EQUALS(static_cast<BlendMode::Type>(mode), BlendMode::ON, TEST_LOCATION);
// OFF
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::OFF );
- mode = renderer.GetProperty<int>( Renderer::Property::BLEND_MODE );
- DALI_TEST_EQUALS( static_cast< BlendMode::Type >( mode ), BlendMode::OFF, TEST_LOCATION );
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::OFF);
+ mode = renderer.GetProperty<int>(Renderer::Property::BLEND_MODE);
+ DALI_TEST_EQUALS(static_cast<BlendMode::Type>(mode), BlendMode::OFF, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test SetBlendColor(color)");
- Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
+ Geometry geometry = CreateQuadGeometry();
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
TextureSet textureSet = TextureSet::New();
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50);
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50);
textureSet.SetTexture(0u, image);
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::TRANSPARENT );
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::TRANSPARENT);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( renderer.GetProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION);
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA );
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA);
- DALI_TEST_EQUALS( renderer.GetProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION );
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.GetLastBlendColor(), Color::MAGENTA, TEST_LOCATION);
- Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, color );
+ Vector4 color(0.1f, 0.2f, 0.3f, 0.4f);
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, color);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), color, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetLastBlendColor(), color, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test GetBlendColor()");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::TRANSPARENT, TEST_LOCATION);
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, Color::MAGENTA );
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, Color::MAGENTA);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), Color::MAGENTA, TEST_LOCATION);
- Vector4 color( 0.1f, 0.2f, 0.3f, 0.4f );
- renderer.SetProperty( Renderer::Property::BLEND_COLOR, color );
+ Vector4 color(0.1f, 0.2f, 0.3f, 0.4f);
+ renderer.SetProperty(Renderer::Property::BLEND_COLOR, color);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>( Renderer::Property::BLEND_COLOR ), color, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(Renderer::Property::BLEND_COLOR), color, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test BLEND_PRE_MULTIPLIED_ALPHA property");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 0.5f));
application.GetScene().Add(actor);
- Property::Value value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
- bool preMultipliedAlpha;
- DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
- DALI_TEST_CHECK( !preMultipliedAlpha );
+ Property::Value value = renderer.GetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+ bool preMultipliedAlpha;
+ DALI_TEST_CHECK(value.Get(preMultipliedAlpha));
+ DALI_TEST_CHECK(!preMultipliedAlpha);
- int srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
- int destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
- int srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
- int destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ int srcFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_RGB);
+ int destFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_RGB);
+ int srcFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_ALPHA);
+ int destFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_ALPHA);
- DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_SRC_RGB, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_DEST_RGB, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_SRC_ALPHA, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)DEFAULT_BLEND_FACTOR_DEST_ALPHA, destFactorAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_SRC_RGB, srcFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_DEST_RGB, destFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_SRC_ALPHA, srcFactorAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)DEFAULT_BLEND_FACTOR_DEST_ALPHA, destFactorAlpha, TEST_LOCATION);
application.SendNotification();
application.Render();
- Vector4 actualValue(Vector4::ZERO);
+ Vector4 actualValue(Vector4::ZERO);
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Vector4(1.0f, 0.0f, 1.0f, 0.5f), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Vector4(1.0f, 0.0f, 1.0f, 0.5f), TEST_LOCATION);
// Enable pre-multiplied alpha
- renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true );
+ renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, true);
application.SendNotification();
application.Render();
- value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
- DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
- DALI_TEST_CHECK( preMultipliedAlpha );
+ value = renderer.GetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+ DALI_TEST_CHECK(value.Get(preMultipliedAlpha));
+ DALI_TEST_CHECK(preMultipliedAlpha);
- value = renderer.GetCurrentProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
- DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
- DALI_TEST_CHECK( preMultipliedAlpha );
+ value = renderer.GetCurrentProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+ DALI_TEST_CHECK(value.Get(preMultipliedAlpha));
+ DALI_TEST_CHECK(preMultipliedAlpha);
- srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
- destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
- srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
- destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ srcFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_RGB);
+ destFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_RGB);
+ srcFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_ALPHA);
+ destFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_ALPHA);
- DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS((int)BlendFactor::ONE, srcFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Vector4(0.5f, 0.0f, 0.5f, 0.5f), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Vector4(0.5f, 0.0f, 0.5f, 0.5f), TEST_LOCATION);
// Disable pre-multiplied alpha again
- renderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, false );
+ renderer.SetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, false);
application.SendNotification();
application.Render();
- value = renderer.GetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
- DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
- DALI_TEST_CHECK( !preMultipliedAlpha );
+ value = renderer.GetProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+ DALI_TEST_CHECK(value.Get(preMultipliedAlpha));
+ DALI_TEST_CHECK(!preMultipliedAlpha);
- value = renderer.GetCurrentProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA );
- DALI_TEST_CHECK( value.Get( preMultipliedAlpha ) );
- DALI_TEST_CHECK( !preMultipliedAlpha );
+ value = renderer.GetCurrentProperty(Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA);
+ DALI_TEST_CHECK(value.Get(preMultipliedAlpha));
+ DALI_TEST_CHECK(!preMultipliedAlpha);
- srcFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_RGB );
- destFactorRgb = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_RGB );
- srcFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_SRC_ALPHA );
- destFactorAlpha = renderer.GetProperty<int>( Renderer::Property::BLEND_FACTOR_DEST_ALPHA );
+ srcFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_RGB);
+ destFactorRgb = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_RGB);
+ srcFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_SRC_ALPHA);
+ destFactorAlpha = renderer.GetProperty<int>(Renderer::Property::BLEND_FACTOR_DEST_ALPHA);
- DALI_TEST_EQUALS( (int)BlendFactor::SRC_ALPHA, srcFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION );
- DALI_TEST_EQUALS( (int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION );
+ DALI_TEST_EQUALS((int)BlendFactor::SRC_ALPHA, srcFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorRgb, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE, srcFactorAlpha, TEST_LOCATION);
+ DALI_TEST_EQUALS((int)BlendFactor::ONE_MINUS_SRC_ALPHA, destFactorAlpha, TEST_LOCATION);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Vector4( 1.0f, 0.0f, 1.0f, 0.5f ), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Vector4(1.0f, 0.0f, 1.0f, 0.5f), TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a non-uniform renderer property can be constrained");
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION);
// Apply constraint
- Constraint constraint = Constraint::New<Vector4>( renderer, colorIndex, TestConstraintNoBlue );
+ Constraint constraint = Constraint::New<Vector4>(renderer, colorIndex, TestConstraintNoBlue);
constraint.Apply();
application.SendNotification();
application.Render(0);
// Expect no blue component in either buffer - yellow
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION);
renderer.RemoveConstraints();
- renderer.SetProperty(colorIndex, Color::WHITE );
+ renderer.SetProperty(colorIndex, Color::WHITE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a uniform map renderer property can be constrained");
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor);
TestGlAbstraction& gl = application.GetGlAbstraction();
application.Render(0);
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION);
// Apply constraint
- Constraint constraint = Constraint::New<Vector4>( renderer, colorIndex, TestConstraintNoBlue );
+ Constraint constraint = Constraint::New<Vector4>(renderer, colorIndex, TestConstraintNoBlue);
constraint.Apply();
application.SendNotification();
application.Render(0);
- // Expect no blue component in either buffer - yellow
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+ // Expect no blue component in either buffer - yellow
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION);
application.Render(0);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION);
renderer.RemoveConstraints();
- renderer.SetProperty(colorIndex, Color::WHITE );
+ renderer.SetProperty(colorIndex, Color::WHITE);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::WHITE, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a non-uniform renderer property can be animated");
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION);
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, initialColor);
keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( renderer, colorIndex ), keyFrames );
+ animation.AnimateBetween(Property(renderer, colorIndex), keyFrames);
animation.Play();
application.SendNotification();
application.Render(500);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE * 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION);
application.Render(500);
- DALI_TEST_EQUALS( renderer.GetCurrentProperty< Vector4 >( colorIndex ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a uniform map renderer property can be animated");
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = renderer.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = renderer.RegisterProperty("uFadeColor", initialColor);
TestGlAbstraction& gl = application.GetGlAbstraction();
application.Render(0);
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION);
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, initialColor);
keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( renderer, colorIndex ), keyFrames );
+ animation.AnimateBetween(Property(renderer, colorIndex), keyFrames);
animation.Play();
application.SendNotification();
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::WHITE * 0.5f, TEST_LOCATION);
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::TRANSPARENT, TEST_LOCATION);
END_TEST;
}
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- renderer.RegisterProperty( "uFadeColor", Color::RED );
- actor.RegisterProperty( "uFadeColor", Color::GREEN );
- Property::Index shaderFadeColorIndex = shader.RegisterProperty( "uFadeColor", Color::MAGENTA );
+ renderer.RegisterProperty("uFadeColor", Color::RED);
+ actor.RegisterProperty("uFadeColor", Color::GREEN);
+ Property::Index shaderFadeColorIndex = shader.RegisterProperty("uFadeColor", Color::MAGENTA);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Expect that the actor's fade color property is accessed
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
// Animate shader's fade color property. Should be no change to uniform
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, Color::WHITE);
keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( shader, shaderFadeColorIndex ), keyFrames );
+ animation.AnimateBetween(Property(shader, shaderFadeColorIndex), keyFrames);
animation.Play();
application.SendNotification();
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
END_TEST;
}
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
// Don't add property / uniform map to renderer
- actor.RegisterProperty( "uFadeColor", Color::GREEN );
- Property::Index shaderFadeColorIndex = shader.RegisterProperty( "uFadeColor", Color::BLUE );
+ actor.RegisterProperty("uFadeColor", Color::GREEN);
+ Property::Index shaderFadeColorIndex = shader.RegisterProperty("uFadeColor", Color::BLUE);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Expect that the actor's fade color property is accessed
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
// Animate texture set's fade color property. Should be no change to uniform
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, Color::WHITE);
keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( shader, shaderFadeColorIndex ), keyFrames );
+ animation.AnimateBetween(Property(shader, shaderFadeColorIndex), keyFrames);
animation.Play();
application.SendNotification();
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::GREEN, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRendererUniformMapPrecendence03(void)
{
TestApplication application;
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
// Don't add property / uniform map to renderer or actor
- shader.RegisterProperty( "uFadeColor", Color::BLACK );
+ shader.RegisterProperty("uFadeColor", Color::BLACK);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Expect that the shader's fade color property is accessed
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::BLACK, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::BLACK, TEST_LOCATION);
END_TEST;
}
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- renderer.RegisterProperty( "uUniform1", Color::RED );
- actor.RegisterProperty( "uUniform2", Color::GREEN );
- shader.RegisterProperty( "uUniform3", Color::MAGENTA );
+ renderer.RegisterProperty("uUniform1", Color::RED);
+ actor.RegisterProperty("uUniform2", Color::GREEN);
+ shader.RegisterProperty("uUniform3", Color::MAGENTA);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Expect that each of the object's uniforms are set
Vector4 uniform1Value(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uUniform1", uniform1Value ) );
- DALI_TEST_EQUALS( uniform1Value, Color::RED, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uUniform1", uniform1Value));
+ DALI_TEST_EQUALS(uniform1Value, Color::RED, TEST_LOCATION);
Vector4 uniform2Value(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uUniform2", uniform2Value ) );
- DALI_TEST_EQUALS( uniform2Value, Color::GREEN, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uUniform2", uniform2Value));
+ DALI_TEST_EQUALS(uniform2Value, Color::GREEN, TEST_LOCATION);
Vector4 uniform3Value(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uUniform3", uniform3Value ) );
- DALI_TEST_EQUALS( uniform3Value, Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uUniform3", uniform3Value));
+ DALI_TEST_EQUALS(uniform3Value, Color::MAGENTA, TEST_LOCATION);
END_TEST;
}
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = Shader::New("VertexSource", "FragmentSource");
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
Property::Value value1(Color::RED);
- renderer.RegisterProperty( "uFadeColor", value1 );
+ renderer.RegisterProperty("uFadeColor", value1);
Property::Value value2(1.0f);
- actor.RegisterProperty( "uFadeProgress", value2 );
+ actor.RegisterProperty("uFadeProgress", value2);
Property::Value value3(Matrix3::IDENTITY);
- shader.RegisterProperty( "uANormalMatrix", value3 );
+ shader.RegisterProperty("uANormalMatrix", value3);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Expect that each of the object's uniforms are set
Vector4 uniform1Value(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", uniform1Value ) );
- DALI_TEST_EQUALS( uniform1Value, value1.Get<Vector4>(), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", uniform1Value));
+ DALI_TEST_EQUALS(uniform1Value, value1.Get<Vector4>(), TEST_LOCATION);
float uniform2Value(0.0f);
- DALI_TEST_CHECK( gl.GetUniformValue<float>( "uFadeProgress", uniform2Value ) );
- DALI_TEST_EQUALS( uniform2Value, value2.Get<float>(), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<float>("uFadeProgress", uniform2Value));
+ DALI_TEST_EQUALS(uniform2Value, value2.Get<float>(), TEST_LOCATION);
Matrix3 uniform3Value;
- DALI_TEST_CHECK( gl.GetUniformValue<Matrix3>( "uANormalMatrix", uniform3Value ) );
- DALI_TEST_EQUALS( uniform3Value, value3.Get<Matrix3>(), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Matrix3>("uANormalMatrix", uniform3Value));
+ DALI_TEST_EQUALS(uniform3Value, value3.Get<Matrix3>(), TEST_LOCATION);
END_TEST;
}
-
-Renderer CreateRenderer( Actor actor, Geometry geometry, Shader shader, int depthIndex )
+Renderer CreateRenderer(Actor actor, Geometry geometry, Shader shader, int depthIndex)
{
- Texture image0 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 64, 64);
- TextureSet textureSet0 = CreateTextureSet( image0 );
- Renderer renderer0 = Renderer::New( geometry, shader );
- renderer0.SetTextures( textureSet0 );
- renderer0.SetProperty( Renderer::Property::DEPTH_INDEX, depthIndex );
+ Texture image0 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 64, 64);
+ TextureSet textureSet0 = CreateTextureSet(image0);
+ Renderer renderer0 = Renderer::New(geometry, shader);
+ renderer0.SetTextures(textureSet0);
+ renderer0.SetProperty(Renderer::Property::DEPTH_INDEX, depthIndex);
actor.AddRenderer(renderer0);
return renderer0;
}
-
-Actor CreateActor( Actor parent, int siblingOrder, const char* location )
+Actor CreateActor(Actor parent, int siblingOrder, const char* location)
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN,AnchorPoint::CENTER);
- actor.SetProperty( Actor::Property::POSITION, Vector2(0.0f,0.0f));
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
parent.Add(actor);
- actor.SetProperty( Dali::DevelActor::Property::SIBLING_ORDER, siblingOrder );
- DALI_TEST_EQUALS( actor.GetProperty<int>( Dali::DevelActor::Property::SIBLING_ORDER), siblingOrder, TEST_INNER_LOCATION(location) );
+ actor.SetProperty(Dali::DevelActor::Property::SIBLING_ORDER, siblingOrder);
+ DALI_TEST_EQUALS(actor.GetProperty<int>(Dali::DevelActor::Property::SIBLING_ORDER), siblingOrder, TEST_INNER_LOCATION(location));
return actor;
}
TestApplication application;
tet_infoline("Test the rendering order in a 2D layer is correct");
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
Actor root = application.GetScene().GetRootLayer();
- Actor actor0 = CreateActor( root, 0, TEST_LOCATION );
- Renderer renderer0 = CreateRenderer( actor0, geometry, shader, 0 );
+ Actor actor0 = CreateActor(root, 0, TEST_LOCATION);
+ Renderer renderer0 = CreateRenderer(actor0, geometry, shader, 0);
- Actor actor1 = CreateActor( root, 0, TEST_LOCATION );
- Renderer renderer1 = CreateRenderer( actor1, geometry, shader, 0 );
+ Actor actor1 = CreateActor(root, 0, TEST_LOCATION);
+ Renderer renderer1 = CreateRenderer(actor1, geometry, shader, 0);
- Actor actor2 = CreateActor( root, 0, TEST_LOCATION );
- Renderer renderer2 = CreateRenderer( actor2, geometry, shader, 0 );
+ Actor actor2 = CreateActor(root, 0, TEST_LOCATION);
+ Renderer renderer2 = CreateRenderer(actor2, geometry, shader, 0);
- Actor actor3 = CreateActor( root, 0, TEST_LOCATION );
- Renderer renderer3 = CreateRenderer( actor3, geometry, shader, 0 );
+ Actor actor3 = CreateActor(root, 0, TEST_LOCATION);
+ Renderer renderer3 = CreateRenderer(actor3, geometry, shader, 0);
application.SendNotification();
application.Render(0);
application.Render(0);
int textureBindIndex[4];
- for( unsigned int i(0); i<4; ++i )
+ for(unsigned int i(0); i < 4; ++i)
{
std::stringstream params;
- params << GL_TEXTURE_2D<<", "<<i+1;
- textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str() );
+ params << GL_TEXTURE_2D << ", " << i + 1;
+ textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str());
}
//Check that actor1 has been rendered after actor2
- DALI_TEST_GREATER( textureBindIndex[1], textureBindIndex[2], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[1], textureBindIndex[2], TEST_LOCATION);
//Check that actor0 has been rendered after actor1
- DALI_TEST_GREATER( textureBindIndex[0], textureBindIndex[1], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[0], textureBindIndex[1], TEST_LOCATION);
//Check that actor3 has been rendered after actor0
- DALI_TEST_GREATER( textureBindIndex[3], textureBindIndex[0], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[3], textureBindIndex[0], TEST_LOCATION);
END_TEST;
}
* Expected rendering order: renderer1 - renderer2 - renderer0 - renderer5 - renderer4 - renderer3
*/
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
Actor root = application.GetScene().GetRootLayer();
- Actor actor0 = CreateActor( root, 0, TEST_LOCATION );
- Actor actor1 = CreateActor( actor0, 0, TEST_LOCATION );
- Renderer renderer0 = CreateRenderer( actor0, geometry, shader, 2 );
- Renderer renderer1 = CreateRenderer( actor0, geometry, shader, 0 );
- Renderer renderer2 = CreateRenderer( actor0, geometry, shader, 1 );
- Renderer renderer3 = CreateRenderer( actor1, geometry, shader, 1 );
- Renderer renderer4 = CreateRenderer( actor1, geometry, shader, 0 );
- Renderer renderer5 = CreateRenderer( actor1, geometry, shader, -1 );
+ Actor actor0 = CreateActor(root, 0, TEST_LOCATION);
+ Actor actor1 = CreateActor(actor0, 0, TEST_LOCATION);
+ Renderer renderer0 = CreateRenderer(actor0, geometry, shader, 2);
+ Renderer renderer1 = CreateRenderer(actor0, geometry, shader, 0);
+ Renderer renderer2 = CreateRenderer(actor0, geometry, shader, 1);
+ Renderer renderer3 = CreateRenderer(actor1, geometry, shader, 1);
+ Renderer renderer4 = CreateRenderer(actor1, geometry, shader, 0);
+ Renderer renderer5 = CreateRenderer(actor1, geometry, shader, -1);
application.SendNotification();
application.Render(0);
application.Render(0);
int textureBindIndex[6];
- for( unsigned int i(0); i<6; ++i )
+ for(unsigned int i(0); i < 6; ++i)
{
std::stringstream params;
- params << GL_TEXTURE_2D<<", "<<i+1;
- textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str() );
+ params << GL_TEXTURE_2D << ", " << i + 1;
+ textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str());
}
//Check that renderer3 has been rendered after renderer4
- DALI_TEST_GREATER( textureBindIndex[3], textureBindIndex[4], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[3], textureBindIndex[4], TEST_LOCATION);
//Check that renderer0 has been rendered after renderer2
- DALI_TEST_GREATER( textureBindIndex[4], textureBindIndex[5], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[4], textureBindIndex[5], TEST_LOCATION);
//Check that renderer5 has been rendered after renderer2
- DALI_TEST_GREATER( textureBindIndex[5], textureBindIndex[0], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[5], textureBindIndex[0], TEST_LOCATION);
//Check that renderer0 has been rendered after renderer2
- DALI_TEST_GREATER( textureBindIndex[0], textureBindIndex[2], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[0], textureBindIndex[2], TEST_LOCATION);
//Check that renderer2 has been rendered after renderer1
- DALI_TEST_GREATER( textureBindIndex[2], textureBindIndex[1], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[2], textureBindIndex[1], TEST_LOCATION);
END_TEST;
}
-
int UtcDaliRendererRenderOrder2DLayerSiblingOrder(void)
{
TestApplication application;
* Expected rendering order: renderer2 - renderer3 - renderer4 - renderer1 - renderer0 - renderer5
*/
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Actor root = application.GetScene().GetRootLayer();
- Actor actor0 = CreateActor( root, 1, TEST_LOCATION );
- Actor actor1 = CreateActor( root, 0, TEST_LOCATION );
- Actor actor2 = CreateActor( actor0, 0, TEST_LOCATION );
+ Actor root = application.GetScene().GetRootLayer();
+ Actor actor0 = CreateActor(root, 1, TEST_LOCATION);
+ Actor actor1 = CreateActor(root, 0, TEST_LOCATION);
+ Actor actor2 = CreateActor(actor0, 0, TEST_LOCATION);
- Renderer renderer0 = CreateRenderer( actor0, geometry, shader, 2 );
- Renderer renderer1 = CreateRenderer( actor0, geometry, shader, 0 );
- Renderer renderer2 = CreateRenderer( actor1, geometry, shader, 0 );
- Renderer renderer3 = CreateRenderer( actor1, geometry, shader, 1 );
- Renderer renderer4 = CreateRenderer( actor1, geometry, shader, 2 );
- Renderer renderer5 = CreateRenderer( actor2, geometry, shader, -1 );
+ Renderer renderer0 = CreateRenderer(actor0, geometry, shader, 2);
+ Renderer renderer1 = CreateRenderer(actor0, geometry, shader, 0);
+ Renderer renderer2 = CreateRenderer(actor1, geometry, shader, 0);
+ Renderer renderer3 = CreateRenderer(actor1, geometry, shader, 1);
+ Renderer renderer4 = CreateRenderer(actor1, geometry, shader, 2);
+ Renderer renderer5 = CreateRenderer(actor2, geometry, shader, -1);
application.SendNotification();
application.Render();
application.Render(0);
int textureBindIndex[6];
- for( unsigned int i(0); i<6; ++i )
+ for(unsigned int i(0); i < 6; ++i)
{
std::stringstream params;
- params << GL_TEXTURE_2D<<", "<<i+1;
- textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str() );
+ params << GL_TEXTURE_2D << ", " << i + 1;
+ textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str());
}
- DALI_TEST_EQUALS( textureBindIndex[2], 0, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[3], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[4], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[1], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[0], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[5], 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(textureBindIndex[2], 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[3], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[4], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[1], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[0], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[5], 5, TEST_LOCATION);
// Change sibling order of actor1
// New Expected rendering order: renderer1 - renderer0 - renderer 5 - renderer2 - renderer3 - renderer4
- actor1.SetProperty( Dali::DevelActor::Property::SIBLING_ORDER, 2 );
+ actor1.SetProperty(Dali::DevelActor::Property::SIBLING_ORDER, 2);
gl.GetTextureTrace().Reset();
application.SendNotification();
application.Render(0);
- for( unsigned int i(0); i<6; ++i )
+ for(unsigned int i(0); i < 6; ++i)
{
std::stringstream params;
- params << GL_TEXTURE_2D<<", "<<i+1;
- textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str() );
+ params << GL_TEXTURE_2D << ", " << i + 1;
+ textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str());
}
- DALI_TEST_EQUALS( textureBindIndex[1], 0, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[0], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[5], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[2], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[3], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( textureBindIndex[4], 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(textureBindIndex[1], 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[0], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[5], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[2], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[3], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureBindIndex[4], 5, TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Test the rendering order in a 2D layer is correct for overlays");
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Actor root = application.GetScene().GetRootLayer();
+ Actor root = application.GetScene().GetRootLayer();
/*
* Create the following hierarchy:
* Expected rendering order : actor2 - actor4 - actor1 - actor0 - actor3
*/
- Actor actor0 = CreateActor( root, 0, TEST_LOCATION );
- actor0.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
- Renderer renderer0 = CreateRenderer( actor0, geometry, shader, 0 );
+ Actor actor0 = CreateActor(root, 0, TEST_LOCATION);
+ actor0.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
+ Renderer renderer0 = CreateRenderer(actor0, geometry, shader, 0);
- Actor actor1 = CreateActor( root, 0, TEST_LOCATION );
- actor1.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
- Renderer renderer1 = CreateRenderer( actor1, geometry, shader, 0 );
+ Actor actor1 = CreateActor(root, 0, TEST_LOCATION);
+ actor1.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
+ Renderer renderer1 = CreateRenderer(actor1, geometry, shader, 0);
- Actor actor2 = CreateActor( root, 0, TEST_LOCATION );
- Renderer renderer2 = CreateRenderer( actor2, geometry, shader, 0 );
+ Actor actor2 = CreateActor(root, 0, TEST_LOCATION);
+ Renderer renderer2 = CreateRenderer(actor2, geometry, shader, 0);
- Actor actor3 = CreateActor( root, 0, TEST_LOCATION );
- actor3.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D );
- Renderer renderer3 = CreateRenderer( actor3, geometry, shader, 0 );
+ Actor actor3 = CreateActor(root, 0, TEST_LOCATION);
+ actor3.SetProperty(Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D);
+ Renderer renderer3 = CreateRenderer(actor3, geometry, shader, 0);
- Actor actor4 = CreateActor( root, 0, TEST_LOCATION );
- Renderer renderer4 = CreateRenderer( actor4, geometry, shader, 0 );
+ Actor actor4 = CreateActor(root, 0, TEST_LOCATION);
+ Renderer renderer4 = CreateRenderer(actor4, geometry, shader, 0);
application.SendNotification();
application.Render(0);
application.Render(0);
int textureBindIndex[5];
- for( unsigned int i(0); i<5; ++i )
+ for(unsigned int i(0); i < 5; ++i)
{
std::stringstream params;
- params << GL_TEXTURE_2D<<", "<<i+1;
- textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str() );
+ params << GL_TEXTURE_2D << ", " << i + 1;
+ textureBindIndex[i] = gl.GetTextureTrace().FindIndexFromMethodAndParams("BindTexture", params.str());
}
//Check that actor4 has been rendered after actor2
- DALI_TEST_GREATER( textureBindIndex[4], textureBindIndex[2], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[4], textureBindIndex[2], TEST_LOCATION);
//Check that actor1 has been rendered after actor4
- DALI_TEST_GREATER( textureBindIndex[1], textureBindIndex[4], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[1], textureBindIndex[4], TEST_LOCATION);
//Check that actor0 has been rendered after actor1
- DALI_TEST_GREATER( textureBindIndex[0], textureBindIndex[1], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[0], textureBindIndex[1], TEST_LOCATION);
//Check that actor3 has been rendered after actor0
- DALI_TEST_GREATER( textureBindIndex[3], textureBindIndex[0], TEST_LOCATION );
+ DALI_TEST_GREATER(textureBindIndex[3], textureBindIndex[0], TEST_LOCATION);
END_TEST;
}
int UtcDaliRendererSetIndexRange(void)
{
std::string
- vertexShader(
- "attribute vec2 aPosition;\n"
- "void main()\n"
- "{\n"
- " gl_Position = aPosition;\n"
- "}"
- ),
- fragmentShader(
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0)\n"
- "}\n"
- );
+ vertexShader(
+ "attribute vec2 aPosition;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = aPosition;\n"
+ "}"),
+ fragmentShader(
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0)\n"
+ "}\n");
TestApplication application;
tet_infoline("Test setting the range of indices to draw");
TestGlAbstraction& gl = application.GetGlAbstraction();
- gl.EnableDrawCallTrace( true );
+ gl.EnableDrawCallTrace(true);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
// create geometry
Geometry geometry = Geometry::New();
- geometry.SetType( Geometry::LINE_LOOP );
+ geometry.SetType(Geometry::LINE_LOOP);
// --------------------------------------------------------------------------
// index buffer
- unsigned short indices[] = { 0, 2, 4, 6, 8, // offset = 0, count = 5
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // offset = 5, count = 10
- 1, 3, 5, 7, 9, 1 }; // offset = 15, count = 6 // line strip
+ unsigned short indices[] = {0, 2, 4, 6, 8, // offset = 0, count = 5
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9, // offset = 5, count = 10
+ 1,
+ 3,
+ 5,
+ 7,
+ 9,
+ 1}; // offset = 15, count = 6 // line strip
// --------------------------------------------------------------------------
// vertex buffer
Vector2 position;
};
Vertex shapes[] =
- {
- // pentagon // star
- { Vector2( 0.0f, 1.00f) }, { Vector2( 0.0f, -1.00f) },
- { Vector2( -0.95f, 0.31f) }, { Vector2( 0.59f, 0.81f) },
- { Vector2( -0.59f, -0.81f) }, { Vector2( -0.95f, -0.31f) },
- { Vector2( 0.59f, -0.81f) }, { Vector2( 0.95f, -0.31f) },
- { Vector2( 0.95f, 0.31f) }, { Vector2( -0.59f, 0.81f) },
- };
+ {
+ // pentagon // star
+ {Vector2(0.0f, 1.00f)},
+ {Vector2(0.0f, -1.00f)},
+ {Vector2(-0.95f, 0.31f)},
+ {Vector2(0.59f, 0.81f)},
+ {Vector2(-0.59f, -0.81f)},
+ {Vector2(-0.95f, -0.31f)},
+ {Vector2(0.59f, -0.81f)},
+ {Vector2(0.95f, -0.31f)},
+ {Vector2(0.95f, 0.31f)},
+ {Vector2(-0.59f, 0.81f)},
+ };
Property::Map vertexFormat;
vertexFormat["aPosition"] = Property::VECTOR2;
- VertexBuffer vertexBuffer = VertexBuffer::New( vertexFormat );
- vertexBuffer.SetData( shapes, sizeof(shapes)/sizeof(shapes[0]));
+ VertexBuffer vertexBuffer = VertexBuffer::New(vertexFormat);
+ vertexBuffer.SetData(shapes, sizeof(shapes) / sizeof(shapes[0]));
// --------------------------------------------------------------------------
- geometry.SetIndexBuffer( indices, sizeof(indices)/sizeof(indices[0]) );
- geometry.AddVertexBuffer( vertexBuffer );
+ geometry.SetIndexBuffer(indices, sizeof(indices) / sizeof(indices[0]));
+ geometry.AddVertexBuffer(vertexBuffer);
// create shader
- Shader shader = Shader::New( vertexShader,fragmentShader );
- Renderer renderer = Renderer::New( geometry, shader );
- actor.AddRenderer( renderer );
+ Shader shader = Shader::New(vertexShader, fragmentShader);
+ Renderer renderer = Renderer::New(geometry, shader);
+ actor.AddRenderer(renderer);
Integration::Scene scene = application.GetScene();
- scene.Add( actor );
+ scene.Add(actor);
- char buffer[ 128 ];
+ char buffer[128];
// LINE_LOOP, first 0, count 5
{
- renderer.SetIndexRange( 0, 5 );
+ renderer.SetIndexRange(0, 5);
application.SendNotification();
application.Render();
- Property::Value value = renderer.GetProperty( Renderer::Property::INDEX_RANGE_FIRST );
- int convertedValue;
- DALI_TEST_CHECK( value.Get( convertedValue ) );
- DALI_TEST_CHECK( convertedValue == 0 );
+ Property::Value value = renderer.GetProperty(Renderer::Property::INDEX_RANGE_FIRST);
+ int convertedValue;
+ DALI_TEST_CHECK(value.Get(convertedValue));
+ DALI_TEST_CHECK(convertedValue == 0);
- value = renderer.GetCurrentProperty( Renderer::Property::INDEX_RANGE_FIRST );
- DALI_TEST_CHECK( value.Get( convertedValue ) );
- DALI_TEST_CHECK( convertedValue == 0 );
+ value = renderer.GetCurrentProperty(Renderer::Property::INDEX_RANGE_FIRST);
+ DALI_TEST_CHECK(value.Get(convertedValue));
+ DALI_TEST_CHECK(convertedValue == 0);
- value = renderer.GetProperty( Renderer::Property::INDEX_RANGE_COUNT );
- DALI_TEST_CHECK( value.Get( convertedValue ) );
- DALI_TEST_CHECK( convertedValue == 5 );
+ value = renderer.GetProperty(Renderer::Property::INDEX_RANGE_COUNT);
+ DALI_TEST_CHECK(value.Get(convertedValue));
+ DALI_TEST_CHECK(convertedValue == 5);
- value = renderer.GetCurrentProperty( Renderer::Property::INDEX_RANGE_COUNT );
- DALI_TEST_CHECK( value.Get( convertedValue ) );
- DALI_TEST_CHECK( convertedValue == 5 );
+ value = renderer.GetCurrentProperty(Renderer::Property::INDEX_RANGE_COUNT);
+ DALI_TEST_CHECK(value.Get(convertedValue));
+ DALI_TEST_CHECK(convertedValue == 5);
- sprintf( buffer, "%u, 5, %u, indices", GL_LINE_LOOP, GL_UNSIGNED_SHORT );
- bool result = gl.GetDrawTrace().FindMethodAndParams( "DrawElements" , buffer );
- DALI_TEST_CHECK( result );
+ sprintf(buffer, "%u, 5, %u, indices", GL_LINE_LOOP, GL_UNSIGNED_SHORT);
+ bool result = gl.GetDrawTrace().FindMethodAndParams("DrawElements", buffer);
+ DALI_TEST_CHECK(result);
}
// LINE_LOOP, first 5, count 10
{
- renderer.SetIndexRange( 5, 10 );
- sprintf( buffer, "%u, 10, %u, indices", GL_LINE_LOOP, GL_UNSIGNED_SHORT );
+ renderer.SetIndexRange(5, 10);
+ sprintf(buffer, "%u, 10, %u, indices", GL_LINE_LOOP, GL_UNSIGNED_SHORT);
application.SendNotification();
application.Render();
- bool result = gl.GetDrawTrace().FindMethodAndParams( "DrawElements" , buffer );
- DALI_TEST_CHECK( result );
+ bool result = gl.GetDrawTrace().FindMethodAndParams("DrawElements", buffer);
+ DALI_TEST_CHECK(result);
}
// LINE_STRIP, first 15, count 6
{
- renderer.SetIndexRange( 15, 6 );
- geometry.SetType( Geometry::LINE_STRIP );
- sprintf( buffer, "%u, 6, %u, indices", GL_LINE_STRIP, GL_UNSIGNED_SHORT );
+ renderer.SetIndexRange(15, 6);
+ geometry.SetType(Geometry::LINE_STRIP);
+ sprintf(buffer, "%u, 6, %u, indices", GL_LINE_STRIP, GL_UNSIGNED_SHORT);
application.SendNotification();
application.Render();
- bool result = gl.GetDrawTrace().FindMethodAndParams( "DrawElements" , buffer );
- DALI_TEST_CHECK( result );
+ bool result = gl.GetDrawTrace().FindMethodAndParams("DrawElements", buffer);
+ DALI_TEST_CHECK(result);
}
// Index out of bounds
{
- renderer.SetIndexRange( 15, 30 );
- geometry.SetType( Geometry::LINE_STRIP );
- sprintf( buffer, "%u, 6, %u, indices", GL_LINE_STRIP, GL_UNSIGNED_SHORT );
+ renderer.SetIndexRange(15, 30);
+ geometry.SetType(Geometry::LINE_STRIP);
+ sprintf(buffer, "%u, 6, %u, indices", GL_LINE_STRIP, GL_UNSIGNED_SHORT);
application.SendNotification();
application.Render();
- bool result = gl.GetDrawTrace().FindMethodAndParams( "DrawElements" , buffer );
- DALI_TEST_CHECK( result );
+ bool result = gl.GetDrawTrace().FindMethodAndParams("DrawElements", buffer);
+ DALI_TEST_CHECK(result);
}
// drawing whole buffer starting from 15 ( last valid primitive )
{
- renderer.SetIndexRange( 15, 0 );
- geometry.SetType( Geometry::LINE_STRIP );
- sprintf( buffer, "%u, 6, %u, indices", GL_LINE_STRIP, GL_UNSIGNED_SHORT );
+ renderer.SetIndexRange(15, 0);
+ geometry.SetType(Geometry::LINE_STRIP);
+ sprintf(buffer, "%u, 6, %u, indices", GL_LINE_STRIP, GL_UNSIGNED_SHORT);
application.SendNotification();
application.Render();
- bool result = gl.GetDrawTrace().FindMethodAndParams( "DrawElements" , buffer );
- DALI_TEST_CHECK( result );
+ bool result = gl.GetDrawTrace().FindMethodAndParams("DrawElements", buffer);
+ DALI_TEST_CHECK(result);
}
END_TEST;
}
-
int UtcDaliRendererSetDepthFunction(void)
{
TestApplication application;
tet_infoline("Test setting the depth function");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
Integration::Scene scene = application.GetScene();
- scene.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
+ scene.GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
scene.Add(actor);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
//GL_NEVER
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::NEVER);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::NEVER);
glEnableDisableStack.Reset();
glDepthFunctionStack.Reset();
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", depthTestStr.str().c_str() ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", depthTestStr.str().c_str()));
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_NEVER;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_ALWAYS
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::ALWAYS);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::ALWAYS);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_ALWAYS;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_LESS
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_LESS;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_GREATER
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::GREATER);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::GREATER);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_GREATER;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_EQUAL
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::EQUAL);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::EQUAL);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_EQUAL;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_NOTEQUAL
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::NOT_EQUAL);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::NOT_EQUAL);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_NOTEQUAL;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_LEQUAL
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS_EQUAL);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS_EQUAL);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_LEQUAL;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
//GL_GEQUAL
{
- renderer.SetProperty( Renderer::Property::DEPTH_FUNCTION, DepthFunction::GREATER_EQUAL);
+ renderer.SetProperty(Renderer::Property::DEPTH_FUNCTION, DepthFunction::GREATER_EQUAL);
glDepthFunctionStack.Reset();
application.SendNotification();
std::ostringstream depthFunctionStr;
depthFunctionStr << GL_GEQUAL;
- DALI_TEST_CHECK( glDepthFunctionStack.FindMethodAndParams( "DepthFunc", depthFunctionStr.str().c_str() ) );
+ DALI_TEST_CHECK(glDepthFunctionStack.FindMethodAndParams("DepthFunc", depthFunctionStr.str().c_str()));
}
END_TEST;
* - Set a different value via string.
* - Check it was set.
*/
-template< typename T >
-void CheckEnumerationProperty( TestApplication& application, Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString )
+template<typename T>
+void CheckEnumerationProperty(TestApplication& application, Renderer& renderer, Property::Index propertyIndex, T initialValue, T firstCheckEnumeration, T secondCheckEnumeration, std::string secondCheckString)
{
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( initialValue ) );
- DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( initialValue ) );
- renderer.SetProperty( propertyIndex, firstCheckEnumeration );
- DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
- DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) != static_cast<int>( firstCheckEnumeration ) );
+ DALI_TEST_CHECK(renderer.GetProperty<int>(propertyIndex) == static_cast<int>(initialValue));
+ DALI_TEST_CHECK(renderer.GetCurrentProperty<int>(propertyIndex) == static_cast<int>(initialValue));
+ renderer.SetProperty(propertyIndex, firstCheckEnumeration);
+ DALI_TEST_CHECK(renderer.GetProperty<int>(propertyIndex) == static_cast<int>(firstCheckEnumeration));
+ DALI_TEST_CHECK(renderer.GetCurrentProperty<int>(propertyIndex) != static_cast<int>(firstCheckEnumeration));
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
- DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( firstCheckEnumeration ) );
+ DALI_TEST_CHECK(renderer.GetProperty<int>(propertyIndex) == static_cast<int>(firstCheckEnumeration));
+ DALI_TEST_CHECK(renderer.GetCurrentProperty<int>(propertyIndex) == static_cast<int>(firstCheckEnumeration));
- renderer.SetProperty( propertyIndex, secondCheckString );
- DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
- DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) != static_cast<int>( secondCheckEnumeration ) );
+ renderer.SetProperty(propertyIndex, secondCheckString);
+ DALI_TEST_CHECK(renderer.GetProperty<int>(propertyIndex) == static_cast<int>(secondCheckEnumeration));
+ DALI_TEST_CHECK(renderer.GetCurrentProperty<int>(propertyIndex) != static_cast<int>(secondCheckEnumeration));
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( renderer.GetProperty<int>( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
- DALI_TEST_CHECK( renderer.GetCurrentProperty< int >( propertyIndex ) == static_cast<int>( secondCheckEnumeration ) );
+ DALI_TEST_CHECK(renderer.GetProperty<int>(propertyIndex) == static_cast<int>(secondCheckEnumeration));
+ DALI_TEST_CHECK(renderer.GetCurrentProperty<int>(propertyIndex) == static_cast<int>(secondCheckEnumeration));
}
int UtcDaliRendererEnumProperties(void)
{
TestApplication application;
- tet_infoline( "Test Renderer enumeration properties can be set with both integer and string values" );
+ tet_infoline("Test Renderer enumeration properties can be set with both integer and string values");
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
/*
* @see CheckEnumerationProperty for details of the checks performed.
*/
- CheckEnumerationProperty< FaceCullingMode::Type >( application, renderer, Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE, FaceCullingMode::FRONT, FaceCullingMode::BACK, "BACK" );
- CheckEnumerationProperty< BlendMode::Type >( application, renderer, Renderer::Property::BLEND_MODE, BlendMode::AUTO, BlendMode::OFF, BlendMode::ON, "ON" );
- CheckEnumerationProperty< BlendEquation::Type >( application, renderer, Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" );
- CheckEnumerationProperty< BlendEquation::Type >( application, renderer, Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT" );
- CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" );
- CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" );
- CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::SRC_COLOR, "SRC_COLOR" );
- CheckEnumerationProperty< BlendFactor::Type >( application, renderer, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR" );
- CheckEnumerationProperty< DepthWriteMode::Type >( application, renderer, Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO, DepthWriteMode::OFF, DepthWriteMode::ON, "ON" );
- CheckEnumerationProperty< DepthFunction::Type >( application, renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER" );
- CheckEnumerationProperty< DepthTestMode::Type >( application, renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON" );
- CheckEnumerationProperty< StencilFunction::Type >( application, renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL" );
- CheckEnumerationProperty< RenderMode::Type >( application, renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL" );
- CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
- CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
- CheckEnumerationProperty< StencilOperation::Type >( application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT" );
+ CheckEnumerationProperty<FaceCullingMode::Type>(application, renderer, Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::NONE, FaceCullingMode::FRONT, FaceCullingMode::BACK, "BACK");
+ CheckEnumerationProperty<BlendMode::Type>(application, renderer, Renderer::Property::BLEND_MODE, BlendMode::AUTO, BlendMode::OFF, BlendMode::ON, "ON");
+ CheckEnumerationProperty<BlendEquation::Type>(application, renderer, Renderer::Property::BLEND_EQUATION_RGB, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT");
+ CheckEnumerationProperty<BlendEquation::Type>(application, renderer, Renderer::Property::BLEND_EQUATION_ALPHA, BlendEquation::ADD, BlendEquation::SUBTRACT, BlendEquation::REVERSE_SUBTRACT, "REVERSE_SUBTRACT");
+ CheckEnumerationProperty<BlendFactor::Type>(application, renderer, Renderer::Property::BLEND_FACTOR_SRC_RGB, BlendFactor::SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR");
+ CheckEnumerationProperty<BlendFactor::Type>(application, renderer, Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR");
+ CheckEnumerationProperty<BlendFactor::Type>(application, renderer, Renderer::Property::BLEND_FACTOR_SRC_ALPHA, BlendFactor::ONE, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::SRC_COLOR, "SRC_COLOR");
+ CheckEnumerationProperty<BlendFactor::Type>(application, renderer, Renderer::Property::BLEND_FACTOR_DEST_ALPHA, BlendFactor::ONE_MINUS_SRC_ALPHA, BlendFactor::ONE, BlendFactor::SRC_COLOR, "SRC_COLOR");
+ CheckEnumerationProperty<DepthWriteMode::Type>(application, renderer, Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO, DepthWriteMode::OFF, DepthWriteMode::ON, "ON");
+ CheckEnumerationProperty<DepthFunction::Type>(application, renderer, Renderer::Property::DEPTH_FUNCTION, DepthFunction::LESS, DepthFunction::ALWAYS, DepthFunction::GREATER, "GREATER");
+ CheckEnumerationProperty<DepthTestMode::Type>(application, renderer, Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO, DepthTestMode::OFF, DepthTestMode::ON, "ON");
+ CheckEnumerationProperty<StencilFunction::Type>(application, renderer, Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS, StencilFunction::LESS, StencilFunction::EQUAL, "EQUAL");
+ CheckEnumerationProperty<RenderMode::Type>(application, renderer, Renderer::Property::RENDER_MODE, RenderMode::AUTO, RenderMode::NONE, RenderMode::STENCIL, "STENCIL");
+ CheckEnumerationProperty<StencilOperation::Type>(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT");
+ CheckEnumerationProperty<StencilOperation::Type>(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT");
+ CheckEnumerationProperty<StencilOperation::Type>(application, renderer, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::KEEP, StencilOperation::REPLACE, StencilOperation::INCREMENT, "INCREMENT");
END_TEST;
}
-Renderer RendererTestFixture( TestApplication& application )
+Renderer RendererTestFixture(TestApplication& application)
{
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
Integration::Scene scene = application.GetScene();
- scene.GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_3D );
- scene.Add( actor );
+ scene.GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
+ scene.Add(actor);
return renderer;
}
TestApplication application;
tet_infoline("Test setting the DepthTestMode");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace( true );
+ glAbstraction.EnableEnableDisableCallTrace(true);
TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
glEnableDisableStack.Reset();
application.Render();
// Check depth-test is enabled by default.
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetDepthTestString() ) );
- DALI_TEST_CHECK( !glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetDepthTestString()));
+ DALI_TEST_CHECK(!glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString()));
// Turn off depth-testing. We want to check if the depth buffer has been disabled, so we need to turn off depth-write as well for this case.
- renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::OFF );
- renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF );
+ renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::OFF);
+ renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF);
glEnableDisableStack.Reset();
application.SendNotification();
application.Render();
// Check the depth buffer was disabled.
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString()));
// Turn on automatic mode depth-testing.
// Layer behavior is currently set to LAYER_3D so AUTO should enable depth-testing.
- renderer.SetProperty( Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO );
+ renderer.SetProperty(Renderer::Property::DEPTH_TEST_MODE, DepthTestMode::AUTO);
glEnableDisableStack.Reset();
application.SendNotification();
application.Render();
// Check depth-test is now enabled.
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetDepthTestString() ) );
- DALI_TEST_CHECK( !glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetDepthTestString()));
+ DALI_TEST_CHECK(!glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString()));
// Change the layer behavior to LAYER_UI.
// Note this will also disable depth testing for the layer by default, we test this first.
- application.GetScene().GetRootLayer().SetProperty( Layer::Property::BEHAVIOR, Layer::LAYER_UI );
+ application.GetScene().GetRootLayer().SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_UI);
glEnableDisableStack.Reset();
application.SendNotification();
application.Render();
// Check depth-test is disabled.
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Disable", GetDepthTestString() ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Disable", GetDepthTestString()));
// Turn the layer depth-test flag back on, and confirm that depth testing is now on.
- application.GetScene().GetRootLayer().SetProperty(Layer::Property::DEPTH_TEST, true );
+ application.GetScene().GetRootLayer().SetProperty(Layer::Property::DEPTH_TEST, true);
glEnableDisableStack.Reset();
application.SendNotification();
application.Render();
// Check depth-test is *still* disabled.
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetDepthTestString() ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetDepthTestString()));
END_TEST;
}
TestApplication application;
tet_infoline("Test setting the DepthWriteMode");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
application.SendNotification();
application.Render();
// Check the default depth-write status first.
- DALI_TEST_CHECK( glAbstraction.GetLastDepthMask() );
+ DALI_TEST_CHECK(glAbstraction.GetLastDepthMask());
// Turn off depth-writing.
- renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF );
+ renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF);
application.SendNotification();
application.Render();
// Check depth-write is now disabled.
- DALI_TEST_CHECK( !glAbstraction.GetLastDepthMask() );
+ DALI_TEST_CHECK(!glAbstraction.GetLastDepthMask());
// Test the AUTO mode for depth-writing.
// As our renderer is opaque, depth-testing should be enabled.
- renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO );
+ renderer.SetProperty(Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::AUTO);
application.SendNotification();
application.Render();
// Check depth-write is now enabled.
- DALI_TEST_CHECK( glAbstraction.GetLastDepthMask() );
+ DALI_TEST_CHECK(glAbstraction.GetLastDepthMask());
// Now make the renderer be treated as translucent by enabling blending.
// The AUTO depth-write mode should turn depth-write off in this scenario.
- renderer.SetProperty( Renderer::Property::BLEND_MODE, BlendMode::ON );
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
application.SendNotification();
application.Render();
// Check depth-write is now disabled.
- DALI_TEST_CHECK( !glAbstraction.GetLastDepthMask() );
+ DALI_TEST_CHECK(!glAbstraction.GetLastDepthMask());
END_TEST;
}
TestApplication application;
tet_infoline("Test the stencil defaults");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace( true );
- glAbstraction.EnableStencilFunctionCallTrace( true );
- TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+ glAbstraction.EnableStencilFunctionCallTrace(true);
+ TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
// Check the defaults:
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get<int>() ), static_cast<int>( StencilFunction::ALWAYS ), TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get<int>() ), 0xFF, TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get<int>() ), 0x00, TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0xFF, TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL ).Get<int>() ), static_cast<int>( StencilOperation::KEEP ), TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL ).Get<int>() ), static_cast<int>( StencilOperation::KEEP ), TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS ).Get<int>() ), static_cast<int>( StencilOperation::KEEP ), TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION).Get<int>()), static_cast<int>(StencilFunction::ALWAYS), TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_MASK).Get<int>()), 0xFF, TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE).Get<int>()), 0x00, TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_MASK).Get<int>()), 0xFF, TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL).Get<int>()), static_cast<int>(StencilOperation::KEEP), TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL).Get<int>()), static_cast<int>(StencilOperation::KEEP), TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS).Get<int>()), static_cast<int>(StencilOperation::KEEP), TEST_LOCATION);
END_TEST;
}
TestApplication application;
tet_infoline("Test setting the RenderMode to use the stencil buffer");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace( true );
- glAbstraction.EnableStencilFunctionCallTrace( true );
- TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+ glAbstraction.EnableStencilFunctionCallTrace(true);
+ TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
// Set the StencilFunction to something other than the default, to confirm it is set as a property,
// but NO GL call has been made while the RenderMode is set to not use the stencil buffer.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::NONE );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::NONE);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::NEVER );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get<int>() ), static_cast<int>( StencilFunction::NEVER ), TEST_LOCATION );
+ renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION, StencilFunction::NEVER);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION).Get<int>()), static_cast<int>(StencilFunction::NEVER), TEST_LOCATION);
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
- std::string methodString( "StencilFunc" );
- DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
+ std::string methodString("StencilFunc");
+ DALI_TEST_CHECK(!glStencilFunctionStack.FindMethod(methodString));
// Test the other RenderModes that will not enable the stencil buffer.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::AUTO );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
- DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::AUTO);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
+ DALI_TEST_CHECK(!glStencilFunctionStack.FindMethod(methodString));
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
- DALI_TEST_CHECK( !glStencilFunctionStack.FindMethod( methodString ) );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
+ DALI_TEST_CHECK(!glStencilFunctionStack.FindMethod(methodString));
// Now set the RenderMode to modes that will use the stencil buffer, and check the StencilFunction has changed.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) );
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethod( methodString ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetStencilTestString()));
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethod(methodString));
// Test the COLOR_STENCIL RenderMode as it also enables the stencil buffer.
// First set a mode to turn off the stencil buffer, so the enable is required.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL);
// Set a different stencil function as the last one is cached.
- renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- DALI_TEST_CHECK( glEnableDisableStack.FindMethodAndParams( "Enable", GetStencilTestString() ) );
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethod( methodString ) );
+ DALI_TEST_CHECK(glEnableDisableStack.FindMethodAndParams("Enable", GetStencilTestString()));
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethod(methodString));
END_TEST;
}
// Helper function for the SetRenderModeToUseColorBuffer test.
-void CheckRenderModeColorMask( TestApplication& application, Renderer& renderer, RenderMode::Type renderMode, bool expectedValue )
+void CheckRenderModeColorMask(TestApplication& application, Renderer& renderer, RenderMode::Type renderMode, bool expectedValue)
{
// Set the RenderMode property to a value that should not allow color buffer writes.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, renderMode );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, renderMode);
application.SendNotification();
application.Render();
// Check if ColorMask has been called, and that the values are correct.
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- const TestGlAbstraction::ColorMaskParams& colorMaskParams( glAbstraction.GetColorMaskParams() );
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
+ const TestGlAbstraction::ColorMaskParams& colorMaskParams(glAbstraction.GetColorMaskParams());
- DALI_TEST_EQUALS<bool>( colorMaskParams.red, expectedValue, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.green, expectedValue, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.blue, expectedValue, TEST_LOCATION );
- DALI_TEST_EQUALS<bool>( colorMaskParams.alpha, expectedValue, TEST_LOCATION );
+ DALI_TEST_EQUALS<bool>(colorMaskParams.red, expectedValue, TEST_LOCATION);
+ DALI_TEST_EQUALS<bool>(colorMaskParams.green, expectedValue, TEST_LOCATION);
+ DALI_TEST_EQUALS<bool>(colorMaskParams.blue, expectedValue, TEST_LOCATION);
+ DALI_TEST_EQUALS<bool>(colorMaskParams.alpha, expectedValue, TEST_LOCATION);
}
int UtcDaliRendererSetRenderModeToUseColorBuffer(void)
TestApplication application;
tet_infoline("Test setting the RenderMode to use the color buffer");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
// Set the RenderMode property to a value that should not allow color buffer writes.
// Then check if ColorMask has been called, and that the values are correct.
- CheckRenderModeColorMask( application, renderer, RenderMode::AUTO, true );
- CheckRenderModeColorMask( application, renderer, RenderMode::NONE, false );
- CheckRenderModeColorMask( application, renderer, RenderMode::COLOR, true );
- CheckRenderModeColorMask( application, renderer, RenderMode::STENCIL, false );
- CheckRenderModeColorMask( application, renderer, RenderMode::COLOR_STENCIL, true );
+ CheckRenderModeColorMask(application, renderer, RenderMode::AUTO, true);
+ CheckRenderModeColorMask(application, renderer, RenderMode::NONE, false);
+ CheckRenderModeColorMask(application, renderer, RenderMode::COLOR, true);
+ CheckRenderModeColorMask(application, renderer, RenderMode::STENCIL, false);
+ CheckRenderModeColorMask(application, renderer, RenderMode::COLOR_STENCIL, true);
END_TEST;
}
TestApplication application;
tet_infoline("Test setting the StencilFunction");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace( true );
- glAbstraction.EnableStencilFunctionCallTrace( true );
- TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+ glAbstraction.EnableStencilFunctionCallTrace(true);
+ TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
// RenderMode must use the stencil for StencilFunction to operate.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL);
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
/*
* Lookup table for testing StencilFunction.
* Note: This MUST be in the same order as the Dali::StencilFunction enum.
*/
const int StencilFunctionLookupTable[] = {
- GL_NEVER,
- GL_LESS,
- GL_EQUAL,
- GL_LEQUAL,
- GL_GREATER,
- GL_NOTEQUAL,
- GL_GEQUAL,
- GL_ALWAYS
- }; const int StencilFunctionLookupTableCount = sizeof( StencilFunctionLookupTable ) / sizeof( StencilFunctionLookupTable[0] );
+ GL_NEVER,
+ GL_LESS,
+ GL_EQUAL,
+ GL_LEQUAL,
+ GL_GREATER,
+ GL_NOTEQUAL,
+ GL_GEQUAL,
+ GL_ALWAYS};
+ const int StencilFunctionLookupTableCount = sizeof(StencilFunctionLookupTable) / sizeof(StencilFunctionLookupTable[0]);
/*
* Loop through all types of StencilFunction, checking:
* - Checks the correct parameters to "glStencilFunc" were used
*/
std::string nonChangingParameters = "0, 255";
- std::string methodString( "StencilFunc" );
- for( int i = 0; i < StencilFunctionLookupTableCount; ++i )
+ std::string methodString("StencilFunc");
+ for(int i = 0; i < StencilFunctionLookupTableCount; ++i)
{
// Set the property.
- renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, static_cast<Dali::StencilFunction::Type>( i ) );
+ renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION, static_cast<Dali::StencilFunction::Type>(i));
// Check GetProperty returns the same value.
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION ).Get<int>() ), i, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION).Get<int>()), i, TEST_LOCATION);
// Reset the trace debug.
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
// Check the function is called and the parameters are correct.
std::stringstream parameterStream;
- parameterStream << StencilFunctionLookupTable[ i ] << ", " << nonChangingParameters;
+ parameterStream << StencilFunctionLookupTable[i] << ", " << nonChangingParameters;
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) );
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str()));
}
// Change the Function Reference only and check the behavior is correct:
// 170 is 0xaa in hex / 10101010 in binary (every other bit set).
int testValueReference = 170;
- renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, testValueReference );
+ renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE, testValueReference);
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get<int>() ), testValueReference, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE).Get<int>()), testValueReference, TEST_LOCATION);
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE ).Get<int>() ), testValueReference, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetCurrentProperty(Renderer::Property::STENCIL_FUNCTION_REFERENCE).Get<int>()), testValueReference, TEST_LOCATION);
std::stringstream parameterStream;
- parameterStream << StencilFunctionLookupTable[ StencilOperation::DECREMENT_WRAP ] << ", " << testValueReference << ", 255";
-
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) );
+ parameterStream << StencilFunctionLookupTable[StencilOperation::DECREMENT_WRAP] << ", " << testValueReference << ", 255";
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str()));
// Change the Function Mask only and check the behavior is correct:
// 85 is 0x55 in hex / 01010101 in binary (every other bit set).
int testValueMask = 85;
- renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, testValueMask );
+ renderer.SetProperty(Renderer::Property::STENCIL_FUNCTION_MASK, testValueMask);
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get<int>() ), testValueMask, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_FUNCTION_MASK).Get<int>()), testValueMask, TEST_LOCATION);
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_FUNCTION_MASK ).Get<int>() ), testValueMask, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetCurrentProperty(Renderer::Property::STENCIL_FUNCTION_MASK).Get<int>()), testValueMask, TEST_LOCATION);
// Clear the stringstream.
- parameterStream.str( std::string() );
- parameterStream << StencilFunctionLookupTable[ StencilOperation::DECREMENT_WRAP ] << ", " << testValueReference << ", " << testValueMask;
+ parameterStream.str(std::string());
+ parameterStream << StencilFunctionLookupTable[StencilOperation::DECREMENT_WRAP] << ", " << testValueReference << ", " << testValueMask;
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) );
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str()));
END_TEST;
}
TestApplication application;
tet_infoline("Test setting the StencilOperation");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace( true );
- glAbstraction.EnableStencilFunctionCallTrace( true );
- TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+ glAbstraction.EnableStencilFunctionCallTrace(true);
+ TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
// RenderMode must use the stencil for StencilOperation to operate.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL);
/*
* Lookup table for testing StencilOperation.
GL_DECR,
GL_INVERT,
GL_INCR_WRAP,
- GL_DECR_WRAP
- }; const int StencilOperationLookupTableCount = sizeof( StencilOperationLookupTable ) / sizeof( StencilOperationLookupTable[0] );
+ GL_DECR_WRAP};
+ const int StencilOperationLookupTableCount = sizeof(StencilOperationLookupTable) / sizeof(StencilOperationLookupTable[0]);
// Set all 3 StencilOperation properties to a default.
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP );
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::ZERO );
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::ZERO );
+ renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL, StencilOperation::KEEP);
+ renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, StencilOperation::ZERO);
+ renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, StencilOperation::ZERO);
// Set our expected parameter list to the equivalent result.
- int parameters[] = { StencilOperationLookupTable[ StencilOperation::ZERO ], StencilOperationLookupTable[ StencilOperation::ZERO ], StencilOperationLookupTable[ StencilOperation::ZERO ] };
+ int parameters[] = {StencilOperationLookupTable[StencilOperation::ZERO], StencilOperationLookupTable[StencilOperation::ZERO], StencilOperationLookupTable[StencilOperation::ZERO]};
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
/*
* Loop through all types of StencilOperation, checking:
* - Checks the correct parameters to "glStencilFunc" were used
* - Checks the above for all 3 parameter placements of StencilOperation ( OnFail, OnZFail, OnPass )
*/
- std::string methodString( "StencilOp" );
+ std::string methodString("StencilOp");
- for( int i = 0; i < StencilOperationLookupTableCount; ++i )
+ for(int i = 0; i < StencilOperationLookupTableCount; ++i)
{
- for( int j = 0; j < StencilOperationLookupTableCount; ++j )
+ for(int j = 0; j < StencilOperationLookupTableCount; ++j)
{
- for( int k = 0; k < StencilOperationLookupTableCount; ++k )
+ for(int k = 0; k < StencilOperationLookupTableCount; ++k)
{
// Set the property (outer loop causes all 3 different properties to be set separately).
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL, static_cast<Dali::StencilFunction::Type>( i ) );
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, static_cast<Dali::StencilFunction::Type>( j ) );
- renderer.SetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, static_cast<Dali::StencilFunction::Type>( k ) );
+ renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL, static_cast<Dali::StencilFunction::Type>(i));
+ renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, static_cast<Dali::StencilFunction::Type>(j));
+ renderer.SetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, static_cast<Dali::StencilFunction::Type>(k));
// Check GetProperty returns the same value.
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_FAIL ).Get<int>() ), i, TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL ).Get<int>() ), j, TEST_LOCATION );
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_OPERATION_ON_Z_PASS ).Get<int>() ), k, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_FAIL).Get<int>()), i, TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL).Get<int>()), j, TEST_LOCATION);
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_OPERATION_ON_Z_PASS).Get<int>()), k, TEST_LOCATION);
// Reset the trace debug.
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
// Check the function is called and the parameters are correct.
// Set the expected parameter value at its correct index (only)
- parameters[ 0u ] = StencilOperationLookupTable[ i ];
- parameters[ 1u ] = StencilOperationLookupTable[ j ];
- parameters[ 2u ] = StencilOperationLookupTable[ k ];
+ parameters[0u] = StencilOperationLookupTable[i];
+ parameters[1u] = StencilOperationLookupTable[j];
+ parameters[2u] = StencilOperationLookupTable[k];
// Build the parameter list.
std::stringstream parameterStream;
- for( int parameterBuild = 0; parameterBuild < 3; ++parameterBuild )
+ for(int parameterBuild = 0; parameterBuild < 3; ++parameterBuild)
{
- parameterStream << parameters[ parameterBuild ];
+ parameterStream << parameters[parameterBuild];
// Comma-separate the parameters.
- if( parameterBuild < 2 )
+ if(parameterBuild < 2)
{
parameterStream << ", ";
}
}
// Check the function was called and the parameters were correct.
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterStream.str() ) );
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterStream.str()));
}
}
}
TestApplication application;
tet_infoline("Test setting the StencilMask");
- Renderer renderer = RendererTestFixture( application );
+ Renderer renderer = RendererTestFixture(application);
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableEnableDisableCallTrace( true );
- glAbstraction.EnableStencilFunctionCallTrace( true );
- TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
+ glAbstraction.EnableEnableDisableCallTrace(true);
+ glAbstraction.EnableStencilFunctionCallTrace(true);
+ TraceCallStack& glEnableDisableStack = glAbstraction.GetEnableDisableTrace();
TraceCallStack& glStencilFunctionStack = glAbstraction.GetStencilFunctionTrace();
// RenderMode must use the stencil for StencilMask to operate.
- renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
+ renderer.SetProperty(Renderer::Property::RENDER_MODE, RenderMode::STENCIL);
// Set the StencilMask property to a value.
- renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0x00 );
+ renderer.SetProperty(Renderer::Property::STENCIL_MASK, 0x00);
// Check GetProperty returns the same value.
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0x00, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_MASK).Get<int>()), 0x00, TEST_LOCATION);
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0x00, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetCurrentProperty(Renderer::Property::STENCIL_MASK).Get<int>()), 0x00, TEST_LOCATION);
- std::string methodString( "StencilMask" );
+ std::string methodString("StencilMask");
std::string parameterString = "0";
// Check the function was called and the parameters were correct.
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterString ) );
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterString));
// Set the StencilMask property to another value to ensure it has changed.
- renderer.SetProperty( Renderer::Property::STENCIL_MASK, 0xFF );
+ renderer.SetProperty(Renderer::Property::STENCIL_MASK, 0xFF);
// Check GetProperty returns the same value.
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0xFF, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetProperty(Renderer::Property::STENCIL_MASK).Get<int>()), 0xFF, TEST_LOCATION);
- ResetDebugAndFlush( application, glEnableDisableStack, glStencilFunctionStack );
+ ResetDebugAndFlush(application, glEnableDisableStack, glStencilFunctionStack);
- DALI_TEST_EQUALS<int>( static_cast<int>( renderer.GetCurrentProperty( Renderer::Property::STENCIL_MASK ).Get<int>() ), 0xFF, TEST_LOCATION );
+ DALI_TEST_EQUALS<int>(static_cast<int>(renderer.GetCurrentProperty(Renderer::Property::STENCIL_MASK).Get<int>()), 0xFF, TEST_LOCATION);
parameterString = "255";
// Check the function was called and the parameters were correct.
- DALI_TEST_CHECK( glStencilFunctionStack.FindMethodAndParams( methodString, parameterString ) );
+ DALI_TEST_CHECK(glStencilFunctionStack.FindMethodAndParams(methodString, parameterString));
END_TEST;
}
//Create a TextureSet with 4 textures (One more texture in the texture set than active samplers)
//@note Shaders in the test suit have 3 active samplers. See TestGlAbstraction::GetActiveUniform()
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64u, 64u );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64u, 64u);
TextureSet textureSet = CreateTextureSet();
- textureSet.SetTexture(0, texture );
- textureSet.SetTexture(1, texture );
- textureSet.SetTexture(2, texture );
- textureSet.SetTexture(3, texture );
- Shader shader = Shader::New("VertexSource", "FragmentSource");
+ textureSet.SetTexture(0, texture);
+ textureSet.SetTexture(1, texture);
+ textureSet.SetTexture(2, texture);
+ textureSet.SetTexture(3, texture);
+ Shader shader = Shader::New("VertexSource", "FragmentSource");
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
- Actor actor= Actor::New();
+ Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::POSITION, Vector2(0.0f,0.0f));
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
application.GetScene().Add(actor);
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& drawTrace = gl.GetDrawTrace();
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
drawTrace.Reset();
drawTrace.Enable(true);
application.Render(0);
//Test we do the drawcall when TextureSet has more textures than there are active samplers in the shader
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
//Create a TextureSet with 1 texture (two more active samplers than texture in the texture set)
//@note Shaders in the test suit have 3 active samplers. See TestGlAbstraction::GetActiveUniform()
textureSet = CreateTextureSet();
- renderer.SetTextures( textureSet );
- textureSet.SetTexture(0, texture );
+ renderer.SetTextures(textureSet);
+ textureSet.SetTexture(0, texture);
drawTrace.Reset();
application.SendNotification();
application.Render(0);
//Test we do the drawcall when TextureSet has less textures than there are active samplers in the shader.
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Test OPACITY property" );
+ tet_infoline("Test OPACITY property");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
- application.GetScene().Add( actor );
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f));
+ application.GetScene().Add(actor);
- Property::Value value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
- float opacity;
- DALI_TEST_CHECK( value.Get( opacity ) );
- DALI_TEST_EQUALS( opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ Property::Value value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+ float opacity;
+ DALI_TEST_CHECK(value.Get(opacity));
+ DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
application.SendNotification();
application.Render();
- Vector4 actualValue;
+ Vector4 actualValue;
TestGlAbstraction& gl = application.GetGlAbstraction();
- DALI_TEST_CHECK( gl.GetUniformValue< Vector4 >( "uColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue.a, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+ DALI_TEST_EQUALS(actualValue.a, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.5f );
+ renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.5f);
application.SendNotification();
application.Render();
- value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
- DALI_TEST_CHECK( value.Get( opacity ) );
- DALI_TEST_EQUALS( opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+ DALI_TEST_CHECK(value.Get(opacity));
+ DALI_TEST_EQUALS(opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- value = renderer.GetCurrentProperty( DevelRenderer::Property::OPACITY );
- DALI_TEST_CHECK( value.Get( opacity ) );
- DALI_TEST_EQUALS( opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ value = renderer.GetCurrentProperty(DevelRenderer::Property::OPACITY);
+ DALI_TEST_CHECK(value.Get(opacity));
+ DALI_TEST_EQUALS(opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- DALI_TEST_CHECK( gl.GetUniformValue< Vector4 >( "uColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue.a, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+ DALI_TEST_EQUALS(actualValue.a, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Test OPACITY property animation" );
+ tet_infoline("Test OPACITY property animation");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
- application.GetScene().Add( actor );
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f));
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- Property::Value value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
- float opacity;
- DALI_TEST_CHECK( value.Get( opacity ) );
- DALI_TEST_EQUALS( opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ Property::Value value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+ float opacity;
+ DALI_TEST_CHECK(value.Get(opacity));
+ DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( renderer, DevelRenderer::Property::OPACITY ), 0.0f );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.0f);
animation.Play();
application.SendNotification();
- application.Render( 1000 );
+ application.Render(1000);
- value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
- DALI_TEST_CHECK( value.Get( opacity ) );
- DALI_TEST_EQUALS( opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+ DALI_TEST_CHECK(value.Get(opacity));
+ DALI_TEST_EQUALS(opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
// Need to clear the animation before setting the property as the animation value is baked and will override any previous setters
animation.Clear();
- renderer.SetProperty( DevelRenderer::Property::OPACITY, 0.1f );
+ renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.1f);
- animation.AnimateBy( Property( renderer, DevelRenderer::Property::OPACITY ), 0.5f );
+ animation.AnimateBy(Property(renderer, DevelRenderer::Property::OPACITY), 0.5f);
animation.Play();
application.SendNotification();
- application.Render( 1000 );
+ application.Render(1000);
- value = renderer.GetProperty( DevelRenderer::Property::OPACITY );
- DALI_TEST_CHECK( value.Get( opacity ) );
- DALI_TEST_EQUALS( opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
- DALI_TEST_EQUALS( opacity, renderer.GetCurrentProperty( DevelRenderer::Property::OPACITY ).Get< float >(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION );
+ value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+ DALI_TEST_CHECK(value.Get(opacity));
+ DALI_TEST_EQUALS(opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+ DALI_TEST_EQUALS(opacity, renderer.GetCurrentProperty(DevelRenderer::Property::OPACITY).Get<float>(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Test invalid property" );
+ tet_infoline("Test invalid property");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- application.GetScene().Add( actor );
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- Property::Value value = renderer.GetProperty( Renderer::Property::DEPTH_INDEX + 100 );
- DALI_TEST_CHECK( value.GetType() == Property::Type::NONE );
+ Property::Value value = renderer.GetProperty(Renderer::Property::DEPTH_INDEX + 100);
+ DALI_TEST_CHECK(value.GetType() == Property::Type::NONE);
- value = renderer.GetCurrentProperty( Renderer::Property::DEPTH_INDEX + 100 );
- DALI_TEST_CHECK( value.GetType() == Property::Type::NONE );
+ value = renderer.GetCurrentProperty(Renderer::Property::DEPTH_INDEX + 100);
+ DALI_TEST_CHECK(value.GetType() == Property::Type::NONE);
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Test RENDERING_BEHAVIOR property" );
+ tet_infoline("Test RENDERING_BEHAVIOR property");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
- application.GetScene().Add( actor );
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f));
+ application.GetScene().Add(actor);
- Property::Value value = renderer.GetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR );
- int renderingBehavior;
- DALI_TEST_CHECK( value.Get( renderingBehavior ) );
- DALI_TEST_EQUALS( static_cast< DevelRenderer::Rendering::Type >( renderingBehavior ), DevelRenderer::Rendering::IF_REQUIRED, TEST_LOCATION );
+ Property::Value value = renderer.GetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR);
+ int renderingBehavior;
+ DALI_TEST_CHECK(value.Get(renderingBehavior));
+ DALI_TEST_EQUALS(static_cast<DevelRenderer::Rendering::Type>(renderingBehavior), DevelRenderer::Rendering::IF_REQUIRED, TEST_LOCATION);
application.SendNotification();
application.Render();
uint32_t updateStatus = application.GetUpdateStatus();
- DALI_TEST_CHECK( !( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ) );
+ DALI_TEST_CHECK(!(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING));
- renderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY );
+ renderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY);
- value = renderer.GetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR );
- DALI_TEST_CHECK( value.Get( renderingBehavior ) );
- DALI_TEST_EQUALS( static_cast< DevelRenderer::Rendering::Type >( renderingBehavior ), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION );
+ value = renderer.GetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR);
+ DALI_TEST_CHECK(value.Get(renderingBehavior));
+ DALI_TEST_EQUALS(static_cast<DevelRenderer::Rendering::Type>(renderingBehavior), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION);
// Render and check the update status
application.SendNotification();
updateStatus = application.GetUpdateStatus();
- DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING );
+ DALI_TEST_CHECK(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING);
- value = renderer.GetCurrentProperty( DevelRenderer::Property::RENDERING_BEHAVIOR );
- DALI_TEST_CHECK( value.Get( renderingBehavior ) );
- DALI_TEST_EQUALS( static_cast< DevelRenderer::Rendering::Type >( renderingBehavior ), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION );
+ value = renderer.GetCurrentProperty(DevelRenderer::Property::RENDERING_BEHAVIOR);
+ DALI_TEST_CHECK(value.Get(renderingBehavior));
+ DALI_TEST_EQUALS(static_cast<DevelRenderer::Rendering::Type>(renderingBehavior), DevelRenderer::Rendering::CONTINUOUSLY, TEST_LOCATION);
// Render again and check the update status
application.SendNotification();
updateStatus = application.GetUpdateStatus();
- DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING );
+ DALI_TEST_CHECK(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING);
// Change rendering behavior
- renderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
+ renderer.SetProperty(DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED);
// Render and check the update status
application.SendNotification();
updateStatus = application.GetUpdateStatus();
- DALI_TEST_CHECK( !( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING ) );
+ DALI_TEST_CHECK(!(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING));
END_TEST;
}
{
TestApplication application;
- tet_infoline( "Test regenerating uniform map when attaching renderer to the node" );
+ tet_infoline("Test regenerating uniform map when attaching renderer to the node");
Geometry geometry = CreateQuadGeometry();
- Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = Shader::New("vertexSrc", "fragmentSrc");
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- actor.SetProperty( Actor::Property::COLOR, Vector4( 1.0f, 0.0f, 1.0f, 1.0f ) );
- application.GetScene().Add( actor );
+ actor.AddRenderer(renderer);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f));
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- actor.RemoveRenderer( renderer );
- shader = Shader::New( "vertexSrc", "fragmentSrc" );
- shader.RegisterProperty( "opacity", 0.5f );
- renderer.SetShader( shader );
+ actor.RemoveRenderer(renderer);
+ shader = Shader::New("vertexSrc", "fragmentSrc");
+ shader.RegisterProperty("opacity", 0.5f);
+ renderer.SetShader(shader);
- Stage::GetCurrent().KeepRendering( 1.0f );
+ Stage::GetCurrent().KeepRendering(1.0f);
// Update for several frames
application.SendNotification();
application.Render();
// Add Renderer
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
application.SendNotification();
application.Render();
// Nothing to test here, the test must not crash
auto updateStatus = application.GetUpdateStatus();
- DALI_TEST_CHECK( updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING );
+ DALI_TEST_CHECK(updateStatus & Integration::KeepUpdating::STAGE_KEEP_RENDERING);
END_TEST;
}
tet_infoline("Test adding draw commands to the renderer");
- TestGlAbstraction &glAbstraction = application.GetGlAbstraction();
+ TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
glAbstraction.EnableEnableDisableCallTrace(true);
Geometry geometry = CreateQuadGeometry();
Shader shader = Shader::New("vertexSrc", "fragmentSrc");
Renderer renderer = Renderer::New(geometry, shader);
- renderer.SetProperty( Renderer::Property::BLEND_MODE, Dali::BlendMode::ON );
+ renderer.SetProperty(Renderer::Property::BLEND_MODE, Dali::BlendMode::ON);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
// Expect delivering a single draw call
- auto &drawTrace = glAbstraction.GetDrawTrace();
+ auto& drawTrace = glAbstraction.GetDrawTrace();
drawTrace.Reset();
drawTrace.Enable(true);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(drawTrace.CountMethod("DrawElements"), 1, TEST_LOCATION);
- auto drawCommand1 = DevelRenderer::DrawCommand{};
+ auto drawCommand1 = DevelRenderer::DrawCommand{};
drawCommand1.drawType = DevelRenderer::DrawType::INDEXED;
drawCommand1.firstIndex = 0;
drawCommand1.elementCount = 2;
drawCommand1.queue = DevelRenderer::RENDER_QUEUE_OPAQUE;
- auto drawCommand2 = DevelRenderer::DrawCommand{};
+ auto drawCommand2 = DevelRenderer::DrawCommand{};
drawCommand2.drawType = DevelRenderer::DrawType::INDEXED;
drawCommand2.firstIndex = 2;
drawCommand2.elementCount = 2;
drawCommand2.queue = DevelRenderer::RENDER_QUEUE_TRANSPARENT;
- auto drawCommand3 = DevelRenderer::DrawCommand{};
+ auto drawCommand3 = DevelRenderer::DrawCommand{};
drawCommand3.drawType = DevelRenderer::DrawType::ARRAY;
drawCommand3.firstIndex = 2;
drawCommand3.elementCount = 2;
int UtcDaliRendererSetGeometryNegative(void)
{
TestApplication application;
- Dali::Renderer instance;
+ Dali::Renderer instance;
try
{
Dali::Geometry arg1;
int UtcDaliRendererSetTexturesNegative(void)
{
TestApplication application;
- Dali::Renderer instance;
+ Dali::Renderer instance;
try
{
Dali::TextureSet arg1;
int UtcDaliRendererSetShaderNegative(void)
{
TestApplication application;
- Dali::Renderer instance;
+ Dali::Renderer instance;
try
{
Dali::Shader arg1;
int UtcDaliRendererGetGeometryNegative(void)
{
TestApplication application;
- Dali::Renderer instance;
+ Dali::Renderer instance;
try
{
instance.GetGeometry();
int UtcDaliRendererGetTexturesNegative(void)
{
TestApplication application;
- Dali::Renderer instance;
+ Dali::Renderer instance;
try
{
instance.GetTextures();
int UtcDaliRendererGetShaderNegative(void)
{
TestApplication application;
- Dali::Renderer instance;
+ Dali::Renderer instance;
try
{
instance.GetShader();
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <test-touch-event-utils.h>
+#include <iostream>
+
using namespace Dali;
void utc_dali_rotation_gesture_detector_startup(void)
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
rotatedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
RotationGesture receivedGesture;
- Actor rotatedActor;
+ Actor rotatedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const RotationGesture& rotation)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = rotation;
- signalData.rotatedActor = actor;
+ signalData.rotatedActor = actor;
}
void operator()()
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
- : GestureReceivedFunctor( data ),
- stateToUnstage( stateToUnstage ),
- scene( scene )
+ UnstageActorFunctor(SignalData& data, GestureState& stateToUnstage, Integration::Scene scene)
+ : GestureReceivedFunctor(data),
+ stateToUnstage(stateToUnstage),
+ scene(scene)
{
}
- void operator()( Actor actor, const RotationGesture& rotation )
+ void operator()(Actor actor, const RotationGesture& rotation)
{
- GestureReceivedFunctor::operator()( actor, rotation );
+ GestureReceivedFunctor::operator()(actor, rotation);
- if ( rotation.GetState() == stateToUnstage )
+ if(rotation.GetState() == stateToUnstage)
{
- scene.Remove( actor );
+ scene.Remove(actor);
}
}
- GestureState& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
{
TestApplication application;
- RotationGestureDetector detector = RotationGestureDetector::New();;
+ RotationGestureDetector detector = RotationGestureDetector::New();
+ ;
- RotationGestureDetector copy( detector );
- DALI_TEST_CHECK( detector );
+ RotationGestureDetector copy(detector);
+ DALI_TEST_CHECK(detector);
END_TEST;
}
{
TestApplication application;
- RotationGestureDetector detector = RotationGestureDetector::New();;
+ RotationGestureDetector detector = RotationGestureDetector::New();
+ ;
RotationGestureDetector assign;
assign = detector;
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(detector);
- DALI_TEST_CHECK( detector == assign );
+ DALI_TEST_CHECK(detector == assign);
END_TEST;
}
// Attach an actor and emit a touch event on the actor to ensure complete line coverage
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
Integration::TouchEvent touchEvent(1);
- Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ Integration::Point point;
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point);
application.ProcessEvent(touchEvent);
Integration::Point point2;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point2);
application.ProcessEvent(touchEvent);
END_TEST;
RotationGestureDetector detector2 = RotationGestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- RotationGestureDetector detector3 = DownCast< RotationGestureDetector >(object);
+ RotationGestureDetector detector3 = DownCast<RotationGestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
RotationGestureDetector detector4 = RotationGestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- RotationGestureDetector detector5 = DownCast< RotationGestureDetector >(unInitializedObject);
+ RotationGestureDetector detector5 = DownCast<RotationGestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
- GestureDetector detector6 = RotationGestureDetector::New();
+ GestureDetector detector6 = RotationGestureDetector::New();
RotationGestureDetector detector7 = RotationGestureDetector::DownCast(detector6);
DALI_TEST_CHECK(detector7);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do a rotation outside actor's area
- TestStartRotation( application, Vector2( 112.0f, 62.0f ), Vector2( 112.0f, 162.0f ),
- Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ), 100 );
+ TestStartRotation(application, Vector2(112.0f, 62.0f), Vector2(112.0f, 162.0f), Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Continue rotation into actor's area - we should still not receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ),
- Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
+ TestContinueRotation(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Stop rotating - we should still not receive the signal
data.Reset();
- TestEndRotation( application, Vector2( 6.0f, 6.0f ), Vector2( 18.0f, 18.0f ),
- Vector2( 10.0f, 8.0f ), Vector2( 14.0f, 16.0f ), 300 );
+ TestEndRotation(application, Vector2(6.0f, 6.0f), Vector2(18.0f, 18.0f), Vector2(10.0f, 8.0f), Vector2(14.0f, 16.0f), 300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start rotation within the actor's area
- TestStartRotation( application, Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 20.0f ),
- Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 30.0f ), 100 );
+ TestStartRotation(application, Vector2(5.0f, 5.0f), Vector2(20.0f, 20.0f), Vector2(5.0f, 5.0f), Vector2(20.0f, 30.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.244f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), 400);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
// Rotation Gesture leaves actor's area - we should still receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 );
+ TestContinueRotation(application, Vector2(17.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
// Gesture ends - we would receive a finished state
data.Reset();
- TestEndRotation( application, Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ),
- Vector2( 305.0f, 10.0f ), Vector2( 315.0f, 10.0f ), 1500);
+ TestEndRotation(application, Vector2(300.0f, 10.0f), Vector2(340.0f, 10.0f), Vector2(305.0f, 10.0f), Vector2(315.0f, 10.0f), 1500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start rotation within the actor's area
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 31.0f, 29.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(31.0f, 29.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(0.404892f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 29.0f, 15.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(29.0f, 15.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(-0.343024f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
// Gesture ends within actor's area - we would receive a finished state
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 15.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(29.0f, 15.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(-0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start rotation within the actor's area
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
-
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
// Ensure we are no longer signalled
data.Reset();
- TestGenerateRotation( application );
+ TestGenerateRotation(application);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start rotation within the actor's area
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
// Attach a temporary actor to stop detector being removed from RotationGestureProcessor when main actor
// is destroyed.
Actor tempActor = Actor::New();
- tempActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- tempActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ tempActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ tempActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.GetScene().Add(tempActor);
detector.Attach(tempActor);
// Actor lifetime is scoped
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
// Start rotation within the actor's area
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within the area where the actor used to be
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
application.GetScene().Add(actor);
// Render and notify a couple of times
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do an entire rotation, only check finished value
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(27.0f, 15.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(67.5f, 27.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do an entire rotation, only check finished value
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100);
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 3000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(27.0f, 15.0f), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(27.0f, 32.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do an entire rotation, only check finished value
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 4100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 4100);
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 5000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(27.0f, 15.0f), 5000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
parent.Add(child);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do an entire pan, only check finished value - hits child area but parent should still receive it
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 25.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(29.0f, 25.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.rotatedActor, TEST_LOCATION);
DALI_TEST_EQUALS(0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
detector.Detach(parent);
// Do an entire pan, only check finished value
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 2100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 2100);
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 35.0f ), 3000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(29.0f, 35.0f), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.rotatedActor, TEST_LOCATION);
DALI_TEST_EQUALS(0.982794f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
TestApplication application;
Actor first = Actor::New();
- first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- second.SetProperty( Actor::Property::POSITION_X, 100.0f);
- second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start rotation within second actor's area
- TestStartRotation( application, Vector2( 102.0f, 20.0f ), Vector2( 138.0f, 20.0f ),
- Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(102.0f, 20.0f), Vector2(138.0f, 20.0f), Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.rotatedActor, TEST_LOCATION);
// Rotation moves into first actor's area - second actor should receive the rotation
data.Reset();
- TestContinueRotation( application, Vector2( 110.0f, 20.0f ), Vector2( 130.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(110.0f, 20.0f), Vector2(130.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.rotatedActor, TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 119.0f, 20.0f ), Vector2( 121.0f, 20.0f ), 3000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(119.0f, 20.0f), Vector2(121.0f, 20.0f), 3000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start rotation in actor's area
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Rotation continues within actor's area
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Actor become invisible - actor should not receive the next rotation
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// Render and notify
application.SendNotification();
// Gesture ends within actor's area
data.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
application.GetScene().Add(actor2);
// Render and notify
application.Render();
// Attach actor to one detector
- SignalData firstData;
- GestureReceivedFunctor firstFunctor(firstData);
+ SignalData firstData;
+ GestureReceivedFunctor firstFunctor(firstData);
RotationGestureDetector firstDetector = RotationGestureDetector::New();
firstDetector.Attach(actor);
firstDetector.DetectedSignal().Connect(&application, firstFunctor);
// Attach actor to another detector
- SignalData secondData;
- GestureReceivedFunctor secondFunctor(secondData);
+ SignalData secondData;
+ GestureReceivedFunctor secondFunctor(secondData);
RotationGestureDetector secondDetector = RotationGestureDetector::New();
secondDetector.Attach(actor);
secondDetector.DetectedSignal().Connect(&application, secondFunctor);
secondDetector.Attach(actor2);
// Rotation in actor's area - both detector's functors should be called
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
// Rotation continues in actor's area - both detector's functors should be called
firstData.Reset();
secondData.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
firstDetector.Detach(actor);
firstData.Reset();
secondData.Reset();
- TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
// New rotation on actor, only secondDetector has actor attached
firstData.Reset();
secondData.Reset();
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
secondDetector.Detach(actor);
firstData.Reset();
secondData.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000);
DALI_TEST_EQUALS(false, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor1 = Actor::New();
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor1);
- SignalData data1;
- GestureReceivedFunctor functor1(data1);
+ SignalData data1;
+ GestureReceivedFunctor functor1(data1);
RotationGestureDetector detector1 = RotationGestureDetector::New();
detector1.Attach(actor1);
detector1.DetectedSignal().Connect(&application, functor1);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::BOTTOM_RIGHT);
- actor2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_RIGHT);
+ actor2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_RIGHT);
application.GetScene().Add(actor2);
- SignalData data2;
- GestureReceivedFunctor functor2(data2);
+ SignalData data2;
+ GestureReceivedFunctor functor2(data2);
RotationGestureDetector detector2 = RotationGestureDetector::New();
detector2.Attach(actor2);
detector2.DetectedSignal().Connect(&application, functor2);
application.Render();
// Start pan in actor1's area, only data1 should be set
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data1.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
RotationGestureDetector detector = RotationGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit signals
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
stateToUnstage = GestureState::CONTINUING;
// Emit signals
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
stateToUnstage = GestureState::FINISHED;
// Emit signals
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- tet_result( TET_PASS ); // If we get here then we have handled actor stage removal gracefully.
+ tet_result(TET_PASS); // If we get here then we have handled actor stage removal gracefully.
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Create and add a second actor so that GestureDetector destruction does not come into play.
- Actor dummyActor( Actor::New() );
- dummyActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- dummyActor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
- dummyActor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ Actor dummyActor(Actor::New());
+ dummyActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
+ dummyActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(dummyActor);
// Render and notify
application.Render();
// State to remove actor in.
- GestureState stateToUnstage( GestureState::STARTED );
+ GestureState stateToUnstage(GestureState::STARTED);
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, stateToUnstage, application.GetScene() );
+ SignalData data;
+ UnstageActorFunctor functor(data, stateToUnstage, application.GetScene());
RotationGestureDetector detector = RotationGestureDetector::New();
detector.Attach(actor);
detector.Attach(dummyActor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
// Emit signals
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Here we delete an actor in started, we should not receive any subsequent signalling.
// Emit signals
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
application.Render();
// Continue signal emission
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 2000 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 2000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 3000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- SignalData data;
- GestureReceivedFunctor functor(data);
+ SignalData data;
+ GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Add a layer to overlap the actor
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer );
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
layer.RaiseToTop();
// Render and notify
application.Render();
// Emit signals, should receive
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 1500 );
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 2000);
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 1500);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 2000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
- bool consume = false;
+ bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchedSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start gesture within the actor's area, we should receive the rotation as the touch is NOT being consumed
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
consume = true;
- TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
+ TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Start another rotation, we should not even get the callback this time
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- RotationGestureDetector detector = RotationGestureDetector::New();
- bool functorCalled = false;
- detector.Attach( actor );
+ RotationGestureDetector detector = RotationGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach(actor);
detector.DetectedSignal().Connect(
- &application,
- [&detector, &functorCalled](Actor actor, const RotationGesture& gesture)
+ &application,
+ [&detector, &functorCalled](Actor actor, const RotationGesture& gesture) {
+ if(gesture.GetState() == GestureState::FINISHED)
{
- if( gesture.GetState() == GestureState::FINISHED )
- {
- detector.Detach(actor);
- functorCalled = true;
- }
- });
+ detector.Detach(actor);
+ functorCalled = true;
+ }
+ });
// Render and notify
application.SendNotification();
// Try the gesture, should not crash
try
{
- TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
- Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
- TestContinueRotation( application, Vector2( 112.0f, 100.0f ), Vector2( 112.0f, 124.0f ),
- Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
- TestEndRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
- Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
-
- DALI_TEST_CHECK( true ); // No crash, test has passed
+ TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100);
+ TestContinueRotation(application, Vector2(112.0f, 100.0f), Vector2(112.0f, 124.0f), Vector2(5.0f, 5.0f), Vector2(35.0f, 35.0f), 200);
+ TestEndRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(19.0f, 20.0f), Vector2(21.0f, 20.0f), 1000);
+
+ DALI_TEST_CHECK(true); // No crash, test has passed
DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
}
catch(...)
{
- DALI_TEST_CHECK( false ); // If we crash, the test has failed
+ DALI_TEST_CHECK(false); // If we crash, the test has failed
}
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/input-options.h>
-#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-test-suite-utils.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/input-options.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
rotatedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
RotationGesture receivedGesture;
- Actor rotatedActor;
+ Actor rotatedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const RotationGesture& rotation)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = rotation;
- signalData.rotatedActor = actor;
+ signalData.rotatedActor = actor;
}
void operator()()
SignalData& signalData;
};
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( stateA );
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- point.SetState( stateB);
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(stateA);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ point.SetState(stateB);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
int UtcDaliRotationGestureRecognizerRealistic(void)
RotationGestureDetector detector = RotationGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 100));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 105));
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 110));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 115));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 30.0f), PointState::MOTION, Vector2(20.0f, 85.0f), 120));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 35.0f), PointState::MOTION, Vector2(20.0f, 80.0f), 125));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), PointState::MOTION, Vector2(20.0f, 75.0f), 130));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 45.0f), PointState::MOTION, Vector2(20.0f, 70.0f), 135));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::MOTION, Vector2(20.0f, 65.0f), 140));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), PointState::MOTION, Vector2(20.0f, 60.0f), 145));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 56.0f), 155));
application.SendNotification();
RotationGestureDetector detector = RotationGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
// application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
// application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 30.0f), 152));
application.SendNotification();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
- detector.Attach( actor );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(&application, functor);
// Case 1
// 2 touch events make a gesture begin
- Integration::SetRotationGestureMinimumTouchEvents( 2 );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
+ Integration::SetRotationGestureMinimumTouchEvents(2);
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160));
- DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Case 2
// 4 touch events make a gesture begin
- Integration::SetRotationGestureMinimumTouchEvents( 4 );
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
+ Integration::SetRotationGestureMinimumTouchEvents(4);
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160));
// Check the gesture is not detected unlike previous case
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
RotationGestureDetector detector = RotationGestureDetector::New();
- detector.Attach( actor );
- detector.DetectedSignal().Connect( &application, functor );
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(&application, functor);
// Case 1
// > 2 touch events make a gesture begin
Integration::SetRotationGestureMinimumTouchEvents(2);
Integration::SetRotationGestureMinimumTouchEventsAfterStart(6);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), PointState::DOWN, Vector2(20.0f, 90.0f), 150));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(90.0f, 90.0f), 160));
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 170 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 180 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 190 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 170));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 180));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 190));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 200));
// > Test : not enough touch events to make the gesture state "CONTINUING"
DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 210 ) );
- application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 220 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 210));
+ application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 20.0f), PointState::MOTION, Vector2(20.0f, 90.0f), 220));
// > Test : 6 touch events after start make the gesture state "CONTINUING"
DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// EXTERNAL INCLUDES
#include <dali/public-api/dali-core.h>
-#include <unistd.h>
#include <string.h>
+#include <unistd.h>
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
int UtcDaliSamplerNew01(void)
{
TestApplication application;
- Sampler sampler = Sampler::New();
+ Sampler sampler = Sampler::New();
- DALI_TEST_EQUALS( (bool)sampler, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)sampler, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliSamplerNew02(void)
{
TestApplication application;
- Sampler sampler;
- DALI_TEST_EQUALS( (bool)sampler, false, TEST_LOCATION );
+ Sampler sampler;
+ DALI_TEST_EQUALS((bool)sampler, false, TEST_LOCATION);
END_TEST;
}
// Copy the object, ref count == 2
Sampler copy(sampler);
DALI_TEST_CHECK(copy);
- if (copy)
+ if(copy)
{
DALI_TEST_EQUALS(2, copy.GetBaseObject().ReferenceCount(), TEST_LOCATION);
}
TestApplication application;
Sampler sampler = Sampler::New();
- DALI_TEST_CHECK( sampler );
- DALI_TEST_EQUALS( 1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(sampler);
+ DALI_TEST_EQUALS(1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- Sampler move = std::move( sampler );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !sampler );
+ Sampler move = std::move(sampler);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!sampler);
END_TEST;
}
TestApplication application;
Sampler sampler = Sampler::New();
- DALI_TEST_CHECK( sampler );
- DALI_TEST_EQUALS( 1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(sampler);
+ DALI_TEST_EQUALS(1, sampler.GetBaseObject().ReferenceCount(), TEST_LOCATION);
Sampler move;
- move = std::move( sampler );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( !sampler );
+ move = std::move(sampler);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(!sampler);
END_TEST;
}
int UtcDaliSamplerDownCast01(void)
{
TestApplication application;
- Sampler sampler = Sampler::New();
+ Sampler sampler = Sampler::New();
BaseHandle handle(sampler);
- Sampler sampler2 = Sampler::DownCast(handle);
- DALI_TEST_EQUALS( (bool)sampler2, true, TEST_LOCATION );
+ Sampler sampler2 = Sampler::DownCast(handle);
+ DALI_TEST_EQUALS((bool)sampler2, true, TEST_LOCATION);
END_TEST;
}
TestApplication application;
BaseHandle handle;
- Sampler sampler = Sampler::DownCast(handle);
- DALI_TEST_EQUALS( (bool)sampler, false, TEST_LOCATION );
+ Sampler sampler = Sampler::DownCast(handle);
+ DALI_TEST_EQUALS((bool)sampler, false, TEST_LOCATION);
END_TEST;
}
int UtcDaliSamplerAssignmentOperator(void)
{
TestApplication application;
- Sampler sampler1 = Sampler::New();
+ Sampler sampler1 = Sampler::New();
Sampler sampler2;
{
TestApplication application;
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
Sampler sampler = Sampler::New();
TextureSet textureSet = CreateTextureSet();
textureSet.SetTexture(0u, image);
- textureSet.SetSampler( 0u, sampler );
+ textureSet.SetSampler(0u, sampler);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- application.GetScene().Add( actor );
-
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
// Default/Default
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
- sampler.SetFilterMode( FilterMode::DEFAULT, FilterMode::DEFAULT );
+ sampler.SetFilterMode(FilterMode::DEFAULT, FilterMode::DEFAULT);
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// There are 4 calls to TexParameteri when the texture is first created
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION);
std::stringstream out;
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_LINEAR;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
/**************************************************************/
// Linear/Linear
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
- sampler.SetFilterMode( FilterMode::LINEAR, FilterMode::LINEAR );
+ sampler.SetFilterMode(FilterMode::LINEAR, FilterMode::LINEAR);
// Flush the queue and render once
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// Should not make any calls when settings are the same (DEFAULT = LINEAR )
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 0, TEST_LOCATION);
/**************************************************************/
// Nearest/Nearest
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST);
// Flush the queue and render once
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify actor gl state
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 2, TEST_LOCATION);
out.str("");
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_NEAREST;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
out.str("");
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MAG_FILTER << ", " << GL_NEAREST;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(1, "TexParameteri", out.str()), true, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(1, "TexParameteri", out.str()), true, TEST_LOCATION);
/**************************************************************/
// Nearest/Linear
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::LINEAR );
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::LINEAR);
// Flush the queue and render once
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify actor gl state
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 1, TEST_LOCATION);
out.str("");
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MAG_FILTER << ", " << GL_LINEAR;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
/**************************************************************/
// NONE/NONE
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
- sampler.SetFilterMode( FilterMode::NONE, FilterMode::NONE );
+ sampler.SetFilterMode(FilterMode::NONE, FilterMode::NONE);
// Flush the queue and render once
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify actor gl state
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 1, TEST_LOCATION);
out.str("");
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_MIN_FILTER << ", " << GL_NEAREST_MIPMAP_LINEAR;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(0, "TexParameteri", out.str()), true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
TextureSet textureSet = CreateTextureSet();
- Sampler sampler = Sampler::New();
+ Sampler sampler = Sampler::New();
textureSet.SetTexture(0u, image);
- textureSet.SetSampler( 0u, sampler );
+ textureSet.SetSampler(0u, sampler);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
// CLAMP_TO_EDGE / CLAMP_TO_EDGE
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// There are 4 calls to TexParameteri when the texture is first created
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION);
std::stringstream out;
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_S << ", " << GL_CLAMP_TO_EDGE;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(2, "TexParameteri", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(2, "TexParameteri", out.str()), true, TEST_LOCATION);
out.str("");
out << GL_TEXTURE_2D << ", " << GL_TEXTURE_WRAP_T << ", " << GL_CLAMP_TO_EDGE;
- DALI_TEST_EQUALS( texParameterTrace.TestMethodAndParams(3, "TexParameteri", out.str()), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.TestMethodAndParams(3, "TexParameteri", out.str()), true, TEST_LOCATION);
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
- sampler.SetWrapMode( WrapMode::DEFAULT, WrapMode::DEFAULT );
+ sampler.SetWrapMode(WrapMode::DEFAULT, WrapMode::DEFAULT);
// Flush the queue and render once
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// Should not make any calls when settings are the same
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 0, TEST_LOCATION);
//Todo: Test the other wrap mode ( REPEAT, MIRRORED_REPEAT ) , currently not support!!
TestApplication application;
// Create a cube-map texture.
- unsigned int width = 8u;
- unsigned int height = 8u;
- Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
+ unsigned int width = 8u;
+ unsigned int height = 8u;
+ Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height);
// Create source image data.
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= new unsigned char[ bufferSize ];
- memset( buffer, 0u, bufferSize );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = new unsigned char[bufferSize];
+ memset(buffer, 0u, bufferSize);
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::DELETE_ARRAY );
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::DELETE_ARRAY);
// Upload the source image data to all 6 sides of our cube-map.
- texture.Upload( pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height );
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height );
- texture.Upload( pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height );
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height );
- texture.Upload( pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height );
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height);
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height);
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height);
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height);
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height);
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height);
// Finalize the cube-map setup.
TextureSet textureSet = TextureSet::New();
- textureSet.SetTexture( 0u, texture );
+ textureSet.SetTexture(0u, texture);
Sampler sampler = Sampler::New();
- textureSet.SetSampler( 0u, sampler );
+ textureSet.SetSampler(0u, sampler);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+ application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
// Call the 3 dimensional wrap mode API.
- sampler.SetWrapMode( WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE );
+ sampler.SetWrapMode(WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE, WrapMode::CLAMP_TO_EDGE);
application.SendNotification();
application.Render();
// Verify that no TexParameteri calls occurred since wrap mode hasn't changed.
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 0u, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 0u, TEST_LOCATION);
- sampler.SetWrapMode( WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT );
+ sampler.SetWrapMode(WrapMode::REPEAT, WrapMode::REPEAT, WrapMode::REPEAT);
texParameterTrace.Reset();
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify that 3 TexParameteri calls occurred.
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 3u, TEST_LOCATION );
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 3u, TEST_LOCATION);
END_TEST;
}
int UtcDaliSamplerSetWrapModeNegative01(void)
{
TestApplication application;
- Dali::Sampler instance;
+ Dali::Sampler instance;
try
{
Dali::WrapMode::Type arg1(static_cast<Dali::WrapMode::Type>(-1));
Dali::WrapMode::Type arg2(static_cast<Dali::WrapMode::Type>(-1));
- instance.SetWrapMode(arg1,arg2);
+ instance.SetWrapMode(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliSamplerSetWrapModeNegative02(void)
{
TestApplication application;
- Dali::Sampler instance;
+ Dali::Sampler instance;
try
{
Dali::WrapMode::Type arg1(static_cast<Dali::WrapMode::Type>(-1));
Dali::WrapMode::Type arg2(static_cast<Dali::WrapMode::Type>(-1));
Dali::WrapMode::Type arg3(static_cast<Dali::WrapMode::Type>(-1));
- instance.SetWrapMode(arg1,arg2,arg3);
+ instance.SetWrapMode(arg1, arg2, arg3);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliSamplerSetFilterModeNegative(void)
{
TestApplication application;
- Dali::Sampler instance;
+ Dali::Sampler instance;
try
{
Dali::FilterMode::Type arg1(static_cast<Dali::FilterMode::Type>(-1));
Dali::FilterMode::Type arg2(static_cast<Dali::FilterMode::Type>(-1));
- instance.SetFilterMode(arg1,arg2);
+ instance.SetFilterMode(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/integration-api/scene.h>
-#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/public-api/events/key-event.h>
+#include <dali-test-suite-utils.h>
#include <dali/devel-api/common/stage.h>
+#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/wheel-event-integ.h>
-
-#include <dali-test-suite-utils.h>
+#include <dali/integration-api/scene.h>
+#include <dali/public-api/events/key-event.h>
#include <mesh-builder.h>
+#include <stdlib.h>
+
+#include <iostream>
// Internal headers are allowed here
namespace
{
-
const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
// Functor for EventProcessingFinished signal
/**
* @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called.
*/
- EventProcessingFinishedFunctor( bool& eventProcessingFinished )
- : mEventProcessingFinished( eventProcessingFinished )
- {}
+ EventProcessingFinishedFunctor(bool& eventProcessingFinished)
+ : mEventProcessingFinished(eventProcessingFinished)
+ {
+ }
void operator()()
{
{
KeyEventSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
receivedKeyEvent.Reset();
}
- bool functorCalled;
+ bool functorCalled;
KeyEvent receivedKeyEvent;
};
// Functor that sets the data when called
struct KeyEventReceivedFunctor
{
- KeyEventReceivedFunctor( KeyEventSignalData& data ) : signalData( data ) { }
+ KeyEventReceivedFunctor(KeyEventSignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( const KeyEvent& keyEvent )
+ bool operator()(const KeyEvent& keyEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedKeyEvent = keyEvent;
return true;
: functorCalled(false),
createNewScene(false),
newSceneCreated(false)
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
- createNewScene = false;
+ functorCalled = false;
+ createNewScene = false;
newSceneCreated = false;
receivedTouchEvent.Reset();
}
- bool functorCalled;
- bool createNewScene;
- bool newSceneCreated;
+ bool functorCalled;
+ bool createNewScene;
+ bool newSceneCreated;
TouchEvent receivedTouchEvent;
};
// Functor that sets the data when touched signal is received
struct TouchFunctor
{
- TouchFunctor( TouchedSignalData& data ) : signalData( data ) { }
+ TouchFunctor(TouchedSignalData& data)
+ : signalData(data)
+ {
+ }
- void operator()( const TouchEvent& touch )
+ void operator()(const TouchEvent& touch)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedTouchEvent = touch;
- if ( signalData.createNewScene )
+ if(signalData.createNewScene)
{
- Dali::Integration::Scene scene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) );
- DALI_TEST_CHECK( scene );
+ Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+ DALI_TEST_CHECK(scene);
signalData.newSceneCreated = true;
}
{
WheelEventSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
functorCalled = false;
}
- bool functorCalled;
+ bool functorCalled;
WheelEvent receivedWheelEvent;
};
// Functor that sets the data when wheel-event signal is received
struct WheelEventReceivedFunctor
{
- WheelEventReceivedFunctor( WheelEventSignalData& data ) : signalData( data ) { }
+ WheelEventReceivedFunctor(WheelEventSignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( const WheelEvent& wheelEvent )
+ bool operator()(const WheelEvent& wheelEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedWheelEvent = wheelEvent;
return true;
{
KeyEventGeneratedSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
receivedKeyEvent.Reset();
}
- bool functorCalled;
+ bool functorCalled;
KeyEvent receivedKeyEvent;
};
// Functor that sets the data when called
struct KeyEventGeneratedReceivedFunctor
{
- KeyEventGeneratedReceivedFunctor( KeyEventGeneratedSignalData& data )
- : signalData( data )
- {}
+ KeyEventGeneratedReceivedFunctor(KeyEventGeneratedSignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( const KeyEvent& keyEvent )
+ bool operator()(const KeyEvent& keyEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedKeyEvent = keyEvent;
return true;
KeyEventGeneratedSignalData& signalData;
};
-void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition )
+void GenerateTouch(TestApplication& application, PointState::Type state, const Vector2& screenPosition)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ touchEvent.points.push_back(point);
+ application.ProcessEvent(touchEvent);
}
-bool DummyTouchCallback( Actor actor, const TouchEvent& touch )
+bool DummyTouchCallback(Actor actor, const TouchEvent& touch)
{
return true;
}
-void FrameCallback( int frameId )
+void FrameCallback(int frameId)
{
}
Dali::Integration::Scene scene = application.GetScene();
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
- scene.Add( actor );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ scene.Add(actor);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
END_TEST;
}
Dali::Integration::Scene scene = application.GetScene();
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
- scene.Add( actor );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ scene.Add(actor);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
scene.Remove(actor);
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
END_TEST;
}
tet_infoline("Testing Dali::Integration::Scene::GetSize");
Dali::Integration::Scene scene = application.GetScene();
- Size size = scene.GetSize();
- DALI_TEST_EQUALS( TestApplication::DEFAULT_SURFACE_WIDTH, size.width, TEST_LOCATION );
- DALI_TEST_EQUALS( TestApplication::DEFAULT_SURFACE_HEIGHT, size.height, TEST_LOCATION );
+ Size size = scene.GetSize();
+ DALI_TEST_EQUALS(TestApplication::DEFAULT_SURFACE_WIDTH, size.width, TEST_LOCATION);
+ DALI_TEST_EQUALS(TestApplication::DEFAULT_SURFACE_HEIGHT, size.height, TEST_LOCATION);
END_TEST;
}
// Test that setting core DPI explicitly also sets up the scene's DPI.
Dali::Integration::Scene scene = application.GetScene();
- scene.SetDpi( Vector2(200.0f, 180.0f) );
+ scene.SetDpi(Vector2(200.0f, 180.0f));
Vector2 dpi = scene.GetDpi();
- DALI_TEST_EQUALS( dpi.x, 200.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( dpi.y, 180.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION);
END_TEST;
}
const RenderTaskList& tasks = scene.GetRenderTaskList();
// There should be 1 task by default.
- DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(tasks.GetTaskCount(), 1u, TEST_LOCATION);
// RenderTaskList has it's own UTC tests.
// But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
RenderTask newTask = scene.GetRenderTaskList().CreateTask();
- DALI_TEST_EQUALS( scene.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION );
+ DALI_TEST_EQUALS(scene.GetRenderTaskList().GetTask(1), newTask, TEST_LOCATION);
END_TEST;
}
tet_infoline("Testing Dali::Integration::Scene::GetRootLayer");
Dali::Integration::Scene scene = application.GetScene();
- Layer layer = scene.GetLayer( 0 );
- DALI_TEST_CHECK( layer );
+ Layer layer = scene.GetLayer(0);
+ DALI_TEST_CHECK(layer);
// Check that GetRootLayer() correctly retreived layer 0.
- DALI_TEST_CHECK( scene.GetRootLayer() == layer );
+ DALI_TEST_CHECK(scene.GetRootLayer() == layer);
END_TEST;
}
Dali::Integration::Scene scene = application.GetScene();
// Initially we have a default layer
- DALI_TEST_EQUALS( scene.GetLayerCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(scene.GetLayerCount(), 1u, TEST_LOCATION);
Layer layer = Layer::New();
- scene.Add( layer );
+ scene.Add(layer);
- DALI_TEST_EQUALS( scene.GetLayerCount(), 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(scene.GetLayerCount(), 2u, TEST_LOCATION);
END_TEST;
}
Dali::Integration::Scene scene = application.GetScene();
- Layer rootLayer = scene.GetLayer( 0 );
- DALI_TEST_CHECK( rootLayer );
+ Layer rootLayer = scene.GetLayer(0);
+ DALI_TEST_CHECK(rootLayer);
Layer layer = Layer::New();
- scene.Add( layer );
+ scene.Add(layer);
- Layer sameLayer = scene.GetLayer( 1 );
- DALI_TEST_CHECK( layer == sameLayer );
+ Layer sameLayer = scene.GetLayer(1);
+ DALI_TEST_CHECK(layer == sameLayer);
END_TEST;
}
Dali::Integration::Scene scene = application.GetScene();
Actor actor = Actor::New();
- DALI_TEST_CHECK( Dali::Integration::Scene() == Dali::Integration::Scene::Get( actor ) );
+ DALI_TEST_CHECK(Dali::Integration::Scene() == Dali::Integration::Scene::Get(actor));
- scene.Add( actor );
+ scene.Add(actor);
- DALI_TEST_CHECK( scene == Dali::Integration::Scene::Get( actor ) );
+ DALI_TEST_CHECK(scene == Dali::Integration::Scene::Get(actor));
END_TEST;
}
tet_infoline("Testing Dali::Scene::Discard");
// Create a new Scene
- Dali::Integration::Scene scene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) );
- DALI_TEST_CHECK( scene );
+ Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+ DALI_TEST_CHECK(scene);
// One reference of scene kept here and the other one kept in the Core
- DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 );
+ DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 2);
// Render and notify.
application.SendNotification();
// Keep the reference of the root layer handle so it will still be alive after the scene is deleted
Layer rootLayer = scene.GetRootLayer();
- DALI_TEST_CHECK( rootLayer );
- DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 2 );
+ DALI_TEST_CHECK(rootLayer);
+ DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 2);
// Request to discard the scene from the Core
scene.Discard();
- DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 1 );
+ DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 1);
// Reset the scene handle
scene.Reset();
// At this point, the scene should have been automatically deleted
// To prove this, the ref count of the root layer handle should be decremented to 1
- DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 );
+ DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 1);
// Delete the root layer handle
rootLayer.Reset();
TouchedSignalData data;
data.createNewScene = true;
- TouchFunctor functor( data );
- scene.TouchedSignal().Connect( &application, functor );
+ TouchFunctor functor(data);
+ scene.TouchedSignal().Connect(&application, functor);
// Render and notify.
application.SendNotification();
application.Render();
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, data.createNewScene, TEST_LOCATION );
- DALI_TEST_EQUALS( true, data.newSceneCreated, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data.createNewScene, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, data.newSceneCreated, TEST_LOCATION);
data.Reset();
END_TEST;
TestApplication application;
// Create a Scene
- Dali::Integration::Scene scene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) );
- DALI_TEST_CHECK( scene );
+ Dali::Integration::Scene scene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+ DALI_TEST_CHECK(scene);
// One reference of scene kept here and the other one kept in the Core
- DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 2 );
+ DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 2);
// Add a renderable actor to the scene
auto actor = CreateRenderableActor();
- scene.Add( actor );
+ scene.Add(actor);
// Render and notify.
application.SendNotification();
// Keep the reference of the root layer handle so it will still be alive after the scene is deleted
Layer rootLayer = scene.GetRootLayer();
- DALI_TEST_CHECK( rootLayer );
- DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 2 );
+ DALI_TEST_CHECK(rootLayer);
+ DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 2);
// Request to discard the scene from the Core
scene.Discard();
- DALI_TEST_CHECK( scene.GetBaseObject().ReferenceCount() == 1 );
+ DALI_TEST_CHECK(scene.GetBaseObject().ReferenceCount() == 1);
// Reset the scene handle
scene.Reset();
// At this point, the scene should have been automatically deleted
// To prove this, the ref count of the root layer handle should be decremented to 1
- DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 );
+ DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 1);
// Create a new Scene while the root layer of the deleted scene is still alive
- Dali::Integration::Scene newScene = Dali::Integration::Scene::New( Size( 480.0f, 800.0f ) );
- DALI_TEST_CHECK( newScene );
+ Dali::Integration::Scene newScene = Dali::Integration::Scene::New(Size(480.0f, 800.0f));
+ DALI_TEST_CHECK(newScene);
// Render and notify.
application.SendNotification();
// At this point, we have only one scene but two root layers
// The root layer of the deleted scene is still alive
- DALI_TEST_CHECK( rootLayer.GetBaseObject().ReferenceCount() == 1 );
+ DALI_TEST_CHECK(rootLayer.GetBaseObject().ReferenceCount() == 1);
// Delete the root layer of the deleted scene
rootLayer.Reset();
int UtcDaliSceneEventProcessingFinishedP(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
- bool eventProcessingFinished = false;
- EventProcessingFinishedFunctor functor( eventProcessingFinished );
- scene.EventProcessingFinishedSignal().Connect( &application, functor );
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor(eventProcessingFinished);
+ scene.EventProcessingFinishedSignal().Connect(&application, functor);
- Actor actor( Actor::New() );
- scene.Add( actor );
+ Actor actor(Actor::New());
+ scene.Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( eventProcessingFinished );
+ DALI_TEST_CHECK(eventProcessingFinished);
END_TEST;
}
int UtcDaliSceneEventProcessingFinishedN(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
- bool eventProcessingFinished = false;
- EventProcessingFinishedFunctor functor( eventProcessingFinished );
- scene.EventProcessingFinishedSignal().Connect( &application, functor );
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor(eventProcessingFinished);
+ scene.EventProcessingFinishedSignal().Connect(&application, functor);
- Actor actor( Actor::New() );
- scene.Add( actor );
+ Actor actor(Actor::New());
+ scene.Add(actor);
// Do not complete event processing and confirm the signal has not been emitted.
- DALI_TEST_CHECK( !eventProcessingFinished );
+ DALI_TEST_CHECK(!eventProcessingFinished);
END_TEST;
}
int UtcDaliSceneSignalKeyEventP(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
- KeyEventSignalData data;
- KeyEventReceivedFunctor functor( data );
- scene.KeyEventSignal().Connect( &application, functor );
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor(data);
+ scene.KeyEventSignal().Connect(&application, functor);
- Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event );
+ Integration::KeyEvent event("i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event2 );
+ Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event2);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event3 );
+ Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event3);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event4 );
+ Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event4);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
END_TEST;
}
int UtcDaliSceneSignalKeyEventN(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
- KeyEventSignalData data;
- KeyEventReceivedFunctor functor( data );
- scene.KeyEventSignal().Connect( &application, functor );
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor(data);
+ scene.KeyEventSignal().Connect(&application, functor);
// Check that a non-pressed key events data is not modified.
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
int UtcDaliSceneTouchedSignalP(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
TouchedSignalData data;
- TouchFunctor functor( data );
- scene.TouchedSignal().Connect( &application, functor );
+ TouchFunctor functor(data);
+ scene.TouchedSignal().Connect(&application, functor);
// Render and notify.
application.SendNotification();
// Basic test: No actors, single touch (down then up).
{
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
- GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
}
// Add an actor to the scene.
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchedSignal().Connect( &DummyTouchCallback );
- scene.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.TouchedSignal().Connect(&DummyTouchCallback);
+ scene.Add(actor);
// Render and notify.
application.SendNotification();
// Actor on scene, single touch, down in actor, motion, then up outside actor.
{
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor);
data.Reset();
- GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
+ GenerateTouch(application, PointState::MOTION, Vector2(150.0f, 10.0f)); // Some motion
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
+ GenerateTouch(application, PointState::UP, Vector2(150.0f, 10.0f)); // Some motion
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
}
// Multiple touch. Should only receive a touch on first down and last up.
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
+ Integration::Point point;
// 1st point
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.0f, 10.0f));
+ touchEvent.points.push_back(point);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
data.Reset();
// 2nd point
- touchEvent.points[0].SetState( PointState::STATIONARY );
- point.SetDeviceId( 1 );
- point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ touchEvent.points[0].SetState(PointState::STATIONARY);
+ point.SetDeviceId(1);
+ point.SetScreenPosition(Vector2(50.0f, 50.0f));
+ touchEvent.points.push_back(point);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Primary point is up
- touchEvent.points[0].SetState( PointState::UP );
- touchEvent.points[1].SetState( PointState::STATIONARY );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ touchEvent.points[0].SetState(PointState::UP);
+ touchEvent.points[1].SetState(PointState::STATIONARY);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Remove 1st point now, 2nd point is now in motion
- touchEvent.points.erase( touchEvent.points.begin() );
- touchEvent.points[0].SetState( PointState::MOTION );
- touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ touchEvent.points.erase(touchEvent.points.begin());
+ touchEvent.points[0].SetState(PointState::MOTION);
+ touchEvent.points[0].SetScreenPosition(Vector2(150.0f, 50.0f));
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Final point Up
- touchEvent.points[0].SetState( PointState::UP );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ touchEvent.points[0].SetState(PointState::UP);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
data.Reset();
}
END_TEST;
int UtcDaliSceneTouchedSignalN(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
TouchedSignalData data;
- TouchFunctor functor( data );
- scene.TouchedSignal().Connect( &application, functor );
+ TouchFunctor functor(data);
+ scene.TouchedSignal().Connect(&application, functor);
// Render and notify.
application.SendNotification();
application.Render();
// Confirm functor not called before there has been any touch event.
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// No actors, single touch, down, motion then up.
{
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
// Confirm there is no signal when the touchpoint is only moved.
- GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
+ GenerateTouch(application, PointState::MOTION, Vector2(1200.0f, 10.0f)); // Some motion
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Confirm a following up event generates a signal.
- GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
+ GenerateTouch(application, PointState::UP, Vector2(1200.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
}
// Add an actor to the scene.
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchedSignal().Connect( &DummyTouchCallback );
- scene.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.TouchedSignal().Connect(&DummyTouchCallback);
+ scene.Add(actor);
// Render and notify.
application.SendNotification();
// Actor on scene. Interrupted before down and interrupted after down.
{
- GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
data.Reset();
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::DOWN );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::DOWN);
data.Reset();
- GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
// Check that getting info about a non-existent point returns an empty handle
- Actor actor = data.receivedTouchEvent.GetHitActor( 1 );
- DALI_TEST_CHECK( !actor );
+ Actor actor = data.receivedTouchEvent.GetHitActor(1);
+ DALI_TEST_CHECK(!actor);
data.Reset();
}
int UtcDaliSceneSignalWheelEventP(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
- WheelEventSignalData data;
- WheelEventReceivedFunctor functor( data );
- scene.WheelEventSignal().Connect( &application, functor );
+ WheelEventSignalData data;
+ WheelEventReceivedFunctor functor(data);
+ scene.WheelEventSignal().Connect(&application, functor);
- Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u );
- application.ProcessEvent( event );
+ Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
+ application.ProcessEvent(event);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.GetType() );
- DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.GetDirection() );
- DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.GetModifiers() );
- DALI_TEST_CHECK( event.point == data.receivedWheelEvent.GetPoint() );
- DALI_TEST_CHECK( event.delta == data.receivedWheelEvent.GetDelta() );
- DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.GetTime() );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event.type) == data.receivedWheelEvent.GetType());
+ DALI_TEST_CHECK(event.direction == data.receivedWheelEvent.GetDirection());
+ DALI_TEST_CHECK(event.modifiers == data.receivedWheelEvent.GetModifiers());
+ DALI_TEST_CHECK(event.point == data.receivedWheelEvent.GetPoint());
+ DALI_TEST_CHECK(event.delta == data.receivedWheelEvent.GetDelta());
+ DALI_TEST_CHECK(event.timeStamp == data.receivedWheelEvent.GetTime());
data.Reset();
- Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u );
- application.ProcessEvent( event2 );
+ Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
+ application.ProcessEvent(event2);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.GetType() );
- DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.GetDirection() );
- DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.GetModifiers() );
- DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.GetPoint() );
- DALI_TEST_CHECK( event2.delta == data.receivedWheelEvent.GetDelta() );
- DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.GetTime() );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event2.type) == data.receivedWheelEvent.GetType());
+ DALI_TEST_CHECK(event2.direction == data.receivedWheelEvent.GetDirection());
+ DALI_TEST_CHECK(event2.modifiers == data.receivedWheelEvent.GetModifiers());
+ DALI_TEST_CHECK(event2.point == data.receivedWheelEvent.GetPoint());
+ DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta());
+ DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime());
END_TEST;
}
int UtcDaliSceneSurfaceResizedDefaultScene(void)
{
- tet_infoline( "Ensure resizing of the surface is handled properly" );
+ tet_infoline("Ensure resizing of the surface is handled properly");
TestApplication application;
auto defaultScene = application.GetScene();
- DALI_TEST_CHECK( defaultScene );
+ DALI_TEST_CHECK(defaultScene);
// Ensure stage size matches the scene size
auto stage = Stage::GetCurrent();
- DALI_TEST_EQUALS( stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION);
// Resize the scene
- Vector2 newSize( 1000.0f, 2000.0f );
- DALI_TEST_CHECK( stage.GetSize() != newSize );
- defaultScene.SurfaceResized( newSize.width, newSize.height );
+ Vector2 newSize(1000.0f, 2000.0f);
+ DALI_TEST_CHECK(stage.GetSize() != newSize);
+ defaultScene.SurfaceResized(newSize.width, newSize.height);
- DALI_TEST_EQUALS( stage.GetSize(), newSize, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultScene.GetSize(), newSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION);
END_TEST;
}
int UtcDaliSceneSurfaceResizedDefaultSceneViewport(void)
{
- tet_infoline( "Ensure resizing of the surface & viewport is handled properly" );
+ tet_infoline("Ensure resizing of the surface & viewport is handled properly");
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& callStack = glAbstraction.GetViewportTrace();
- glAbstraction.EnableViewportCallTrace( true );
+ TraceCallStack& callStack = glAbstraction.GetViewportTrace();
+ glAbstraction.EnableViewportCallTrace(true);
// Initial scene setup
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
// Render before resizing surface
glAbstraction.ResetViewportCallStack();
auto defaultScene = application.GetScene();
- DALI_TEST_CHECK( defaultScene );
+ DALI_TEST_CHECK(defaultScene);
// Ensure stage size matches the scene size
auto stage = Stage::GetCurrent();
- DALI_TEST_EQUALS( stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION);
// Resize the scene
- Vector2 newSize( 1000.0f, 2000.0f );
- std::string viewportParams( "0, 0, 1000, 2000" ); // to match newSize
- DALI_TEST_CHECK( stage.GetSize() != newSize );
- defaultScene.SurfaceResized( newSize.width, newSize.height );
+ Vector2 newSize(1000.0f, 2000.0f);
+ std::string viewportParams("0, 0, 1000, 2000"); // to match newSize
+ DALI_TEST_CHECK(stage.GetSize() != newSize);
+ defaultScene.SurfaceResized(newSize.width, newSize.height);
- DALI_TEST_EQUALS( stage.GetSize(), newSize, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultScene.GetSize(), newSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION);
// Render after resizing surface
application.SendNotification();
application.Render(0);
// Check that the viewport is handled properly
- DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("Viewport", viewportParams ) );
+ DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("Viewport", viewportParams));
END_TEST;
}
int UtcDaliSceneSurfaceResizedMultipleRenderTasks(void)
{
- tet_infoline( "Ensure resizing of the surface & viewport is handled properly" );
+ tet_infoline("Ensure resizing of the surface & viewport is handled properly");
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- TraceCallStack& callStack = glAbstraction.GetViewportTrace();
- glAbstraction.EnableViewportCallTrace( true );
+ TraceCallStack& callStack = glAbstraction.GetViewportTrace();
+ glAbstraction.EnableViewportCallTrace(true);
// Initial scene setup
auto scene = application.GetScene();
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- int testWidth = 400;
+ int testWidth = 400;
int testHeight = 400;
- actor.SetProperty( Actor::Property::SIZE, Vector2( testWidth, testHeight) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(testWidth, testHeight));
scene.Add(actor);
- CameraActor offscreenCameraActor = CameraActor::New( Size( testWidth, testHeight ) );
- application.GetScene().Add( offscreenCameraActor );
+ CameraActor offscreenCameraActor = CameraActor::New(Size(testWidth, testHeight));
+ application.GetScene().Add(offscreenCameraActor);
- FrameBuffer newFrameBuffer = FrameBuffer::New( testWidth, testHeight, FrameBuffer::Attachment::NONE );
+ FrameBuffer newFrameBuffer = FrameBuffer::New(testWidth, testHeight, FrameBuffer::Attachment::NONE);
RenderTask newTask = scene.GetRenderTaskList().CreateTask();
- newTask.SetCameraActor( offscreenCameraActor );
- newTask.SetSourceActor( actor );
- newTask.SetFrameBuffer( newFrameBuffer );
- newTask.SetViewportPosition( Vector2(0, 0) );
- newTask.SetViewportSize( Vector2(testWidth, testHeight) );
+ newTask.SetCameraActor(offscreenCameraActor);
+ newTask.SetSourceActor(actor);
+ newTask.SetFrameBuffer(newFrameBuffer);
+ newTask.SetViewportPosition(Vector2(0, 0));
+ newTask.SetViewportSize(Vector2(testWidth, testHeight));
// Render before resizing surface
application.SendNotification();
glAbstraction.ResetViewportCallStack();
Rect<int32_t> initialViewport = newTask.GetViewport();
- int initialWidth = initialViewport.width;
- int initialHeight = initialViewport.height;
- DALI_TEST_EQUALS( initialWidth, testWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( initialHeight, testHeight, TEST_LOCATION );
+ int initialWidth = initialViewport.width;
+ int initialHeight = initialViewport.height;
+ DALI_TEST_EQUALS(initialWidth, testWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(initialHeight, testHeight, TEST_LOCATION);
auto defaultScene = application.GetScene();
- DALI_TEST_CHECK( defaultScene );
+ DALI_TEST_CHECK(defaultScene);
// Ensure stage size matches the scene size
auto stage = Stage::GetCurrent();
- DALI_TEST_EQUALS( stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), defaultScene.GetSize(), TEST_LOCATION);
// Resize the scene
- Vector2 newSize( 1000.0f, 2000.0f );
- std::string viewportParams( "0, 0, 1000, 2000" ); // to match newSize
- DALI_TEST_CHECK( stage.GetSize() != newSize );
- defaultScene.SurfaceResized( newSize.width, newSize.height );
+ Vector2 newSize(1000.0f, 2000.0f);
+ std::string viewportParams("0, 0, 1000, 2000"); // to match newSize
+ DALI_TEST_CHECK(stage.GetSize() != newSize);
+ defaultScene.SurfaceResized(newSize.width, newSize.height);
- DALI_TEST_EQUALS( stage.GetSize(), newSize, TEST_LOCATION );
- DALI_TEST_EQUALS( defaultScene.GetSize(), newSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), newSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(defaultScene.GetSize(), newSize, TEST_LOCATION);
// Render after resizing surface
application.SendNotification();
application.Render(0);
// Check that the viewport is handled properly
- DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("Viewport", viewportParams ) );
+ DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("Viewport", viewportParams));
// Second render-task should not be affected
Rect<int32_t> viewport = newTask.GetViewport();
- int width = viewport.width;
- int height = viewport.height;
- DALI_TEST_EQUALS( width, testWidth, TEST_LOCATION );
- DALI_TEST_EQUALS( height, testHeight, TEST_LOCATION );
+ int width = viewport.width;
+ int height = viewport.height;
+ DALI_TEST_EQUALS(width, testWidth, TEST_LOCATION);
+ DALI_TEST_EQUALS(height, testHeight, TEST_LOCATION);
END_TEST;
}
int UtcDaliSceneSurfaceResizedAdditionalScene(void)
{
- tet_infoline( "Ensure resizing of the surface is handled properly on additional scenes" );
+ tet_infoline("Ensure resizing of the surface is handled properly on additional scenes");
TestApplication application;
- Vector2 originalSurfaceSize( 500.0f, 1000.0f );
+ Vector2 originalSurfaceSize(500.0f, 1000.0f);
- auto scene = Integration::Scene::New( Size( originalSurfaceSize.width, originalSurfaceSize.height ) );
+ auto scene = Integration::Scene::New(Size(originalSurfaceSize.width, originalSurfaceSize.height));
// Ensure stage size does NOT match the surface size
- auto stage = Stage::GetCurrent();
+ auto stage = Stage::GetCurrent();
const auto stageSize = stage.GetSize();
- DALI_TEST_CHECK( stageSize != originalSurfaceSize );
- DALI_TEST_EQUALS( originalSurfaceSize, scene.GetSize(), TEST_LOCATION );
+ DALI_TEST_CHECK(stageSize != originalSurfaceSize);
+ DALI_TEST_EQUALS(originalSurfaceSize, scene.GetSize(), TEST_LOCATION);
// Resize the surface and inform the scene accordingly
- Vector2 newSize( 1000.0f, 2000.0f );
- DALI_TEST_CHECK( stage.GetSize() != newSize );
- scene.SurfaceResized( newSize.width, newSize.height );
+ Vector2 newSize(1000.0f, 2000.0f);
+ DALI_TEST_CHECK(stage.GetSize() != newSize);
+ scene.SurfaceResized(newSize.width, newSize.height);
// Ensure the stage hasn't been resized
- DALI_TEST_EQUALS( stage.GetSize(), stageSize, TEST_LOCATION );
- DALI_TEST_EQUALS( scene.GetSize(), newSize, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetSize(), stageSize, TEST_LOCATION);
+ DALI_TEST_EQUALS(scene.GetSize(), newSize, TEST_LOCATION);
END_TEST;
}
int UtcDaliSceneKeyEventGeneratedSignalP(void)
{
- TestApplication application;
+ TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
- KeyEventGeneratedSignalData data;
- KeyEventGeneratedReceivedFunctor functor( data );
- scene.KeyEventGeneratedSignal().Connect( &application, functor );
+ KeyEventGeneratedSignalData data;
+ KeyEventGeneratedReceivedFunctor functor(data);
+ scene.KeyEventGeneratedSignal().Connect(&application, functor);
- Integration::KeyEvent event( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event );
+ Integration::KeyEvent event("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event2 );
+ Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event2);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event3 );
+ Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event3);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event4 );
+ Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event4);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
END_TEST;
}
int UtcDaliSceneEnsureReplacedSurfaceKeepsClearColor(void)
{
- tet_infoline( "Ensure we keep background color when the scene surface is replaced " );
+ tet_infoline("Ensure we keep background color when the scene surface is replaced ");
TestApplication application;
// Create a new scene and set the background color of the main scene
auto defaultScene = application.GetScene();
- defaultScene.SetBackgroundColor( Color::BLUE );
+ defaultScene.SetBackgroundColor(Color::BLUE);
// Need to create a renderable as we don't start rendering until we have at least one
// We don't need to add this to any scene
auto actor = CreateRenderableActor();
- auto& glAbstraction = application.GetGlAbstraction();
- auto clearCountBefore = glAbstraction.GetClearCountCalled();
+ auto& glAbstraction = application.GetGlAbstraction();
+ auto clearCountBefore = glAbstraction.GetClearCountCalled();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION);
defaultScene.SurfaceReplaced();
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION);
// Check when the main render task viewport is set the clear color is clipped using scissors
- TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
- scissorTrace.Enable( true );
- enabledDisableTrace.Enable( true );
+ scissorTrace.Enable(true);
+ enabledDisableTrace.Enable(true);
- defaultScene.GetRenderTaskList().GetTask( 0 ).SetViewport( Viewport( 0.0f, 0.0f, 100.0f, 100.0f ) );
+ defaultScene.GetRenderTaskList().GetTask(0).SetViewport(Viewport(0.0f, 0.0f, 100.0f, 100.0f));
application.SendNotification();
application.Render();
// Check scissor test was enabled.
- DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+ DALI_TEST_CHECK(enabledDisableTrace.FindMethodAndParams("Enable", "3089")); // 3089 = 0xC11 (GL_SCISSOR_TEST)
// Check the scissor was set, and the coordinates are correct.
- DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", "0, 700, 100, 100" ) );
+ DALI_TEST_CHECK(scissorTrace.FindMethodAndParams("Scissor", "0, 700, 100, 100"));
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION );
- DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION);
- scissorTrace.Enable( false );
+ scissorTrace.Enable(false);
scissorTrace.Reset();
- enabledDisableTrace.Enable( false );
+ enabledDisableTrace.Enable(false);
enabledDisableTrace.Reset();
END_TEST;
int UtcDaliSceneEmptySceneRendering(void)
{
- tet_infoline( "Ensure not rendering before a Renderer is added" );
+ tet_infoline("Ensure not rendering before a Renderer is added");
- TestApplication application;
+ TestApplication application;
TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
// Render without any renderer
application.Render();
// Check the clear count and the render status
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), 0, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetRenderNeedsPostRender(), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetRenderNeedsPostRender(), false, TEST_LOCATION);
// Add a Renderer
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
+ actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400, 400 ) );
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400, 400));
+ application.GetScene().Add(actor);
// Render
application.SendNotification();
application.Render();
// Check the clear count and the render status
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( application.GetRenderNeedsPostRender(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetRenderNeedsPostRender(), true, TEST_LOCATION);
// Remove the Renderer
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
actor.Reset();
renderer.Reset();
application.Render();
// Check the clear count and the render status
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), 2, TEST_LOCATION ); // Should be cleared
- DALI_TEST_EQUALS( application.GetRenderNeedsPostRender(), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(glAbstraction.GetClearCountCalled(), 2, TEST_LOCATION); // Should be cleared
+ DALI_TEST_EQUALS(application.GetRenderNeedsPostRender(), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliSceneFrameRenderedPresentedCallback(void)
{
- tet_infoline( "UtcDaliSceneFrameRenderedCallback" );
+ tet_infoline("UtcDaliSceneFrameRenderedCallback");
TestApplication application;
// Add a Renderer
Geometry geometry = CreateQuadGeometry();
- Shader shader = CreateShader();
- Renderer renderer = Renderer::New( geometry, shader );
+ Shader shader = CreateShader();
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
- actor.AddRenderer( renderer );
- application.GetScene().Add( actor );
+ actor.AddRenderer(renderer);
+ application.GetScene().Add(actor);
Dali::Integration::Scene scene = application.GetScene();
int frameId = 1;
- scene.AddFrameRenderedCallback( std::unique_ptr< CallbackBase >( MakeCallback( &FrameCallback ) ), frameId );
- scene.AddFramePresentedCallback( std::unique_ptr< CallbackBase >( MakeCallback( &FrameCallback ) ), frameId );
+ scene.AddFrameRenderedCallback(std::unique_ptr<CallbackBase>(MakeCallback(&FrameCallback)), frameId);
+ scene.AddFramePresentedCallback(std::unique_ptr<CallbackBase>(MakeCallback(&FrameCallback)), frameId);
// Render
application.SendNotification();
application.Render();
Dali::Integration::Scene::FrameCallbackContainer callbackContainer;
- scene.GetFrameRenderedCallback( callbackContainer );
+ scene.GetFrameRenderedCallback(callbackContainer);
- DALI_TEST_EQUALS( callbackContainer.size(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( callbackContainer[0].second, frameId, TEST_LOCATION );
+ DALI_TEST_EQUALS(callbackContainer.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(callbackContainer[0].second, frameId, TEST_LOCATION);
callbackContainer.clear();
- scene.GetFramePresentedCallback( callbackContainer );
+ scene.GetFramePresentedCallback(callbackContainer);
- DALI_TEST_EQUALS( callbackContainer.size(), 1, TEST_LOCATION );
- DALI_TEST_EQUALS( callbackContainer[0].second, frameId, TEST_LOCATION );
+ DALI_TEST_EQUALS(callbackContainer.size(), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(callbackContainer[0].second, frameId, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/scripting/scripting.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/scripting/scripting.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
using namespace Dali::Scripting;
namespace
{
-
const StringEnum COLOR_MODE_VALUES[] =
-{
- { "USE_OWN_COLOR", USE_OWN_COLOR },
- { "USE_PARENT_COLOR", USE_PARENT_COLOR },
- { "USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR },
- { "USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA },
+ {
+ {"USE_OWN_COLOR", USE_OWN_COLOR},
+ {"USE_PARENT_COLOR", USE_PARENT_COLOR},
+ {"USE_OWN_MULTIPLY_PARENT_COLOR", USE_OWN_MULTIPLY_PARENT_COLOR},
+ {"USE_OWN_MULTIPLY_PARENT_ALPHA", USE_OWN_MULTIPLY_PARENT_ALPHA},
};
-const unsigned int COLOR_MODE_VALUES_COUNT = sizeof( COLOR_MODE_VALUES ) / sizeof( COLOR_MODE_VALUES[0] );
+const unsigned int COLOR_MODE_VALUES_COUNT = sizeof(COLOR_MODE_VALUES) / sizeof(COLOR_MODE_VALUES[0]);
const StringEnum DRAW_MODE_VALUES[] =
-{
- { "NORMAL", DrawMode::NORMAL },
- { "OVERLAY_2D", DrawMode::OVERLAY_2D }
-};
-const unsigned int DRAW_MODE_VALUES_COUNT = sizeof( DRAW_MODE_VALUES ) / sizeof( DRAW_MODE_VALUES[0] );
-
+ {
+ {"NORMAL", DrawMode::NORMAL},
+ {"OVERLAY_2D", DrawMode::OVERLAY_2D}};
+const unsigned int DRAW_MODE_VALUES_COUNT = sizeof(DRAW_MODE_VALUES) / sizeof(DRAW_MODE_VALUES[0]);
////////////////////////////////////////////////////////////////////////////////
// Helpers for string to enum comparisons for Image and Image loading parameters
/**
* Template to check enumerations of type T, with a class of type X
*/
-template< typename T, typename X >
+template<typename T, typename X>
void TestEnumStrings(
- Property::Map& map, // The map used to create instance of type X
- const char * const keyName, // the name of the key to iterate through
- const StringEnum* values, // An array of string values
- unsigned int num, // Number of items in the array
- T ( X::*method )() const, // The member method of X to call to get the enum
- X ( *creator ) ( const Property::Value& ) // The method which creates an instance of type X
+ Property::Map& map, // The map used to create instance of type X
+ const char* const keyName, // the name of the key to iterate through
+ const StringEnum* values, // An array of string values
+ unsigned int num, // Number of items in the array
+ T (X::*method)() const, // The member method of X to call to get the enum
+ X (*creator)(const Property::Value&) // The method which creates an instance of type X
)
{
// get the key reference so we can change its value
- Property::Value* value = map.Find( keyName );
- for ( unsigned int i = 0; i < num; ++i )
+ Property::Value* value = map.Find(keyName);
+ for(unsigned int i = 0; i < num; ++i)
{
*value = values[i].string;
- tet_printf("Checking: %s: %s\n", keyName, values[i].string );
- X instance = creator( map );
- DALI_TEST_EQUALS( values[i].value, (int)( instance.*method )(), TEST_LOCATION );
+ tet_printf("Checking: %s: %s\n", keyName, values[i].string);
+ X instance = creator(map);
+ DALI_TEST_EQUALS(values[i].value, (int)(instance.*method)(), TEST_LOCATION);
}
}
/**
* Template to check enumerations of type T
*/
-template< typename T >
+template<typename T>
void TestEnumStrings(
- const char * const keyName, // The name of the key to check
- TestApplication& application, // Reference to the application class
- const StringEnum* values, // An array of string values
- unsigned int num, // Number of items in the array
- void ( Actor::*method )( T ) // The Actor member method to set the enumeration
+ const char* const keyName, // The name of the key to check
+ TestApplication& application, // Reference to the application class
+ const StringEnum* values, // An array of string values
+ unsigned int num, // Number of items in the array
+ void (Actor::*method)(T) // The Actor member method to set the enumeration
)
{
- for ( unsigned int i = 0; i < num; ++i )
+ for(unsigned int i = 0; i < num; ++i)
{
- tet_printf("Checking: %s: %s\n", keyName, values[i].string );
+ tet_printf("Checking: %s: %s\n", keyName, values[i].string);
Actor actor = Actor::New();
- (actor.*method)( ( T ) values[i].value );
+ (actor.*method)((T)values[i].value);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
Property::Map map;
- CreatePropertyMap( actor, map );
+ CreatePropertyMap(actor, map);
- DALI_TEST_CHECK( 0 < map.Count() );
- DALI_TEST_CHECK( NULL != map.Find( keyName ) );
- DALI_TEST_EQUALS( map.Find( keyName )->Get< std::string >(), values[i].string, TEST_LOCATION );
+ DALI_TEST_CHECK(0 < map.Count());
+ DALI_TEST_CHECK(NULL != map.Find(keyName));
+ DALI_TEST_EQUALS(map.Find(keyName)->Get<std::string>(), values[i].string, TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
}
}
//////////////////////////////////////////////////////////////////////////////
-
-} // anon namespace
+} // namespace
int UtcDaliValueFromEnum(void)
{
- enum class T {
- None, V1 = 1, V2 = 2
+ enum class T
+ {
+ None,
+ V1 = 1,
+ V2 = 2
};
Property::Value v1 = T::V1;
Property::Value v2 = T::V2;
T t = T::None;
- DALI_TEST_CHECK( v1.Get<T>() == T::V1 );
- DALI_TEST_CHECK( v2.Get<T>() == T::V2 );
- DALI_TEST_CHECK( v1.Get(t) && t == T::V1 );
- DALI_TEST_CHECK( v2.Get(t) && t == T::V2 );
+ DALI_TEST_CHECK(v1.Get<T>() == T::V1);
+ DALI_TEST_CHECK(v2.Get<T>() == T::V2);
+ DALI_TEST_CHECK(v1.Get(t) && t == T::V1);
+ DALI_TEST_CHECK(v2.Get(t) && t == T::V2);
END_TEST;
}
// Empty map
{
- Actor handle = NewActor( Property::Map() );
- DALI_TEST_CHECK( !handle );
+ Actor handle = NewActor(Property::Map());
+ DALI_TEST_CHECK(!handle);
}
// Map with only properties
{
Property::Map map;
- map[ "parentOrigin" ] = ParentOrigin::TOP_CENTER;
- map[ "anchorPoint" ] = AnchorPoint::TOP_CENTER;
- Actor handle = NewActor( map );
- DALI_TEST_CHECK( !handle );
+ map["parentOrigin"] = ParentOrigin::TOP_CENTER;
+ map["anchorPoint"] = AnchorPoint::TOP_CENTER;
+ Actor handle = NewActor(map);
+ DALI_TEST_CHECK(!handle);
}
// Add some signals to the map, we should have no signal connections as its not yet supported
{
Property::Map map;
- map[ "type" ] = "Actor";
- map[ "signals" ] = Property::MAP;
- Actor handle = NewActor( map );
- DALI_TEST_CHECK( handle );
- DALI_TEST_CHECK( !handle.WheelEventSignal().GetConnectionCount() );
- DALI_TEST_CHECK( !handle.OffSceneSignal().GetConnectionCount() );
- DALI_TEST_CHECK( !handle.OnSceneSignal().GetConnectionCount() );
- DALI_TEST_CHECK( !handle.TouchedSignal().GetConnectionCount() );
+ map["type"] = "Actor";
+ map["signals"] = Property::MAP;
+ Actor handle = NewActor(map);
+ DALI_TEST_CHECK(handle);
+ DALI_TEST_CHECK(!handle.WheelEventSignal().GetConnectionCount());
+ DALI_TEST_CHECK(!handle.OffSceneSignal().GetConnectionCount());
+ DALI_TEST_CHECK(!handle.OnSceneSignal().GetConnectionCount());
+ DALI_TEST_CHECK(!handle.TouchedSignal().GetConnectionCount());
}
END_TEST;
}
TestApplication application;
Property::Map map;
- map[ "type" ] = "Actor";
- map[ "size" ] = Vector3::ONE;
- map[ "position" ] = Vector3::XAXIS;
- map[ "scale" ] = Vector3::ONE;
- map[ "visible" ] = false;
- map[ "color" ] = Color::MAGENTA;
- map[ "name" ] = "MyActor";
- map[ "colorMode" ] = "USE_PARENT_COLOR";
- map[ "sensitive" ] = false;
- map[ "leaveRequired" ] = true;
- map[ "drawMode" ] = "OVERLAY_2D";
- map[ "inheritOrientation" ] = false;
- map[ "inheritScale" ] = false;
+ map["type"] = "Actor";
+ map["size"] = Vector3::ONE;
+ map["position"] = Vector3::XAXIS;
+ map["scale"] = Vector3::ONE;
+ map["visible"] = false;
+ map["color"] = Color::MAGENTA;
+ map["name"] = "MyActor";
+ map["colorMode"] = "USE_PARENT_COLOR";
+ map["sensitive"] = false;
+ map["leaveRequired"] = true;
+ map["drawMode"] = "OVERLAY_2D";
+ map["inheritOrientation"] = false;
+ map["inheritScale"] = false;
// Default properties
{
- Actor handle = NewActor( map );
- DALI_TEST_CHECK( handle );
+ Actor handle = NewActor(map);
+ DALI_TEST_CHECK(handle);
- application.GetScene().Add( handle );
+ application.GetScene().Add(handle);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::SIZE ), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::XAXIS, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::SCALE ), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetCurrentProperty< bool >( Actor::Property::VISIBLE ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< std::string >( Actor::Property::NAME ), "MyActor", TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< ColorMode >( Actor::Property::COLOR_MODE ), USE_PARENT_COLOR, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::SENSITIVE ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::LEAVE_REQUIRED ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< DrawMode::Type >( Actor::Property::DRAW_MODE ), DrawMode::OVERLAY_2D, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::INHERIT_ORIENTATION ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetProperty< bool >( Actor::Property::INHERIT_SCALE ), false, TEST_LOCATION );
-
- application.GetScene().Remove( handle );
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::SIZE), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::XAXIS, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::SCALE), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<bool>(Actor::Property::VISIBLE), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<std::string>(Actor::Property::NAME), "MyActor", TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<ColorMode>(Actor::Property::COLOR_MODE), USE_PARENT_COLOR, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(Actor::Property::SENSITIVE), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(Actor::Property::LEAVE_REQUIRED), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<DrawMode::Type>(Actor::Property::DRAW_MODE), DrawMode::OVERLAY_2D, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(Actor::Property::INHERIT_ORIENTATION), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetProperty<bool>(Actor::Property::INHERIT_SCALE), false, TEST_LOCATION);
+
+ application.GetScene().Remove(handle);
}
// Check Anchor point and parent origin vector3s
- map[ "parentOrigin" ] = ParentOrigin::TOP_CENTER;
- map[ "anchorPoint" ] = AnchorPoint::TOP_LEFT;
+ map["parentOrigin"] = ParentOrigin::TOP_CENTER;
+ map["anchorPoint"] = AnchorPoint::TOP_LEFT;
{
- Actor handle = NewActor( map );
- DALI_TEST_CHECK( handle );
+ Actor handle = NewActor(map);
+ DALI_TEST_CHECK(handle);
- application.GetScene().Add( handle );
+ application.GetScene().Add(handle);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_CENTER, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::TOP_LEFT, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_CENTER, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::TOP_LEFT, TEST_LOCATION);
- application.GetScene().Remove( handle );
+ application.GetScene().Remove(handle);
}
// Check Anchor point and parent origin STRINGS
- map[ "parentOrigin" ] = "TOP_LEFT";
- map[ "anchorPoint" ] = "CENTER_LEFT";
+ map["parentOrigin"] = "TOP_LEFT";
+ map["anchorPoint"] = "CENTER_LEFT";
{
- Actor handle = NewActor( map );
- DALI_TEST_CHECK( handle );
+ Actor handle = NewActor(map);
+ DALI_TEST_CHECK(handle);
- application.GetScene().Add( handle );
+ application.GetScene().Add(handle);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::PARENT_ORIGIN ), ParentOrigin::TOP_LEFT, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::ANCHOR_POINT ), AnchorPoint::CENTER_LEFT, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::PARENT_ORIGIN), ParentOrigin::TOP_LEFT, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT), AnchorPoint::CENTER_LEFT, TEST_LOCATION);
- application.GetScene().Remove( handle );
+ application.GetScene().Remove(handle);
}
END_TEST;
}
TestApplication application;
Property::Map map;
- map["actor"] = "Actor1";
- map["property"] = "color";
- map["value"] = Color::MAGENTA;
+ map["actor"] = "Actor1";
+ map["property"] = "color";
+ map["value"] = Color::MAGENTA;
map["alphaFunction"] = "EASE_IN_OUT";
Property::Map timePeriod;
- timePeriod["delay"] = 0.5f;
+ timePeriod["delay"] = 0.5f;
timePeriod["duration"] = 1.0f;
- map["timePeriod"] = timePeriod;
+ map["timePeriod"] = timePeriod;
Dali::AnimationData data;
- Scripting::NewAnimation( map, data );
+ Scripting::NewAnimation(map, data);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::NAME,"Actor1");
- actor.SetProperty( Actor::Property::COLOR,Color::CYAN);
+ actor.SetProperty(Actor::Property::NAME, "Actor1");
+ actor.SetProperty(Actor::Property::COLOR, Color::CYAN);
application.GetScene().Add(actor);
- Animation anim = data.CreateAnimation( actor, 0.5f );
+ Animation anim = data.CreateAnimation(actor, 0.5f);
anim.Play();
application.SendNotification();
application.Render(500); // Start animation
application.Render(500); // Halfway thru anim
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), (Color::MAGENTA+Color::CYAN)*0.5f, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), (Color::MAGENTA + Color::CYAN) * 0.5f, TEST_LOCATION);
application.Render(500); // Halfway thru anim
application.SendNotification();
- DALI_TEST_EQUALS( actor.GetCurrentProperty< Vector4 >( Actor::Property::COLOR ), Color::MAGENTA, TEST_LOCATION );
+ DALI_TEST_EQUALS(actor.GetCurrentProperty<Vector4>(Actor::Property::COLOR), Color::MAGENTA, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Property::Map map;
- map[ "type" ] = "Actor";
- map[ "position" ] = Vector3::XAXIS;
+ map["type"] = "Actor";
+ map["position"] = Vector3::XAXIS;
Property::Map child1Map;
- child1Map[ "type" ] = "Layer";
- child1Map[ "position" ] = Vector3::YAXIS;
+ child1Map["type"] = "Layer";
+ child1Map["position"] = Vector3::YAXIS;
Property::Array childArray;
- childArray.PushBack( child1Map );
- map[ "actors" ] = childArray;
+ childArray.PushBack(child1Map);
+ map["actors"] = childArray;
// Create
- Actor handle = NewActor( map );
- DALI_TEST_CHECK( handle );
+ Actor handle = NewActor(map);
+ DALI_TEST_CHECK(handle);
- application.GetScene().Add( handle );
+ application.GetScene().Add(handle);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( handle.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::XAXIS, TEST_LOCATION );
- DALI_TEST_EQUALS( handle.GetChildCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(handle.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::XAXIS, TEST_LOCATION);
+ DALI_TEST_EQUALS(handle.GetChildCount(), 1u, TEST_LOCATION);
Actor child1 = handle.GetChildAt(0);
- DALI_TEST_CHECK( child1 );
- DALI_TEST_CHECK( Layer::DownCast( child1 ) );
- DALI_TEST_EQUALS( child1.GetCurrentProperty< Vector3 >( Actor::Property::POSITION ), Vector3::YAXIS, TEST_LOCATION );
- DALI_TEST_EQUALS( child1.GetChildCount(), 0u, TEST_LOCATION );
+ DALI_TEST_CHECK(child1);
+ DALI_TEST_CHECK(Layer::DownCast(child1));
+ DALI_TEST_EQUALS(child1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), Vector3::YAXIS, TEST_LOCATION);
+ DALI_TEST_EQUALS(child1.GetChildCount(), 0u, TEST_LOCATION);
- application.GetScene().Remove( handle );
+ application.GetScene().Remove(handle);
END_TEST;
}
-
int UtcDaliScriptingCreatePropertyMapActor(void)
{
TestApplication application;
Actor actor = Actor::New();
Property::Map map;
- CreatePropertyMap( actor, map );
- DALI_TEST_CHECK( !map.Empty() );
- DALI_TEST_CHECK( NULL != map.Find( "type" ) );
- DALI_TEST_EQUALS( map.Find( "type")->Get< std::string >(), "Actor", TEST_LOCATION );
+ CreatePropertyMap(actor, map);
+ DALI_TEST_CHECK(!map.Empty());
+ DALI_TEST_CHECK(NULL != map.Find("type"));
+ DALI_TEST_EQUALS(map.Find("type")->Get<std::string>(), "Actor", TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
}
// Layer Type
Actor actor = Layer::New();
Property::Map map;
- CreatePropertyMap( actor, map );
- DALI_TEST_CHECK( !map.Empty() );
- DALI_TEST_CHECK( NULL != map.Find( "type" ) );
- DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "Layer", TEST_LOCATION );
+ CreatePropertyMap(actor, map);
+ DALI_TEST_CHECK(!map.Empty());
+ DALI_TEST_CHECK(NULL != map.Find("type"));
+ DALI_TEST_EQUALS(map.Find("type")->Get<std::string>(), "Layer", TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
}
// Default properties
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector3::ONE );
- actor.SetProperty( Actor::Property::POSITION, Vector3::XAXIS );
- actor.SetProperty( Actor::Property::SCALE, Vector3::ZAXIS );
- actor.SetProperty( Actor::Property::VISIBLE, false );
- actor.SetProperty( Actor::Property::COLOR, Color::MAGENTA );
- actor.SetProperty( Actor::Property::NAME, "MyActor" );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT );
- actor.SetProperty( Actor::Property::SENSITIVE, false );
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
- actor.SetProperty( Actor::Property::INHERIT_ORIENTATION, false );
- actor.SetProperty( Actor::Property::INHERIT_SCALE, false );
- actor.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3::ONE );
-
- application.GetScene().Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE);
+ actor.SetProperty(Actor::Property::POSITION, Vector3::XAXIS);
+ actor.SetProperty(Actor::Property::SCALE, Vector3::ZAXIS);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
+ actor.SetProperty(Actor::Property::COLOR, Color::MAGENTA);
+ actor.SetProperty(Actor::Property::NAME, "MyActor");
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_RIGHT);
+ actor.SetProperty(Actor::Property::SENSITIVE, false);
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
+ actor.SetProperty(Actor::Property::INHERIT_ORIENTATION, false);
+ actor.SetProperty(Actor::Property::INHERIT_SCALE, false);
+ actor.SetProperty(Actor::Property::SIZE_MODE_FACTOR, Vector3::ONE);
+
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
Property::Map map;
- CreatePropertyMap( actor, map );
-
- DALI_TEST_CHECK( !map.Empty() );
- DALI_TEST_CHECK( NULL != map.Find( "size" ) );
- DALI_TEST_EQUALS( map.Find( "size" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "position" ) );
- DALI_TEST_EQUALS( map.Find( "position" )->Get< Vector3 >(), Vector3::XAXIS, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "scale" ) );
- DALI_TEST_EQUALS( map.Find( "scale" )->Get< Vector3 >(), Vector3::ZAXIS, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "visible" ) );
- DALI_TEST_EQUALS( map.Find( "visible" )->Get< bool >(), false, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "color" ) );
- DALI_TEST_EQUALS( map.Find( "color" )->Get< Vector4 >(), Color::MAGENTA, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "name" ) );
- DALI_TEST_EQUALS( map.Find( "name")->Get< std::string >(), "MyActor", TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "anchorPoint" ) );
- DALI_TEST_EQUALS( map.Find( "anchorPoint" )->Get< Vector3 >(), AnchorPoint::CENTER_LEFT, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "parentOrigin" ) );
- DALI_TEST_EQUALS( map.Find( "parentOrigin" )->Get< Vector3 >(), ParentOrigin::TOP_RIGHT, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "sensitive" ) );
- DALI_TEST_EQUALS( map.Find( "sensitive" )->Get< bool >(), false, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "leaveRequired" ) );
- DALI_TEST_EQUALS( map.Find( "leaveRequired" )->Get< bool >(), true, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "inheritOrientation" ) );
- DALI_TEST_EQUALS( map.Find( "inheritOrientation" )->Get< bool >(), false, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "inheritScale" ) );
- DALI_TEST_EQUALS( map.Find( "inheritScale" )->Get< bool >(), false, TEST_LOCATION );
- DALI_TEST_CHECK( NULL != map.Find( "sizeModeFactor" ) );
- DALI_TEST_EQUALS( map.Find( "sizeModeFactor" )->Get< Vector3 >(), Vector3::ONE, TEST_LOCATION );
-
- application.GetScene().Remove( actor );
+ CreatePropertyMap(actor, map);
+
+ DALI_TEST_CHECK(!map.Empty());
+ DALI_TEST_CHECK(NULL != map.Find("size"));
+ DALI_TEST_EQUALS(map.Find("size")->Get<Vector3>(), Vector3::ONE, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("position"));
+ DALI_TEST_EQUALS(map.Find("position")->Get<Vector3>(), Vector3::XAXIS, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("scale"));
+ DALI_TEST_EQUALS(map.Find("scale")->Get<Vector3>(), Vector3::ZAXIS, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("visible"));
+ DALI_TEST_EQUALS(map.Find("visible")->Get<bool>(), false, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("color"));
+ DALI_TEST_EQUALS(map.Find("color")->Get<Vector4>(), Color::MAGENTA, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("name"));
+ DALI_TEST_EQUALS(map.Find("name")->Get<std::string>(), "MyActor", TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("anchorPoint"));
+ DALI_TEST_EQUALS(map.Find("anchorPoint")->Get<Vector3>(), AnchorPoint::CENTER_LEFT, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("parentOrigin"));
+ DALI_TEST_EQUALS(map.Find("parentOrigin")->Get<Vector3>(), ParentOrigin::TOP_RIGHT, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("sensitive"));
+ DALI_TEST_EQUALS(map.Find("sensitive")->Get<bool>(), false, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("leaveRequired"));
+ DALI_TEST_EQUALS(map.Find("leaveRequired")->Get<bool>(), true, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("inheritOrientation"));
+ DALI_TEST_EQUALS(map.Find("inheritOrientation")->Get<bool>(), false, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("inheritScale"));
+ DALI_TEST_EQUALS(map.Find("inheritScale")->Get<bool>(), false, TEST_LOCATION);
+ DALI_TEST_CHECK(NULL != map.Find("sizeModeFactor"));
+ DALI_TEST_EQUALS(map.Find("sizeModeFactor")->Get<Vector3>(), Vector3::ONE, TEST_LOCATION);
+
+ application.GetScene().Remove(actor);
}
// Children
{
Actor actor = Actor::New();
Actor child = Layer::New();
- actor.Add( child );
+ actor.Add(child);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
application.SendNotification();
application.Render();
Property::Map map;
- CreatePropertyMap( actor, map );
- DALI_TEST_CHECK( !map.Empty() );
+ CreatePropertyMap(actor, map);
+ DALI_TEST_CHECK(!map.Empty());
- DALI_TEST_CHECK( NULL != map.Find( "type" ) );
- DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "Actor", TEST_LOCATION );
+ DALI_TEST_CHECK(NULL != map.Find("type"));
+ DALI_TEST_EQUALS(map.Find("type")->Get<std::string>(), "Actor", TEST_LOCATION);
- DALI_TEST_CHECK( NULL != map.Find( "actors" ) );
- Property::Array children( map.Find( "actors")->Get< Property::Array >() );
- DALI_TEST_CHECK( !children.Empty() );
- Property::Map childMap( children[0].Get< Property::Map >() );
- DALI_TEST_CHECK( !childMap.Empty() );
- DALI_TEST_CHECK( childMap.Find( "type" ) );
- DALI_TEST_EQUALS( childMap.Find( "type" )->Get< std::string >(), "Layer", TEST_LOCATION );
+ DALI_TEST_CHECK(NULL != map.Find("actors"));
+ Property::Array children(map.Find("actors")->Get<Property::Array>());
+ DALI_TEST_CHECK(!children.Empty());
+ Property::Map childMap(children[0].Get<Property::Map>());
+ DALI_TEST_CHECK(!childMap.Empty());
+ DALI_TEST_CHECK(childMap.Find("type"));
+ DALI_TEST_EQUALS(childMap.Find("type")->Get<std::string>(), "Layer", TEST_LOCATION);
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
}
END_TEST;
}
int UtcDaliScriptingGetEnumerationTemplates(void)
{
const Scripting::StringEnum myTable[] =
- {
- { "ONE", 1 },
- { "TWO", 2 },
- { "THREE", 3 },
- { "FOUR", 4 },
- { "FIVE", 5 },
- };
- const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] );
+ {
+ {"ONE", 1},
+ {"TWO", 2},
+ {"THREE", 3},
+ {"FOUR", 4},
+ {"FIVE", 5},
+ };
+ const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]);
- for ( unsigned int i = 0; i < myTableCount; ++i )
+ for(unsigned int i = 0; i < myTableCount; ++i)
{
- tet_printf("Checking: %s\n", myTable[ i ].string );
+ tet_printf("Checking: %s\n", myTable[i].string);
int value;
- DALI_TEST_CHECK( GetEnumeration<int>( myTable[ i ].string, myTable, myTableCount, value ) );
- DALI_TEST_EQUALS( myTable[ i ].value, value, TEST_LOCATION );
+ DALI_TEST_CHECK(GetEnumeration<int>(myTable[i].string, myTable, myTableCount, value));
+ DALI_TEST_EQUALS(myTable[i].value, value, TEST_LOCATION);
}
- for ( unsigned int i = 0; i < myTableCount; ++i )
+ for(unsigned int i = 0; i < myTableCount; ++i)
{
- tet_printf("Checking: %d\n", myTable[ i ].value );
- DALI_TEST_EQUALS( myTable[ i ].string, GetEnumerationName( myTable[ i ].value, myTable, myTableCount ), TEST_LOCATION );
+ tet_printf("Checking: %d\n", myTable[i].value);
+ DALI_TEST_EQUALS(myTable[i].string, GetEnumerationName(myTable[i].value, myTable, myTableCount), TEST_LOCATION);
}
END_TEST;
int UtcDaliScriptingGetEnumerationNameN(void)
{
- const char* value = GetEnumerationName( 10, NULL, 0 );
- DALI_TEST_CHECK( NULL == value );
+ const char* value = GetEnumerationName(10, NULL, 0);
+ DALI_TEST_CHECK(NULL == value);
- value = GetEnumerationName( 10, NULL, 1 );
- DALI_TEST_CHECK( NULL == value );
+ value = GetEnumerationName(10, NULL, 1);
+ DALI_TEST_CHECK(NULL == value);
END_TEST;
}
int UtcDaliScriptingGetLinearEnumerationNameN(void)
{
- const char* value = GetLinearEnumerationName( 10, NULL, 0 );
- DALI_TEST_CHECK( NULL == value );
+ const char* value = GetLinearEnumerationName(10, NULL, 0);
+ DALI_TEST_CHECK(NULL == value);
- value = GetLinearEnumerationName( 10, NULL, 1 );
- DALI_TEST_CHECK( NULL == value );
+ value = GetLinearEnumerationName(10, NULL, 1);
+ DALI_TEST_CHECK(NULL == value);
END_TEST;
}
*/
// String to Enum property table to test with (equivalent to ones used within DALi).
- const Dali::Scripting::StringEnum testTable[] = {
- { "NONE", FaceCullingMode::NONE },
- { "FRONT", FaceCullingMode::FRONT },
- { "BACK", FaceCullingMode::BACK },
- { "FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK }
- }; const unsigned int testTableCount = sizeof( testTable ) / sizeof( testTable[0] );
+ const Dali::Scripting::StringEnum testTable[] = {
+ {"NONE", FaceCullingMode::NONE},
+ {"FRONT", FaceCullingMode::FRONT},
+ {"BACK", FaceCullingMode::BACK},
+ {"FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK}};
+ const unsigned int testTableCount = sizeof(testTable) / sizeof(testTable[0]);
// TEST: An enum can be looked up from a Property::Value of type INTEGER.
// Initialise to first element.
FaceCullingMode::Type result = FaceCullingMode::NONE;
// Set the input property value to a different value (to emulate a change).
- Property::Value propertyValueInteger( FaceCullingMode::FRONT );
+ Property::Value propertyValueInteger(FaceCullingMode::FRONT);
// Perform the lookup.
- bool returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result );
+ bool returnValue = GetEnumerationProperty<FaceCullingMode::Type>(propertyValueInteger, testTable, testTableCount, result);
// TEST: The return value is "true" if the property can be successfully converted AND it has changed
// Check the property could be converted.
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::FRONT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::FRONT), TEST_LOCATION);
// Now emulate a property-set with the same value. false should be returned.
- returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result );
+ returnValue = GetEnumerationProperty<FaceCullingMode::Type>(propertyValueInteger, testTable, testTableCount, result);
// TEST: The return value is "false" if the property can be successfully converted BUT it has NOT changed.
- DALI_TEST_CHECK( !returnValue );
+ DALI_TEST_CHECK(!returnValue);
// The result should remain the same.
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::FRONT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::FRONT), TEST_LOCATION);
// TEST: An enum can be looked up from a Property::Value of type STRING.
// Set the input property value to a different value (to emulate a change).
- Property::Value propertyValueString( "BACK" );
+ Property::Value propertyValueString("BACK");
- returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result );
+ returnValue = GetEnumerationProperty<FaceCullingMode::Type>(propertyValueString, testTable, testTableCount, result);
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
// The result should remain the same.
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::BACK ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::BACK), TEST_LOCATION);
- returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result );
+ returnValue = GetEnumerationProperty<FaceCullingMode::Type>(propertyValueString, testTable, testTableCount, result);
- DALI_TEST_CHECK( !returnValue );
+ DALI_TEST_CHECK(!returnValue);
// The result should remain the same.
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::BACK ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::BACK), TEST_LOCATION);
// TEST: An enum can NOT be looked up for other Property::Value types.
- Property::Value propertyValueBoolean( true );
+ Property::Value propertyValueBoolean(true);
- returnValue = GetEnumerationProperty< FaceCullingMode::Type >( propertyValueBoolean, testTable, testTableCount, result );
+ returnValue = GetEnumerationProperty<FaceCullingMode::Type>(propertyValueBoolean, testTable, testTableCount, result);
// TEST: The return value is "false" if the property can not be successfully converted.
// Return value should be false as Property::Value was of an unsupported type for enum properties.
- DALI_TEST_CHECK( !returnValue );
+ DALI_TEST_CHECK(!returnValue);
// TEST: The result value is only updated if the return value is "true" (IE. successful conversion and property value has changed).
// The result should remain the same.
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::BACK ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::BACK), TEST_LOCATION);
END_TEST;
}
*/
// String to Enum property table to test with (equivalent to ones used within DALi).
- const Dali::Scripting::StringEnum testTable[] = {
- { "NONE", FaceCullingMode::NONE },
- { "FRONT", FaceCullingMode::FRONT },
- { "BACK", FaceCullingMode::BACK },
- { "FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK }
- }; const unsigned int testTableCount = sizeof( testTable ) / sizeof( testTable[0] );
+ const Dali::Scripting::StringEnum testTable[] = {
+ {"NONE", FaceCullingMode::NONE},
+ {"FRONT", FaceCullingMode::FRONT},
+ {"BACK", FaceCullingMode::BACK},
+ {"FRONT_AND_BACK", FaceCullingMode::FRONT_AND_BACK}};
+ const unsigned int testTableCount = sizeof(testTable) / sizeof(testTable[0]);
// TEST: An enum can be looked up from a Property::Value of type INTEGER.
// Initialise to first element.
FaceCullingMode::Type result = FaceCullingMode::NONE;
// Set the input property value to a different value (to emulate a change).
- Property::Value propertyValueInteger( FaceCullingMode::FRONT );
+ Property::Value propertyValueInteger(FaceCullingMode::FRONT);
// Perform the lookup.
- bool returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueInteger, testTable, testTableCount, result );
+ bool returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyValueInteger, testTable, testTableCount, result);
// TEST: The return value is "true" if the property can be successfully converted AND it has changed
// Check the property could be converted.
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::FRONT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::FRONT), TEST_LOCATION);
// TEST: An enum can be looked up from a Property::Value of type STRING.
// Set the input property value to a different value (to emulate a change).
- Property::Value propertyValueString( "BACK" );
+ Property::Value propertyValueString("BACK");
- returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueString, testTable, testTableCount, result );
+ returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyValueString, testTable, testTableCount, result);
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::BACK ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::BACK), TEST_LOCATION);
// TEST: An enum can NOT be looked up from other Property::Value types.
- Property::Value propertyValueVector( Vector3::ZERO );
+ Property::Value propertyValueVector(Vector3::ZERO);
- returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyValueVector, testTable, testTableCount, result );
+ returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyValueVector, testTable, testTableCount, result);
// TEST: The return value is "false" if the property can not be successfully converted.
// Return value should be false as Property::Value was of an unsupported type for enum properties.
- DALI_TEST_CHECK( !returnValue );
+ DALI_TEST_CHECK(!returnValue);
// TEST: The result value is only updated if the return value is "true" (IE. successful conversion and property value has changed).
// The result should remain the same.
- DALI_TEST_EQUALS( static_cast<int>( result ), static_cast<int>( FaceCullingMode::BACK ), TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<int>(result), static_cast<int>(FaceCullingMode::BACK), TEST_LOCATION);
// Test PropertyArrays:
// Property array of 2 integers.
Property::Array propertyArrayIntegers;
- propertyArrayIntegers.PushBack( FaceCullingMode::FRONT );
- propertyArrayIntegers.PushBack( FaceCullingMode::BACK );
+ propertyArrayIntegers.PushBack(FaceCullingMode::FRONT);
+ propertyArrayIntegers.PushBack(FaceCullingMode::BACK);
result = FaceCullingMode::NONE;
- returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayIntegers, testTable, testTableCount, result );
+ returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyArrayIntegers, testTable, testTableCount, result);
// TEST: The return value when checking an array with 2 INTEGERS is "true" if the properties can be successfully converted.
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
// TEST: The result value when checking an array with 2 INTEGERS is the ORd value of the 2 integers.
- DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) );
+ DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK));
// Property array of 2 strings.
Property::Array propertyArrayStrings;
- propertyArrayStrings.PushBack( "FRONT" );
- propertyArrayStrings.PushBack( "BACK" );
+ propertyArrayStrings.PushBack("FRONT");
+ propertyArrayStrings.PushBack("BACK");
result = FaceCullingMode::NONE;
- returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayStrings, testTable, testTableCount, result );
+ returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyArrayStrings, testTable, testTableCount, result);
// TEST: The return value when checking an array with 2 STRINGS is "true" if the properties can be successfully converted.
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
// TEST: The result value when checking an array with 2 STRINGS is the ORd value of the 2 integer equivalents of the strings.
- DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) );
+ DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK));
// Property array of an int and a string.
Property::Array propertyArrayMixed;
- propertyArrayMixed.PushBack( FaceCullingMode::FRONT );
- propertyArrayMixed.PushBack( "BACK" );
+ propertyArrayMixed.PushBack(FaceCullingMode::FRONT);
+ propertyArrayMixed.PushBack("BACK");
result = FaceCullingMode::NONE;
- returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayMixed, testTable, testTableCount, result );
+ returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyArrayMixed, testTable, testTableCount, result);
// TEST: The return value when checking an array with an INTEGER and a STRING is "true" if the properties can be successfully converted.
- DALI_TEST_CHECK( returnValue );
+ DALI_TEST_CHECK(returnValue);
// TEST: The result value when checking an array with an INTEGER and a STRING is the ORd value of the 2 integer equivalents of the strings.
- DALI_TEST_CHECK( result == ( FaceCullingMode::FRONT | FaceCullingMode::BACK ) );
+ DALI_TEST_CHECK(result == (FaceCullingMode::FRONT | FaceCullingMode::BACK));
// Property array of an int and a string.
Property::Array propertyArrayInvalid;
- propertyArrayInvalid.PushBack( FaceCullingMode::FRONT );
- propertyArrayInvalid.PushBack( Vector3::ZERO );
+ propertyArrayInvalid.PushBack(FaceCullingMode::FRONT);
+ propertyArrayInvalid.PushBack(Vector3::ZERO);
// Set the initial value to non-zero, so we can test it does not change.
result = FaceCullingMode::FRONT_AND_BACK;
- returnValue = GetBitmaskEnumerationProperty< FaceCullingMode::Type >( propertyArrayInvalid, testTable, testTableCount, result );
+ returnValue = GetBitmaskEnumerationProperty<FaceCullingMode::Type>(propertyArrayInvalid, testTable, testTableCount, result);
// TEST: The return value when checking an array with an INTEGER and a Vector3 is "false" as the properties can not be successfully converted.
- DALI_TEST_CHECK( !returnValue );
+ DALI_TEST_CHECK(!returnValue);
// TEST: The result value when checking an array with an INTEGER and a Vector3 is unchanged.
- DALI_TEST_CHECK( result == FaceCullingMode::FRONT_AND_BACK );
+ DALI_TEST_CHECK(result == FaceCullingMode::FRONT_AND_BACK);
END_TEST;
}
{
const Scripting::StringEnum myTable[] =
{
- { "ONE", (1<<1) },
- { "TWO", (1<<2) },
- { "THREE", (1<<3) },
- { "FOUR", (1<<4) },
- { "FIVE", (1<<5) },
+ {"ONE", (1 << 1)},
+ {"TWO", (1 << 2)},
+ {"THREE", (1 << 3)},
+ {"FOUR", (1 << 4)},
+ {"FIVE", (1 << 5)},
};
- const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] );
- DALI_TEST_EQUALS( myTableCount, FindEnumIndex( "Foo", myTable, myTableCount ), TEST_LOCATION );
+ const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]);
+ DALI_TEST_EQUALS(myTableCount, FindEnumIndex("Foo", myTable, myTableCount), TEST_LOCATION);
END_TEST;
}
{
const Scripting::StringEnum myTable[] =
{
- { "ONE", (1<<1) },
- { "TWO", (1<<2) },
- { "THREE", (1<<3) },
- { "FOUR", (1<<4) },
- { "FIVE", (1<<5) },
+ {"ONE", (1 << 1)},
+ {"TWO", (1 << 2)},
+ {"THREE", (1 << 3)},
+ {"FOUR", (1 << 4)},
+ {"FIVE", (1 << 5)},
};
- const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] );
+ const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]);
int integerEnum = 0;
- DALI_TEST_CHECK( EnumStringToInteger( "ONE", myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(EnumStringToInteger("ONE", myTable, myTableCount, integerEnum));
- DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION );
+ DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION);
integerEnum = 0;
- DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION);
- DALI_TEST_CHECK( EnumStringToInteger( "ONE,,TWO", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("ONE,,TWO", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION);
- DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO,THREE", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO,THREE", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3), TEST_LOCATION);
- DALI_TEST_CHECK( EnumStringToInteger( "ONE,TWO,THREE,FOUR,FIVE", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("ONE,TWO,THREE,FOUR,FIVE", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5), TEST_LOCATION);
- DALI_TEST_CHECK( EnumStringToInteger( "TWO,ONE", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("TWO,ONE", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2), TEST_LOCATION);
- DALI_TEST_CHECK( EnumStringToInteger( "TWO,ONE,FOUR,THREE,FIVE", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("TWO,ONE,FOUR,THREE,FIVE", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5), TEST_LOCATION);
- DALI_TEST_CHECK( EnumStringToInteger( "ONE,SEVEN", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION );
-
- DALI_TEST_CHECK( EnumStringToInteger( "ONE,", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, (1<<1), TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("ONE,SEVEN", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION);
+ DALI_TEST_CHECK(EnumStringToInteger("ONE,", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, (1 << 1), TEST_LOCATION);
END_TEST;
}
int UtcDaliScriptingEnumStringToIntegerN(void)
{
const Scripting::StringEnum myTable[] =
- {
- { "ONE", 1 },
- { "TWO", 2 },
- { "THREE", 3 },
- { "FOUR", 4 },
- { "FIVE", 5 },
- };
- const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] );
+ {
+ {"ONE", 1},
+ {"TWO", 2},
+ {"THREE", 3},
+ {"FOUR", 4},
+ {"FIVE", 5},
+ };
+ const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]);
int integerEnum = 0;
- DALI_TEST_CHECK( !EnumStringToInteger( "Foo", myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger("Foo", myTable, myTableCount, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( "", myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger("", myTable, myTableCount, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( ",", myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger(",", myTable, myTableCount, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( ",ONE,SEVEN", myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger(",ONE,SEVEN", myTable, myTableCount, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( ",", myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger(",", myTable, myTableCount, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( "ONE", myTable, 0, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger("ONE", myTable, 0, integerEnum));
- DALI_TEST_EQUALS( integerEnum, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(integerEnum, 0, TEST_LOCATION);
END_TEST;
}
int UtcDaliScriptingEnumStringToIntegerInvalidEnumP(void)
{
const Scripting::StringEnum myTable[] =
- {
- { "", 1 },
- { "", 2 },
- { "", 3 },
- };
+ {
+ {"", 1},
+ {"", 2},
+ {"", 3},
+ };
- const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] );
+ const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]);
int integerEnum = 0;
- DALI_TEST_CHECK( EnumStringToInteger( "", myTable, myTableCount, integerEnum ) );
- DALI_TEST_EQUALS( integerEnum, 1, TEST_LOCATION );
+ DALI_TEST_CHECK(EnumStringToInteger("", myTable, myTableCount, integerEnum));
+ DALI_TEST_EQUALS(integerEnum, 1, TEST_LOCATION);
END_TEST;
}
int UtcDaliScriptingEnumStringToIntegerInvalidEnumN(void)
{
const Scripting::StringEnum myTable[] =
- {
- { "", 1 },
- { "", 1 },
- { "", 1 },
- };
+ {
+ {"", 1},
+ {"", 1},
+ {"", 1},
+ };
- const unsigned int myTableCount = sizeof( myTable ) / sizeof( myTable[0] );
+ const unsigned int myTableCount = sizeof(myTable) / sizeof(myTable[0]);
int integerEnum = 0;
- DALI_TEST_CHECK( !EnumStringToInteger( NULL, NULL, 0, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger(NULL, NULL, 0, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( "ONE", NULL, 0, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger("ONE", NULL, 0, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( NULL, myTable, 0, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger(NULL, myTable, 0, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( NULL, myTable, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger(NULL, myTable, myTableCount, integerEnum));
- DALI_TEST_CHECK( !EnumStringToInteger( "ONE", NULL, myTableCount, integerEnum ) );
+ DALI_TEST_CHECK(!EnumStringToInteger("ONE", NULL, myTableCount, integerEnum));
- DALI_TEST_EQUALS( integerEnum, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(integerEnum, 0, TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
#include <mesh-builder.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
static const char* VertexSource =
-"This is a custom vertex shader\n"
-"made on purpose to look nothing like a normal vertex shader inside dali\n";
+ "This is a custom vertex shader\n"
+ "made on purpose to look nothing like a normal vertex shader inside dali\n";
static const char* FragmentSource =
-"This is a custom fragment shader\n"
-"made on purpose to look nothing like a normal fragment shader inside dali\n";
-
+ "This is a custom fragment shader\n"
+ "made on purpose to look nothing like a normal fragment shader inside dali\n";
-void TestConstraintNoBlue( Vector4& current, const PropertyInputContainer& inputs )
+void TestConstraintNoBlue(Vector4& current, const PropertyInputContainer& inputs)
{
current.b = 0.0f;
}
-
-} // anon namespace
-
+} // namespace
int UtcDaliShaderMethodNew01(void)
{
TestApplication application;
- Shader shader = Shader::New( VertexSource, FragmentSource );
+ Shader shader = Shader::New(VertexSource, FragmentSource);
DALI_TEST_EQUALS((bool)shader, true, TEST_LOCATION);
END_TEST;
}
DALI_TEST_CHECK(shader1 == shader2);
- shader2 = Shader::New(VertexSource, FragmentSource);;
+ shader2 = Shader::New(VertexSource, FragmentSource);
+ ;
DALI_TEST_CHECK(!(shader1 == shader2));
TestApplication application;
Shader shader = Shader::New(VertexSource, FragmentSource);
- DALI_TEST_CHECK( shader );
- DALI_TEST_EQUALS( 1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(shader);
+ DALI_TEST_EQUALS(1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION);
// Register a custom property
- Vector2 vec( 1.0f, 2.0f );
- Property::Index customIndex = shader.RegisterProperty( "custom", vec );
- DALI_TEST_EQUALS( shader.GetProperty<Vector2>( customIndex ), vec, TEST_LOCATION );
+ Vector2 vec(1.0f, 2.0f);
+ Property::Index customIndex = shader.RegisterProperty("custom", vec);
+ DALI_TEST_EQUALS(shader.GetProperty<Vector2>(customIndex), vec, TEST_LOCATION);
- Shader move = std::move( shader );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetProperty<Vector2>( customIndex ), vec, TEST_LOCATION );
- DALI_TEST_CHECK( !shader );
+ Shader move = std::move(shader);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetProperty<Vector2>(customIndex), vec, TEST_LOCATION);
+ DALI_TEST_CHECK(!shader);
END_TEST;
}
TestApplication application;
Shader shader = Shader::New(VertexSource, FragmentSource);
- DALI_TEST_CHECK( shader );
- DALI_TEST_EQUALS( 1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(shader);
+ DALI_TEST_EQUALS(1, shader.GetBaseObject().ReferenceCount(), TEST_LOCATION);
// Register a custom property
- Vector2 vec( 1.0f, 2.0f );
- Property::Index customIndex = shader.RegisterProperty( "custom", vec );
- DALI_TEST_EQUALS( shader.GetProperty<Vector2>( customIndex ), vec, TEST_LOCATION );
+ Vector2 vec(1.0f, 2.0f);
+ Property::Index customIndex = shader.RegisterProperty("custom", vec);
+ DALI_TEST_EQUALS(shader.GetProperty<Vector2>(customIndex), vec, TEST_LOCATION);
Shader move;
- move = std::move( shader );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetProperty<Vector2>( customIndex ), vec, TEST_LOCATION );
- DALI_TEST_CHECK( !shader );
+ move = std::move(shader);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetProperty<Vector2>(customIndex), vec, TEST_LOCATION);
+ DALI_TEST_CHECK(!shader);
END_TEST;
}
Shader shader = Shader::New(VertexSource, FragmentSource);
BaseHandle handle(shader);
- Shader shader2 = Shader::DownCast(handle);
- DALI_TEST_EQUALS( (bool)shader2, true, TEST_LOCATION );
+ Shader shader2 = Shader::DownCast(handle);
+ DALI_TEST_EQUALS((bool)shader2, true, TEST_LOCATION);
END_TEST;
}
Handle handle = Handle::New(); // Create a custom object
Shader shader = Shader::DownCast(handle);
- DALI_TEST_EQUALS( (bool)shader, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)shader, false, TEST_LOCATION);
END_TEST;
}
int UtcDaliShaderDefaultProperties(void)
{
TestApplication application;
-// from shader-impl.cpp
-// DALI_PROPERTY( "program", MAP, true, false, false, Dali::Shader::Property::PROGRAM )
+ // from shader-impl.cpp
+ // DALI_PROPERTY( "program", MAP, true, false, false, Dali::Shader::Property::PROGRAM )
Shader shader = Shader::New(VertexSource, FragmentSource);
- DALI_TEST_EQUALS( shader.GetPropertyCount(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetPropertyCount(), 1, TEST_LOCATION);
- DALI_TEST_EQUALS( shader.GetPropertyName( Shader::Property::PROGRAM ), "program", TEST_LOCATION );
- DALI_TEST_EQUALS( shader.GetPropertyIndex( "program" ), (Property::Index)Shader::Property::PROGRAM, TEST_LOCATION );
- DALI_TEST_EQUALS( shader.GetPropertyType( Shader::Property::PROGRAM ), Property::MAP, TEST_LOCATION );
- DALI_TEST_EQUALS( shader.IsPropertyWritable( Shader::Property::PROGRAM ), true, TEST_LOCATION );
- DALI_TEST_EQUALS( shader.IsPropertyAnimatable( Shader::Property::PROGRAM ), false, TEST_LOCATION );
- DALI_TEST_EQUALS( shader.IsPropertyAConstraintInput( Shader::Property::PROGRAM ), false, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetPropertyName(Shader::Property::PROGRAM), "program", TEST_LOCATION);
+ DALI_TEST_EQUALS(shader.GetPropertyIndex("program"), (Property::Index)Shader::Property::PROGRAM, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader.GetPropertyType(Shader::Property::PROGRAM), Property::MAP, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader.IsPropertyWritable(Shader::Property::PROGRAM), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader.IsPropertyAnimatable(Shader::Property::PROGRAM), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader.IsPropertyAConstraintInput(Shader::Property::PROGRAM), false, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a non-uniform shader property can be constrained");
- Shader shader = Shader::New(VertexSource, FragmentSource);
+ Shader shader = Shader::New(VertexSource, FragmentSource);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( shader.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION);
// Apply constraint
- Constraint constraint = Constraint::New<Vector4>( shader, colorIndex, TestConstraintNoBlue );
+ Constraint constraint = Constraint::New<Vector4>(shader, colorIndex, TestConstraintNoBlue);
constraint.Apply();
application.SendNotification();
application.Render(0);
// Expect no blue component in either buffer - yellow
- DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetCurrentProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION);
application.Render(0);
- DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetCurrentProperty<Vector4>(colorIndex), Color::YELLOW, TEST_LOCATION);
shader.RemoveConstraints();
- shader.SetProperty(colorIndex, Color::WHITE );
+ shader.SetProperty(colorIndex, Color::WHITE);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetCurrentProperty<Vector4>(colorIndex), Color::WHITE, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a uniform map shader property can be constrained");
- Shader shader = Shader::New(VertexSource, FragmentSource);
+ Shader shader = Shader::New(VertexSource, FragmentSource);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor);
TestGlAbstraction& gl = application.GetGlAbstraction();
application.Render(0);
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION);
// Apply constraint
- Constraint constraint = Constraint::New<Vector4>( shader, colorIndex, TestConstraintNoBlue );
+ Constraint constraint = Constraint::New<Vector4>(shader, colorIndex, TestConstraintNoBlue);
constraint.Apply();
application.SendNotification();
application.Render(0);
- // Expect no blue component in either buffer - yellow
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+ // Expect no blue component in either buffer - yellow
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION);
application.Render(0);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::YELLOW, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::YELLOW, TEST_LOCATION);
shader.RemoveConstraints();
- shader.SetProperty(colorIndex, Color::WHITE );
+ shader.SetProperty(colorIndex, Color::WHITE);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::WHITE, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::WHITE, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a non-uniform shader property can be animated");
- Shader shader = Shader::New(VertexSource, FragmentSource);
+ Shader shader = Shader::New(VertexSource, FragmentSource);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( shader.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetProperty<Vector4>(colorIndex), initialColor, TEST_LOCATION);
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, initialColor);
keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( shader, colorIndex ), keyFrames );
+ animation.AnimateBetween(Property(shader, colorIndex), keyFrames);
animation.Play();
application.SendNotification();
application.Render(500);
- DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::WHITE * 0.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetCurrentProperty<Vector4>(colorIndex), Color::WHITE * 0.5f, TEST_LOCATION);
application.Render(500);
- DALI_TEST_EQUALS( shader.GetCurrentProperty< Vector4 >( colorIndex ), Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetCurrentProperty<Vector4>(colorIndex), Color::TRANSPARENT, TEST_LOCATION);
END_TEST;
}
tet_infoline("Test that a uniform map shader property can be animated");
- Shader shader = Shader::New(VertexSource, FragmentSource);
+ Shader shader = Shader::New(VertexSource, FragmentSource);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
+ Renderer renderer = Renderer::New(geometry, shader);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
application.GetScene().Add(actor);
application.SendNotification();
application.Render(0);
- Vector4 initialColor = Color::WHITE;
- Property::Index colorIndex = shader.RegisterProperty( "uFadeColor", initialColor );
+ Vector4 initialColor = Color::WHITE;
+ Property::Index colorIndex = shader.RegisterProperty("uFadeColor", initialColor);
TestGlAbstraction& gl = application.GetGlAbstraction();
application.Render(0);
Vector4 actualValue(Vector4::ZERO);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, initialColor, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, initialColor, TEST_LOCATION);
- Animation animation = Animation::New(1.0f);
+ Animation animation = Animation::New(1.0f);
KeyFrames keyFrames = KeyFrames::New();
keyFrames.Add(0.0f, initialColor);
keyFrames.Add(1.0f, Color::TRANSPARENT);
- animation.AnimateBetween( Property( shader, colorIndex ), keyFrames );
+ animation.AnimateBetween(Property(shader, colorIndex), keyFrames);
animation.Play();
application.SendNotification();
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::WHITE * 0.5f, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::WHITE * 0.5f, TEST_LOCATION);
application.Render(500);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::TRANSPARENT, TEST_LOCATION);
// change shader program
Property::Map map;
- map["vertex"] = VertexSource;
+ map["vertex"] = VertexSource;
map["fragment"] = FragmentSource;
- map["hints"] = "MODIFIES_GEOMETRY";
- shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
+ map["hints"] = "MODIFIES_GEOMETRY";
+ shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map));
application.SendNotification();
application.Render(100);
// register another custom property as well
- Property::Index customIndex = shader.RegisterProperty( "uCustom", Vector3(1,2,3) );
- DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(1,2,3), TEST_LOCATION );
+ Property::Index customIndex = shader.RegisterProperty("uCustom", Vector3(1, 2, 3));
+ DALI_TEST_EQUALS(shader.GetProperty<Vector3>(customIndex), Vector3(1, 2, 3), TEST_LOCATION);
application.SendNotification();
application.Render(100);
- DALI_TEST_CHECK( gl.GetUniformValue<Vector4>( "uFadeColor", actualValue ) );
- DALI_TEST_EQUALS( actualValue, Color::TRANSPARENT, TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uFadeColor", actualValue));
+ DALI_TEST_EQUALS(actualValue, Color::TRANSPARENT, TEST_LOCATION);
Vector3 customValue;
- DALI_TEST_CHECK( gl.GetUniformValue<Vector3>( "uCustom", customValue ) );
- DALI_TEST_EQUALS( customValue, Vector3(1,2,3), TEST_LOCATION );
+ DALI_TEST_CHECK(gl.GetUniformValue<Vector3>("uCustom", customValue));
+ DALI_TEST_EQUALS(customValue, Vector3(1, 2, 3), TEST_LOCATION);
END_TEST;
}
tet_infoline("Test get/set progam property");
- Shader shader = Shader::New("", "");
+ Shader shader = Shader::New("", "");
std::string hintSet = "MODIFIES_GEOMETRY";
Property::Map map;
- map["vertex"] = VertexSource;
+ map["vertex"] = VertexSource;
map["fragment"] = FragmentSource;
- map["hints"] = hintSet;
+ map["hints"] = hintSet;
- shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
+ shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map));
// register a custom property as well
- Property::Index customIndex = shader.RegisterProperty( "custom", Vector3(1,2,3) );
- DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(1,2,3), TEST_LOCATION );
+ Property::Index customIndex = shader.RegisterProperty("custom", Vector3(1, 2, 3));
+ DALI_TEST_EQUALS(shader.GetProperty<Vector3>(customIndex), Vector3(1, 2, 3), TEST_LOCATION);
Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- DALI_TEST_CHECK( value.GetType() == Property::MAP);
+ DALI_TEST_CHECK(value.GetType() == Property::MAP);
const Property::Map* outMap = value.GetMap();
std::string v = (*outMap)["vertex"].Get<std::string>();
std::string f = (*outMap)["fragment"].Get<std::string>();
std::string h = (*outMap)["hints"].Get<std::string>();
- DALI_TEST_CHECK( v == VertexSource );
- DALI_TEST_CHECK( f == FragmentSource );
- DALI_TEST_CHECK( h == hintSet );
+ DALI_TEST_CHECK(v == VertexSource);
+ DALI_TEST_CHECK(f == FragmentSource);
+ DALI_TEST_CHECK(h == hintSet);
- value = shader.GetCurrentProperty( Shader::Property::PROGRAM );
- DALI_TEST_CHECK( value.GetType() == Property::MAP);
+ value = shader.GetCurrentProperty(Shader::Property::PROGRAM);
+ DALI_TEST_CHECK(value.GetType() == Property::MAP);
outMap = value.GetMap();
// check that changing the shader did not cause us to loose custom property
- DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(1,2,3), TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetProperty<Vector3>(customIndex), Vector3(1, 2, 3), TEST_LOCATION);
using Dali::Animation;
- Animation animation = Animation::New( 0.1f );
- animation.AnimateTo( Property( shader, customIndex ), Vector3(4,5,6) );
+ Animation animation = Animation::New(0.1f);
+ animation.AnimateTo(Property(shader, customIndex), Vector3(4, 5, 6));
animation.Play();
application.SendNotification();
application.Render(100);
- DALI_TEST_EQUALS( shader.GetProperty<Vector3>( customIndex ), Vector3(4,5,6), TEST_LOCATION );
+ DALI_TEST_EQUALS(shader.GetProperty<Vector3>(customIndex), Vector3(4, 5, 6), TEST_LOCATION);
v = (*outMap)["vertex"].Get<std::string>();
f = (*outMap)["fragment"].Get<std::string>();
h = (*outMap)["hints"].Get<std::string>();
- DALI_TEST_CHECK( v == VertexSource );
- DALI_TEST_CHECK( f == FragmentSource );
- DALI_TEST_CHECK( h == hintSet );
+ DALI_TEST_CHECK(v == VertexSource);
+ DALI_TEST_CHECK(f == FragmentSource);
+ DALI_TEST_CHECK(h == hintSet);
std::string hintGot;
- hintSet = "OUTPUT_IS_TRANSPARENT,MODIFIES_GEOMETRY";
+ hintSet = "OUTPUT_IS_TRANSPARENT,MODIFIES_GEOMETRY";
map["hints"] = hintSet;
- shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
- value = shader.GetProperty(Shader::Property::PROGRAM);
+ shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map));
+ value = shader.GetProperty(Shader::Property::PROGRAM);
hintGot = (*value.GetMap())["hints"].Get<std::string>();
- DALI_TEST_CHECK( hintGot == hintSet );
+ DALI_TEST_CHECK(hintGot == hintSet);
- hintSet = "OUTPUT_IS_TRANSPARENT";
+ hintSet = "OUTPUT_IS_TRANSPARENT";
map["hints"] = hintSet;
- shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
- value = shader.GetProperty(Shader::Property::PROGRAM);
+ shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map));
+ value = shader.GetProperty(Shader::Property::PROGRAM);
hintGot = (*value.GetMap())["hints"].Get<std::string>();
- DALI_TEST_CHECK( hintGot == hintSet );
+ DALI_TEST_CHECK(hintGot == hintSet);
- hintSet = "NONE";
+ hintSet = "NONE";
map["hints"] = hintSet;
- shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
- value = shader.GetProperty(Shader::Property::PROGRAM);
+ shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map));
+ value = shader.GetProperty(Shader::Property::PROGRAM);
hintGot = (*value.GetMap())["hints"].Get<std::string>();
- DALI_TEST_CHECK( hintGot == hintSet );
+ DALI_TEST_CHECK(hintGot == hintSet);
- hintSet = "";
+ hintSet = "";
map["hints"] = hintSet;
- shader.SetProperty( Shader::Property::PROGRAM, Property::Value(map) );
- value = shader.GetProperty(Shader::Property::PROGRAM);
+ shader.SetProperty(Shader::Property::PROGRAM, Property::Value(map));
+ value = shader.GetProperty(Shader::Property::PROGRAM);
hintGot = (*value.GetMap())["hints"].Get<std::string>();
- DALI_TEST_CHECK( hintGot == "NONE" );
+ DALI_TEST_CHECK(hintGot == "NONE");
END_TEST;
}
*/
// EXTERNAL INCLUDES
-#include <iostream>
#include <stdlib.h>
+#include <iostream>
+
// INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/signals/signal-delegate.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/signals/signal-delegate.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
-
void utc_dali_signal_delegate_startup(void)
{
test_return_value = TET_UNDEF;
class SignalDelegateTestClass : public Dali::ConnectionTracker
{
public:
-
- SignalDelegateTestClass( Actor connectActor, std::string connectSignal )
+ SignalDelegateTestClass(Actor connectActor, std::string connectSignal)
{
- mSignalDelegate = new SignalDelegate( connectActor, connectSignal );
+ mSignalDelegate = new SignalDelegate(connectActor, connectSignal);
}
void ConnectToInternalMember()
{
- mSignalDelegate->Connect( this, &SignalDelegateTestClass::SignalHandlerMemberFunction );
+ mSignalDelegate->Connect(this, &SignalDelegateTestClass::SignalHandlerMemberFunction);
}
bool IsConnected()
}
private:
-
void SignalHandlerMemberFunction()
{
- tet_infoline( "Got signal in member function\n" );
+ tet_infoline("Got signal in member function\n");
gSignalReceived = true;
}
}
};
-
// Test cases:
int UtcDaliSignalDelegateIsConnectedP(void)
{
TestApplication application;
- tet_infoline( " UtcDaliSignalDelegateIsConnectedP" );
+ tet_infoline(" UtcDaliSignalDelegateIsConnectedP");
// Set up an actor with a signal to connect to.
- Actor connectActor = Actor::New();
+ Actor connectActor = Actor::New();
std::string connectSignal = "onScene";
// Create the test class (this will create the delegate, but not connect to it yet.
- SignalDelegateTestClass testObject( connectActor, connectSignal );
+ SignalDelegateTestClass testObject(connectActor, connectSignal);
// Tell the test class to connect the delegate to it's internal member.
// Note: It is at this point that the delegate internally makes the connection.
testObject.ConnectToInternalMember();
- DALI_TEST_CHECK( testObject.IsConnected() );
+ DALI_TEST_CHECK(testObject.IsConnected());
END_TEST;
}
int UtcDaliSignalDelegateIsConnectedN(void)
{
TestApplication application;
- tet_infoline( " UtcDaliSignalDelegateIsConnectedN" );
+ tet_infoline(" UtcDaliSignalDelegateIsConnectedN");
// Set up an actor with a signal to connect to.
- Actor connectActor = Actor::New();
+ Actor connectActor = Actor::New();
std::string connectSignal = "onScene";
// Create the test class (this will create the delegate, but not connect to it yet.
- SignalDelegateTestClass testObject( connectActor, connectSignal );
+ SignalDelegateTestClass testObject(connectActor, connectSignal);
- DALI_TEST_CHECK( !testObject.IsConnected() );
+ DALI_TEST_CHECK(!testObject.IsConnected());
END_TEST;
}
int UtcDaliSignalDelegateConnectToMemberP(void)
{
TestApplication application;
- tet_infoline( " UtcDaliSignalDelegateConnectToMemberP" );
+ tet_infoline(" UtcDaliSignalDelegateConnectToMemberP");
// Set up an actor with a signal to connect to.
- Actor connectActor = Actor::New();
+ Actor connectActor = Actor::New();
std::string connectSignal = "onScene";
gSignalReceived = false;
// Create the test class (this will create the delegate, but not connect to it yet.
- SignalDelegateTestClass testObject( connectActor, connectSignal );
+ SignalDelegateTestClass testObject(connectActor, connectSignal);
// Tell the test class to connect the delegate to it's internal member.
// Note: It is at this point that the delegate internally makes the connection.
// Add the actor to the scene to trigger it's "onScene" signal.
// If the delegate connected correctly, this will call the member
// function in the test object and set a global flag.
- application.GetScene().Add( connectActor );
+ application.GetScene().Add(connectActor);
// Check the global flag to confirm the signal was received.
- DALI_TEST_CHECK( gSignalReceived );
+ DALI_TEST_CHECK(gSignalReceived);
END_TEST;
}
int UtcDaliSignalDelegateConnectToMemberN(void)
{
TestApplication application;
- tet_infoline( " UtcDaliSignalDelegateConnectToMemberN" );
+ tet_infoline(" UtcDaliSignalDelegateConnectToMemberN");
// Set up an actor with a signal to connect to.
- Actor connectActor = Actor::New();
+ Actor connectActor = Actor::New();
std::string connectSignal = "onScene";
gSignalReceived = false;
// Create the test class (this will create the delegate, but not connect to it yet.
- SignalDelegateTestClass testObject( connectActor, connectSignal );
+ SignalDelegateTestClass testObject(connectActor, connectSignal);
// Tell the test class to connect the delegate to it's internal member.
// Note: It is at this point that the delegate internally makes the connection.
testObject.ConnectToInternalMember();
// Check the global flag to confirm the signal was not received.
- DALI_TEST_CHECK( !gSignalReceived );
+ DALI_TEST_CHECK(!gSignalReceived);
END_TEST;
}
int UtcDaliSignalDelegateConnectToFunctorP(void)
{
TestApplication application;
- tet_infoline( " UtcDaliSignalDelegateConnectToFunctorP" );
+ tet_infoline(" UtcDaliSignalDelegateConnectToFunctorP");
// Set up an actor with a signal to connect to.
- Actor connectActor = Actor::New();
+ Actor connectActor = Actor::New();
std::string connectSignal = "onScene";
// Initialise the signal delegate with the actor to connect to and it's signal.
- SignalDelegate signalDelegate( connectActor, connectSignal );
+ SignalDelegate signalDelegate(connectActor, connectSignal);
// We need a connection tracker object to associated with the connection.
// This could normally be "this", but since we are not within a class, we pass
TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject();
// Check the signal delegate currently has no connection.
- DALI_TEST_CHECK( !signalDelegate.IsConnected() );
+ DALI_TEST_CHECK(!signalDelegate.IsConnected());
// Tell the signal delegate to connect to the given functor (via a functor delegate).
// Note: It is at this point that the delegate internally makes the connection.
- signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) );
+ signalDelegate.Connect(testTracker, FunctorDelegate::New(SignalDelegateTestFunctor()));
// Check the signal delegate has made the connection.
- DALI_TEST_CHECK( signalDelegate.IsConnected() );
+ DALI_TEST_CHECK(signalDelegate.IsConnected());
// Add the actor to the scene to trigger it's "onScene" signal.
// If the delegate connected correctly, this will call the () operator of our
// passed-in functor, the functor will in turn set a global flag.
- application.GetScene().Add( connectActor );
+ application.GetScene().Add(connectActor);
// Check the global flag to confirm the signal was received.
- DALI_TEST_CHECK( gSignalReceived );
+ DALI_TEST_CHECK(gSignalReceived);
END_TEST;
}
int UtcDaliSignalDelegateConnectToFunctorN(void)
{
TestApplication application;
- tet_infoline( " UtcDaliSignalDelegateConnectToFunctorN" );
+ tet_infoline(" UtcDaliSignalDelegateConnectToFunctorN");
// Set up an actor with a signal to connect to.
- Actor connectActor = Actor::New();
+ Actor connectActor = Actor::New();
std::string connectSignal = "onScene";
// Initialise the signal delegate with the actor to connect to and it's signal.
- SignalDelegate signalDelegate( connectActor, connectSignal );
+ SignalDelegate signalDelegate(connectActor, connectSignal);
// We need a connection tracker object to associated with the connection.
// This could normally be "this", but since we are not within a class, we pass
TestConnectionTrackerObject* testTracker = new TestConnectionTrackerObject();
// Check the signal delegate currently has no connection.
- DALI_TEST_CHECK( !signalDelegate.IsConnected() );
+ DALI_TEST_CHECK(!signalDelegate.IsConnected());
// Tell the signal delegate to connect to the given functor (via a functor delegate).
// Note: It is at this point that the delegate internally makes the connection.
- signalDelegate.Connect( testTracker, FunctorDelegate::New( SignalDelegateTestFunctor() ) );
+ signalDelegate.Connect(testTracker, FunctorDelegate::New(SignalDelegateTestFunctor()));
// Check the signal delegate has made the connection.
- DALI_TEST_CHECK( signalDelegate.IsConnected() );
+ DALI_TEST_CHECK(signalDelegate.IsConnected());
// Check the global flag to confirm the signal was received.
- DALI_TEST_CHECK( !gSignalReceived );
+ DALI_TEST_CHECK(!gSignalReceived);
END_TEST;
}
*/
// EXTERNAL INCLUDES
-#include <iostream>
#include <stdlib.h>
+#include <iostream>
+
// INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+
#include "signal-helper.h"
using namespace Dali;
test_return_value = TET_PASS;
}
-namespace {
-
-
-bool wasStaticVoidCallbackVoidCalled = false;
-bool wasStaticFloatCallbackVoidCalled = false;
-bool wasStaticVoidCallbackIntValueCalled = false;
-int staticIntValue = 0;
-bool wasStaticFloatCallbackFloatValueFloatValueCalled = false;
-float staticFloatValue1 = 0.0f;
-float staticFloatValue2 = 0.0f;
+namespace
+{
+bool wasStaticVoidCallbackVoidCalled = false;
+bool wasStaticFloatCallbackVoidCalled = false;
+bool wasStaticVoidCallbackIntValueCalled = false;
+int staticIntValue = 0;
+bool wasStaticFloatCallbackFloatValueFloatValueCalled = false;
+float staticFloatValue1 = 0.0f;
+float staticFloatValue2 = 0.0f;
void StaticVoidCallbackVoid()
{
return 7.0f;
}
-void StaticVoidCallbackIntValue( int value )
+void StaticVoidCallbackIntValue(int value)
{
wasStaticVoidCallbackIntValueCalled = true;
- staticIntValue = value;
+ staticIntValue = value;
}
-float StaticFloatCallbackFloatValueFloatValue( float value1, float value2 )
+float StaticFloatCallbackFloatValueFloatValue(float value1, float value2)
{
wasStaticFloatCallbackFloatValueFloatValueCalled = true;
- staticFloatValue1 = value1;
- staticFloatValue2 = value2;
+ staticFloatValue1 = value1;
+ staticFloatValue2 = value2;
return value1 + value2;
}
-} // anon namespace
-
-
+} // namespace
/*******************************************
*
{
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
}
// Test that Empty() is true, when a slot has connected and disconnected
{
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid );
- signal.Disconnect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( signal.Empty() );
+ TestSlotHandler handler;
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ signal.Disconnect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(signal.Empty());
}
END_TEST;
// Test that Empty() is false after signal connection
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ TestSlotHandler handler;
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
END_TEST;
}
TestApplication application; // Create core for debug logging
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( signal.GetConnectionCount() == 1 );
+ TestSlotHandler handler;
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(signal.GetConnectionCount() == 1);
TestSlotHandler handler2;
- signal.Connect( &handler2, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( signal.GetConnectionCount() == 2 );
+ signal.Connect(&handler2, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(signal.GetConnectionCount() == 2);
END_TEST;
}
int UtcDaliSignalGetConnectionCountN(void)
{
- TestApplication application; // Create core for debug logging
+ TestApplication application; // Create core for debug logging
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.GetConnectionCount() == 0 );
+ DALI_TEST_CHECK(signal.GetConnectionCount() == 0);
END_TEST;
}
// test static function: void Connect( void (*func)() )
TestSignals::VoidRetNoParamSignal signal;
- signal.Connect( StaticVoidCallbackVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
-
+ signal.Connect(StaticVoidCallbackVoid);
+ DALI_TEST_CHECK(!signal.Empty());
END_TEST;
}
TestApplication application; // Create core for debug logging
TestSignals::VoidRetNoParamSignal signal;
- signal.Connect( NULL );
+ signal.Connect(NULL);
try
{
signal.Emit();
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
// Tests that a negative test of an assertion succeeds
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_PASS);
}
END_TEST;
}
-
int UtcDaliSignalConnectP02(void)
{
TestApplication application; // Create core for debug logging
// test member function: Connect( X* obj, void (X::*func)() ))
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ TestSlotHandler handler;
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_CHECK( handler.mHandled == true );
+ DALI_TEST_CHECK(handler.mHandled == true);
END_TEST;
}
try
{
// test member function: Connect( X* obj, void (X::*func)() )) with NULL object
- signal.Connect( static_cast<TestSlotHandler*>(NULL), &TestSlotHandler::VoidSlotVoid );
+ signal.Connect(static_cast<TestSlotHandler*>(NULL), &TestSlotHandler::VoidSlotVoid);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
// Tests that a negative test of an assertion succeeds
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
tet_result(TET_PASS);
}
END_TEST;
}
-
int UtcDaliSignalConnectP03(void)
{
TestApplication application; // Create core for debug logging
// test slot delegate: Connect( SlotDelegate<X>& delegate, void (X::*func)() )
TestSignals::VoidRetNoParamSignal signal;
- TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ TestSlotDelegateHandler handler;
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_CHECK( handler.mHandled == true );
+ DALI_TEST_CHECK(handler.mHandled == true);
END_TEST;
}
{
TestApplication application; // Create core for debug logging
// the delegate is passed by reference, so you can't pass null.
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
END_TEST;
}
TestApplication application; // Create core for debug logging
// test function object: Connect( ConnectionTrackerInterface* connectionTracker, const X& func )
- TestSlotHandler handler;
+ TestSlotHandler handler;
TestSignals::VoidRetNoParamSignal signal;
- bool functorCalled(false);
- TestFunctor functor( functorCalled );
- signal.Connect( &handler, functor );
- DALI_TEST_CHECK( ! signal.Empty() );
+ bool functorCalled(false);
+ TestFunctor functor(functorCalled);
+ signal.Connect(&handler, functor);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_CHECK( functorCalled == true );
+ DALI_TEST_CHECK(functorCalled == true);
END_TEST;
}
{
// for negative test we try to connect a null connection tracker to the signal
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler *nullHandler( NULL );
+ TestSlotHandler* nullHandler(NULL);
try
{
- signal.Connect( nullHandler , &TestSlotHandler::VoidSlotVoid );
+ signal.Connect(nullHandler, &TestSlotHandler::VoidSlotVoid);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
// Tests that a negative test of an assertion succeeds
- DALI_TEST_PRINT_ASSERT( e );
- tet_result( TET_PASS );
+ DALI_TEST_PRINT_ASSERT(e);
+ tet_result(TET_PASS);
}
END_TEST;
-
}
int UtcDaliSignalConnectP05(void)
// test function object using FunctorDelegate.
// :Connect( ConnectionTrackerInterface* connectionTracker, FunctorDelegate* delegate )
{
- TestSlotHandler handler;
+ TestSlotHandler handler;
TestSignals::VoidRetNoParamSignal signal;
- bool functorDelegateCalled(false);
- signal.Connect( &handler, FunctorDelegate::New( VoidFunctorVoid(functorDelegateCalled) ));
- DALI_TEST_CHECK( ! signal.Empty() );
+ bool functorDelegateCalled(false);
+ signal.Connect(&handler, FunctorDelegate::New(VoidFunctorVoid(functorDelegateCalled)));
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_CHECK( functorDelegateCalled == true );
+ DALI_TEST_CHECK(functorDelegateCalled == true);
}
{
- TestSlotHandler handler;
+ TestSlotHandler handler;
TestSignals::VoidRet1ValueParamSignal signal;
- bool functorDelegateCalled(false);
- signal.Connect( &handler, FunctorDelegate::New( VoidFunctorVoid(functorDelegateCalled) ));
- DALI_TEST_CHECK( ! signal.Empty() );
+ bool functorDelegateCalled(false);
+ signal.Connect(&handler, FunctorDelegate::New(VoidFunctorVoid(functorDelegateCalled)));
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit(1);
}
END_TEST;
// for negative test we try to connect a null connection tracker to the signal
// :Connect( ConnectionTrackerInterface == NULL, FunctorDelegate* delegate )
- TestSlotHandler *nullHandler( NULL );
+ TestSlotHandler* nullHandler(NULL);
TestSignals::VoidRetNoParamSignal signal;
- bool functorDelegateCalled(false);
+ bool functorDelegateCalled(false);
try
{
- signal.Connect( nullHandler, FunctorDelegate::New( VoidFunctorVoid(functorDelegateCalled) ));
+ signal.Connect(nullHandler, FunctorDelegate::New(VoidFunctorVoid(functorDelegateCalled)));
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- tet_result( TET_PASS );
+ DALI_TEST_PRINT_ASSERT(e);
+ tet_result(TET_PASS);
}
END_TEST;
}
-
/**
* there 3 different disconnect functions
* we go through them here in order of definition in dali-signal.h
// test static function: Disconnect( void (*func)( Arg0 arg0 ) )
TestSignals::VoidRetNoParamSignal signal;
- signal.Connect( StaticVoidCallbackVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
- signal.Disconnect( StaticVoidCallbackVoid );
- DALI_TEST_CHECK( signal.Empty() );
+ signal.Connect(StaticVoidCallbackVoid);
+ DALI_TEST_CHECK(!signal.Empty());
+ signal.Disconnect(StaticVoidCallbackVoid);
+ DALI_TEST_CHECK(signal.Empty());
END_TEST;
-
- }
+}
int UtcDaliSignalDisconnectN01(void)
{
TestApplication application; // Create core for debug logging
// 1. Disconnect using the function
TestSignals::VoidRetNoParamSignal signal;
- signal.Connect( StaticVoidCallbackVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(StaticVoidCallbackVoid);
+ DALI_TEST_CHECK(!signal.Empty());
- signal.Disconnect( AlternativeVoidCallbackVoid );
+ signal.Disconnect(AlternativeVoidCallbackVoid);
- DALI_TEST_CHECK( ! signal.Empty() );
+ DALI_TEST_CHECK(!signal.Empty());
END_TEST;
}
// test member function: Disconnect( X* obj, void (X::*func)( Arg0 arg0 ) )
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
- signal.Disconnect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( signal.Empty() );
+ TestSlotHandler handler;
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
+ signal.Disconnect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(signal.Empty());
END_TEST;
-
}
int UtcDaliSignalDisconnectN02(void)
{
// 1. Disconnect using a null connection tracker
TestSignals::VoidRetNoParamSignal signal;
- TestSlotHandler handler;
+ TestSlotHandler handler;
- signal.Connect( &handler , &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( !signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
try
{
- TestSlotHandler* nullHandler( NULL );
- signal.Disconnect( nullHandler , &TestSlotHandler::VoidSlotVoid );
+ TestSlotHandler* nullHandler(NULL);
+ signal.Disconnect(nullHandler, &TestSlotHandler::VoidSlotVoid);
}
catch(Dali::DaliException& e)
{
// Tests that a negative test of an assertion succeeds
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_CHECK( !signal.Empty() );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_CHECK(!signal.Empty());
}
END_TEST;
}
// test slot delegate: Disconnect( SlotDelegate<X>& delegate, void (X::*func)( Arg0 arg0 ) )
TestSignals::VoidRetNoParamSignal signal;
- TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
- signal.Disconnect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid );
- DALI_TEST_CHECK( signal.Empty() );
+ TestSlotDelegateHandler handler;
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
+ signal.Disconnect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(signal.Empty());
END_TEST;
}
{
TestApplication application; // Create core for debug logging
- // try to disconnect from the wrong signal
+ // try to disconnect from the wrong signal
TestSignals::VoidRetNoParamSignal signal;
- TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid );
+ TestSlotDelegateHandler handler;
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
// use different signal
- signal.Disconnect( handler.mSlotDelegate , &TestSlotDelegateHandler::AlternativeVoidSlotVoid );
+ signal.Disconnect(handler.mSlotDelegate, &TestSlotDelegateHandler::AlternativeVoidSlotVoid);
- DALI_TEST_CHECK( !signal.Empty() );
+ DALI_TEST_CHECK(!signal.Empty());
END_TEST;
-
}
/*******************************************
{
TestSignals::VoidRetNoParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
signal.Emit();
{
TestSignals::VoidRet1ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- signal.Emit( 10 );
+ signal.Emit(10);
}
{
TestSignals::VoidRet1RefParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotIntRef );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotIntRef);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- int temp( 5 );
- signal.Emit( temp );
+ int temp(5);
+ signal.Emit(temp);
}
{
TestSignals::VoidRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::VoidSlotIntValueIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::VoidSlotIntValueIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- signal.Emit( 1, 2 );
+ signal.Emit(1, 2);
}
{
TestSignals::BoolRet1ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::BoolSlotFloatValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::BoolSlotFloatValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- bool blah = signal.Emit( 1.0f );
- DALI_TEST_CHECK( ! blah );
+ bool blah = signal.Emit(1.0f);
+ DALI_TEST_CHECK(!blah);
}
{
TestSignals::BoolRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::BoolSlotFloatValueIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::BoolSlotFloatValueIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- bool blah = signal.Emit( 1.0f, 2 );
- DALI_TEST_CHECK( ! blah );
+ bool blah = signal.Emit(1.0f, 2);
+ DALI_TEST_CHECK(!blah);
}
{
TestSignals::IntRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::IntSlotFloatValueIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::IntSlotFloatValueIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- int blah = signal.Emit( 10.0f, 100 );
- DALI_TEST_CHECK( 0 == blah );
+ int blah = signal.Emit(10.0f, 100);
+ DALI_TEST_CHECK(0 == blah);
}
{
TestSignals::FloatRet0ParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
- signal.Connect( &handler, &TestSlotHandler::FloatSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&handler, &TestSlotHandler::FloatSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
float blah = signal.Emit();
- DALI_TEST_CHECK( 0.0f == blah );
+ DALI_TEST_CHECK(0.0f == blah);
}
{
TestSignals::FloatRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotHandler handler;
signal.Connect(&handler, &TestSlotHandler::FloatSlotFloatValueFloatValue);
- DALI_TEST_CHECK( ! signal.Empty() );
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- float blah = signal.Emit( 3.0f, 4.0f );
- DALI_TEST_CHECK( 0.0f == blah );
+ float blah = signal.Emit(3.0f, 4.0f);
+ DALI_TEST_CHECK(0.0f == blah);
}
END_TEST;
}
{
TestSlotHandler handlers;
signals.SignalVoidNone().Connect(&handlers, &TestSlotHandler::VoidSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
// Test double emission
handlers.mHandled = false;
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalVoid1Ref().Connect(&handlers, &TestSlotHandler::VoidSlotIntRef);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
int x = 7;
signals.EmitVoidSignalIntRef(x);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 7, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalVoid1Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignal1IntValue(5);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 5, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalVoid2Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignal2IntValue(6, 7);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 6, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 7, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalBool1Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
// repeat with opposite return value
handlers.mBoolReturn = false;
- handlers.mHandled = false;
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 6.0f, TEST_LOCATION );
+ handlers.mHandled = false;
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 6.0f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalBool2Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 10, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalInt2Value().Connect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mIntReturn = 27;
- int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5);
- DALI_TEST_EQUALS( x, 27, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 33.5f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 5, TEST_LOCATION );
+ int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5);
+ DALI_TEST_EQUALS(x, 27, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 33.5f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 5, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalFloat0().Connect(&handlers, &TestSlotHandler::FloatSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
- float f = signals.EmitFloat0Signal();
- DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ float f = signals.EmitFloat0Signal();
+ DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalFloat2Value().Connect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
- float f = signals.EmitFloat2VSignal(5, 33.0f);
- DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION );
+ float f = signals.EmitFloat2VSignal(5, 33.0f);
+ DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.VoidSignalFloatValue3().Connect(&handlers, &TestSlotHandler::VoidSlotFloatValue3);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignalFloatValue3(5, 33.0f, 100.0f);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotHandler handlers;
signals.SignalFloat3Value().Connect(&handlers, &TestSlotHandler::FloatSlotFloatValue3);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
- float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f);
- DALI_TEST_EQUALS( returnValue, 27.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION );
+ float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f);
+ DALI_TEST_EQUALS(returnValue, 27.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
END_TEST;
int UtcDaliSignalConnectAndEmit02P(void)
{
// testing connection of static functions
- TestSignals signals;
+ TestSignals signals;
StaticFunctionHandlers handlers;
// void ( void )
- signals.SignalVoidNone().Connect( &StaticFunctionHandlers::VoidSlotVoid );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
+ signals.SignalVoidNone().Connect(&StaticFunctionHandlers::VoidSlotVoid);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// void ( p1 )
handlers.Reset();
- signals.SignalVoid1Value().Connect( &StaticFunctionHandlers::VoidSlot1Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
- signals.EmitVoidSignal1IntValue( 1 );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
+ signals.SignalVoid1Value().Connect(&StaticFunctionHandlers::VoidSlot1Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
+ signals.EmitVoidSignal1IntValue(1);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// void ( p1, p2 )
handlers.Reset();
- signals.SignalVoid2Value().Connect( &StaticFunctionHandlers::VoidSlot2Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
- signals.EmitVoidSignal2IntValue( 1, 2 );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
-
+ signals.SignalVoid2Value().Connect(&StaticFunctionHandlers::VoidSlot2Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
+ signals.EmitVoidSignal2IntValue(1, 2);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// void ( p1, p2, p3 )
handlers.Reset();
- signals.SignalVoid3Value().Connect( &StaticFunctionHandlers::VoidSlot3Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
- signals.EmitVoidSignal3IntValue( 1, 2, 3 );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
+ signals.SignalVoid3Value().Connect(&StaticFunctionHandlers::VoidSlot3Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
+ signals.EmitVoidSignal3IntValue(1, 2, 3);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// ret ( )
handlers.Reset();
- signals.SignalFloat0().Connect( &StaticFunctionHandlers::RetSlot0Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
+ signals.SignalFloat0().Connect(&StaticFunctionHandlers::RetSlot0Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
signals.EmitFloat0Signal();
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// ret ( p1 )
handlers.Reset();
- signals.SignalFloat1Value().Connect( &StaticFunctionHandlers::RetSlot1Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
- signals.EmitFloat1VSignal( 1.f );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
+ signals.SignalFloat1Value().Connect(&StaticFunctionHandlers::RetSlot1Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
+ signals.EmitFloat1VSignal(1.f);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// ret ( p1, p2 )
handlers.Reset();
- signals.SignalFloat2Value().Connect( &StaticFunctionHandlers::RetSlot2Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
- signals.EmitFloat2VSignal( 1.f, 2.f );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
-
+ signals.SignalFloat2Value().Connect(&StaticFunctionHandlers::RetSlot2Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
+ signals.EmitFloat2VSignal(1.f, 2.f);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
// ret ( p1, p2, p3 )
handlers.Reset();
- signals.SignalFloat3Value().Connect( &StaticFunctionHandlers::RetSlot3Param );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, false, TEST_LOCATION );
- signals.EmitFloat3VSignal( 1.f, 2.f, 3.f );
- DALI_TEST_EQUALS( handlers.staticFunctionHandled, true, TEST_LOCATION );
+ signals.SignalFloat3Value().Connect(&StaticFunctionHandlers::RetSlot3Param);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, false, TEST_LOCATION);
+ signals.EmitFloat3VSignal(1.f, 2.f, 3.f);
+ DALI_TEST_EQUALS(handlers.staticFunctionHandled, true, TEST_LOCATION);
END_TEST;
-
}
-
int UtcDaliSignalDisconnect(void)
{
// Test that callbacks don't occur if a signal is disconnected before emission
{
TestSlotHandler handlers;
signals.SignalVoidNone().Connect(&handlers, &TestSlotHandler::VoidSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.SignalVoidNone().Disconnect(&handlers, &TestSlotHandler::VoidSlotVoid);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalVoid1Ref().Connect(&handlers, &TestSlotHandler::VoidSlotIntRef);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- int r = 7;
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ int r = 7;
handlers.mIntReturn = 5;
signals.SignalVoid1Ref().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntRef);
signals.EmitVoidSignalIntRef(r);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( r, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(r, 7, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalVoid1Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.SignalVoid1Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValue);
signals.EmitVoidSignal1IntValue(5);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalVoid2Value().Connect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.SignalVoid2Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue);
signals.EmitVoidSignal2IntValue(5, 10);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalBool1Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
signals.SignalBool1Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalBool2Value().Connect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
signals.SignalBool2Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue);
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalInt2Value().Connect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mIntReturn = 27;
signals.SignalInt2Value().Disconnect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue);
signals.EmitIntSignalFloatValueIntValue(5, 33.0f);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalFloat0().Connect(&handlers, &TestSlotHandler::FloatSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
signals.SignalFloat0().Disconnect(&handlers, &TestSlotHandler::FloatSlotVoid);
signals.EmitFloat0Signal();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalFloat2Value().Connect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
signals.SignalFloat2Value().Disconnect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue);
signals.EmitFloat2VSignal(5, 33.0f);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
END_TEST;
}
TestSlotHandler handlers;
signals.SignalVoidNone().Disconnect(&handlers, &TestSlotHandler::VoidSlotVoid);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
}
{
TestSlotHandler handlers;
- int r = 7;
+ int r = 7;
signals.SignalVoid1Ref().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntRef);
signals.EmitVoidSignalIntRef(r);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( r, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(r, 7, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalVoid1Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValue);
signals.EmitVoidSignal1IntValue(5);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalVoid2Value().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntValueIntValue);
signals.EmitVoidSignal2IntValue(5, 10);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION);
}
{
TestSlotHandler handlers;
handlers.mBoolReturn = true;
signals.SignalBool1Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
}
{
TestSlotHandler handlers;
handlers.mBoolReturn = true;
signals.SignalBool2Value().Disconnect(&handlers, &TestSlotHandler::BoolSlotFloatValueIntValue);
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION);
}
{
handlers.mIntReturn = 27;
signals.SignalInt2Value().Disconnect(&handlers, &TestSlotHandler::IntSlotFloatValueIntValue);
signals.EmitIntSignalFloatValueIntValue(5, 33.0f);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
{
handlers.mFloatReturn = 27.0f;
signals.SignalFloat2Value().Disconnect(&handlers, &TestSlotHandler::FloatSlotFloatValueFloatValue);
signals.EmitFloat2VSignal(5, 33.0f);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
{
handlers.mFloatReturn = 27.0f;
signals.SignalFloat0().Disconnect(&handlers, &TestSlotHandler::FloatSlotVoid);
signals.EmitFloat0Signal();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
END_TEST;
}
{
TestSlotHandler handlers;
signals.SignalVoidNone().Connect(&handlers, &TestSlotHandler::VoidSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
// Emit first
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
// Disconnect and emit again
handlers.mHandled = false;
signals.SignalVoidNone().Disconnect(&handlers, &TestSlotHandler::VoidSlotVoid);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
}
{
TestSlotHandler handlers;
signals.SignalVoid1Ref().Connect(&handlers, &TestSlotHandler::VoidSlotIntRef);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
int r = 7;
// Emit first
signals.EmitVoidSignalIntRef(r);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 7, TEST_LOCATION);
// Disconnect and emit again
- handlers.mHandled = false;
+ handlers.mHandled = false;
handlers.mIntParam1 = 0;
signals.SignalVoid1Ref().Disconnect(&handlers, &TestSlotHandler::VoidSlotIntRef);
signals.EmitVoidSignalIntRef(r);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( r, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(r, 7, TEST_LOCATION);
}
END_TEST;
}
{
TestSignals::VoidRetNoParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestBasicConnectionTrackerInterface customTracker;
- signal.Connect( &customTracker, &TestBasicConnectionTrackerInterface::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(&customTracker, &TestBasicConnectionTrackerInterface::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
signal.Emit();
// Test signal emission & destruction
{
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
- DALI_TEST_EQUALS( 0u, customTracker2.GetConnectionCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(signal.Empty());
+ DALI_TEST_EQUALS(0u, customTracker2.GetConnectionCount(), TEST_LOCATION);
- signal.Connect( &customTracker2, &TestBasicConnectionTrackerInterface::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
- DALI_TEST_EQUALS( 1u, customTracker2.GetConnectionCount(), TEST_LOCATION );
+ signal.Connect(&customTracker2, &TestBasicConnectionTrackerInterface::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
+ DALI_TEST_EQUALS(1u, customTracker2.GetConnectionCount(), TEST_LOCATION);
- DALI_TEST_EQUALS( customTracker2.mCallbackHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(customTracker2.mCallbackHandled, false, TEST_LOCATION);
signal.Emit();
- DALI_TEST_EQUALS( customTracker2.mCallbackHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(customTracker2.mCallbackHandled, true, TEST_LOCATION);
}
- DALI_TEST_EQUALS( 0u, customTracker2.GetConnectionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, customTracker2.GetConnectionCount(), TEST_LOCATION);
// Test for removing a null callback
{
- TestBasicConnectionTrackerInterface customTracker3;
-
- TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
- DALI_TEST_EQUALS( 0u, customTracker3.GetConnectionCount(), TEST_LOCATION );
-
- signal.Connect( &customTracker3, &TestBasicConnectionTrackerInterface::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
- DALI_TEST_EQUALS( 1u, customTracker3.GetConnectionCount(), TEST_LOCATION );
- try
- {
- // should assert
- customTracker3.RemoveNullCallback();
- tet_result( TET_FAIL );
- }
- catch (Dali::DaliException& e)
- {
- tet_result( TET_PASS );
- }
- }
+ TestBasicConnectionTrackerInterface customTracker3;
+
+ TestSignals::VoidRetNoParamSignal signal;
+ DALI_TEST_CHECK(signal.Empty());
+ DALI_TEST_EQUALS(0u, customTracker3.GetConnectionCount(), TEST_LOCATION);
+
+ signal.Connect(&customTracker3, &TestBasicConnectionTrackerInterface::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
+ DALI_TEST_EQUALS(1u, customTracker3.GetConnectionCount(), TEST_LOCATION);
+ try
+ {
+ // should assert
+ customTracker3.RemoveNullCallback();
+ tet_result(TET_FAIL);
+ }
+ catch(Dali::DaliException& e)
+ {
+ tet_result(TET_PASS);
+ }
+ }
END_TEST;
}
{
TestSlotHandler handler1;
- signals.SignalVoidNone().Connect( &handler1, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
+ signals.SignalVoidNone().Connect(&handler1, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
TestSlotHandler handler2;
- signals.SignalVoidNone().Connect( &handler2, &TestSlotHandler::VoidSlotVoid );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
+ signals.SignalVoidNone().Connect(&handler2, &TestSlotHandler::VoidSlotVoid);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION);
// Remove first connection and repeat
handler1.Reset();
handler2.Reset();
- signals.SignalVoidNone().Disconnect( &handler1, &TestSlotHandler::VoidSlotVoid );
+ signals.SignalVoidNone().Disconnect(&handler1, &TestSlotHandler::VoidSlotVoid);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION);
}
{
TestSlotHandler handler1;
- signals.SignalVoid1Ref().Connect( &handler1, &TestSlotHandler::VoidSlotIntRef );
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Ref().Connect(&handler1, &TestSlotHandler::VoidSlotIntRef);
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
TestSlotHandler handler2;
- signals.SignalVoid1Ref().Connect( &handler2, &TestSlotHandler::VoidSlotIntRef );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Ref().Connect(&handler2, &TestSlotHandler::VoidSlotIntRef);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
int x = 7;
signals.EmitVoidSignalIntRef(x);
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 7, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mIntParam1, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 7, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mIntParam1, 7, TEST_LOCATION);
// Remove second connection and repeat
handler1.Reset();
handler2.Reset();
x = 8;
- signals.SignalVoid1Ref().Disconnect( &handler2, &TestSlotHandler::VoidSlotIntRef );
+ signals.SignalVoid1Ref().Disconnect(&handler2, &TestSlotHandler::VoidSlotIntRef);
signals.EmitVoidSignalIntRef(x);
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 8, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mIntParam1, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 8, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mIntParam1, 0, TEST_LOCATION);
}
{
TestSlotHandler handler1;
- signals.SignalVoid1Value().Connect( &handler1, &TestSlotHandler::VoidSlotIntValue );
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Value().Connect(&handler1, &TestSlotHandler::VoidSlotIntValue);
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
TestSlotHandler handler2;
- signals.SignalVoid1Value().Connect( &handler2, &TestSlotHandler::VoidSlotIntValue );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Value().Connect(&handler2, &TestSlotHandler::VoidSlotIntValue);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
TestSlotHandler handler3;
- signals.SignalVoid1Value().Connect( &handler3, &TestSlotHandler::VoidSlotIntValue );
- DALI_TEST_EQUALS( handler3.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Value().Connect(&handler3, &TestSlotHandler::VoidSlotIntValue);
+ DALI_TEST_EQUALS(handler3.mHandled, false, TEST_LOCATION);
- signals.EmitVoidSignal1IntValue( 5 );
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 5, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mIntParam1, 5, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mIntParam1, 5, TEST_LOCATION );
+ signals.EmitVoidSignal1IntValue(5);
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mIntParam1, 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mIntParam1, 5, TEST_LOCATION);
// Remove middle connection and repeat
handler1.Reset();
handler2.Reset();
handler3.Reset();
- signals.SignalVoid1Value().Disconnect( &handler2, &TestSlotHandler::VoidSlotIntValue );
+ signals.SignalVoid1Value().Disconnect(&handler2, &TestSlotHandler::VoidSlotIntValue);
- signals.EmitVoidSignal1IntValue( 6 );
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 6, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mIntParam1, 6, TEST_LOCATION );
+ signals.EmitVoidSignal1IntValue(6);
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mIntParam1, 6, TEST_LOCATION);
}
// Test that multiple callbacks are disconnected when a signal is destroyed
{
TestSignals::VoidRet1ValueParamSignal tempSignal;
- DALI_TEST_EQUALS( handler4.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler5.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler6.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler4.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler5.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler6.GetConnectionCount(), 0u, TEST_LOCATION);
- tempSignal.Connect( &handler4, &TestSlotHandler::VoidSlotIntValue );
- tempSignal.Connect( &handler5, &TestSlotHandler::VoidSlotIntValue );
- tempSignal.Connect( &handler6, &TestSlotHandler::VoidSlotIntValue );
+ tempSignal.Connect(&handler4, &TestSlotHandler::VoidSlotIntValue);
+ tempSignal.Connect(&handler5, &TestSlotHandler::VoidSlotIntValue);
+ tempSignal.Connect(&handler6, &TestSlotHandler::VoidSlotIntValue);
- DALI_TEST_EQUALS( handler4.GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler5.GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler6.GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler4.GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler5.GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler6.GetConnectionCount(), 1u, TEST_LOCATION);
}
// End of tempSignal lifetime
- DALI_TEST_EQUALS( handler4.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler5.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler6.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler4.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler5.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler6.GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
TestSlotHandler handler1;
// Note the double connection is intentional
- signals.SignalVoid1Value().Connect( &handler1, &TestSlotHandler::VoidSlotIntValue );
- signals.SignalVoid1Value().Connect( &handler1, &TestSlotHandler::VoidSlotIntValue );
- DALI_TEST_EQUALS( handler1.mHandledCount, 0, TEST_LOCATION );
+ signals.SignalVoid1Value().Connect(&handler1, &TestSlotHandler::VoidSlotIntValue);
+ signals.SignalVoid1Value().Connect(&handler1, &TestSlotHandler::VoidSlotIntValue);
+ DALI_TEST_EQUALS(handler1.mHandledCount, 0, TEST_LOCATION);
- signals.EmitVoidSignal1IntValue( 6 );
- DALI_TEST_EQUALS( handler1.mHandledCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 6, TEST_LOCATION );
+ signals.EmitVoidSignal1IntValue(6);
+ DALI_TEST_EQUALS(handler1.mHandledCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 6, TEST_LOCATION);
// Calling Disconnect once should be enough
- signals.SignalVoid1Value().Disconnect( &handler1, &TestSlotHandler::VoidSlotIntValue );
- DALI_TEST_CHECK( signals.SignalVoid1Value().Empty() );
+ signals.SignalVoid1Value().Disconnect(&handler1, &TestSlotHandler::VoidSlotIntValue);
+ DALI_TEST_CHECK(signals.SignalVoid1Value().Empty());
handler1.mIntParam1 = 0;
- signals.EmitVoidSignal1IntValue( 7 );
- DALI_TEST_EQUALS( handler1.mHandledCount, 1/*not incremented since last check*/, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 0, TEST_LOCATION );
+ signals.EmitVoidSignal1IntValue(7);
+ DALI_TEST_EQUALS(handler1.mHandledCount, 1 /*not incremented since last check*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 0, TEST_LOCATION);
}
// Test automatic disconnect after multiple Connect() calls
{
TestSlotHandler handler2;
- signals.SignalVoid1Value().Connect( &handler2, &TestSlotHandler::VoidSlotIntValue );
- signals.SignalVoid1Value().Connect( &handler2, &TestSlotHandler::VoidSlotIntValue );
+ signals.SignalVoid1Value().Connect(&handler2, &TestSlotHandler::VoidSlotIntValue);
+ signals.SignalVoid1Value().Connect(&handler2, &TestSlotHandler::VoidSlotIntValue);
TestSlotHandler handler3;
- signals.SignalBool1Value().Connect( &handler3, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler3, &TestSlotHandler::BoolSlotFloatValue );
+ signals.SignalBool1Value().Connect(&handler3, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler3, &TestSlotHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( handler2.mHandledCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mHandledCount, 0, TEST_LOCATION );
- DALI_TEST_CHECK( ! signals.SignalVoid1Value().Empty() );
- DALI_TEST_CHECK( ! signals.SignalBool1Value().Empty() );
+ DALI_TEST_EQUALS(handler2.mHandledCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mHandledCount, 0, TEST_LOCATION);
+ DALI_TEST_CHECK(!signals.SignalVoid1Value().Empty());
+ DALI_TEST_CHECK(!signals.SignalBool1Value().Empty());
}
- DALI_TEST_CHECK( signals.SignalVoid1Value().Empty() );
- DALI_TEST_CHECK( signals.SignalBool1Value().Empty() );
+ DALI_TEST_CHECK(signals.SignalVoid1Value().Empty());
+ DALI_TEST_CHECK(signals.SignalBool1Value().Empty());
// Should be NOOP
- signals.EmitVoidSignal1IntValue( 1 );
- signals.EmitBoolSignalFloatValue( 1.0f );
+ signals.EmitVoidSignal1IntValue(1);
+ signals.EmitBoolSignalFloatValue(1.0f);
// Test that connecting the same callback 10 times is a NOOP
TestSlotHandler handler4;
- DALI_TEST_EQUALS( handler4.mHandledCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handler4.mFloatParam1, 0.0f, TEST_LOCATION );
-
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- signals.SignalBool1Value().Connect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
-
- signals.EmitBoolSignalFloatValue( 2.0f );
- DALI_TEST_EQUALS( handler4.mHandledCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( handler4.mFloatParam1, 2.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler4.mHandledCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler4.mFloatParam1, 0.0f, TEST_LOCATION);
+
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ signals.SignalBool1Value().Connect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+
+ signals.EmitBoolSignalFloatValue(2.0f);
+ DALI_TEST_EQUALS(handler4.mHandledCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler4.mFloatParam1, 2.0f, TEST_LOCATION);
// Calling Disconnect once should be enough
- signals.SignalBool1Value().Disconnect( &handler4, &TestSlotHandler::BoolSlotFloatValue );
- DALI_TEST_CHECK( signals.SignalBool1Value().Empty() );
+ signals.SignalBool1Value().Disconnect(&handler4, &TestSlotHandler::BoolSlotFloatValue);
+ DALI_TEST_CHECK(signals.SignalBool1Value().Empty());
- signals.EmitBoolSignalFloatValue( 3.0f );
- DALI_TEST_EQUALS( handler4.mHandledCount, 1/*not incremented since last check*/, TEST_LOCATION );
- DALI_TEST_EQUALS( handler4.mFloatParam1, 2.0f, TEST_LOCATION );
+ signals.EmitBoolSignalFloatValue(3.0f);
+ DALI_TEST_EQUALS(handler4.mHandledCount, 1 /*not incremented since last check*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler4.mFloatParam1, 2.0f, TEST_LOCATION);
END_TEST;
}
{
TestSignals::VoidRet1ValueParamSignal tempSignal;
- DALI_TEST_EQUALS( handler1.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mHandledCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mHandledCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 0, TEST_LOCATION);
// Note that the duplicate connection is deliberate
- tempSignal.Connect( &handler1, &TestSlotHandler::VoidSlotIntValue );
- tempSignal.Connect( &handler1, &TestSlotHandler::VoidDuplicateSlotIntValue );
+ tempSignal.Connect(&handler1, &TestSlotHandler::VoidSlotIntValue);
+ tempSignal.Connect(&handler1, &TestSlotHandler::VoidDuplicateSlotIntValue);
- DALI_TEST_EQUALS( handler1.GetConnectionCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mHandledCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.GetConnectionCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mHandledCount, 0, TEST_LOCATION);
- tempSignal.Emit( 10 );
+ tempSignal.Emit(10);
- DALI_TEST_EQUALS( handler1.mHandledCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam1, 10, TEST_LOCATION );
- DALI_TEST_EQUALS( handler1.mIntParam2, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandledCount, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam1, 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler1.mIntParam2, 10, TEST_LOCATION);
}
// End of tempSignal lifetime
- DALI_TEST_EQUALS( handler1.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliSignalDisconnectStatic(void)
{
// void Func()
{
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
- signal.Connect( StaticVoidCallbackVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(StaticVoidCallbackVoid);
+ DALI_TEST_CHECK(!signal.Empty());
wasStaticVoidCallbackVoidCalled = false;
signal.Emit();
- DALI_TEST_EQUALS( wasStaticVoidCallbackVoidCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(wasStaticVoidCallbackVoidCalled, true, TEST_LOCATION);
- signal.Disconnect( StaticVoidCallbackVoid );
- DALI_TEST_CHECK( signal.Empty() );
+ signal.Disconnect(StaticVoidCallbackVoid);
+ DALI_TEST_CHECK(signal.Empty());
wasStaticVoidCallbackVoidCalled = false;
signal.Emit();
- DALI_TEST_EQUALS( wasStaticVoidCallbackVoidCalled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(wasStaticVoidCallbackVoidCalled, false, TEST_LOCATION);
}
// float Func()
{
TestSignals::FloatRet0ParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
- signal.Connect( StaticFloatCallbackVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(StaticFloatCallbackVoid);
+ DALI_TEST_CHECK(!signal.Empty());
wasStaticFloatCallbackVoidCalled = false;
- float result = signal.Emit();
- DALI_TEST_EQUALS( wasStaticFloatCallbackVoidCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( result, 7.0f, TEST_LOCATION );
+ float result = signal.Emit();
+ DALI_TEST_EQUALS(wasStaticFloatCallbackVoidCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(result, 7.0f, TEST_LOCATION);
- signal.Disconnect( StaticFloatCallbackVoid );
- DALI_TEST_CHECK( signal.Empty() );
+ signal.Disconnect(StaticFloatCallbackVoid);
+ DALI_TEST_CHECK(signal.Empty());
wasStaticFloatCallbackVoidCalled = false;
- result = signal.Emit();
- DALI_TEST_EQUALS( wasStaticFloatCallbackVoidCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( result, 0.0f, TEST_LOCATION );
+ result = signal.Emit();
+ DALI_TEST_EQUALS(wasStaticFloatCallbackVoidCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(result, 0.0f, TEST_LOCATION);
}
// void Func( int )
{
TestSignals::VoidRet1ValueParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
- signal.Connect( StaticVoidCallbackIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(StaticVoidCallbackIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
wasStaticVoidCallbackIntValueCalled = false;
- staticIntValue = 0;
- signal.Emit( 10 );
- DALI_TEST_EQUALS( wasStaticVoidCallbackIntValueCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( staticIntValue, 10, TEST_LOCATION );
+ staticIntValue = 0;
+ signal.Emit(10);
+ DALI_TEST_EQUALS(wasStaticVoidCallbackIntValueCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(staticIntValue, 10, TEST_LOCATION);
- signal.Disconnect( StaticVoidCallbackIntValue );
- DALI_TEST_CHECK( signal.Empty() );
+ signal.Disconnect(StaticVoidCallbackIntValue);
+ DALI_TEST_CHECK(signal.Empty());
wasStaticVoidCallbackIntValueCalled = false;
- staticIntValue = 0;
- signal.Emit( 11 );
- DALI_TEST_EQUALS( wasStaticVoidCallbackIntValueCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( staticIntValue, 0, TEST_LOCATION );
+ staticIntValue = 0;
+ signal.Emit(11);
+ DALI_TEST_EQUALS(wasStaticVoidCallbackIntValueCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(staticIntValue, 0, TEST_LOCATION);
}
// float Func( float, float )
{
TestSignals::FloatRet2ValueParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
- signal.Connect( StaticFloatCallbackFloatValueFloatValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(StaticFloatCallbackFloatValueFloatValue);
+ DALI_TEST_CHECK(!signal.Empty());
wasStaticFloatCallbackFloatValueFloatValueCalled = false;
- staticFloatValue1 = 0.0f;
- staticFloatValue2 = 0.0f;
- float result = signal.Emit( 5.0f, 6.0f );
- DALI_TEST_EQUALS( wasStaticFloatCallbackFloatValueFloatValueCalled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( staticFloatValue1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( staticFloatValue2, 6.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( result, 5.0f+6.0f, TEST_LOCATION );
+ staticFloatValue1 = 0.0f;
+ staticFloatValue2 = 0.0f;
+ float result = signal.Emit(5.0f, 6.0f);
+ DALI_TEST_EQUALS(wasStaticFloatCallbackFloatValueFloatValueCalled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(staticFloatValue1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(staticFloatValue2, 6.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(result, 5.0f + 6.0f, TEST_LOCATION);
- signal.Disconnect( StaticFloatCallbackFloatValueFloatValue );
- DALI_TEST_CHECK( signal.Empty() );
+ signal.Disconnect(StaticFloatCallbackFloatValueFloatValue);
+ DALI_TEST_CHECK(signal.Empty());
wasStaticFloatCallbackFloatValueFloatValueCalled = false;
- staticFloatValue1 = 0.0f;
- staticFloatValue2 = 0.0f;
- result = signal.Emit( 7.0f, 8.0f );
- DALI_TEST_EQUALS( wasStaticFloatCallbackFloatValueFloatValueCalled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( staticFloatValue1, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( staticFloatValue2, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( result, 0.0f, TEST_LOCATION );
+ staticFloatValue1 = 0.0f;
+ staticFloatValue2 = 0.0f;
+ result = signal.Emit(7.0f, 8.0f);
+ DALI_TEST_EQUALS(wasStaticFloatCallbackFloatValueFloatValueCalled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(staticFloatValue1, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(staticFloatValue2, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(result, 0.0f, TEST_LOCATION);
}
END_TEST;
}
// Test disconnection during each callback
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDisconnector handler1;
- handler1.VoidConnectVoid( signal );
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
- DALI_TEST_CHECK( ! signal.Empty() );
+ handler1.VoidConnectVoid(signal);
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_CHECK(signal.Empty());
// Repeat with 2 callbacks
handler1.mHandled = false;
TestSlotDisconnector handler2;
- handler1.VoidConnectVoid( signal );
- handler2.VoidConnectVoid( signal );
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
- DALI_TEST_CHECK( ! signal.Empty() );
+ handler1.VoidConnectVoid(signal);
+ handler2.VoidConnectVoid(signal);
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION );
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION);
+ DALI_TEST_CHECK(signal.Empty());
// Repeat with no callbacks
handler2.mHandled = false;
signal.Emit();
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
// Repeat with 3 callbacks
TestSlotDisconnector handler3;
- handler1.VoidConnectVoid( signal );
- handler2.VoidConnectVoid( signal );
- handler3.VoidConnectVoid( signal );
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mHandled, false, TEST_LOCATION );
- DALI_TEST_CHECK( ! signal.Empty() );
+ handler1.VoidConnectVoid(signal);
+ handler2.VoidConnectVoid(signal);
+ handler3.VoidConnectVoid(signal);
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mHandled, false, TEST_LOCATION);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
- DALI_TEST_EQUALS( handler1.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mHandled, true, TEST_LOCATION );
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_EQUALS(handler1.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mHandled, true, TEST_LOCATION);
+ DALI_TEST_CHECK(signal.Empty());
// Repeat with no callbacks
handler3.mHandled = false;
signal.Emit();
- DALI_TEST_EQUALS( handler1.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler2.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler3.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler1.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler2.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler3.mHandled, false, TEST_LOCATION);
END_TEST;
}
// Test disconnection of some (but not all) callbacks during sigmal emission
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotMultiDisconnector handler;
- handler.ConnectAll( signal );
- DALI_TEST_EQUALS( handler.mSlotHandled[0], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[1], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[2], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[3], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[4], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[5], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[6], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[7], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[8], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[9], false, TEST_LOCATION );
- DALI_TEST_CHECK( ! signal.Empty() );
+ handler.ConnectAll(signal);
+ DALI_TEST_EQUALS(handler.mSlotHandled[0], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[1], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[2], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[3], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[4], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[5], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[6], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[7], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[8], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[9], false, TEST_LOCATION);
+ DALI_TEST_CHECK(!signal.Empty());
signal.Emit();
// Slots 5, 7, & 9 should be disconnected before being called
- DALI_TEST_EQUALS( handler.mSlotHandled[0], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[1], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[2], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[3], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[4], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[5], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[6], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[7], false, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[8], true, TEST_LOCATION );
- DALI_TEST_EQUALS( handler.mSlotHandled[9], false, TEST_LOCATION );
- DALI_TEST_CHECK( ! signal.Empty() );
+ DALI_TEST_EQUALS(handler.mSlotHandled[0], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[1], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[2], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[3], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[4], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[5], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[6], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[7], false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[8], true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handler.mSlotHandled[9], false, TEST_LOCATION);
+ DALI_TEST_CHECK(!signal.Empty());
// Odd slots are disconnected
- DALI_TEST_EQUALS( handler.GetConnectionCount(), 5u, TEST_LOCATION );
+ DALI_TEST_EQUALS(handler.GetConnectionCount(), 5u, TEST_LOCATION);
END_TEST;
}
// for coverage purposes we test the emit guard for each signal type (0,1,2,3 params) void / return value
{
TestSignals::VoidRetNoParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestEmitDuringCallback handler1;
- handler1.VoidConnectVoid( signal );
+ handler1.VoidConnectVoid(signal);
// Test that this does not result in an infinite loop!
signal.Emit();
{
TestSignals::FloatRet0ParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestEmitDuringCallback handler1;
- handler1.FloatRet0ParamConnect( signal );
+ handler1.FloatRet0ParamConnect(signal);
// Test that this does not result in an infinite loop!
signal.Emit();
{
TestSignals::FloatRet1ParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestEmitDuringCallback handler1;
- handler1.FloatRet1ParamConnect( signal );
+ handler1.FloatRet1ParamConnect(signal);
// Test that this does not result in an infinite loop!
- signal.Emit( 1.f );
+ signal.Emit(1.f);
}
{
TestSignals::FloatRet2ValueParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestEmitDuringCallback handler1;
- handler1.FloatRet2ParamConnect( signal );
+ handler1.FloatRet2ParamConnect(signal);
// Test that this does not result in an infinite loop!
- signal.Emit( 1.f, 1.f );
+ signal.Emit(1.f, 1.f);
}
{
TestSignals::FloatRet3ValueParamSignal signal;
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestEmitDuringCallback handler1;
- handler1.FloatRet3ParamConnect( signal );
+ handler1.FloatRet3ParamConnect(signal);
// Test that this does not result in an infinite loop!
- signal.Emit( 1.f,1.f,1.f );
+ signal.Emit(1.f, 1.f, 1.f);
}
END_TEST;
}
TestSignals::VoidRetNoParamSignal* signal = new TestSignals::VoidRetNoParamSignal;
TestEmitDuringCallback handler1;
- handler1.DeleteDuringEmitConnect( *signal );
+ handler1.DeleteDuringEmitConnect(*signal);
// should just log an error
signal->Emit();
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
END_TEST;
}
// Signal dies first.
TestButton* button = new TestButton(1);
- TestApp app;
- button->DownSignal().Connect(&app,&TestApp::OnButtonPress);
+ TestApp app;
+ button->DownSignal().Connect(&app, &TestApp::OnButtonPress);
// check we have both the button, and the app have 1 connection
- DALI_TEST_EQUALS( app.GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( button->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(button->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION);
- delete button; // should automatically destroy the connection
+ delete button; // should automatically destroy the connection
// check we have a 0 connections
- DALI_TEST_EQUALS( app.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
// Slot owning object dies first.
TestButton button(1);
- TestApp *app = new TestApp;
- button.DownSignal().Connect( app, &TestApp::OnButtonPress);
+ TestApp* app = new TestApp;
+ button.DownSignal().Connect(app, &TestApp::OnButtonPress);
// check we have a 1 connection
- DALI_TEST_EQUALS( app->GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app->GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION);
- delete app; // should automatically destroy the connection
+ delete app; // should automatically destroy the connection
// check we have a 0 connections
- DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
// 1 of the slot owners dies. Then the second slot owner dies
TestButton button(1);
- TestApp *app1 = new TestApp;
- TestApp *app2 = new TestApp;
+ TestApp* app1 = new TestApp;
+ TestApp* app2 = new TestApp;
- button.DownSignal().Connect( app1, &TestApp::OnButtonPress);
- button.DownSignal().Connect( app2, &TestApp::OnButtonPress);
+ button.DownSignal().Connect(app1, &TestApp::OnButtonPress);
+ button.DownSignal().Connect(app2, &TestApp::OnButtonPress);
- // check we have a 2 connections to the signal
- DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 2u, TEST_LOCATION );
+ // check we have a 2 connections to the signal
+ DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 2u, TEST_LOCATION);
// kill the first slot
- delete app1; // should automatically destroy the connection
+ delete app1; // should automatically destroy the connection
// check we have 1 connection left
- DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 1u, TEST_LOCATION);
- button.Press(); // emit the signal (to ensure it doesn't seg fault)
+ button.Press(); // emit the signal (to ensure it doesn't seg fault)
// kill the second slot
- delete app2; // should automatically destroy the connection
+ delete app2; // should automatically destroy the connection
// check we have 1 connection left
- DALI_TEST_EQUALS( button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(button.DownSignal().GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
// The Signal dies, check the 2 slots disconnect automatically
TestButton* button = new TestButton(1);
- TestApp app1;
- TestApp app2;
+ TestApp app1;
+ TestApp app2;
- button->DownSignal().Connect(&app1,&TestApp::OnButtonPress);
- button->DownSignal().Connect(&app2,&TestApp::OnButtonPress);
+ button->DownSignal().Connect(&app1, &TestApp::OnButtonPress);
+ button->DownSignal().Connect(&app2, &TestApp::OnButtonPress);
// check the connection counts
- DALI_TEST_EQUALS( app1.GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( app2.GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( button->DownSignal().GetConnectionCount(), 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app1.GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(app2.GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(button->DownSignal().GetConnectionCount(), 2u, TEST_LOCATION);
- delete button; // should automatically destroy the connection
+ delete button; // should automatically destroy the connection
// check both slot owners have zero connections
- DALI_TEST_EQUALS( app1.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( app2.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app1.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(app2.GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
TestApp app;
- button1->DownSignal().Connect(&app,&TestApp::OnButtonPress);
- button2->DownSignal().Connect(&app,&TestApp::OnButtonPress);
+ button1->DownSignal().Connect(&app, &TestApp::OnButtonPress);
+ button2->DownSignal().Connect(&app, &TestApp::OnButtonPress);
// check the connection counts
- DALI_TEST_EQUALS( app.GetConnectionCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( button1->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( button2->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetConnectionCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(button1->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(button2->DownSignal().GetConnectionCount(), 1u, TEST_LOCATION);
// make sure both signals emit ok
button2->Press();
- DALI_TEST_EQUALS( app.GetButtonPressedId() , 2 , TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetButtonPressedId(), 2, TEST_LOCATION);
button1->Press();
- DALI_TEST_EQUALS( app.GetButtonPressedId() , 1 , TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetButtonPressedId(), 1, TEST_LOCATION);
- delete button1; // should automatically destroy 1 connection
+ delete button1; // should automatically destroy 1 connection
// check both slot owners have zero connections
- DALI_TEST_EQUALS( app.GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetConnectionCount(), 1u, TEST_LOCATION);
// check remaining connection still works
button2->Press();
- DALI_TEST_EQUALS( app.GetButtonPressedId() , 2 , TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetButtonPressedId(), 2, TEST_LOCATION);
// kill the last signal
delete button2;
- DALI_TEST_EQUALS( app.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(app.GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
int UtcDaliSignalTestApp06(void)
{
- Signal< bool () > boolSignal;
- TestApp app;
- bool result(false);
+ Signal<bool()> boolSignal;
+ TestApp app;
+ bool result(false);
// connect a slot which will return false
- boolSignal.Connect( &app, &TestApp::BoolReturnTestFalse);
+ boolSignal.Connect(&app, &TestApp::BoolReturnTestFalse);
result = boolSignal.Emit();
- DALI_TEST_EQUALS( result, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(result, false, TEST_LOCATION);
// disconnect last slot, and connect a slot which returns true
- boolSignal.Disconnect( &app, &TestApp::BoolReturnTestFalse);
- boolSignal.Connect( &app, &TestApp::BoolReturnTestTrue);
+ boolSignal.Disconnect(&app, &TestApp::BoolReturnTestFalse);
+ boolSignal.Connect(&app, &TestApp::BoolReturnTestTrue);
result = boolSignal.Emit();
- DALI_TEST_EQUALS( result, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(result, true, TEST_LOCATION);
END_TEST;
}
{
TestSlotDelegateHandler handlers;
- signals.SignalVoidNone().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalVoidNone().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
// Test double emission
handlers.mHandled = false;
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalVoid1Ref().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Ref().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
int x = 7;
signals.EmitVoidSignalIntRef(x);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 7, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalVoid1Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignal1IntValue(5);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 5, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 5, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalVoid2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalVoid2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignal2IntValue(6, 7);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 6, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 7, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalBool1Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalBool1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
// repeat with opposite return value
handlers.mBoolReturn = false;
- handlers.mHandled = false;
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 6.0f, TEST_LOCATION );
+ handlers.mHandled = false;
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(6.0f), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 6.0f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalBool2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalBool2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 10, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalInt2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalInt2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mIntReturn = 27;
- int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5);
- DALI_TEST_EQUALS( x, 27, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 33.5f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 5, TEST_LOCATION );
+ int x = signals.EmitIntSignalFloatValueIntValue(33.5f, 5);
+ DALI_TEST_EQUALS(x, 27, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 33.5f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 5, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalFloat0().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalFloat0().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
- float f = signals.EmitFloat0Signal();
- DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ float f = signals.EmitFloat0Signal();
+ DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalFloat2Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalFloat2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
- float f = signals.EmitFloat2VSignal(5, 33.0f);
- DALI_TEST_EQUALS( f, 27.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION );
+ float f = signals.EmitFloat2VSignal(5, 33.0f);
+ DALI_TEST_EQUALS(f, 27.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.VoidSignalFloatValue3().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotFloatValue3 );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.VoidSignalFloatValue3().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotFloatValue3);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.EmitVoidSignalFloatValue3(5, 33.0f, 100.0f);
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
{
TestSlotDelegateHandler handlers;
- signals.SignalFloat3Value().Connect( handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValue3 );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ signals.SignalFloat3Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValue3);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
- float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f);
- DALI_TEST_EQUALS( returnValue, 27.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, true, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION );
+ float returnValue = signals.EmitFloat3VSignal(5, 33.0f, 100.0f);
+ DALI_TEST_EQUALS(returnValue, 27.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 33.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam3, 100.0f, 0.001f, TEST_LOCATION);
}
signals.CheckNoConnections();
END_TEST;
{
TestSignals::VoidRetNoParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
signal.Emit();
{
TestSignals::VoidRet1ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- signal.Emit( 10 );
+ signal.Emit(10);
}
{
TestSignals::VoidRet1RefParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- int temp( 5 );
- signal.Emit( temp );
+ int temp(5);
+ signal.Emit(temp);
}
{
TestSignals::VoidRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- signal.Emit( 1, 2 );
+ signal.Emit(1, 2);
}
{
TestSignals::BoolRet1ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- bool blah = signal.Emit( 1.0f );
- DALI_TEST_CHECK( ! blah );
+ bool blah = signal.Emit(1.0f);
+ DALI_TEST_CHECK(!blah);
}
{
TestSignals::BoolRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- bool blah = signal.Emit( 1.0f, 2 );
- DALI_TEST_CHECK( ! blah );
+ bool blah = signal.Emit(1.0f, 2);
+ DALI_TEST_CHECK(!blah);
}
{
TestSignals::IntRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- int blah = signal.Emit( 10.0f, 100 );
- DALI_TEST_CHECK( 0 == blah );
+ int blah = signal.Emit(10.0f, 100);
+ DALI_TEST_CHECK(0 == blah);
}
{
TestSignals::FloatRet0ParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
- signal.Connect( handler.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid );
- DALI_TEST_CHECK( ! signal.Empty() );
+ signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid);
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
float blah = signal.Emit();
- DALI_TEST_CHECK( 0.0f == blah );
+ DALI_TEST_CHECK(0.0f == blah);
}
{
TestSignals::FloatRet2ValueParamSignal signal;
{
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
TestSlotDelegateHandler handler;
signal.Connect(handler.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue);
- DALI_TEST_CHECK( ! signal.Empty() );
+ DALI_TEST_CHECK(!signal.Empty());
}
// End of slot lifetime
- DALI_TEST_CHECK( signal.Empty() );
+ DALI_TEST_CHECK(signal.Empty());
// Signal emission should be a NOOP
- float blah = signal.Emit( 3.0f, 4.0f );
- DALI_TEST_CHECK( 0.0f == blah );
+ float blah = signal.Emit(3.0f, 4.0f);
+ DALI_TEST_CHECK(0.0f == blah);
}
END_TEST;
}
{
TestSlotDelegateHandler handlers;
signals.SignalVoidNone().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.SignalVoidNone().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotVoid);
signals.EmitVoidSignalVoid();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalVoid1Ref().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- int r = 7;
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ int r = 7;
handlers.mIntReturn = 5;
signals.SignalVoid1Ref().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntRef);
signals.EmitVoidSignalIntRef(r);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( r, 7, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(r, 7, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalVoid1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.SignalVoid1Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValue);
signals.EmitVoidSignal1IntValue(5);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalVoid2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
signals.SignalVoid2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::VoidSlotIntValueIntValue);
signals.EmitVoidSignal2IntValue(5, 10);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalBool1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
signals.SignalBool1Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValue(5.0f), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalBool2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mBoolReturn = true;
signals.SignalBool2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValueIntValue);
- DALI_TEST_EQUALS( signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam2, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(signals.EmitBoolSignalFloatValueIntValue(5.0f, 10), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam2, 0, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalInt2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mIntReturn = 27;
signals.SignalInt2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::IntSlotFloatValueIntValue);
signals.EmitIntSignalFloatValueIntValue(5, 33.0f);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mIntParam1, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mIntParam1, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalFloat0().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
signals.SignalFloat0().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotVoid);
signals.EmitFloat0Signal();
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
{
TestSlotDelegateHandler handlers;
signals.SignalFloat2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
handlers.mFloatReturn = 27.0f;
signals.SignalFloat2Value().Disconnect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue);
signals.EmitFloat2VSignal(5, 33.0f);
- DALI_TEST_EQUALS( handlers.mHandled, false, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION );
- DALI_TEST_EQUALS( handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION );
+ DALI_TEST_EQUALS(handlers.mHandled, false, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam1, 0.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(handlers.mFloatParam2, 0.0f, 0.001f, TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliCallbackBase(void)
{
// simple constructor for coverage
CallbackBase base;
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
END_TEST;
}
TestSignals signals;
TestSlotDelegateHandler handlers;
- DALI_TEST_EQUALS( 0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION);
signals.SignalFloat2Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::FloatSlotFloatValueFloatValue);
- DALI_TEST_EQUALS( 1, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION);
signals.SignalBool1Value().Connect(handlers.mSlotDelegate, &TestSlotDelegateHandler::BoolSlotFloatValue);
- DALI_TEST_EQUALS( 2, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(2, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION);
handlers.mSlotDelegate.DisconnectAll();
- DALI_TEST_EQUALS( 0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0, handlers.mSlotDelegate.GetConnectionCount(), TEST_LOCATION);
END_TEST;
}
*/
// EXTERNAL INCLUDES
-#include <iostream>
#include <stdlib.h>
+#include <iostream>
+
// INTERNAL INCLUDES
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
namespace
{
-
class TestSignals
{
public:
+ typedef Signal<void()> VoidSignalVoid;
+ typedef Signal<void(float)> VoidSignalFloat;
- typedef Signal<void ()> VoidSignalVoid;
- typedef Signal<void (float)> VoidSignalFloat;
-
- typedef Signal<float ()> FloatSignalVoid;
- typedef Signal<float (float)> FloatSignalFloat;
+ typedef Signal<float()> FloatSignalVoid;
+ typedef Signal<float(float)> FloatSignalFloat;
TestSignals()
{
void CheckNoConnections()
{
- DALI_TEST_EQUALS( mVoidSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mVoidSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(mVoidSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mVoidSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( mFloatSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( mFloatSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(mFloatSignalVoid.GetConnectionCount(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(mFloatSignalFloat.GetConnectionCount(), 0u, TEST_LOCATION);
}
- VoidSignalVoid mVoidSignalVoid;
+ VoidSignalVoid mVoidSignalVoid;
VoidSignalFloat mVoidSignalFloat;
- FloatSignalVoid mFloatSignalVoid;
+ FloatSignalVoid mFloatSignalVoid;
FloatSignalFloat mFloatSignalFloat;
};
class TestConnectionTracker : public ConnectionTracker
{
public:
-
TestConnectionTracker()
{
}
++mCurrentInstanceCount;
}
- VoidFunctorVoid( const VoidFunctorVoid& copyMe )
+ VoidFunctorVoid(const VoidFunctorVoid& copyMe)
{
++mTotalInstanceCount;
++mCurrentInstanceCount;
struct VoidFunctorFloat
{
- VoidFunctorFloat( float* lastReceivedValue )
- : mLastReceivedValue( lastReceivedValue )
+ VoidFunctorFloat(float* lastReceivedValue)
+ : mLastReceivedValue(lastReceivedValue)
{
++mTotalInstanceCount;
++mCurrentInstanceCount;
}
- VoidFunctorFloat( const VoidFunctorFloat& copyMe )
- : mLastReceivedValue( copyMe.mLastReceivedValue )
+ VoidFunctorFloat(const VoidFunctorFloat& copyMe)
+ : mLastReceivedValue(copyMe.mLastReceivedValue)
{
++mTotalInstanceCount;
++mCurrentInstanceCount;
{
++mCallbackCount;
- if( mLastReceivedValue )
+ if(mLastReceivedValue)
{
*mLastReceivedValue = value;
}
++mCurrentInstanceCount;
}
- FloatFunctorVoid( const FloatFunctorVoid& copyMe )
+ FloatFunctorVoid(const FloatFunctorVoid& copyMe)
{
++mTotalInstanceCount;
++mCurrentInstanceCount;
++mCurrentInstanceCount;
}
- FloatFunctorFloat( const FloatFunctorFloat& copyMe )
- : mLastReceivedValue (copyMe.mLastReceivedValue )
+ FloatFunctorFloat(const FloatFunctorFloat& copyMe)
+ : mLastReceivedValue(copyMe.mLastReceivedValue)
{
++mTotalInstanceCount;
++mCurrentInstanceCount;
int FloatFunctorFloat::mCurrentInstanceCount = 0;
int FloatFunctorFloat::mCallbackCount = 0;
-} // anon namespace
-
+} // namespace
int UtcDaliSignalFunctorsEmptyCheck(void)
{
{
TestSignals::VoidSignalVoid signal;
- DALI_TEST_CHECK( signal.Empty() );
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(signal.Empty());
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
TestConnectionTracker tracker;
- signal.Connect( &tracker, VoidFunctorVoid() );
- DALI_TEST_CHECK( ! signal.Empty() );
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION );
+ signal.Connect(&tracker, VoidFunctorVoid());
+ DALI_TEST_CHECK(!signal.Empty());
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
{
TestSignals::VoidSignalFloat signal;
- DALI_TEST_CHECK( signal.Empty() );
- DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(signal.Empty());
+ DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION);
TestConnectionTracker tracker;
- signal.Connect( &tracker, VoidFunctorFloat(NULL) );
- DALI_TEST_CHECK( ! signal.Empty() );
- DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION );
+ signal.Connect(&tracker, VoidFunctorFloat(NULL));
+ DALI_TEST_CHECK(!signal.Empty());
+ DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION);
END_TEST;
}
{
TestConnectionTracker tracker;
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mVoidSignalVoid.Connect( &tracker, VoidFunctorVoid() );
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION );
+ signals.mVoidSignalVoid.Connect(&tracker, VoidFunctorVoid());
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION);
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION);
// Test double emission
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION);
signals.CheckNoConnections();
{
TestConnectionTracker tracker;
- float lastReceivedValue( 0.0f );
+ float lastReceivedValue(0.0f);
- DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mVoidSignalFloat.Connect( &tracker, VoidFunctorFloat(&lastReceivedValue) );
- DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 0, TEST_LOCATION );
+ signals.mVoidSignalFloat.Connect(&tracker, VoidFunctorFloat(&lastReceivedValue));
+ DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 0, TEST_LOCATION);
- signals.mVoidSignalFloat.Emit( 3.5f );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( lastReceivedValue, 3.5f, TEST_LOCATION );
+ signals.mVoidSignalFloat.Emit(3.5f);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(lastReceivedValue, 3.5f, TEST_LOCATION);
// Test double emission
- signals.mVoidSignalFloat.Emit( 7.0f );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( lastReceivedValue, 7.0f, TEST_LOCATION );
+ signals.mVoidSignalFloat.Emit(7.0f);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(lastReceivedValue, 7.0f, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( VoidFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorFloat::mCallbackCount, 2, TEST_LOCATION);
signals.CheckNoConnections();
END_TEST;
}
{
TestConnectionTracker tracker;
- DALI_TEST_EQUALS( FloatFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(FloatFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mFloatSignalVoid.Connect( &tracker, FloatFunctorVoid() );
- DALI_TEST_EQUALS( FloatFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 0, TEST_LOCATION );
+ signals.mFloatSignalVoid.Connect(&tracker, FloatFunctorVoid());
+ DALI_TEST_EQUALS(FloatFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 0, TEST_LOCATION);
float returnValue = signals.mFloatSignalVoid.Emit();
- DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION);
// Test double emission
returnValue = signals.mFloatSignalVoid.Emit();
- DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION );
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(returnValue, FloatFunctorVoid::DEFAULT_RETURN_VALUE, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( FloatFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(FloatFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorVoid::mCallbackCount, 2, TEST_LOCATION);
signals.CheckNoConnections();
{
TestConnectionTracker tracker;
- DALI_TEST_EQUALS( FloatFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(FloatFunctorFloat::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mFloatSignalFloat.Connect( &tracker, FloatFunctorFloat() );
- DALI_TEST_EQUALS( FloatFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 0, TEST_LOCATION );
+ signals.mFloatSignalFloat.Connect(&tracker, FloatFunctorFloat());
+ DALI_TEST_EQUALS(FloatFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCurrentInstanceCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 0, TEST_LOCATION);
- float returnValue = signals.mFloatSignalFloat.Emit( 0.1f );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( returnValue, 1.0f + 0.1f, TEST_LOCATION );
+ float returnValue = signals.mFloatSignalFloat.Emit(0.1f);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(returnValue, 1.0f + 0.1f, TEST_LOCATION);
// Test double emission
- returnValue = signals.mFloatSignalFloat.Emit( 0.2f );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( returnValue, 1.0f + 0.2f, TEST_LOCATION );
+ returnValue = signals.mFloatSignalFloat.Emit(0.2f);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(returnValue, 1.0f + 0.2f, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( FloatFunctorFloat::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(FloatFunctorFloat::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCurrentInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(FloatFunctorFloat::mCallbackCount, 2, TEST_LOCATION);
signals.CheckNoConnections();
END_TEST;
}
{
TestConnectionTracker tracker;
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mVoidSignalVoid.Connect( &tracker, VoidFunctorVoid() );
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION );
+ signals.mVoidSignalVoid.Connect(&tracker, VoidFunctorVoid());
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION);
tracker.DisconnectAll();
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION);
// Test double emission
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION);
}
END_TEST;
}
{
TestSignals signals;
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mVoidSignalVoid.Connect( &tracker, VoidFunctorVoid() );
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION );
+ signals.mVoidSignalVoid.Connect(&tracker, VoidFunctorVoid());
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION);
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount,1, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION);
- DALI_TEST_EQUALS( tracker.GetConnectionCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracker.GetConnectionCount(), 1u, TEST_LOCATION);
}
// Functor should have been deleted with signal
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION);
- DALI_TEST_EQUALS( tracker.GetConnectionCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(tracker.GetConnectionCount(), 0u, TEST_LOCATION);
END_TEST;
}
{
TestConnectionTracker tracker;
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
- signals.mVoidSignalVoid.Connect( &tracker, FunctorDelegate::New( VoidFunctorVoid() ) );
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION );
+ signals.mVoidSignalVoid.Connect(&tracker, FunctorDelegate::New(VoidFunctorVoid()));
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 0, TEST_LOCATION);
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 1, TEST_LOCATION);
// Test double emission
signals.mVoidSignalVoid.Emit();
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION);
}
// TestConnectionTracker should auto-disconnect
- DALI_TEST_EQUALS( VoidFunctorVoid::mTotalInstanceCount, 2/*temporary copy + signal copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(VoidFunctorVoid::mTotalInstanceCount, 2 /*temporary copy + signal copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCurrentInstanceCount, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(VoidFunctorVoid::mCallbackCount, 2, TEST_LOCATION);
signals.CheckNoConnections();
END_TEST;
}
*/
// EXTERNAL INCLUDES
-#include <stdlib.h>
-#include <iostream>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/common/singleton-service.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
class TestHandle : public BaseHandle
{
public:
- TestHandle() {}
- TestHandle( BaseObject* object ) : BaseHandle( object ) {}
+ TestHandle()
+ {
+ }
+ TestHandle(BaseObject* object)
+ : BaseHandle(object)
+ {
+ }
};
class TestObject : public BaseObject
// Attempt to retrieve SingletonService before creating application
SingletonService singletonService;
singletonService = SingletonService::Get();
- DALI_TEST_CHECK( !singletonService );
+ DALI_TEST_CHECK(!singletonService);
// Create Application class, should be able to retrieve SingletonService now
TestApplication application;
singletonService = SingletonService::Get();
- DALI_TEST_CHECK( singletonService );
+ DALI_TEST_CHECK(singletonService);
END_TEST;
}
int UtcDaliSingletonServiceRegisterAndGetSingleton(void)
{
- TestApplication application;
- SingletonService singletonService( SingletonService::Get() );
+ TestApplication application;
+ SingletonService singletonService(SingletonService::Get());
// Attempt to register an empty handle
TestHandle handle;
- singletonService.Register( typeid( handle ), handle );
- DALI_TEST_CHECK( !singletonService.GetSingleton( typeid( handle ) ) );
+ singletonService.Register(typeid(handle), handle);
+ DALI_TEST_CHECK(!singletonService.GetSingleton(typeid(handle)));
// Create an actor instance and retrieve, should be valid this time
- handle = TestHandle( new TestObject );
- singletonService.Register( typeid( handle ), handle );
- DALI_TEST_CHECK( singletonService.GetSingleton( typeid( handle ) ) );
+ handle = TestHandle(new TestObject);
+ singletonService.Register(typeid(handle), handle);
+ DALI_TEST_CHECK(singletonService.GetSingleton(typeid(handle)));
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/devel-api/common/stage-devel.h>
#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/public-api/events/key-event.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <dali/public-api/events/key-event.h>
+#include <stdlib.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
using namespace Dali;
namespace
{
-
const std::string DEFAULT_DEVICE_NAME("hwKeyboard");
// Functor for EventProcessingFinished signal
/**
* @param[in] eventProcessingFinished reference to a boolean variable used to check if signal has been called.
*/
- EventProcessingFinishedFunctor( bool& eventProcessingFinished )
- : mEventProcessingFinished( eventProcessingFinished )
- {}
+ EventProcessingFinishedFunctor(bool& eventProcessingFinished)
+ : mEventProcessingFinished(eventProcessingFinished)
+ {
+ }
void operator()()
{
{
KeyEventGeneratedSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
receivedKeyEvent.Reset();
}
- bool functorCalled;
+ bool functorCalled;
KeyEvent receivedKeyEvent;
};
// Functor that sets the data when called
struct KeyEventGeneratedReceivedFunctor
{
- KeyEventGeneratedReceivedFunctor( KeyEventGeneratedSignalData& data )
- : signalData( data )
- {}
+ KeyEventGeneratedReceivedFunctor(KeyEventGeneratedSignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( const KeyEvent& keyEvent )
+ bool operator()(const KeyEvent& keyEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedKeyEvent = keyEvent;
return true;
{
KeyEventSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
receivedKeyEvent.Reset();
}
- bool functorCalled;
+ bool functorCalled;
KeyEvent receivedKeyEvent;
};
// Functor that sets the data when called
struct KeyEventReceivedFunctor
{
- KeyEventReceivedFunctor( KeyEventSignalData& data ) : signalData( data ) { }
+ KeyEventReceivedFunctor(KeyEventSignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( const KeyEvent& keyEvent )
+ bool operator()(const KeyEvent& keyEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedKeyEvent = keyEvent;
return true;
{
TouchedSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
receivedTouchEvent.Reset();
}
- bool functorCalled;
+ bool functorCalled;
TouchEvent receivedTouchEvent;
};
// Functor that sets the data when touched signal is received
struct TouchFunctor
{
- TouchFunctor( TouchedSignalData& data ) : signalData( data ) { }
+ TouchFunctor(TouchedSignalData& data)
+ : signalData(data)
+ {
+ }
- void operator()( const TouchEvent& touch )
+ void operator()(const TouchEvent& touch)
{
signalData.functorCalled = true;
TouchEvent handle(touch);
{
WheelEventSignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
functorCalled = false;
}
- bool functorCalled;
+ bool functorCalled;
WheelEvent receivedWheelEvent;
};
// Functor that sets the data when wheel-event signal is received
struct WheelEventReceivedFunctor
{
- WheelEventReceivedFunctor( WheelEventSignalData& data ) : signalData( data ) { }
+ WheelEventReceivedFunctor(WheelEventSignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( const WheelEvent& wheelEvent )
+ bool operator()(const WheelEvent& wheelEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedWheelEvent = wheelEvent;
return true;
WheelEventSignalData& signalData;
};
-bool DummyTouchCallback( Actor actor, const TouchEvent& touch )
+bool DummyTouchCallback(Actor actor, const TouchEvent& touch)
{
return true;
}
struct ContextStatusFunctor
{
- ContextStatusFunctor(bool& calledFlag) : mCalledFlag( calledFlag )
+ ContextStatusFunctor(bool& calledFlag)
+ : mCalledFlag(calledFlag)
{
mCalledFlag = false;
}
struct SceneCreatedStatusFunctor
{
- SceneCreatedStatusFunctor(bool& calledFlag) : mCalledFlag( calledFlag )
+ SceneCreatedStatusFunctor(bool& calledFlag)
+ : mCalledFlag(calledFlag)
{
mCalledFlag = false;
}
struct ActorCreatedFunctor
{
- ActorCreatedFunctor( bool& signalReceived )
- : mSignalVerified( signalReceived )
+ ActorCreatedFunctor(bool& signalReceived)
+ : mSignalVerified(signalReceived)
{
}
- void operator()( BaseHandle object )
+ void operator()(BaseHandle object)
{
- tet_infoline( "Verifying TestActorCallback()" );
- Actor actor = Actor::DownCast( object );
- if( actor )
+ tet_infoline("Verifying TestActorCallback()");
+ Actor actor = Actor::DownCast(object);
+ if(actor)
{
mSignalVerified = true;
}
bool& mSignalVerified;
};
-void GenerateTouch( TestApplication& application, PointState::Type state, const Vector2& screenPosition )
+void GenerateTouch(TestApplication& application, PointState::Type state, const Vector2& screenPosition)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ touchEvent.points.push_back(point);
+ application.ProcessEvent(touchEvent);
}
} // unnamed namespace
-
int UtcDaliStageDefaultConstructorP(void)
{
TestApplication application;
- Stage stage;
+ Stage stage;
- DALI_TEST_CHECK( !stage );
+ DALI_TEST_CHECK(!stage);
END_TEST;
}
int UtcDaliStageDestructorP(void)
{
TestApplication application;
- Stage* stage = new Stage();
+ Stage* stage = new Stage();
delete stage;
stage = NULL;
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
int UtcDaliStageGetCurrentP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- DALI_TEST_CHECK( stage );
+ DALI_TEST_CHECK(stage);
END_TEST;
}
{
Stage stage = Stage::GetCurrent();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "stage && \"Stage doesn't exist\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "stage && \"Stage doesn't exist\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
Stage::GetCurrent();
- DALI_TEST_CHECK( Stage::IsInstalled() );
+ DALI_TEST_CHECK(Stage::IsInstalled());
END_TEST;
}
int UtcDaliStageIsInstalledN(void)
{
- DALI_TEST_CHECK( !Stage::IsInstalled() );
+ DALI_TEST_CHECK(!Stage::IsInstalled());
END_TEST;
}
int UtcDaliStageCopyConstructorP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- Stage copyStage( stage );
+ Stage copyStage(stage);
- DALI_TEST_CHECK( copyStage );
- DALI_TEST_CHECK( copyStage.GetRootLayer() == stage.GetRootLayer() );
+ DALI_TEST_CHECK(copyStage);
+ DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer());
END_TEST;
}
int UtcDaliStageAssignmentOperatorP(void)
{
TestApplication application;
- const Stage stage = Stage::GetCurrent();
+ const Stage stage = Stage::GetCurrent();
Stage copyStage = stage;
- DALI_TEST_CHECK( copyStage );
- DALI_TEST_CHECK( copyStage.GetRootLayer() == stage.GetRootLayer() );
+ DALI_TEST_CHECK(copyStage);
+ DALI_TEST_CHECK(copyStage.GetRootLayer() == stage.GetRootLayer());
END_TEST;
}
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
- stage.Add( actor );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ stage.Add(actor);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
END_TEST;
}
bool asserted = false;
try
{
- stage.Add( actor );
+ stage.Add(actor);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "actor && \"Actor handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
- stage.Add( actor );
- DALI_TEST_CHECK( actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ stage.Add(actor);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
stage.Remove(actor);
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
END_TEST;
}
try
{
// Actor is not valid, confirm a removal attempt does assert.
- stage.Remove( actor );
+ stage.Remove(actor);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "actor && \"Actor handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "actor && \"Actor handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
Stage stage = Stage::GetCurrent();
Actor actor = Actor::New();
- DALI_TEST_CHECK( !actor.GetProperty< bool >( Actor::Property::CONNECTED_TO_SCENE ) );
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
bool asserted = false;
try
{
// Actor is not on stage, confirm a removal attempt does not assert / segfault.
- stage.Remove( actor );
+ stage.Remove(actor);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
asserted = true;
}
- DALI_TEST_CHECK( !asserted );
+ DALI_TEST_CHECK(!asserted);
END_TEST;
}
Stage stage = Stage::GetCurrent();
// Initially we have a default layer
- DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
// Check we cannot remove the root layer from the stage.
- Layer layer = stage.GetRootLayer();
- bool asserted = true;
+ Layer layer = stage.GetRootLayer();
+ bool asserted = true;
try
{
- stage.Remove( layer );
+ stage.Remove(layer);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "this != &child && \"Cannot remove actor from itself\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
- DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ DALI_TEST_CHECK(asserted);
+ DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
END_TEST;
}
Vector2 size = stage.GetSize();
- DALI_TEST_EQUALS( size.width, static_cast<float>( TestApplication::DEFAULT_SURFACE_WIDTH ), TEST_LOCATION );
- DALI_TEST_EQUALS( size.height, static_cast<float>( TestApplication::DEFAULT_SURFACE_HEIGHT ), TEST_LOCATION );
+ DALI_TEST_EQUALS(size.width, static_cast<float>(TestApplication::DEFAULT_SURFACE_WIDTH), TEST_LOCATION);
+ DALI_TEST_EQUALS(size.height, static_cast<float>(TestApplication::DEFAULT_SURFACE_HEIGHT), TEST_LOCATION);
END_TEST;
}
Stage stage;
- bool asserted = false;
+ bool asserted = false;
Vector2 size;
try
{
size = stage.GetSize();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
// Test the default DPI.
Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS( dpi.x, static_cast<float>( TestApplication::DEFAULT_HORIZONTAL_DPI ), TEST_LOCATION );
- DALI_TEST_EQUALS( dpi.y, static_cast<float>( TestApplication::DEFAULT_VERTICAL_DPI ), TEST_LOCATION );
+ DALI_TEST_EQUALS(dpi.x, static_cast<float>(TestApplication::DEFAULT_HORIZONTAL_DPI), TEST_LOCATION);
+ DALI_TEST_EQUALS(dpi.y, static_cast<float>(TestApplication::DEFAULT_VERTICAL_DPI), TEST_LOCATION);
END_TEST;
}
// Test that setting core DPI explicitly also sets up the Stage's DPI.
Dali::Integration::Scene scene = application.GetScene();
- scene.SetDpi( Vector2(200.0f, 180.0f) );
+ scene.SetDpi(Vector2(200.0f, 180.0f));
- Stage stage = Stage::GetCurrent();
- Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS( dpi.x, 200.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( dpi.y, 180.0f, TEST_LOCATION );
+ Stage stage = Stage::GetCurrent();
+ Vector2 dpi = stage.GetDpi();
+ DALI_TEST_EQUALS(dpi.x, 200.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(dpi.y, 180.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliStageGetDpiP3(void)
{
- TestApplication application( 480, 800, 72, 120 ); // Initializes core DPI with specific values
+ TestApplication application(480, 800, 72, 120); // Initializes core DPI with specific values
Stage stage = Stage::GetCurrent();
// Test that setting core DPI explicitly also sets up the Stage's DPI.
Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS( dpi.x, 72.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( dpi.y, 120.0f, TEST_LOCATION) ;
+ DALI_TEST_EQUALS(dpi.x, 72.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(dpi.y, 120.0f, TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Initializes core DPI to default values
- Stage stage = Stage::GetCurrent();
- Vector2 dpi = stage.GetDpi();
+ Stage stage = Stage::GetCurrent();
+ Vector2 dpi = stage.GetDpi();
- DALI_TEST_EQUALS( dpi.x, 220.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( dpi.y, 217.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(dpi.x, 220.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(dpi.y, 217.0f, TEST_LOCATION);
END_TEST;
}
Stage stage = Stage::GetCurrent();
// Initially we have a default layer
- DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
Layer layer = Layer::New();
- stage.Add( layer );
+ stage.Add(layer);
- DALI_TEST_EQUALS( stage.GetLayerCount(), 2u, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetLayerCount(), 2u, TEST_LOCATION);
END_TEST;
}
Stage stage = Stage::GetCurrent();
// Initially we have a default layer
- DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
Layer layer = Layer::New();
- stage.Remove( layer );
+ stage.Remove(layer);
// Still have 1 layer.
- DALI_TEST_EQUALS( stage.GetLayerCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetLayerCount(), 1u, TEST_LOCATION);
END_TEST;
}
Stage stage = Stage::GetCurrent();
- Layer rootLayer = stage.GetLayer( 0 );
- DALI_TEST_CHECK( rootLayer );
+ Layer rootLayer = stage.GetLayer(0);
+ DALI_TEST_CHECK(rootLayer);
Layer layer = Layer::New();
- stage.Add( layer );
+ stage.Add(layer);
- Layer sameLayer = stage.GetLayer( 1 );
- DALI_TEST_CHECK( layer == sameLayer );
+ Layer sameLayer = stage.GetLayer(1);
+ DALI_TEST_CHECK(layer == sameLayer);
END_TEST;
}
try
{
// Try to get a layer that doesn't exist (note: 0 is the root layer).
- Layer layer = stage.GetLayer( 1 );
+ Layer layer = stage.GetLayer(1);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "depth < mLayers.size()", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "depth < mLayers.size()", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
Stage stage = Stage::GetCurrent();
- Layer layer = stage.GetLayer( 0 );
- DALI_TEST_CHECK( layer );
+ Layer layer = stage.GetLayer(0);
+ DALI_TEST_CHECK(layer);
// Check that GetRootLayer() correctly retreived layer 0.
- DALI_TEST_CHECK( stage.GetRootLayer() == layer );
+ DALI_TEST_CHECK(stage.GetRootLayer() == layer);
END_TEST;
}
Stage stage = Stage::GetCurrent();
- Layer rootLayer = stage.GetLayer( 0 );
- DALI_TEST_CHECK( rootLayer );
- DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer );
+ Layer rootLayer = stage.GetLayer(0);
+ DALI_TEST_CHECK(rootLayer);
+ DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
// Create a new layer and attempt to lower it below the root layer.
Layer layer = Layer::New();
- stage.Add( layer );
+ stage.Add(layer);
layer.LowerToBottom();
// Check that GetRootLayer still retrieves the same original layer.
- DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer );
+ DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
// Check modifying the root layer is also blocked.
rootLayer.RaiseToTop();
- DALI_TEST_CHECK( stage.GetRootLayer() == rootLayer );
+ DALI_TEST_CHECK(stage.GetRootLayer() == rootLayer);
END_TEST;
}
Stage stage = Stage::GetCurrent();
- Vector4 testColor( 0.1f, 0.2f, 0.3f, 1.0f );
- stage.SetBackgroundColor( testColor );
+ Vector4 testColor(0.1f, 0.2f, 0.3f, 1.0f);
+ stage.SetBackgroundColor(testColor);
- DALI_TEST_EQUALS( testColor, stage.GetBackgroundColor(), TEST_LOCATION );
+ DALI_TEST_EQUALS(testColor, stage.GetBackgroundColor(), TEST_LOCATION);
END_TEST;
}
Stage stage = Stage::GetCurrent();
- DALI_TEST_EQUALS( DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION );
+ DALI_TEST_EQUALS(DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION);
END_TEST;
}
Stage stage = Stage::GetCurrent();
// Run core until it wants to sleep
- bool keepUpdating( true );
- while ( keepUpdating )
+ bool keepUpdating(true);
+ while(keepUpdating)
{
application.SendNotification();
- keepUpdating = application.Render( 1000.0f /*1 second*/ );
+ keepUpdating = application.Render(1000.0f /*1 second*/);
}
// Force rendering for the next 5 seconds
- stage.KeepRendering( 5.0f );
+ stage.KeepRendering(5.0f);
application.SendNotification();
// Test that core wants to sleep after 10 seconds
- keepUpdating = application.Render( 1000.0f /*1 second*/ );
- DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render( 1000.0f /*2 seconds*/ );
- DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render( 1000.0f /*3 seconds*/ );
- DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render( 1000.0f /*4 seconds*/ );
- DALI_TEST_CHECK( keepUpdating );
- keepUpdating = application.Render( 1000.0f /*5 seconds*/ );
- DALI_TEST_CHECK( !keepUpdating );
+ keepUpdating = application.Render(1000.0f /*1 second*/);
+ DALI_TEST_CHECK(keepUpdating);
+ keepUpdating = application.Render(1000.0f /*2 seconds*/);
+ DALI_TEST_CHECK(keepUpdating);
+ keepUpdating = application.Render(1000.0f /*3 seconds*/);
+ DALI_TEST_CHECK(keepUpdating);
+ keepUpdating = application.Render(1000.0f /*4 seconds*/);
+ DALI_TEST_CHECK(keepUpdating);
+ keepUpdating = application.Render(1000.0f /*5 seconds*/);
+ DALI_TEST_CHECK(!keepUpdating);
END_TEST;
}
Stage stage = Stage::GetCurrent();
// Run core until it wants to sleep
- bool keepUpdating( true );
- while ( keepUpdating )
+ bool keepUpdating(true);
+ while(keepUpdating)
{
application.SendNotification();
- keepUpdating = application.Render( 1000.0f /*1 second*/ );
+ keepUpdating = application.Render(1000.0f /*1 second*/);
}
// Force rendering for the next 5 seconds
- stage.KeepRendering( -1.0f );
+ stage.KeepRendering(-1.0f);
application.SendNotification();
// Test that core wants to sleep after 10 seconds
- keepUpdating = application.Render( 1000.0f /*1 second*/ );
- DALI_TEST_CHECK( !keepUpdating );
+ keepUpdating = application.Render(1000.0f /*1 second*/);
+ DALI_TEST_CHECK(!keepUpdating);
END_TEST;
}
int UtcDaliStageEventProcessingFinishedP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- bool eventProcessingFinished = false;
- EventProcessingFinishedFunctor functor( eventProcessingFinished );
- stage.EventProcessingFinishedSignal().Connect( &application, functor );
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor(eventProcessingFinished);
+ stage.EventProcessingFinishedSignal().Connect(&application, functor);
- Actor actor( Actor::New() );
- stage.Add( actor );
+ Actor actor(Actor::New());
+ stage.Add(actor);
application.SendNotification();
application.Render();
- DALI_TEST_CHECK( eventProcessingFinished );
+ DALI_TEST_CHECK(eventProcessingFinished);
END_TEST;
}
int UtcDaliStageEventProcessingFinishedN(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- bool eventProcessingFinished = false;
- EventProcessingFinishedFunctor functor( eventProcessingFinished );
- stage.EventProcessingFinishedSignal().Connect( &application, functor );
+ bool eventProcessingFinished = false;
+ EventProcessingFinishedFunctor functor(eventProcessingFinished);
+ stage.EventProcessingFinishedSignal().Connect(&application, functor);
- Actor actor( Actor::New() );
- stage.Add( actor );
+ Actor actor(Actor::New());
+ stage.Add(actor);
// Do not complete event processing and confirm the signal has not been emitted.
- DALI_TEST_CHECK( !eventProcessingFinished );
+ DALI_TEST_CHECK(!eventProcessingFinished);
END_TEST;
}
int UtcDaliStageKeyEventGeneratedSignalP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- KeyEventGeneratedSignalData data;
- KeyEventGeneratedReceivedFunctor functor( data );
- DevelStage::KeyEventGeneratedSignal( stage ).Connect( &application, functor );
+ KeyEventGeneratedSignalData data;
+ KeyEventGeneratedReceivedFunctor functor(data);
+ DevelStage::KeyEventGeneratedSignal(stage).Connect(&application, functor);
- KeyEventGeneratedSignalData data2;
- KeyEventGeneratedReceivedFunctor functor2( data2 );
- GetImplementation( stage ).ConnectSignal( &application, "keyEventGenerated", functor2 );
+ KeyEventGeneratedSignalData data2;
+ KeyEventGeneratedReceivedFunctor functor2(data2);
+ GetImplementation(stage).ConnectSignal(&application, "keyEventGenerated", functor2);
- Integration::KeyEvent event( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event );
+ Integration::KeyEvent event("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event2 );
+ Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event2);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event3 );
+ Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event3);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event4 );
+ Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event4);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
END_TEST;
}
int UtcDaliStageSignalKeyEventP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- KeyEventSignalData data;
- KeyEventReceivedFunctor functor( data );
- stage.KeyEventSignal().Connect( &application, functor );
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor(data);
+ stage.KeyEventSignal().Connect(&application, functor);
- Integration::KeyEvent event( "i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event );
+ Integration::KeyEvent event("i", "", "i", 0, 0, 0, Integration::KeyEvent::DOWN, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event2( "i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event2 );
+ Integration::KeyEvent event2("i", "", "i", 0, 0, 0, Integration::KeyEvent::UP, "i", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event2);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event2.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event2.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event2.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event2.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event2.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event2.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event2.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event2.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event3( "a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event3 );
+ Integration::KeyEvent event3("a", "", "a", 0, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event3);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event3.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event3.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event3.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event3.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event3.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event3.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event3.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event3.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
data.Reset();
- Integration::KeyEvent event4( "a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE );
- application.ProcessEvent( event4 );
+ Integration::KeyEvent event4("a", "", "a", 0, 0, 0, Integration::KeyEvent::UP, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE);
+ application.ProcessEvent(event4);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( event4.keyModifier == data.receivedKeyEvent.GetKeyModifier() );
- DALI_TEST_CHECK( event4.keyName == data.receivedKeyEvent.GetKeyName() );
- DALI_TEST_CHECK( event4.keyString == data.receivedKeyEvent.GetKeyString() );
- DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.GetState() ) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(event4.keyModifier == data.receivedKeyEvent.GetKeyModifier());
+ DALI_TEST_CHECK(event4.keyName == data.receivedKeyEvent.GetKeyName());
+ DALI_TEST_CHECK(event4.keyString == data.receivedKeyEvent.GetKeyString());
+ DALI_TEST_CHECK(event4.state == static_cast<Integration::KeyEvent::State>(data.receivedKeyEvent.GetState()));
END_TEST;
}
int UtcDaliStageSignalKeyEventN(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- KeyEventSignalData data;
- KeyEventReceivedFunctor functor( data );
- stage.KeyEventSignal().Connect( &application, functor );
+ KeyEventSignalData data;
+ KeyEventReceivedFunctor functor(data);
+ stage.KeyEventSignal().Connect(&application, functor);
// Check that a non-pressed key events data is not modified.
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
int UtcDaliStageTouchedSignalP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
TouchedSignalData data;
- TouchFunctor functor( data );
- stage.TouchedSignal().Connect( &application, functor );
+ TouchFunctor functor(data);
+ stage.TouchedSignal().Connect(&application, functor);
// Render and notify.
application.SendNotification();
// Basic test: No actors, single touch (down then up).
{
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
- GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::UP, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
}
// Add an actor to the scene.
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchedSignal().Connect( &DummyTouchCallback );
- stage.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.TouchedSignal().Connect(&DummyTouchCallback);
+ stage.Add(actor);
// Render and notify.
application.SendNotification();
// Actor on scene, single touch, down in actor, motion, then up outside actor.
{
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0));
data.Reset();
- GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
+ GenerateTouch(application, PointState::MOTION, Vector2(150.0f, 10.0f)); // Some motion
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
- GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
+ GenerateTouch(application, PointState::UP, Vector2(150.0f, 10.0f)); // Some motion
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
}
// Multiple touch. Should only receive a touch on first down and last up.
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
+ Integration::Point point;
// 1st point
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(10.0f, 10.0f));
+ touchEvent.points.push_back(point);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
data.Reset();
// 2nd point
- touchEvent.points[0].SetState( PointState::STATIONARY );
- point.SetDeviceId( 1 );
- point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( (bool)data.receivedTouchEvent, false, TEST_LOCATION );
+ touchEvent.points[0].SetState(PointState::STATIONARY);
+ point.SetDeviceId(1);
+ point.SetScreenPosition(Vector2(50.0f, 50.0f));
+ touchEvent.points.push_back(point);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
data.Reset();
// Primary point is up
- touchEvent.points[0].SetState( PointState::UP );
- touchEvent.points[1].SetState( PointState::STATIONARY );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( (bool)data.receivedTouchEvent, false, TEST_LOCATION );
+ touchEvent.points[0].SetState(PointState::UP);
+ touchEvent.points[1].SetState(PointState::STATIONARY);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
data.Reset();
// Remove 1st point now, 2nd point is now in motion
- touchEvent.points.erase( touchEvent.points.begin() );
- touchEvent.points[0].SetState( PointState::MOTION );
- touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( (bool)data.receivedTouchEvent, false, TEST_LOCATION );
+ touchEvent.points.erase(touchEvent.points.begin());
+ touchEvent.points[0].SetState(PointState::MOTION);
+ touchEvent.points[0].SetScreenPosition(Vector2(150.0f, 50.0f));
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)data.receivedTouchEvent, false, TEST_LOCATION);
data.Reset();
// Final point Up
- touchEvent.points[0].SetState( PointState::UP );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ touchEvent.points[0].SetState(PointState::UP);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
data.Reset();
}
END_TEST;
int UtcDaliStageTouchedSignalN(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
TouchedSignalData data;
- TouchFunctor functor( data );
- stage.TouchedSignal().Connect( &application, functor );
+ TouchFunctor functor(data);
+ stage.TouchedSignal().Connect(&application, functor);
// Render and notify.
application.SendNotification();
application.Render();
// Confirm functor not called before there has been any touch event.
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// No actors, single touch, down, motion then up.
{
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
// Confirm there is no signal when the touchpoint is only moved.
- GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
+ GenerateTouch(application, PointState::MOTION, Vector2(1200.0f, 10.0f)); // Some motion
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Confirm a following up event generates a signal.
- GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
+ GenerateTouch(application, PointState::UP, Vector2(1200.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
data.Reset();
}
// Add an actor to the scene.
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchedSignal().Connect( &DummyTouchCallback );
- stage.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ actor.TouchedSignal().Connect(&DummyTouchCallback);
+ stage.Add(actor);
// Render and notify.
application.SendNotification();
// Actor on scene. Interrupted before down and interrupted after down.
{
- GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
data.Reset();
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::DOWN );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetHitActor(0) == actor);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::DOWN);
data.Reset();
- GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
+ GenerateTouch(application, PointState::INTERRUPTED, Vector2(10.0f, 10.0f));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetPointCount() != 0u);
+ DALI_TEST_CHECK(!data.receivedTouchEvent.GetHitActor(0));
+ DALI_TEST_CHECK(data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED);
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION);
// Check that getting info about a non-existent point causes an assert.
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetState( 1 ), PointState::FINISHED, TEST_LOCATION );
+ DALI_TEST_EQUALS(data.receivedTouchEvent.GetState(1), PointState::FINISHED, TEST_LOCATION);
data.Reset();
}
int UtcDaliStageSignalWheelEventP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- WheelEventSignalData data;
- WheelEventReceivedFunctor functor( data );
- stage.WheelEventSignal().Connect( &application, functor );
+ WheelEventSignalData data;
+ WheelEventReceivedFunctor functor(data);
+ stage.WheelEventSignal().Connect(&application, functor);
- Integration::WheelEvent event( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), 1, 1000u );
- application.ProcessEvent( event );
+ Integration::WheelEvent event(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), 1, 1000u);
+ application.ProcessEvent(event);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.GetType() );
- DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.GetDirection() );
- DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.GetModifiers() );
- DALI_TEST_CHECK( event.point == data.receivedWheelEvent.GetPoint() );
- DALI_TEST_CHECK( event.delta == data.receivedWheelEvent.GetDelta() );
- DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.GetTime() );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event.type) == data.receivedWheelEvent.GetType());
+ DALI_TEST_CHECK(event.direction == data.receivedWheelEvent.GetDirection());
+ DALI_TEST_CHECK(event.modifiers == data.receivedWheelEvent.GetModifiers());
+ DALI_TEST_CHECK(event.point == data.receivedWheelEvent.GetPoint());
+ DALI_TEST_CHECK(event.delta == data.receivedWheelEvent.GetDelta());
+ DALI_TEST_CHECK(event.timeStamp == data.receivedWheelEvent.GetTime());
data.Reset();
- Integration::WheelEvent event2( Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2( 0.0f, 0.0f ), -1, 1000u );
- application.ProcessEvent( event2 );
+ Integration::WheelEvent event2(Integration::WheelEvent::CUSTOM_WHEEL, 0, 0u, Vector2(0.0f, 0.0f), -1, 1000u);
+ application.ProcessEvent(event2);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.GetType() );
- DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.GetDirection() );
- DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.GetModifiers() );
- DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.GetPoint() );
- DALI_TEST_CHECK( event2.delta == data.receivedWheelEvent.GetDelta() );
- DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.GetTime() );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(static_cast<WheelEvent::Type>(event2.type) == data.receivedWheelEvent.GetType());
+ DALI_TEST_CHECK(event2.direction == data.receivedWheelEvent.GetDirection());
+ DALI_TEST_CHECK(event2.modifiers == data.receivedWheelEvent.GetModifiers());
+ DALI_TEST_CHECK(event2.point == data.receivedWheelEvent.GetPoint());
+ DALI_TEST_CHECK(event2.delta == data.receivedWheelEvent.GetDelta());
+ DALI_TEST_CHECK(event2.timeStamp == data.receivedWheelEvent.GetTime());
END_TEST;
}
int UtcDaliStageContextLostSignalP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- bool contextLost = false;
- ContextStatusFunctor contextLostFunctor( contextLost );
- stage.ContextLostSignal().Connect( &application, contextLostFunctor );
+ bool contextLost = false;
+ ContextStatusFunctor contextLostFunctor(contextLost);
+ stage.ContextLostSignal().Connect(&application, contextLostFunctor);
Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
notifier->NotifyContextLost();
- DALI_TEST_EQUALS( contextLost, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(contextLost, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliStageContextLostSignalN(void)
{
TestApplication application;
- Stage stage;
+ Stage stage;
// Check that connecting to the signal with a bad stage instance causes an assert.
- bool asserted = false;
- bool contextLost = false;
- ContextStatusFunctor contextLostFunctor( contextLost );
+ bool asserted = false;
+ bool contextLost = false;
+ ContextStatusFunctor contextLostFunctor(contextLost);
try
{
- stage.ContextLostSignal().Connect( &application, contextLostFunctor );
+ stage.ContextLostSignal().Connect(&application, contextLostFunctor);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliStageContextRegainedSignalP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- bool contextRegained = false;
- ContextStatusFunctor contextRegainedFunctor( contextRegained );
- stage.ContextRegainedSignal().Connect( &application, contextRegainedFunctor );
+ bool contextRegained = false;
+ ContextStatusFunctor contextRegainedFunctor(contextRegained);
+ stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor);
Integration::ContextNotifierInterface* notifier = application.GetCore().GetContextNotifier();
notifier->NotifyContextLost();
notifier->NotifyContextRegained();
- DALI_TEST_EQUALS( contextRegained, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(contextRegained, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliStageContextRegainedSignalN(void)
{
TestApplication application;
- Stage stage;
+ Stage stage;
// Check that connecting to the signal with a bad stage instance causes an assert.
- bool asserted = false;
- bool contextRegained = false;
- ContextStatusFunctor contextRegainedFunctor( contextRegained );
+ bool asserted = false;
+ bool contextRegained = false;
+ ContextStatusFunctor contextRegainedFunctor(contextRegained);
try
{
- stage.ContextRegainedSignal().Connect( &application, contextRegainedFunctor );
+ stage.ContextRegainedSignal().Connect(&application, contextRegainedFunctor);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliStageSceneCreatedSignalP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- bool signalCalled = false;
- SceneCreatedStatusFunctor sceneCreatedFunctor( signalCalled );
- stage.SceneCreatedSignal().Connect( &application, sceneCreatedFunctor );
+ bool signalCalled = false;
+ SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
+ stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor);
Integration::Core& core = application.GetCore();
core.SceneCreated();
- DALI_TEST_EQUALS( signalCalled, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(signalCalled, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliStageSceneCreatedSignalN(void)
{
TestApplication application;
- Stage stage;
+ Stage stage;
// Check that connecting to the signal with a bad stage instance causes an assert.
- bool asserted = false;
- bool signalCalled = false;
- SceneCreatedStatusFunctor sceneCreatedFunctor( signalCalled );
+ bool asserted = false;
+ bool signalCalled = false;
+ SceneCreatedStatusFunctor sceneCreatedFunctor(signalCalled);
try
{
- stage.SceneCreatedSignal().Connect( &application, sceneCreatedFunctor );
+ stage.SceneCreatedSignal().Connect(&application, sceneCreatedFunctor);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliStageGetRenderTaskListP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
// Check we get a valid instance.
const RenderTaskList& tasks = stage.GetRenderTaskList();
// There should be 1 task by default.
- DALI_TEST_EQUALS( tasks.GetTaskCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(tasks.GetTaskCount(), 1u, TEST_LOCATION);
// RenderTaskList has it's own UTC tests.
// But we can confirm that GetRenderTaskList in Stage retrieves the same RenderTaskList each time.
RenderTask newTask = stage.GetRenderTaskList().CreateTask();
- DALI_TEST_EQUALS( stage.GetRenderTaskList().GetTask( 1 ), newTask, TEST_LOCATION );
+ DALI_TEST_EQUALS(stage.GetRenderTaskList().GetTask(1), newTask, TEST_LOCATION);
END_TEST;
}
int UtcDaliStageGetRenderTaskListN(void)
{
TestApplication application;
- Stage stage;
+ Stage stage;
// Check that getting the render task list with a bad stage instance causes an assert.
bool asserted = false;
{
stage.GetRenderTaskList();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "stage && \"Stage handle is empty\"", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "stage && \"Stage handle is empty\"", TEST_LOCATION);
asserted = true;
}
- DALI_TEST_CHECK( asserted );
+ DALI_TEST_CHECK(asserted);
END_TEST;
}
int UtcDaliStageGetObjectRegistryP(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
ObjectRegistry objectRegistry = stage.GetObjectRegistry();
// Object registry tests are covered in their own module.
// However we want a basic test to confirm the returned registry is valid and works.
- bool verified = false;
- ActorCreatedFunctor test( verified );
- objectRegistry.ObjectCreatedSignal().Connect( &application, test );
+ bool verified = false;
+ ActorCreatedFunctor test(verified);
+ objectRegistry.ObjectCreatedSignal().Connect(&application, test);
Actor actor = Actor::New();
- DALI_TEST_CHECK( test.mSignalVerified );
+ DALI_TEST_CHECK(test.mSignalVerified);
END_TEST;
}
int UtcDaliStageGetObjectRegistryN(void)
{
TestApplication application;
- Stage stage;
+ Stage stage;
// Check that getting the object registry with a bad stage instance DOES NOT cause an assert.
// This is because GetCurrent() is used, always creating a stage if one does not exist.
{
stage.GetObjectRegistry();
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
asserted = true;
}
- DALI_TEST_CHECK( !asserted );
+ DALI_TEST_CHECK(!asserted);
END_TEST;
}
int UtcDaliStageOperatorAssign(void)
{
TestApplication application;
- Stage stage;
- DALI_TEST_CHECK( !stage );
+ Stage stage;
+ DALI_TEST_CHECK(!stage);
stage = Stage::GetCurrent();
- DALI_TEST_CHECK( stage );
+ DALI_TEST_CHECK(stage);
END_TEST;
}
int UtcDaliStageRenderingBehavior(void)
{
TestApplication application;
- Stage stage = Stage::GetCurrent();
+ Stage stage = Stage::GetCurrent();
- tet_infoline( "Check default rendering behavior is only if required" );
- DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::IF_REQUIRED );
+ tet_infoline("Check default rendering behavior is only if required");
+ DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED);
- tet_infoline( "No update required with an empty application" );
+ tet_infoline("No update required with an empty application");
application.SendNotification();
- DALI_TEST_CHECK( application.UpdateOnly() == false );
+ DALI_TEST_CHECK(application.UpdateOnly() == false);
application.RenderOnly();
- tet_infoline( "Change to continuous rendering, further updates should be required" );
- DevelStage::SetRenderingBehavior( stage, DevelStage::Rendering::CONTINUOUSLY );
+ tet_infoline("Change to continuous rendering, further updates should be required");
+ DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::CONTINUOUSLY);
- DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::CONTINUOUSLY );
+ DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::CONTINUOUSLY);
application.SendNotification();
- DALI_TEST_CHECK( application.UpdateOnly() == true );
+ DALI_TEST_CHECK(application.UpdateOnly() == true);
application.RenderOnly();
application.SendNotification();
- DALI_TEST_CHECK( application.UpdateOnly() == true );
+ DALI_TEST_CHECK(application.UpdateOnly() == true);
application.RenderOnly();
- tet_infoline( "Change to rendering only if required, further updates should NOT be required" );
- DevelStage::SetRenderingBehavior( stage, DevelStage::Rendering::IF_REQUIRED );
+ tet_infoline("Change to rendering only if required, further updates should NOT be required");
+ DevelStage::SetRenderingBehavior(stage, DevelStage::Rendering::IF_REQUIRED);
- DALI_TEST_CHECK( DevelStage::GetRenderingBehavior( stage ) == DevelStage::Rendering::IF_REQUIRED );
+ DALI_TEST_CHECK(DevelStage::GetRenderingBehavior(stage) == DevelStage::Rendering::IF_REQUIRED);
application.SendNotification();
- DALI_TEST_CHECK( application.UpdateOnly() == false );
+ DALI_TEST_CHECK(application.UpdateOnly() == false);
application.RenderOnly();
- tet_infoline( "The next update is not required so TestApplication should print a warning" );
+ tet_infoline("The next update is not required so TestApplication should print a warning");
application.SendNotification();
- DALI_TEST_CHECK( application.UpdateOnly() == false );
+ DALI_TEST_CHECK(application.UpdateOnly() == false);
application.RenderOnly();
END_TEST;
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
#include <test-touch-event-utils.h>
+#include <iostream>
+
using namespace Dali;
void utc_dali_tap_gesture_detector_startup(void)
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false)
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
tappedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
TapGesture receivedGesture;
- Actor tappedActor;
+ Actor tappedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const TapGesture& tap)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = tap;
- signalData.tappedActor = actor;
+ signalData.tappedActor = actor;
}
void operator()()
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Integration::Scene scene )
- : GestureReceivedFunctor( data ),
- scene( scene )
+ UnstageActorFunctor(SignalData& data, Integration::Scene scene)
+ : GestureReceivedFunctor(data),
+ scene(scene)
{
}
void operator()(Actor actor, const TapGesture& tap)
{
- GestureReceivedFunctor::operator()( actor, tap );
- scene.Remove( actor );
+ GestureReceivedFunctor::operator()(actor, tap);
+ scene.Remove(actor);
}
Integration::Scene scene;
{
//For line coverage
unsigned int points = touch.GetPointCount();
- if( points > 0)
+ if(points > 0)
{
tet_printf("Touch Point state = %d\n", touch.GetState(0));
}
}
};
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
// Positive test case for a method
int UtcDaliTapGestureDetectorConstructor(void)
{
TapGestureDetector detector = TapGestureDetector::New();
- TapGestureDetector copy( detector );
- DALI_TEST_CHECK( detector );
+ TapGestureDetector copy(detector);
+ DALI_TEST_CHECK(detector);
END_TEST;
}
{
TestApplication application;
- TapGestureDetector detector = TapGestureDetector::New();;
+ TapGestureDetector detector = TapGestureDetector::New();
+ ;
TapGestureDetector assign;
assign = detector;
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(detector);
- DALI_TEST_CHECK( detector == assign );
+ DALI_TEST_CHECK(detector == assign);
END_TEST;
}
DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
- TapGestureDetector detector2 = TapGestureDetector::New( 5u );
+ TapGestureDetector detector2 = TapGestureDetector::New(5u);
DALI_TEST_CHECK(detector2);
DALI_TEST_EQUALS(5u, detector2.GetMinimumTapsRequired(), TEST_LOCATION);
DALI_TEST_EQUALS(5u, detector2.GetMaximumTapsRequired(), TEST_LOCATION);
// Attach an actor and emit a touch event on the actor to ensure complete line coverage
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
TouchEventFunctor touchFunctor;
- actor.TouchedSignal().Connect( &application, touchFunctor );
+ actor.TouchedSignal().Connect(&application, touchFunctor);
Integration::TouchEvent touchEvent(1);
- Integration::Point point;
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 20.0f, 20.0f ) );
+ Integration::Point point;
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(20.0f, 20.0f));
touchEvent.AddPoint(point);
application.ProcessEvent(touchEvent);
TapGestureDetector detector2 = TapGestureDetector::DownCast(object);
DALI_TEST_CHECK(detector2);
- TapGestureDetector detector3 = DownCast< TapGestureDetector >(object);
+ TapGestureDetector detector3 = DownCast<TapGestureDetector>(object);
DALI_TEST_CHECK(detector3);
- BaseHandle unInitializedObject;
+ BaseHandle unInitializedObject;
TapGestureDetector detector4 = TapGestureDetector::DownCast(unInitializedObject);
DALI_TEST_CHECK(!detector4);
- TapGestureDetector detector5 = DownCast< TapGestureDetector >(unInitializedObject);
+ TapGestureDetector detector5 = DownCast<TapGestureDetector>(unInitializedObject);
DALI_TEST_CHECK(!detector5);
- GestureDetector detector6 = TapGestureDetector::New();
+ GestureDetector detector6 = TapGestureDetector::New();
TapGestureDetector detector7 = TapGestureDetector::DownCast(detector6);
DALI_TEST_CHECK(detector7);
END_TEST;
// Attach an actor and change the required touches
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
try
{
TapGestureDetector detector = TapGestureDetector::New();
- detector.SetMinimumTapsRequired( 7u );
- detector.SetMaximumTapsRequired( 3u );
+ detector.SetMinimumTapsRequired(7u);
+ detector.SetMaximumTapsRequired(3u);
detector.Attach(actor);
- DALI_TEST_CHECK( false ); // Should not get here
+ DALI_TEST_CHECK(false); // Should not get here
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
}
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Do a tap outside actor's area
- TestGenerateTap( application, 112.0f, 112.0f, 100 );
+ TestGenerateTap(application, 112.0f, 112.0f, 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Do a tap inside actor's area
- TestGenerateTap( application, 50.0f, 50.0f, 100 );
+ TestGenerateTap(application, 50.0f, 50.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start tap within the actor's area
- TestGenerateTap( application, 20.0f, 20.0f, 100 );
+ TestGenerateTap(application, 20.0f, 20.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
// repeat the tap within the actor's area - we should still receive the signal
data.Reset();
- TestGenerateTap( application, 50.0f, 50.0f, 700 );
+ TestGenerateTap(application, 50.0f, 50.0f, 700);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
// Detach actor
detector.DetachAll();
// Ensure we are no longer signalled
data.Reset();
- TestGenerateTap( application, 20.0f, 20.0f, 1300 );
+ TestGenerateTap(application, 20.0f, 20.0f, 1300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- TestGenerateTap( application, 50.0f, 50.0f, 1900 );
+ TestGenerateTap(application, 50.0f, 50.0f, 1900);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
// Actor lifetime is scoped
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
// Start tap within the actor's area
- TestGenerateTap( application, 20.0f, 20.0f, 100 );
+ TestGenerateTap(application, 20.0f, 20.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Remove the actor from stage and reset the data
// Actor should now have been destroyed
data.Reset();
- TestGenerateTap( application, 20.0f, 20.0f, 700 );
+ TestGenerateTap(application, 20.0f, 20.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do tap, only check finished value
- TestGenerateTap( application, 5.0f, 5.0f, 100 );
+ TestGenerateTap(application, 5.0f, 5.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
application.SendNotification();
application.Render();
// Do tap, should still receive event
data.Reset();
- TestGenerateTap( application, 5.0f, 5.0f, 700 );
+ TestGenerateTap(application, 5.0f, 5.0f, 700);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
- actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) );
+ actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS));
application.SendNotification();
application.Render();
// Do tap, inside the actor's area (area if it is not rotated), Should not receive the event
data.Reset();
- TestGenerateTap( application, 70.0f, 70.0f, 1300 );
+ TestGenerateTap(application, 70.0f, 70.0f, 1300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
// Set child to completely cover parent.
// Change rotation of child to be different from parent so that we can check if our local coordinate
// conversion of the parent actor is correct.
Actor child = Actor::New();
- child.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- child.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- child.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- child.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS) );
+ child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
parent.Add(child);
TouchEventFunctor touchFunctor;
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Do tap - hits child area but parent should still receive it
- TestGenerateTap( application, 50.0f, 50.0f, 100 );
+ TestGenerateTap(application, 50.0f, 50.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.tappedActor, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
// Do an entire tap, only check finished value
data.Reset();
- TestGenerateTap( application, 51.0f, 51.0f, 700 );
+ TestGenerateTap(application, 51.0f, 51.0f, 700);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.tappedActor, TEST_LOCATION);
DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
TestApplication application;
Actor first = Actor::New();
- first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- second.SetProperty( Actor::Property::POSITION_X, 100.0f);
- second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Tap within second actor's area
- TestGenerateTap( application, 120.0f, 10.0f, 100 );
+ TestGenerateTap(application, 120.0f, 10.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
// Tap within first actor's area
data.Reset();
- TestGenerateTap( application, 20.0f, 10.0f, 700 );
+ TestGenerateTap(application, 20.0f, 10.0f, 700);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
// second actor shouldn't receive event
data.Reset();
- TestGenerateTap( application, 120.0f, 10.0f, 1300 );
+ TestGenerateTap(application, 120.0f, 10.0f, 1300);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// first actor should continue receiving event
data.Reset();
- TestGenerateTap( application, 20.0f, 10.0f, 1900 );
+ TestGenerateTap(application, 20.0f, 10.0f, 1900);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Tap in actor's area
- TestGenerateTap( application, 50.0f, 10.0f, 100 );
+ TestGenerateTap(application, 50.0f, 10.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
// Actor become invisible - actor should not receive the next pan
- actor.SetProperty( Actor::Property::VISIBLE,false);
+ actor.SetProperty(Actor::Property::VISIBLE, false);
// Render and notify
application.SendNotification();
// Tap in the same area, shouldn't receive event
data.Reset();
- TestGenerateTap( application, 50.0f, 10.0f, 700 );
+ TestGenerateTap(application, 50.0f, 10.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor first = Actor::New();
- first.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- first.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(first);
Actor second = Actor::New();
- second.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- second.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- second.SetProperty( Actor::Property::POSITION_X, 100.0f);
+ second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ second.SetProperty(Actor::Property::POSITION_X, 100.0f);
first.Add(second);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector firstDetector = TapGestureDetector::New();
// secondDetector is scoped
{
- TapGestureDetector secondDetector = TapGestureDetector::New( 2 );
+ TapGestureDetector secondDetector = TapGestureDetector::New(2);
secondDetector.Attach(second);
secondDetector.DetectedSignal().Connect(&application, functor);
// Tap within second actor's area
- TestGenerateTap( application, 150.0f, 10.0f, 100 );
- TestGenerateTap( application, 150.0f, 10.0f, 200 );
+ TestGenerateTap(application, 150.0f, 10.0f, 100);
+ TestGenerateTap(application, 150.0f, 10.0f, 200);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
// Tap continues as single touch gesture - we should not receive any gesture
data.Reset();
- TestGenerateTap( application, 150.0f, 10.0f, 800 );
+ TestGenerateTap(application, 150.0f, 10.0f, 800);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Single touch tap starts - first actor should be panned
data.Reset();
- TestGenerateTap( application, 50.0f, 10.0f, 1400 );
+ TestGenerateTap(application, 50.0f, 10.0f, 1400);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
// Tap changes to double-touch - we shouldn't receive event
data.Reset();
- TestGenerateTwoPointTap( application, 50.0f, 10.0f, 60.0f, 20.0f, 2000 );
+ TestGenerateTwoPointTap(application, 50.0f, 10.0f, 60.0f, 20.0f, 2000);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to one detector
- SignalData firstData;
+ SignalData firstData;
GestureReceivedFunctor firstFunctor(firstData);
- TapGestureDetector firstDetector = TapGestureDetector::New();
+ TapGestureDetector firstDetector = TapGestureDetector::New();
firstDetector.Attach(actor);
firstDetector.DetectedSignal().Connect(&application, firstFunctor);
// Attach actor to another detector
- SignalData secondData;
+ SignalData secondData;
GestureReceivedFunctor secondFunctor(secondData);
- TapGestureDetector secondDetector = TapGestureDetector::New();
+ TapGestureDetector secondDetector = TapGestureDetector::New();
secondDetector.Attach(actor);
secondDetector.DetectedSignal().Connect(&application, secondFunctor);
// Tap in actor's area - both detector's functors should be called
- TestGenerateTap( application, 50.0f, 10.0f, 100 );
+ TestGenerateTap(application, 50.0f, 10.0f, 100);
DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Gesture possible in actor's area.
- TestStartLongPress( application, 50.0f, 10.0f, 100 );
+ TestStartLongPress(application, 50.0f, 10.0f, 100);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor somewhere else
- actor.SetProperty( Actor::Property::POSITION, Vector2( 100.0f, 100.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
// Render and notify
application.SendNotification();
application.Render();
// Emit STARTED event, we should not receive the tap.
- TestEndPan( application, Vector2(50.0f, 10.0f), 120 );
+ TestEndPan(application, Vector2(50.0f, 10.0f), 120);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Tap possible in empty area.
- TestStartLongPress( application, 50.0f, 10.0f, 700 );
+ TestStartLongPress(application, 50.0f, 10.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Move actor in to the tap position.
- actor.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, 0.0f ));
+ actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
// Render and notify
application.SendNotification();
application.Render();
// Emit STARTED event, we should not receive the tap.
- TestEndPan( application, Vector2(50.0f, 10.0f), 720 );
+ TestEndPan(application, Vector2(50.0f, 10.0f), 720);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Normal tap in actor's area for completeness.
- TestGenerateTap( application, 50.0f, 10.0f, 1300 );
+ TestGenerateTap(application, 50.0f, 10.0f, 1300);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- UnstageActorFunctor functor( data, application.GetScene() );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ UnstageActorFunctor functor(data, application.GetScene());
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
- TestGenerateTap( application, 50.0f, 10.0f, 100 );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- tet_result( TET_PASS ); // If we get here, then the actor removal on signal handler was handled gracefully.
+ TestGenerateTap(application, 50.0f, 10.0f, 100);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ tet_result(TET_PASS); // If we get here, then the actor removal on signal handler was handled gracefully.
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit a possible - Down press, as emitted by long press function
- TestStartLongPress( application, 50.0f, 10.0f, 100 );
+ TestStartLongPress(application, 50.0f, 10.0f, 100);
// Detach actor and send a STARTED state, no signal.
detector.DetachAll();
- TestEndPan( application, Vector2(50.0f, 10.0f), 120 );
+ TestEndPan(application, Vector2(50.0f, 10.0f), 120);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
- TapGestureDetector detector = TapGestureDetector::New();
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Emit a possible - Down press, as emitted by long press function
- TestStartLongPress( application, 50.0f, 10.0f, 100 );
+ TestStartLongPress(application, 50.0f, 10.0f, 100);
// Remove, render and delete actor
application.GetScene().Remove(actor);
actor.Reset();
// Send a STARTED state, no signal - Up motion as provided by end pan function
- TestEndPan( application, Vector2(50.0f, 10.0f), 120 );
+ TestEndPan(application, Vector2(50.0f, 10.0f), 120);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
- TapGestureDetector detector = TapGestureDetector::New();
+ TapGestureDetector detector = TapGestureDetector::New();
detector.Attach(actor);
- detector.DetectedSignal().Connect( &application, functor );
+ detector.DetectedSignal().Connect(&application, functor);
// Add a layer to overlap the actor
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer );
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
layer.RaiseToTop();
// Render and notify
application.Render();
// Emit signals, should receive
- TestGenerateTap( application, 50.0f, 50.0f, 100 );
+ TestGenerateTap(application, 50.0f, 50.0f, 100);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
- TestGenerateTap( application, 50.0f, 50.0f, 700 );
+ TestGenerateTap(application, 50.0f, 50.0f, 700);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
- bool consume = false;
+ bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchedSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
application.Render();
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
TapGestureDetector detector = TapGestureDetector::New();
detector.DetectedSignal().Connect(&application, functor);
// Start gesture within the actor's area, we should receive the gesture as the touch is NOT being consumed
- TestGenerateTap( application, 50.0f, 50.0f );
+ TestGenerateTap(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Another gesture in the same location, this time we will not receive it as touch is being consumed
consume = true;
- TestGenerateTap( application, 50.0f, 50.0f );
+ TestGenerateTap(application, 50.0f, 50.0f);
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Add a detector
- TapGestureDetector detector = TapGestureDetector::New();
- bool functorCalled = false;
- detector.Attach( actor );
+ TapGestureDetector detector = TapGestureDetector::New();
+ bool functorCalled = false;
+ detector.Attach(actor);
detector.DetectedSignal().Connect(
- &application,
- [&detector, &functorCalled](Actor actor, const TapGesture& gesture)
- {
- detector.Detach(actor);
- functorCalled = true;
- });
+ &application,
+ [&detector, &functorCalled](Actor actor, const TapGesture& gesture) {
+ detector.Detach(actor);
+ functorCalled = true;
+ });
// Render and notify
application.SendNotification();
// Try the gesture, should not crash
try
{
- TestGenerateTap( application, 50.0f, 10.0f );
+ TestGenerateTap(application, 50.0f, 10.0f);
- DALI_TEST_CHECK( true ); // No crash, test has passed
+ DALI_TEST_CHECK(true); // No crash, test has passed
DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
}
catch(...)
{
- DALI_TEST_CHECK( false ); // If we crash, the test has failed
+ DALI_TEST_CHECK(false); // If we crash, the test has failed
}
END_TEST;
}
-
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+#include <iostream>
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
namespace
{
-
struct SignalData
{
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
receivedGesture()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
tappedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
TapGesture receivedGesture;
- Actor tappedActor;
+ Actor tappedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, const TapGesture& tap)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = tap;
- signalData.tappedActor = actor;
+ signalData.tappedActor = actor;
}
void operator()()
SignalData& signalData;
};
-
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-Integration::TouchEvent GenerateDoubleTouch( PointState::Type state, const Vector2& screenPositionA, const Vector2& screenPositionB, uint32_t time )
+Integration::TouchEvent GenerateDoubleTouch(PointState::Type state, const Vector2& screenPositionA, const Vector2& screenPositionB, uint32_t time)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPositionA );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
- point.SetScreenPosition( screenPositionB );
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPositionA);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
+ point.SetScreenPosition(screenPositionB);
+ touchEvent.points.push_back(point);
touchEvent.time = time;
return touchEvent;
}
-
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
-
int UtcDaliTapGestureRecognizerBasic(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerGapTooLong(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 651 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 651));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerInterrupted(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 20.0f ), 175 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 20.0f), 175));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerMoveTooFar(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 20.0f), 200));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerStartDouble(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), Vector2( 25.0f, 25.0f ), 150 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), Vector2(25.0f, 25.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerEndDouble(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), Vector2( 25.0f, 25.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), Vector2(25.0f, 25.0f), 200));
- application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), Vector2( 25.0f, 25.0f ), 200 ) );
+ application.ProcessEvent(GenerateDoubleTouch(PointState::UP, Vector2(20.0f, 20.0f), Vector2(25.0f, 25.0f), 200));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerDoubleTap(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 250 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 250));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 300 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 300));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerDoubleTapMoveTooFar(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), 250 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), 250));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 50.0f ), 300 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 50.0f), 300));
application.SendNotification();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 450 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 450));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 500 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 500));
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 550 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 550));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 600 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 600));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerDoubleTapWaitTooLong(void)
{
TestApplication application;
TapGestureDetector detector = TapGestureDetector::New(2);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
detector.Attach(actor);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 650 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 650));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 750 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 750));
application.SendNotification();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 950 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 950));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 1000 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1000));
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 50.0f, 50.0f ), 1050 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 1050));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 1000 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1000));
application.SendNotification();
END_TEST;
}
-
int UtcDaliTapGestureRecognizerMultipleDetectors(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
Actor actor2 = Actor::New();
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor2.SetProperty( Actor::Property::POSITION_X, 100.0f);
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor2.SetProperty(Actor::Property::POSITION_X, 100.0f);
application.GetScene().Add(actor2);
// Render and notify
TapGestureDetector detector2 = TapGestureDetector::New(2);
detector2.Attach(actor2);
- SignalData data;
+ SignalData data;
GestureReceivedFunctor functor(data);
detector.DetectedSignal().Connect(&application, functor);
- SignalData data2;
+ SignalData data2;
GestureReceivedFunctor functor2(data2);
detector2.DetectedSignal().Connect(&application, functor2);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
application.SendNotification();
data.Reset();
DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), 250 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(120.0f, 20.0f), 250));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 120.0f, 20.0f ), 300 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(120.0f, 20.0f), 300));
application.SendNotification();
DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), 350 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(120.0f, 20.0f), 350));
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 120.0f, 20.0f ), 400 ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(120.0f, 20.0f), 400));
application.SendNotification();
*
*/
-#include <dali/public-api/dali-core.h>
-#include <dali/devel-api/images/pixel-data-devel.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/images/pixel-data-devel.h>
+#include <dali/public-api/dali-core.h>
#include <test-native-image.h>
using namespace Dali;
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
- DALI_TEST_CHECK( texture );
+ DALI_TEST_CHECK(texture);
END_TEST;
}
int UtcDaliTextureNew02(void)
{
TestApplication application;
- Texture texture;
- DALI_TEST_CHECK( !texture );
+ Texture texture;
+ DALI_TEST_CHECK(!texture);
END_TEST;
}
TestApplication application;
// Create a native image source.
- TestNativeImagePointer testNativeImage = TestNativeImage::New( 64u, 64u );
+ TestNativeImagePointer testNativeImage = TestNativeImage::New(64u, 64u);
// Create a texture from the native image source.
- Texture nativeTexture = Texture::New( *testNativeImage );
+ Texture nativeTexture = Texture::New(*testNativeImage);
// Check the texture was created OK.
- DALI_TEST_CHECK( nativeTexture );
+ DALI_TEST_CHECK(nativeTexture);
END_TEST;
}
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
Texture textureCopy(texture);
- DALI_TEST_CHECK( textureCopy );
+ DALI_TEST_CHECK(textureCopy);
END_TEST;
}
int UtcDaliTextureAssignmentOperator(void)
{
TestApplication application;
- unsigned int width(64);
- unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ unsigned int width(64);
+ unsigned int height(64);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
Texture texture2;
- DALI_TEST_CHECK( !texture2 );
+ DALI_TEST_CHECK(!texture2);
texture2 = texture;
- DALI_TEST_CHECK( texture2 );
+ DALI_TEST_CHECK(texture2);
END_TEST;
}
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- DALI_TEST_CHECK( texture );
- DALI_TEST_EQUALS( 1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION );
- DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION );
-
- Texture move = std::move( texture );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetWidth(), width, TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetHeight(), height, TEST_LOCATION );
- DALI_TEST_CHECK( !texture );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ DALI_TEST_CHECK(texture);
+ DALI_TEST_EQUALS(1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(texture.GetWidth(), width, TEST_LOCATION);
+ DALI_TEST_EQUALS(texture.GetHeight(), height, TEST_LOCATION);
+
+ Texture move = std::move(texture);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetWidth(), width, TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetHeight(), height, TEST_LOCATION);
+ DALI_TEST_CHECK(!texture);
END_TEST;
}
{
TestApplication application;
- uint32_t width = 64;
- uint32_t height = 64;
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- DALI_TEST_CHECK( texture );
- DALI_TEST_EQUALS( 1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION );
- DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION );
+ uint32_t width = 64;
+ uint32_t height = 64;
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ DALI_TEST_CHECK(texture);
+ DALI_TEST_EQUALS(1, texture.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(texture.GetWidth(), width, TEST_LOCATION);
+ DALI_TEST_EQUALS(texture.GetHeight(), height, TEST_LOCATION);
Texture move;
- move = std::move( texture );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetWidth(), width, TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetHeight(), height, TEST_LOCATION );
- DALI_TEST_CHECK( !texture );
+ move = std::move(texture);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetWidth(), width, TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetHeight(), height, TEST_LOCATION);
+ DALI_TEST_CHECK(!texture);
END_TEST;
}
int UtcDaliTextureDownCast01(void)
{
TestApplication application;
- unsigned int width(64);
- unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ unsigned int width(64);
+ unsigned int height(64);
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
BaseHandle handle(texture);
- Texture texture2 = Texture::DownCast(handle);
- DALI_TEST_CHECK( texture2 );
+ Texture texture2 = Texture::DownCast(handle);
+ DALI_TEST_CHECK(texture2);
END_TEST;
}
{
TestApplication application;
- Handle handle = Handle::New(); // Create a custom object
+ Handle handle = Handle::New(); // Create a custom object
Texture texture = Texture::DownCast(handle);
- DALI_TEST_CHECK( !texture );
+ DALI_TEST_CHECK(!texture);
END_TEST;
}
//Create the texture
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
//TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
//Upload data to the texture
callStack.Reset();
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelData );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelData);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
//Upload part of the texture
callStack.Reset();
- bufferSize = width * height * 2;
- buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelDataSubImage = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelDataSubImage, 0u, 0u, width/2, height/2, width/2, height/2 );
+ bufferSize = width * height * 2;
+ buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelDataSubImage = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelDataSubImage, 0u, 0u, width / 2, height / 2, width / 2, height / 2);
application.SendNotification();
application.Render();
//TexSubImage2D should be called to upload the data
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width/2 << ", " << height/2 << ", " << width/2 << ", " << height/2;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width / 2 << ", " << height / 2 << ", " << width / 2 << ", " << height / 2;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexSubImage2D", out.str().c_str()));
}
-
END_TEST;
}
//Create the texture
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
//TexImage2D should be called six times with a null pointer to reserve storage for the six textures of the cube map
- for( unsigned int i(0); i<6; ++i )
+ for(unsigned int i(0); i < 6; ++i)
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_POSITIVE_X + i <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_POSITIVE_X + i << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
//Upload data to the POSITIVE_X face of the texture
{
callStack.Reset();
- texture.Upload( pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_X, 0u, 0u, 0u, width, height);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to the POSITIVE_X face
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_POSITIVE_X <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_POSITIVE_X << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
{
callStack.Reset();
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to the NEGATIVE_X face
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
//Upload data to the POSITIVE_Y face of the texture
{
callStack.Reset();
- texture.Upload( pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_Y, 0u, 0u, 0u, width, height);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to the POSITIVE_Y face
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_POSITIVE_Y <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_POSITIVE_Y << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
//Upload data to the NEGATIVE_Y face of the texture
{
callStack.Reset();
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Y, 0u, 0u, 0u, width, height);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to the NEGATIVE_Y face
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Y <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Y << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
//Upload data to the POSITIVE_Z face of the texture
{
callStack.Reset();
- texture.Upload( pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::POSITIVE_Z, 0u, 0u, 0u, width, height);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to the POSITIVE_Z face
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_POSITIVE_Z <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_POSITIVE_Z << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
//Upload data to the NEGATIVE_Z face of the texture
{
callStack.Reset();
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height );
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_Z, 0u, 0u, 0u, width, height);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to the NEGATIVE_Z face
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Z <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_NEGATIVE_Z << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
unsigned int widthMipmap1(32);
unsigned int heightMipmap1(32);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
//TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
//Upload data to the texture mipmap 0 and mipmap 1
callStack.Reset();
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelData, 0u, 0u, 0u, 0u, width, height );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelData, 0u, 0u, 0u, 0u, width, height);
- bufferSize = widthMipmap1 * heightMipmap1 * 4;
- buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelDataMipmap1 = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelDataMipmap1, 0u, 1u, 0u, 0u, widthMipmap1, heightMipmap1 );
+ bufferSize = widthMipmap1 * heightMipmap1 * 4;
+ buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelDataMipmap1 = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelDataMipmap1, 0u, 1u, 0u, 0u, widthMipmap1, heightMipmap1);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to mipmaps 0 and 1
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 1u << ", " << widthMipmap1 <<", "<< heightMipmap1;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 1u << ", " << widthMipmap1 << ", " << heightMipmap1;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
END_TEST;
unsigned int widthMipmap1(32);
unsigned int heightMipmap1(32);
- Texture texture = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
//Upload data to the NEGATIVE_X face mipmap 0 and mipmap 1
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height );
-
- bufferSize = widthMipmap1 * heightMipmap1 * 4;
- buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelDataMipmap1 = PixelData::New( buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelDataMipmap1, CubeMapLayer::NEGATIVE_X, 1u, 0u, 0u, widthMipmap1, heightMipmap1 );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelData, CubeMapLayer::NEGATIVE_X, 0u, 0u, 0u, width, height);
+
+ bufferSize = widthMipmap1 * heightMipmap1 * 4;
+ buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelDataMipmap1 = PixelData::New(buffer, bufferSize, width, height, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelDataMipmap1, CubeMapLayer::NEGATIVE_X, 1u, 0u, 0u, widthMipmap1, heightMipmap1);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data to mipmaps 0 and 1
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
{
std::stringstream out;
- out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X <<", "<< 1u << ", " << widthMipmap1 <<", "<< heightMipmap1;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_CUBE_MAP_NEGATIVE_X << ", " << 1u << ", " << widthMipmap1 << ", " << heightMipmap1;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
END_TEST;
int UtcDaliTextureUpload05(void)
{
Pixel::Format COMPRESSED_PIXEL_FORMATS[] =
- {
- Pixel::COMPRESSED_R11_EAC,
- Pixel::COMPRESSED_SIGNED_R11_EAC,
- Pixel::COMPRESSED_RG11_EAC,
- Pixel::COMPRESSED_SIGNED_RG11_EAC,
- Pixel::COMPRESSED_RGB8_ETC2,
- Pixel::COMPRESSED_SRGB8_ETC2,
- Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- Pixel::COMPRESSED_RGBA8_ETC2_EAC,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
- Pixel::COMPRESSED_RGB8_ETC1,
- Pixel::COMPRESSED_RGB_PVRTC_4BPPV1,
- Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR,
- Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
- Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
- };
- const unsigned int NUMBER_OF_COMPRESSED_PIXEL_FORMATS = sizeof( COMPRESSED_PIXEL_FORMATS ) / sizeof( Pixel::Format );
-
- for( unsigned int index = 0; index < NUMBER_OF_COMPRESSED_PIXEL_FORMATS; ++index )
+ {
+ Pixel::COMPRESSED_R11_EAC,
+ Pixel::COMPRESSED_SIGNED_R11_EAC,
+ Pixel::COMPRESSED_RG11_EAC,
+ Pixel::COMPRESSED_SIGNED_RG11_EAC,
+ Pixel::COMPRESSED_RGB8_ETC2,
+ Pixel::COMPRESSED_SRGB8_ETC2,
+ Pixel::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ Pixel::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ Pixel::COMPRESSED_RGBA8_ETC2_EAC,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ Pixel::COMPRESSED_RGB8_ETC1,
+ Pixel::COMPRESSED_RGB_PVRTC_4BPPV1,
+ Pixel::COMPRESSED_RGBA_ASTC_4x4_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_5x4_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_5x5_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_6x5_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_6x6_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_8x5_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_8x6_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_8x8_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_10x5_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_10x6_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_10x8_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_10x10_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_12x10_KHR,
+ Pixel::COMPRESSED_RGBA_ASTC_12x12_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
+ Pixel::COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
+ };
+ const unsigned int NUMBER_OF_COMPRESSED_PIXEL_FORMATS = sizeof(COMPRESSED_PIXEL_FORMATS) / sizeof(Pixel::Format);
+
+ for(unsigned int index = 0; index < NUMBER_OF_COMPRESSED_PIXEL_FORMATS; ++index)
{
TestApplication application;
//Create a texture with a compressed format
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, COMPRESSED_PIXEL_FORMATS[index], width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, COMPRESSED_PIXEL_FORMATS[index], width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
//CompressedTexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str()));
}
//Upload data to the texture
callStack.Reset();
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE );
- texture.Upload( pixelData );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE);
+ texture.Upload(pixelData);
application.SendNotification();
application.Render();
//CompressedTexImage2D should be called to upload the data
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("CompressedTexImage2D", out.str().c_str()));
}
//Upload part of the texture
callStack.Reset();
- bufferSize = width * height * 2;
- buffer = reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelDataSubImage = PixelData::New( buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE );
- texture.Upload( pixelDataSubImage, 0u, 0u, width/2, height/2, width/2, height/2 );
+ bufferSize = width * height * 2;
+ buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelDataSubImage = PixelData::New(buffer, bufferSize, width, height, COMPRESSED_PIXEL_FORMATS[index], PixelData::FREE);
+ texture.Upload(pixelDataSubImage, 0u, 0u, width / 2, height / 2, width / 2, height / 2);
application.SendNotification();
application.Render();
//CompressedTexSubImage2D should be called to upload the data
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width/2 << ", " << height/2 << ", " << width/2 << ", " << height/2;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("CompressedTexSubImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width / 2 << ", " << height / 2 << ", " << width / 2 << ", " << height / 2;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("CompressedTexSubImage2D", out.str().c_str()));
}
application.GetGlAbstraction().ResetTextureCallStack();
//Create the texture
unsigned int width(64);
unsigned int height(64);
- tet_infoline( "Creating a Texure with an alpha channel" );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ tet_infoline("Creating a Texure with an alpha channel");
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
- tet_infoline( "TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu" );
+ tet_infoline("TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu");
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
- tet_infoline( "Upload data to the texture" );
+ tet_infoline("Upload data to the texture");
callStack.Reset();
- tet_infoline( "Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly" );
- unsigned int bufferSize( width * height * 3 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE );
- texture.Upload( pixelData );
+ tet_infoline("Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly");
+ unsigned int bufferSize(width * height * 3);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, Pixel::RGB888, PixelData::FREE);
+ texture.Upload(pixelData);
application.SendNotification();
application.Render();
- tet_infoline( "TexImage2D should be called to upload the data" );
+ tet_infoline("TexImage2D should be called to upload the data");
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
END_TEST;
int UtcDaliTextureUpload07(void)
{
Pixel::Format FLOATING_POINT_PIXEL_FORMATS[] =
- {
- Pixel::RGB16F,
- Pixel::RGB32F,
- };
- const unsigned int NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS = sizeof( FLOATING_POINT_PIXEL_FORMATS ) / sizeof( Pixel::Format );
+ {
+ Pixel::RGB16F,
+ Pixel::RGB32F,
+ };
+ const unsigned int NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS = sizeof(FLOATING_POINT_PIXEL_FORMATS) / sizeof(Pixel::Format);
- for( unsigned int index = 0; index < NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS; ++index )
+ for(unsigned int index = 0; index < NUMBER_OF_FLOATING_POINT_PIXEL_FORMATS; ++index)
{
TestApplication application;
//Create the texture
unsigned int width(64);
unsigned int height(64);
- tet_infoline( "Creating a floating point texture" );
- Texture texture = Texture::New( TextureType::TEXTURE_2D, FLOATING_POINT_PIXEL_FORMATS[index], width, height );
+ tet_infoline("Creating a floating point texture");
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, FLOATING_POINT_PIXEL_FORMATS[index], width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
TraceCallStack& callStack = application.GetGlAbstraction().GetTextureTrace();
- tet_infoline( "TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu" );
+ tet_infoline("TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu");
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
- tet_infoline( "Upload data to the texture" );
+ tet_infoline("Upload data to the texture");
callStack.Reset();
- tet_infoline( "Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly" );
- unsigned int bufferSize( width * height * 3 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width, height, FLOATING_POINT_PIXEL_FORMATS[index], PixelData::FREE );
- texture.Upload( pixelData );
+ tet_infoline("Creating a RGB pixel buffer and adding that to the texture to ensure it is handled correctly");
+ unsigned int bufferSize(width * height * 3);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width, height, FLOATING_POINT_PIXEL_FORMATS[index], PixelData::FREE);
+ texture.Upload(pixelData);
application.SendNotification();
application.Render();
- tet_infoline( "TexImage2D should be called to upload the data" );
+ tet_infoline("TexImage2D should be called to upload the data");
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("TexImage2D", out.str().c_str() ) );
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("TexImage2D", out.str().c_str()));
}
}
//Create the texture
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
application.GetGlAbstraction().EnableTextureCallTrace(true);
//TexImage2D should be called with a null pointer to reserve storage for the texture in the gpu
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << width <<", "<< height;
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << width << ", " << height;
std::string params;
- DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("TexImage2D", params ) );
- DALI_TEST_EQUALS( out.str(), params, TEST_LOCATION );
+ DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("TexImage2D", params));
+ DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
}
//Upload data to the texture
callStack.Reset();
- unsigned int bufferSize( width * height * 4 );
- unsigned char* buffer= reinterpret_cast<unsigned char*>( malloc( bufferSize ) );
- PixelData pixelData = PixelData::New( buffer, bufferSize, width/2, height/2, Pixel::RGBA8888, PixelData::FREE );
- texture.Upload( pixelData );
+ unsigned int bufferSize(width * height * 4);
+ unsigned char* buffer = reinterpret_cast<unsigned char*>(malloc(bufferSize));
+ PixelData pixelData = PixelData::New(buffer, bufferSize, width / 2, height / 2, Pixel::RGBA8888, PixelData::FREE);
+ texture.Upload(pixelData);
application.SendNotification();
application.Render();
//TexImage2D should be called to upload the data
{
std::stringstream out;
- out << GL_TEXTURE_2D <<", "<< 0u << ", " << 0u << ", " << 0u << ", " << width/2 << ", " << height/2;
+ out << GL_TEXTURE_2D << ", " << 0u << ", " << 0u << ", " << 0u << ", " << width / 2 << ", " << height / 2;
std::string params;
- DALI_TEST_CHECK( callStack.FindMethodAndGetParameters("TexSubImage2D", params ) );
- DALI_TEST_EQUALS( out.str(), params, TEST_LOCATION );
+ DALI_TEST_CHECK(callStack.FindMethodAndGetParameters("TexSubImage2D", params));
+ DALI_TEST_EQUALS(out.str(), params, TEST_LOCATION);
}
END_TEST;
int UtcDaliTextureGenerateMipmaps(void)
{
TestApplication application;
- unsigned int width(64);
- unsigned int height(64);
+ unsigned int width(64);
+ unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
texture.GenerateMipmaps();
- Texture textureCubemap = Texture::New( TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height );
+ Texture textureCubemap = Texture::New(TextureType::TEXTURE_CUBE, Pixel::RGBA8888, width, height);
textureCubemap.GenerateMipmaps();
application.GetGlAbstraction().EnableTextureCallTrace(true);
{
std::stringstream out;
out << GL_TEXTURE_2D;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str() ) );
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str()));
}
{
std::stringstream out;
out << GL_TEXTURE_CUBE_MAP;
- DALI_TEST_CHECK( callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str() ) );
+ DALI_TEST_CHECK(callStack.FindMethodAndParams("GenerateMipmap", out.str().c_str()));
}
END_TEST;
int UtcDaliTextureGetWidth(void)
{
TestApplication application;
- unsigned int width(64);
- unsigned int height(64);
+ unsigned int width(64);
+ unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- DALI_TEST_EQUALS( texture.GetWidth(), width, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ DALI_TEST_EQUALS(texture.GetWidth(), width, TEST_LOCATION);
END_TEST;
}
int UtcDaliTextureGetHeight(void)
{
TestApplication application;
- unsigned int width(64);
- unsigned int height(64);
+ unsigned int width(64);
+ unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- DALI_TEST_EQUALS( texture.GetHeight(), height, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ DALI_TEST_EQUALS(texture.GetHeight(), height, TEST_LOCATION);
END_TEST;
}
//Create the texture
unsigned int width(64);
unsigned int height(64);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
- DALI_TEST_CHECK( texture );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height);
+ DALI_TEST_CHECK(texture);
application.SendNotification();
application.Render(16);
// Lose & regain context (in render 'thread')
application.ResetContext();
- DALI_TEST_CHECK( texture );
+ DALI_TEST_CHECK(texture);
END_TEST;
}
int UtcDaliNativeImageTexture01(void)
{
TestApplication application;
- tet_infoline( "UtcDaliNativeImageTexture01" );
+ tet_infoline("UtcDaliNativeImageTexture01");
- TestNativeImagePointer imageInterface = TestNativeImage::New( 16, 16 );
+ TestNativeImagePointer imageInterface = TestNativeImage::New(16, 16);
{
- Texture texture = Texture::New( *(imageInterface.Get()) );
- Actor actor = CreateRenderableActor(texture, "", "");
+ Texture texture = Texture::New(*(imageInterface.Get()));
+ Actor actor = CreateRenderableActor(texture, "", "");
application.GetScene().Add(actor);
- DALI_TEST_CHECK( texture );
+ DALI_TEST_CHECK(texture);
application.SendNotification();
application.Render(16);
- DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( actor.GetProperty(Actor::Property::SIZE), Property::Value(Vector3(16,16,0)), TEST_LOCATION);
+ DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::SIZE), Property::Value(Vector3(16, 16, 0)), TEST_LOCATION);
UnparentAndReset(actor);
application.SendNotification();
application.Render(16);
- DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 1, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliNativeImageTexture02(void)
{
TestApplication application;
- tet_infoline( "UtcDaliNativeImageTexture02 - test error on TargetTexture" );
+ tet_infoline("UtcDaliNativeImageTexture02 - test error on TargetTexture");
- TestNativeImagePointer imageInterface = TestNativeImage::New( 16, 16 );
- imageInterface->mTargetTextureError = 1u;
+ TestNativeImagePointer imageInterface = TestNativeImage::New(16, 16);
+ imageInterface->mTargetTextureError = 1u;
{
- Texture texture = Texture::New( *(imageInterface.Get()) );
- Actor actor = CreateRenderableActor(texture, "", "");
+ Texture texture = Texture::New(*(imageInterface.Get()));
+ Actor actor = CreateRenderableActor(texture, "", "");
application.GetScene().Add(actor);
- DALI_TEST_CHECK( texture );
+ DALI_TEST_CHECK(texture);
application.SendNotification();
application.Render(16);
// Expect 2 attempts to create the texture - once when adding the texture
// to the scene-graph, and again since that failed, during the Bind.
- DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION);
UnparentAndReset(actor);
application.Render(16);
// Expect that there are no further calls to create/destroy resource
- DALI_TEST_EQUALS( imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(imageInterface->mExtensionCreateCalls, 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(imageInterface->mExtensionDestroyCalls, 2, TEST_LOCATION);
END_TEST;
}
int UtcDaliTextureGenerateMipmapsNegative(void)
{
TestApplication application;
- Dali::Texture instance;
+ Dali::Texture instance;
try
{
instance.GenerateMipmaps();
int UtcDaliTextureUploadNegative01(void)
{
TestApplication application;
- Dali::Texture instance;
+ Dali::Texture instance;
try
{
Dali::PixelData arg1;
int UtcDaliTextureUploadNegative02(void)
{
TestApplication application;
- Dali::Texture instance;
+ Dali::Texture instance;
try
{
Dali::PixelData arg1;
- unsigned int arg2(0u);
- unsigned int arg3(0u);
- unsigned int arg4(0u);
- unsigned int arg5(0u);
- unsigned int arg6(0u);
- unsigned int arg7(0u);
- instance.Upload(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+ unsigned int arg2(0u);
+ unsigned int arg3(0u);
+ unsigned int arg4(0u);
+ unsigned int arg5(0u);
+ unsigned int arg6(0u);
+ unsigned int arg7(0u);
+ instance.Upload(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliTextureGetWidthNegative(void)
{
TestApplication application;
- Dali::Texture instance;
+ Dali::Texture instance;
try
{
instance.GetWidth();
int UtcDaliTextureGetHeightNegative(void)
{
TestApplication application;
- Dali::Texture instance;
+ Dali::Texture instance;
try
{
instance.GetHeight();
namespace
{
-
enum SetSampler
{
SET_SAMPLER,
DONT_SET_SAMPLER
};
-Actor CreateActor( SetSampler setSamplerOption )
+Actor CreateActor(SetSampler setSamplerOption)
{
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
TextureSet textureSet = CreateTextureSet();
Sampler sampler = Sampler::New();
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
- textureSet.SetTexture( 0u, texture );
- if( setSamplerOption == SET_SAMPLER )
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST);
+ textureSet.SetTexture(0u, texture);
+ if(setSamplerOption == SET_SAMPLER)
{
- textureSet.SetSampler( 0u, sampler );
+ textureSet.SetSampler(0u, sampler);
}
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
return actor;
}
} // namespace
-
void texture_set_test_startup(void)
{
test_return_value = TET_UNDEF;
TextureSet textureSet = TextureSet::New();
- DALI_TEST_CHECK( textureSet );
+ DALI_TEST_CHECK(textureSet);
END_TEST;
}
int UtcDaliTextureSetNew02(void)
{
TestApplication application;
- TextureSet textureSet;
- DALI_TEST_CHECK( !textureSet );
+ TextureSet textureSet;
+ DALI_TEST_CHECK(!textureSet);
END_TEST;
}
{
TestApplication application;
- Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32);
+ Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32);
TextureSet textureSet = TextureSet::New();
- textureSet.SetTexture( 0u, image );
+ textureSet.SetTexture(0u, image);
TextureSet textureSetCopy(textureSet);
- DALI_TEST_CHECK( textureSetCopy );
+ DALI_TEST_CHECK(textureSetCopy);
END_TEST;
}
int UtcDaliTextureSetAssignmentOperator(void)
{
TestApplication application;
- TextureSet textureSet = TextureSet::New();
+ TextureSet textureSet = TextureSet::New();
TextureSet textureSet2;
- DALI_TEST_CHECK( !textureSet2 );
+ DALI_TEST_CHECK(!textureSet2);
textureSet2 = textureSet;
- DALI_TEST_CHECK( textureSet2 );
+ DALI_TEST_CHECK(textureSet2);
END_TEST;
}
TestApplication application;
TextureSet textureSet = TextureSet::New();
- DALI_TEST_CHECK( textureSet );
- DALI_TEST_EQUALS( 1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(textureSet);
+ DALI_TEST_EQUALS(1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32 );
- textureSet.SetTexture( 0u, texture );
- DALI_TEST_EQUALS( textureSet.GetTexture( 0u ), texture, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32);
+ textureSet.SetTexture(0u, texture);
+ DALI_TEST_EQUALS(textureSet.GetTexture(0u), texture, TEST_LOCATION);
- TextureSet move = std::move( textureSet );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetTexture( 0u ), texture, TEST_LOCATION );
- DALI_TEST_CHECK( !textureSet );
+ TextureSet move = std::move(textureSet);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetTexture(0u), texture, TEST_LOCATION);
+ DALI_TEST_CHECK(!textureSet);
END_TEST;
}
TestApplication application;
TextureSet textureSet = TextureSet::New();
- DALI_TEST_CHECK( textureSet );
- DALI_TEST_EQUALS( 1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(textureSet);
+ DALI_TEST_EQUALS(1, textureSet.GetBaseObject().ReferenceCount(), TEST_LOCATION);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32 );
- textureSet.SetTexture( 0u, texture );
- DALI_TEST_EQUALS( textureSet.GetTexture( 0u ), texture, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32);
+ textureSet.SetTexture(0u, texture);
+ DALI_TEST_EQUALS(textureSet.GetTexture(0u), texture, TEST_LOCATION);
TextureSet move;
- move = std::move( textureSet );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( move.GetTexture( 0u ), texture, TEST_LOCATION );
- DALI_TEST_CHECK( !textureSet );
+ move = std::move(textureSet);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(move.GetTexture(0u), texture, TEST_LOCATION);
+ DALI_TEST_CHECK(!textureSet);
END_TEST;
}
int UtcDaliTextureSetDownCast01(void)
{
TestApplication application;
- TextureSet textureSet = TextureSet::New();
+ TextureSet textureSet = TextureSet::New();
BaseHandle handle(textureSet);
TextureSet textureSet2 = TextureSet::DownCast(handle);
- DALI_TEST_CHECK( textureSet2 );
+ DALI_TEST_CHECK(textureSet2);
END_TEST;
}
{
TestApplication application;
- Handle handle = Handle::New(); // Create a custom object
+ Handle handle = Handle::New(); // Create a custom object
TextureSet textureSet = TextureSet::DownCast(handle);
- DALI_TEST_CHECK( !textureSet );
+ DALI_TEST_CHECK(!textureSet);
END_TEST;
}
-
int UtcDaliTextureSetTexture01(void)
{
TestApplication application;
- Actor actor = CreateActor( DONT_SET_SAMPLER );
+ Actor actor = CreateActor(DONT_SET_SAMPLER);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
application.SendNotification();
application.Render();
- int textureUnit=-1;
- DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ int textureUnit = -1;
+ DALI_TEST_CHECK(gl.GetUniformValue<int>("sTexture", textureUnit));
+ DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION);
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// There are four calls to TexParameteri when the texture is first created
// as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION);
END_TEST;
}
Actor actor = CreateActor(SET_SAMPLER);
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
application.SendNotification();
application.Render();
- int textureUnit=-1;
- DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ int textureUnit = -1;
+ DALI_TEST_CHECK(gl.GetUniformValue<int>("sTexture", textureUnit));
+ DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION);
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// There are four calls to TexParameteri when the texture is first created
// Texture minification and magnification filters are now different than default so
//there should have been two extra TexParameteri calls to set the new filter mode
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 6, TEST_LOCATION);
END_TEST;
}
Actor actor1 = CreateActor(SET_SAMPLER);
Actor actor2 = CreateActor(SET_SAMPLER);
- application.GetScene().Add( actor1 );
- application.GetScene().Add( actor2 );
+ application.GetScene().Add(actor1);
+ application.GetScene().Add(actor2);
TestGlAbstraction& gl = application.GetGlAbstraction();
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
application.SendNotification();
application.Render();
- int textureUnit=-1;
- DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ int textureUnit = -1;
+ DALI_TEST_CHECK(gl.GetUniformValue<int>("sTexture", textureUnit));
+ DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION);
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// For each actor there are four calls to TexParameteri when the texture is first created
// Texture minification and magnification filters are now different than default so
//there should have been two extra TexParameteri calls to set the new filter mode
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2 * 6, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 2 * 6, TEST_LOCATION);
END_TEST;
}
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- Shader shader = CreateShader();
- TextureSet textureSet = CreateTextureSet( image );
+ Shader shader = CreateShader();
+ TextureSet textureSet = CreateTextureSet(image);
Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
+ Renderer renderer = Renderer::New(geometry, shader);
+ renderer.SetTextures(textureSet);
Actor actor = Actor::New();
actor.AddRenderer(renderer);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- actor.SetProperty( Actor::Property::SIZE, Vector2( 400.0f, 400.0f ) );
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
- application.GetScene().Add( actor );
+ application.GetScene().Add(actor);
TestGlAbstraction& gl = application.GetGlAbstraction();
TraceCallStack& texParameterTrace = gl.GetTexParameterTrace();
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
application.SendNotification();
application.Render();
- int textureUnit=-1;
- DALI_TEST_CHECK( gl.GetUniformValue<int>( "sTexture", textureUnit ) );
- DALI_TEST_EQUALS( textureUnit, 0, TEST_LOCATION );
+ int textureUnit = -1;
+ DALI_TEST_CHECK(gl.GetUniformValue<int>("sTexture", textureUnit));
+ DALI_TEST_EQUALS(textureUnit, 0, TEST_LOCATION);
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
// There are 4 calls to TexParameteri when the texture is first created
// as the texture is using default sampling parametrers there shouldn't be any more calls to TexParameteri
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 4, TEST_LOCATION);
texParameterTrace.Reset();
- texParameterTrace.Enable( true );
+ texParameterTrace.Enable(true);
Sampler sampler = Sampler::New();
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
- textureSet.SetSampler( 0u, sampler );
-
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST);
+ textureSet.SetSampler(0u, sampler);
application.SendNotification();
application.Render();
- texParameterTrace.Enable( false );
+ texParameterTrace.Enable(false);
// Verify gl state
//There should have been two calls to TexParameteri to set the new filtering mode
- DALI_TEST_EQUALS( texParameterTrace.CountMethod( "TexParameteri" ), 2, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(texParameterTrace.CountMethod("TexParameteri"), 2, TEST_LOCATION);
END_TEST;
}
TestApplication application;
TextureSet textureSet = CreateTextureSet();
- DALI_TEST_EQUALS( textureSet.GetTexture(0), Texture(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(2), Texture(), TEST_LOCATION );
+ DALI_TEST_EQUALS(textureSet.GetTexture(0), Texture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(2), Texture(), TEST_LOCATION);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 );
- textureSet.SetTexture( 0u, texture );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ textureSet.SetTexture(0u, texture);
- DALI_TEST_EQUALS( textureSet.GetTexture(0), texture, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(2), Texture(), TEST_LOCATION );
+ DALI_TEST_EQUALS(textureSet.GetTexture(0), texture, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(2), Texture(), TEST_LOCATION);
- textureSet.SetTexture( 2u, texture );
- DALI_TEST_EQUALS( textureSet.GetTexture(0), texture, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(2), texture, TEST_LOCATION );
+ textureSet.SetTexture(2u, texture);
+ DALI_TEST_EQUALS(textureSet.GetTexture(0), texture, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(2), texture, TEST_LOCATION);
- textureSet.SetTexture( 2u, Texture() );
- DALI_TEST_EQUALS( textureSet.GetTexture(0), texture, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(1), Texture(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetTexture(2), Texture(), TEST_LOCATION );
+ textureSet.SetTexture(2u, Texture());
+ DALI_TEST_EQUALS(textureSet.GetTexture(0), texture, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(1), Texture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetTexture(2), Texture(), TEST_LOCATION);
END_TEST;
}
TestApplication application;
TextureSet textureSet = CreateTextureSet();
- DALI_TEST_EQUALS( textureSet.GetSampler(0), Sampler(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(2), Sampler(), TEST_LOCATION );
+ DALI_TEST_EQUALS(textureSet.GetSampler(0), Sampler(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(2), Sampler(), TEST_LOCATION);
Sampler sampler = Sampler::New();
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
- textureSet.SetSampler( 0u, sampler );
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST);
+ textureSet.SetSampler(0u, sampler);
- DALI_TEST_EQUALS( textureSet.GetSampler(0), sampler, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(2), Sampler(), TEST_LOCATION );
+ DALI_TEST_EQUALS(textureSet.GetSampler(0), sampler, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(2), Sampler(), TEST_LOCATION);
- textureSet.SetSampler( 2u, sampler );
- DALI_TEST_EQUALS( textureSet.GetSampler(0), sampler, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(2), sampler, TEST_LOCATION );
+ textureSet.SetSampler(2u, sampler);
+ DALI_TEST_EQUALS(textureSet.GetSampler(0), sampler, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(2), sampler, TEST_LOCATION);
- textureSet.SetSampler( 2u, Sampler() );
- DALI_TEST_EQUALS( textureSet.GetSampler(0), sampler, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(1), Sampler(), TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(2), Sampler(), TEST_LOCATION );
+ textureSet.SetSampler(2u, Sampler());
+ DALI_TEST_EQUALS(textureSet.GetSampler(0), sampler, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(1), Sampler(), TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(2), Sampler(), TEST_LOCATION);
END_TEST;
}
TestApplication application;
TextureSet textureSet = CreateTextureSet();
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 0u, TEST_LOCATION);
Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
- textureSet.SetTexture( 0u, image );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 1u, TEST_LOCATION );
+ textureSet.SetTexture(0u, image);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 1u, TEST_LOCATION);
- textureSet.SetTexture( 1u, image );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION );
+ textureSet.SetTexture(1u, image);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION);
Sampler sampler = Sampler::New();
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
- textureSet.SetSampler( 2u, sampler );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION );
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST);
+ textureSet.SetSampler(2u, sampler);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION);
- textureSet.SetTexture( 2u, image );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 3u, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(2u), sampler, TEST_LOCATION );
+ textureSet.SetTexture(2u, image);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(2u), sampler, TEST_LOCATION);
END_TEST;
}
TestApplication application;
TextureSet textureSet = CreateTextureSet();
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 0u, TEST_LOCATION);
- Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64 );
- textureSet.SetTexture( 0u, texture );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 1u, TEST_LOCATION );
+ Texture texture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64);
+ textureSet.SetTexture(0u, texture);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 1u, TEST_LOCATION);
- textureSet.SetTexture( 1u, texture );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION );
+ textureSet.SetTexture(1u, texture);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION);
Sampler sampler = Sampler::New();
- sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
- textureSet.SetSampler( 2u, sampler );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION );
-
- textureSet.SetTexture( 2u, texture );
- DALI_TEST_EQUALS( textureSet.GetTextureCount(), 3u, TEST_LOCATION );
- DALI_TEST_EQUALS( textureSet.GetSampler(2u), sampler, TEST_LOCATION );
+ sampler.SetFilterMode(FilterMode::NEAREST, FilterMode::NEAREST);
+ textureSet.SetSampler(2u, sampler);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 2u, TEST_LOCATION);
+ textureSet.SetTexture(2u, texture);
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(textureSet.GetSampler(2u), sampler, TEST_LOCATION);
END_TEST;
}
int UtcDaliTextureSetSetSamplerNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TextureSet instance;
try
{
unsigned long arg1(0u);
Dali::Sampler arg2;
- instance.SetSampler(arg1,arg2);
+ instance.SetSampler(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliTextureSetSetTextureNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TextureSet instance;
try
{
unsigned long arg1(0u);
Dali::Texture arg2;
- instance.SetTexture(arg1,arg2);
+ instance.SetTexture(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliTextureSetGetSamplerNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TextureSet instance;
try
{
int UtcDaliTextureSetGetTextureNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TextureSet instance;
try
{
int UtcDaliTextureSetGetTextureCountNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TextureSet instance;
try
{
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/thread.h>
#include <stdlib.h>
#include <unistd.h>
+
+#include <iostream>
#include <type_traits>
-#include <dali-test-suite-utils.h>
-#include <dali/devel-api/threading/thread.h>
using Dali::Thread;
gRunThreadEntryFunc = true;
}
};
-}
+} // namespace
int UtcDaliThreadP(void)
{
thread.Start();
// wait till the thread is terminated
- while( !gRunThreadEntryFunc )
+ while(!gRunThreadEntryFunc)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
- DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, gRunThreadEntryFunc, TEST_LOCATION);
thread.Join();
thread.Start();
thread.Join();
// wait till the thread is terminated
- while( !gRunThreadEntryFunc )
+ while(!gRunThreadEntryFunc)
{
- usleep( 1 ); // 1 microsecond
+ usleep(1); // 1 microsecond
}
- DALI_TEST_EQUALS( true, gRunThreadEntryFunc, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, gRunThreadEntryFunc, TEST_LOCATION);
END_TEST;
}
{
// we want to make sure that mutex is not copyable (its copy constructor is not defined)
// this test will stop compiling if Mutex has compiler generated copy constructor
- static_assert( !__has_trivial_copy( Thread ), "Thread should NOT be copyable" );
+ static_assert(!__has_trivial_copy(Thread), "Thread should NOT be copyable");
- DALI_TEST_CHECK( true );
+ DALI_TEST_CHECK(true);
END_TEST;
}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-#include <iostream>
+#include <dali-test-suite-utils.h>
+#include <dali/devel-api/threading/thread-pool.h>
#include <stdlib.h>
#include <unistd.h>
+
+#include <iostream>
#include <type_traits>
-#include <dali-test-suite-utils.h>
-#include <dali/devel-api/threading/thread-pool.h>
namespace
{
// Helper function dividing workload into N batches
// the loop lambda contains
-Dali::UniqueFutureGroup ForEachMT( Dali::ThreadPool* pThreadPool,
- uint32_t first,
- uint32_t size,
- std::function<void( uint32_t, uint32_t, uint32_t )> task )
+Dali::UniqueFutureGroup ForEachMT(Dali::ThreadPool* pThreadPool,
+ uint32_t first,
+ uint32_t size,
+ std::function<void(uint32_t, uint32_t, uint32_t)> task)
{
- uint32_t i = 0;
- uint32_t j = 0;
+ uint32_t i = 0;
+ uint32_t j = 0;
const auto workerCount = uint32_t(pThreadPool->GetWorkerCount());
- const auto step = size / workerCount;
- j = workerCount + step;
+ const auto step = size / workerCount;
+ j = workerCount + step;
std::vector<Dali::Task> tasks;
- tasks.reserve( workerCount );
+ tasks.reserve(workerCount);
- for( auto threadIndex = 0u; threadIndex < workerCount; ++threadIndex )
+ for(auto threadIndex = 0u; threadIndex < workerCount; ++threadIndex)
{
- Dali::Task lambda = [task, i, j]( int workerIndex )
- {
- task( uint32_t(workerIndex), i, j );
+ Dali::Task lambda = [task, i, j](int workerIndex) {
+ task(uint32_t(workerIndex), i, j);
};
- tasks.emplace_back( lambda );
+ tasks.emplace_back(lambda);
i = j;
j = i + step;
- if( j > size )
+ if(j > size)
j = size;
}
- return pThreadPool->SubmitTasks( tasks, workerCount );
+ return pThreadPool->SubmitTasks(tasks, workerCount);
}
-}
+} // namespace
int UtcDaliThreadPoolMultipleTasks(void)
{
// initialise global thread pool
- if( !gThreadPool.GetWorkerCount() )
+ if(!gThreadPool.GetWorkerCount())
{
- gThreadPool.Initialize( 0u );
+ gThreadPool.Initialize(0u);
}
// populate inputs
std::array<int, 8192> inputs;
- int checksum = 0;
- for( auto i = 0; i < decltype(i)(inputs.size()); ++i )
+ int checksum = 0;
+ for(auto i = 0; i < decltype(i)(inputs.size()); ++i)
{
inputs[i] = i;
checksum += i;
auto workerCount = gThreadPool.GetWorkerCount();
std::vector<int> outputs;
- outputs.resize( workerCount );
- std::fill( outputs.begin(), outputs.end(), 0 );
+ outputs.resize(workerCount);
+ std::fill(outputs.begin(), outputs.end(), 0);
// submit
- auto future = ForEachMT( &gThreadPool, 0, inputs.size(), [&inputs, &outputs]( uint32_t workerIndex, uint32_t begin, uint32_t end )
- {
- for( auto i = begin; i < end; ++i )
+ auto future = ForEachMT(&gThreadPool, 0, inputs.size(), [&inputs, &outputs](uint32_t workerIndex, uint32_t begin, uint32_t end) {
+ for(auto i = begin; i < end; ++i)
{
outputs[workerIndex] += inputs[i];
}
// check outputs
int checksum2 = 0;
- for( auto output : outputs )
+ for(auto output : outputs)
{
checksum2 += output;
}
printf("sum: %d, sum2: %d\n", checksum, checksum2);
-
- DALI_TEST_EQUALS( checksum, checksum2, TEST_LOCATION );
+ DALI_TEST_EQUALS(checksum, checksum2, TEST_LOCATION);
END_TEST;
}
int UtcDaliThreadPoolSingleTask(void)
{
// initialise global thread pool
- if( !gThreadPool.GetWorkerCount() )
+ if(!gThreadPool.GetWorkerCount())
{
- gThreadPool.Initialize( 0u );
+ gThreadPool.Initialize(0u);
}
// some long lasting task
- int counter = 0;
- auto task = [&counter]( int workerIndex ){
- for( int i = 0; i < 10; ++i )
+ int counter = 0;
+ auto task = [&counter](int workerIndex) {
+ for(int i = 0; i < 10; ++i)
{
counter++;
- usleep( 16 * 1000 );
+ usleep(16 * 1000);
}
};
- auto future = gThreadPool.SubmitTask( 0, task );
+ auto future = gThreadPool.SubmitTask(0, task);
future->Wait();
- DALI_TEST_EQUALS( counter, 10, TEST_LOCATION );
+ DALI_TEST_EQUALS(counter, 10, TEST_LOCATION);
END_TEST;
}
int UtcDaliThreadPoolSubmitTasksCopyArray(void)
{
// initialise global thread pool
- if( !gThreadPool.GetWorkerCount() )
+ if(!gThreadPool.GetWorkerCount())
{
- gThreadPool.Initialize( 0u );
+ gThreadPool.Initialize(0u);
}
- std::array<uint8_t, 1024*1024> dataSrc;
- for( auto i = 0; i < decltype(i)(dataSrc.size()); ++i)
+ std::array<uint8_t, 1024 * 1024> dataSrc;
+ for(auto i = 0; i < decltype(i)(dataSrc.size()); ++i)
{
dataSrc[i] = (std::rand() % 0xff);
}
- std::array<uint8_t, 1024*1024> dataDst;
+ std::array<uint8_t, 1024 * 1024> dataDst;
// each task copies 1kb od data
std::vector<Dali::Task> tasks;
- for( int i = 0; i < 1024; ++i )
+ for(int i = 0; i < 1024; ++i)
{
- auto task = [&dataSrc, &dataDst, i ]( int workerIndex )
- {
- for( int k = 0; k < 1024; ++k )
+ auto task = [&dataSrc, &dataDst, i](int workerIndex) {
+ for(int k = 0; k < 1024; ++k)
{
- dataDst[i*1024+k] = dataSrc[i*1024+k];
+ dataDst[i * 1024 + k] = dataSrc[i * 1024 + k];
}
};
- tasks.push_back( task );
+ tasks.push_back(task);
}
- DALI_TEST_EQUALS( 1024, tasks.size(), TEST_LOCATION );
+ DALI_TEST_EQUALS(1024, tasks.size(), TEST_LOCATION);
- gThreadPool.SubmitTasks( tasks );
+ gThreadPool.SubmitTasks(tasks);
// wait for pool to finish
gThreadPool.Wait();
// compare arrays
- for( auto i = 0; i < decltype(i)(dataSrc.size()); ++i )
+ for(auto i = 0; i < decltype(i)(dataSrc.size()); ++i)
{
- DALI_TEST_EQUALS( dataSrc[i], dataDst[i], TEST_LOCATION );
- if( dataSrc[i] != dataDst[i] )
+ DALI_TEST_EQUALS(dataSrc[i], dataDst[i], TEST_LOCATION);
+ if(dataSrc[i] != dataDst[i])
{
break;
}
*
*/
-#include <iostream>
+#include <dali-test-suite-utils.h>
+#include <dali/integration-api/events/touch-integ.h>
+#include <dali/public-api/dali-core.h>
#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-integ.h>
-#include <dali-test-suite-utils.h>
+#include <iostream>
void utc_dali_touch_event_startup(void)
{
{
return TouchPoint(1, PointState::STARTED, 100.0f, 200.0f);
}
-}
+} // namespace
int UtcDaliTouchEventConstructorP(void)
{
TouchEvent touchEvent;
- DALI_TEST_CHECK( !touchEvent );
+ DALI_TEST_CHECK(!touchEvent);
END_TEST;
}
int UtcDaliTouchEventCopyConstructorP(void)
{
TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
- DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK(touchEvent);
const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
- TouchEvent touchEvent2( touchEvent );
- DALI_TEST_CHECK( touchEvent );
- DALI_TEST_CHECK( touchEvent2 );
- DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION );
- DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ TouchEvent touchEvent2(touchEvent);
+ DALI_TEST_CHECK(touchEvent);
+ DALI_TEST_CHECK(touchEvent2);
+ DALI_TEST_EQUALS(touchEvent, touchEvent2, TEST_LOCATION);
+ DALI_TEST_EQUALS(refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION);
END_TEST;
}
int UtcDaliTouchEventMoveConstructorP(void)
{
TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
- DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK(touchEvent);
const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
- TouchEvent touchEvent2( std::move(touchEvent) );
- DALI_TEST_CHECK( !touchEvent );
- DALI_TEST_CHECK( touchEvent2 );
- DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ TouchEvent touchEvent2(std::move(touchEvent));
+ DALI_TEST_CHECK(!touchEvent);
+ DALI_TEST_CHECK(touchEvent2);
+ DALI_TEST_EQUALS(refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION);
END_TEST;
}
int UtcDaliTouchEventCopyAssignmentP(void)
{
TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
- DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK(touchEvent);
const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
TouchEvent touchEvent2;
- DALI_TEST_CHECK( !touchEvent2 );
+ DALI_TEST_CHECK(!touchEvent2);
touchEvent2 = touchEvent;
- DALI_TEST_CHECK( touchEvent );
- DALI_TEST_CHECK( touchEvent2 );
- DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION );
- DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(touchEvent);
+ DALI_TEST_CHECK(touchEvent2);
+ DALI_TEST_EQUALS(touchEvent, touchEvent2, TEST_LOCATION);
+ DALI_TEST_EQUALS(refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION);
END_TEST;
}
int UtcDaliTouchEventMoveAssignmentP(void)
{
TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
- DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK(touchEvent);
const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
TouchEvent touchEvent2;
- DALI_TEST_CHECK( !touchEvent2 );
+ DALI_TEST_CHECK(!touchEvent2);
touchEvent2 = std::move(touchEvent);
- DALI_TEST_CHECK( !touchEvent );
- DALI_TEST_CHECK( touchEvent2 );
- DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ DALI_TEST_CHECK(!touchEvent);
+ DALI_TEST_CHECK(touchEvent2);
+ DALI_TEST_EQUALS(refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION);
END_TEST;
}
{
Dali::Integration::Point point;
- Vector2 touchPoint( 10.0, 20.0 );
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
+ Vector2 touchPoint(10.0, 20.0);
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
TouchEvent touchEvent = Integration::NewTouchEvent(123u, point);
- DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK(touchEvent);
const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
- TouchEvent touchEvent2( touchEvent );
- DALI_TEST_CHECK( touchEvent );
- DALI_TEST_CHECK( touchEvent2 );
- DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION );
- DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ TouchEvent touchEvent2(touchEvent);
+ DALI_TEST_CHECK(touchEvent);
+ DALI_TEST_CHECK(touchEvent2);
+ DALI_TEST_EQUALS(touchEvent, touchEvent2, TEST_LOCATION);
+ DALI_TEST_EQUALS(refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION);
END_TEST;
}
{
Dali::Integration::Point point;
- Vector2 touchPoint( 10.0, 20.0 );
- point.SetDeviceId( 1 );
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
+ Vector2 touchPoint(10.0, 20.0);
+ point.SetDeviceId(1);
+ point.SetState(PointState::DOWN);
+ point.SetScreenPosition(Vector2(touchPoint.x, touchPoint.y));
TouchEvent touchEvent = Integration::NewTouchEvent(123u, point);
- DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK(touchEvent);
const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
- TouchEvent touchEvent2( std::move(touchEvent) );
- DALI_TEST_CHECK( !touchEvent );
- DALI_TEST_CHECK( touchEvent2 );
- DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+ TouchEvent touchEvent2(std::move(touchEvent));
+ DALI_TEST_CHECK(!touchEvent);
+ DALI_TEST_CHECK(touchEvent2);
+ DALI_TEST_EQUALS(refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/touch-event-combiner.h>
#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/hover-event-integ.h>
-#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
using namespace Dali::Integration;
namespace
{
-Point GeneratePoint( int deviceId, PointState::Type state, float x, float y )
+Point GeneratePoint(int deviceId, PointState::Type state, float x, float y)
{
Point point;
- point.SetDeviceId( deviceId );
- point.SetState( state );
- point.SetScreenPosition( Vector2( x, y ) );
+ point.SetDeviceId(deviceId);
+ point.SetState(state);
+ point.SetScreenPosition(Vector2(x, y));
return point;
}
-}
+} // namespace
void utc_dali_touch_event_combiner_startup(void)
{
test_return_value = TET_PASS;
}
-
int UtcDaliTouchEventCombinerConstructors(void)
{
TouchEventCombiner combiner1;
- DALI_TEST_EQUALS( combiner1.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(1), TEST_LOCATION );
- DALI_TEST_EQUALS( combiner1.GetMinimumMotionDistanceThreshold(), Vector2( 1.0f, 1.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(combiner1.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(1), TEST_LOCATION);
+ DALI_TEST_EQUALS(combiner1.GetMinimumMotionDistanceThreshold(), Vector2(1.0f, 1.0f), TEST_LOCATION);
- TouchEventCombiner combiner2( 10, 20.0f, 31.0f );
- DALI_TEST_EQUALS( combiner2.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
- DALI_TEST_EQUALS( combiner2.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
+ TouchEventCombiner combiner2(10, 20.0f, 31.0f);
+ DALI_TEST_EQUALS(combiner2.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION);
+ DALI_TEST_EQUALS(combiner2.GetMinimumMotionDistanceThreshold(), Vector2(20.0f, 31.0f), TEST_LOCATION);
- TouchEventCombiner combiner3( 10, Vector2( 20.0f, 31.0f ) );
- DALI_TEST_EQUALS( combiner3.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
- DALI_TEST_EQUALS( combiner3.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
+ TouchEventCombiner combiner3(10, Vector2(20.0f, 31.0f));
+ DALI_TEST_EQUALS(combiner3.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION);
+ DALI_TEST_EQUALS(combiner3.GetMinimumMotionDistanceThreshold(), Vector2(20.0f, 31.0f), TEST_LOCATION);
// Boundary Checks
- TouchEventCombiner combiner4( 10, 0.0f, 0.0f );
- DALI_TEST_EQUALS( combiner4.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
+ TouchEventCombiner combiner4(10, 0.0f, 0.0f);
+ DALI_TEST_EQUALS(combiner4.GetMinimumMotionDistanceThreshold(), Vector2(0.0f, 0.0f), TEST_LOCATION);
- TouchEventCombiner combiner5( 10, Vector2( 0.0f, 0.0f ) );
- DALI_TEST_EQUALS( combiner5.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
+ TouchEventCombiner combiner5(10, Vector2(0.0f, 0.0f));
+ DALI_TEST_EQUALS(combiner5.GetMinimumMotionDistanceThreshold(), Vector2(0.0f, 0.0f), TEST_LOCATION);
END_TEST;
}
{
try
{
- TouchEventCombiner combiner( 10, -20.0f, 31.0f );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ TouchEventCombiner combiner(10, -20.0f, 31.0f);
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- TouchEventCombiner combiner( 10, 20.0f, -31.0f );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ TouchEventCombiner combiner(10, 20.0f, -31.0f);
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- TouchEventCombiner combiner( 10, Vector2( -20.0f, 31.0f ) );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ TouchEventCombiner combiner(10, Vector2(-20.0f, 31.0f));
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- TouchEventCombiner combiner( 10, Vector2( 20.0f, -31.0f ) );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ TouchEventCombiner combiner(10, Vector2(20.0f, -31.0f));
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSettersAndGetters(void)
{
TouchEventCombiner combiner;
- unsigned long time( 10u );
- Vector2 distance( 40.0f, 30.0f );
+ unsigned long time(10u);
+ Vector2 distance(40.0f, 30.0f);
- DALI_TEST_CHECK( combiner.GetMinimumMotionTimeThreshold() != time );
- DALI_TEST_CHECK( combiner.GetMinimumMotionDistanceThreshold() != distance );
+ DALI_TEST_CHECK(combiner.GetMinimumMotionTimeThreshold() != time);
+ DALI_TEST_CHECK(combiner.GetMinimumMotionDistanceThreshold() != distance);
- combiner.SetMinimumMotionTimeThreshold( time );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION );
+ combiner.SetMinimumMotionTimeThreshold(time);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION);
- combiner.SetMinimumMotionDistanceThreshold( distance.x );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2( distance.x, distance.x ), TEST_LOCATION );
+ combiner.SetMinimumMotionDistanceThreshold(distance.x);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2(distance.x, distance.x), TEST_LOCATION);
distance.x = 20.0f;
distance.y = 50.0f;
- combiner.SetMinimumMotionDistanceThreshold( distance.x, distance.y );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
+ combiner.SetMinimumMotionDistanceThreshold(distance.x, distance.y);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION);
distance.x = 100.0f;
distance.y = 20.0f;
- combiner.SetMinimumMotionDistanceThreshold( distance );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
+ combiner.SetMinimumMotionDistanceThreshold(distance);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION);
// Boundary Checks
- combiner.SetMinimumMotionDistanceThreshold( 0.0f );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
+ combiner.SetMinimumMotionDistanceThreshold(0.0f);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION);
- combiner.SetMinimumMotionDistanceThreshold( 0.0f, 0.0f );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
+ combiner.SetMinimumMotionDistanceThreshold(0.0f, 0.0f);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION);
- combiner.SetMinimumMotionDistanceThreshold( Vector2::ZERO );
- DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
+ combiner.SetMinimumMotionDistanceThreshold(Vector2::ZERO);
+ DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION);
END_TEST;
}
try
{
- combiner.SetMinimumMotionDistanceThreshold( -100.0f );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ combiner.SetMinimumMotionDistanceThreshold(-100.0f);
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- combiner.SetMinimumMotionDistanceThreshold( -100.0f, 20.0f );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ combiner.SetMinimumMotionDistanceThreshold(-100.0f, 20.0f);
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- combiner.SetMinimumMotionDistanceThreshold( 100.0f, -20.0f );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ combiner.SetMinimumMotionDistanceThreshold(100.0f, -20.0f);
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- combiner.SetMinimumMotionDistanceThreshold( Vector2( -100.0f, 20.0f ) );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ combiner.SetMinimumMotionDistanceThreshold(Vector2(-100.0f, 20.0f));
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
try
{
- combiner.SetMinimumMotionDistanceThreshold( Vector2( 100.0f, -20.0f ) );
- tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ combiner.SetMinimumMotionDistanceThreshold(Vector2(100.0f, -20.0f));
+ tet_printf("%s: Should have asserted\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- tet_result( TET_PASS );
+ tet_result(TET_PASS);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchNormal(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 101.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 101.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
// Motion event, but same time
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
// Up event, no time diff, no movement
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Motion event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Motion event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 103.0f, 103.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 103.0f, 103.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 103.0f, 103.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 103.0f, 103.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::FINISHED, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::FINISHED, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Up event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchTwoUps(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(2, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::MOTION, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(2, PointState::MOTION, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerMultiTouchNormal(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// 1st point down
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::DOWN, 200.0f, 200.0f );
+ Integration::Point point = GeneratePoint(2, PointState::DOWN, 200.0f, 200.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
// 2nd point motion, no time diff
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::MOTION, 200.0f, 200.0f );
+ Integration::Point point = GeneratePoint(2, PointState::MOTION, 200.0f, 200.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::MOTION, 201.0f, 201.0f );
+ Integration::Point point = GeneratePoint(2, PointState::MOTION, 201.0f, 201.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 101.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 101.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::MOTION, 202.0f, 202.0f );
+ Integration::Point point = GeneratePoint(2, PointState::MOTION, 202.0f, 202.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 2, PointState::UP, 202.0f, 202.0f );
+ Integration::Point point = GeneratePoint(2, PointState::UP, 202.0f, 202.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSeveralPoints(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
- unsigned int const maximum( 200u );
+ unsigned long time(0u);
+ unsigned int const maximum(200u);
// Several downs
- for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
+ for(unsigned int pointCount = 1u; pointCount < maximum; ++pointCount)
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(pointCount, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time++, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION);
}
// Several Ups
- for ( unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount )
+ for(unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount)
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( pointCount, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(pointCount, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time++, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerReset(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerSingleTouchInterrupted(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Down event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
}
time++;
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::INTERRUPTED, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
}
// Send up, should not be able to send as combiner has been reset.
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerMultiTouchInterrupted(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
- unsigned int const maximum( 200u );
+ unsigned long time(0u);
+ unsigned int const maximum(200u);
// Several downs
- for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
+ for(unsigned int pointCount = 1u; pointCount < maximum; ++pointCount)
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(pointCount, PointState::DOWN, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION);
}
// Interrupted event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::INTERRUPTED, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
}
// Send up, should not be able to send as combiner has been reset.
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
int UtcDaliTouchEventCombinerInvalidState(void)
{
TouchEventCombiner combiner;
- unsigned long time( 0u );
+ unsigned long time(0u);
// Stationary event
{
Integration::TouchEvent touchEvent;
Integration::HoverEvent hoverEvent;
- Integration::Point point = GeneratePoint( 1, PointState::STATIONARY, 100.0f, 100.0f );
+ Integration::Point point = GeneratePoint(1, PointState::STATIONARY, 100.0f, 100.0f);
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
}
END_TEST;
}
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/touch-integ.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/touch-integ.h>
+#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
{
struct TestPoint
{
- int32_t deviceId{-1};
- PointState::Type state{PointState::FINISHED};
- Actor hitActor;
- Vector2 local;
- Vector2 screen;
- float radius{0};
- Vector2 ellipseRadius;
- float pressure{0};
- Degree angle;
- Device::Class::Type deviceClass{Device::Class::NONE};
+ int32_t deviceId{-1};
+ PointState::Type state{PointState::FINISHED};
+ Actor hitActor;
+ Vector2 local;
+ Vector2 screen;
+ float radius{0};
+ Vector2 ellipseRadius;
+ float pressure{0};
+ Degree angle;
+ Device::Class::Type deviceClass{Device::Class::NONE};
Device::Subclass::Type deviceSubclass{Device::Subclass::NONE};
TestPoint() = default;
const TestPoint TestPoint::ZERO;
-
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
- : functorCalled( false ),
+ : functorCalled(false),
receivedTouch(),
touchedActor()
{
struct TestTouchEvent
{
- unsigned long time;
+ unsigned long time;
std::vector<TestPoint> points;
const TestPoint& GetPoint(size_t i)
{
- if( i < points.size() )
+ if(i < points.size())
{
return points[i];
}
touchedActor.Reset();
}
- bool functorCalled;
+ bool functorCalled;
TestTouchEvent receivedTouch;
- Actor touchedActor;
+ Actor touchedActor;
};
// Functor that sets the data when called
* @param[in] data Reference to the data to store callback information.
* @param[in] returnValue What the functor should return.
*/
- TouchEventFunctor( SignalData& data, bool returnValue = true )
- : signalData( data ),
- returnValue( returnValue )
+ TouchEventFunctor(SignalData& data, bool returnValue = true)
+ : signalData(data),
+ returnValue(returnValue)
{
}
- bool operator()( Actor actor, const TouchEvent& touch )
+ bool operator()(Actor actor, const TouchEvent& touch)
{
signalData.functorCalled = true;
- signalData.touchedActor = actor;
+ signalData.touchedActor = actor;
signalData.receivedTouch.time = touch.GetTime();
signalData.receivedTouch.points.clear();
- for( size_t i=0; i<touch.GetPointCount(); ++i )
+ for(size_t i = 0; i < touch.GetPointCount(); ++i)
{
TestPoint p;
- p.deviceId = touch.GetDeviceId(i);
- p.state = touch.GetState(i);
- p.hitActor = touch.GetHitActor(i);
- p.local = touch.GetLocalPosition(i);
- p.screen = touch.GetScreenPosition(i);
- p.radius = touch.GetRadius(i);
- p.ellipseRadius = touch.GetEllipseRadius(i);
- p.pressure = touch.GetPressure(i);
- p.angle = touch.GetAngle(i);
- p.deviceClass = touch.GetDeviceClass(i);
+ p.deviceId = touch.GetDeviceId(i);
+ p.state = touch.GetState(i);
+ p.hitActor = touch.GetHitActor(i);
+ p.local = touch.GetLocalPosition(i);
+ p.screen = touch.GetScreenPosition(i);
+ p.radius = touch.GetRadius(i);
+ p.ellipseRadius = touch.GetEllipseRadius(i);
+ p.pressure = touch.GetPressure(i);
+ p.angle = touch.GetAngle(i);
+ p.deviceClass = touch.GetDeviceClass(i);
p.deviceSubclass = touch.GetDeviceSubclass(i);
signalData.receivedTouch.points.push_back(p);
}
}
SignalData& signalData;
- bool returnValue;
+ bool returnValue;
};
struct HandleData
{
- bool signalReceived;
+ bool signalReceived;
TouchEvent receivedTouchHandle;
HandleData()
* @param[in] data Reference to the data to store callback information.
* @param[in] returnValue What the functor should return.
*/
- TouchEventHandleFunctor( HandleData& handleData, bool returnValue = true )
+ TouchEventHandleFunctor(HandleData& handleData, bool returnValue = true)
: handleData(handleData),
- returnValue( returnValue )
+ returnValue(returnValue)
{
}
- bool operator()( Actor actor, const TouchEvent& someTouchEvent )
+ bool operator()(Actor actor, const TouchEvent& someTouchEvent)
{
- handleData.signalReceived = true;
+ handleData.signalReceived = true;
handleData.receivedTouchHandle = someTouchEvent;
return returnValue;
}
HandleData& handleData;
- bool returnValue;
+ bool returnValue;
};
-
// Functor that removes the actor when called.
struct RemoveActorFunctor : public TouchEventFunctor
{
* @param[in] data Reference to the data to store callback information.
* @param[in] returnValue What the functor should return.
*/
- RemoveActorFunctor( SignalData& data, bool returnValue = true )
- : TouchEventFunctor( data, returnValue )
+ RemoveActorFunctor(SignalData& data, bool returnValue = true)
+ : TouchEventFunctor(data, returnValue)
{
}
- bool operator()( Actor actor, const TouchEvent& touch )
+ bool operator()(Actor actor, const TouchEvent& touch)
{
- Actor parent( actor.GetParent() );
- if ( parent )
+ Actor parent(actor.GetParent());
+ if(parent)
{
- parent.Remove( actor );
+ parent.Remove(actor);
}
- return TouchEventFunctor::operator()( actor, touch );
+ return TouchEventFunctor::operator()(actor, touch);
}
};
struct OutOfBoundsData
{
TestPoint point;
- bool functorCalled;
+ bool functorCalled;
OutOfBoundsData()
- :functorCalled(false)
+ : functorCalled(false)
{
}
};
* @param[in] data Reference to the data to store callback information.
* @param[in] returnValue What the functor should return.
*/
- OutOfBoundsFunctor( OutOfBoundsData& data, bool returnValue = true )
- : outOfBoundsData ( data ),
- returnValue( returnValue )
+ OutOfBoundsFunctor(OutOfBoundsData& data, bool returnValue = true)
+ : outOfBoundsData(data),
+ returnValue(returnValue)
{
}
- bool operator()( Actor actor, const TouchEvent& touch )
+ bool operator()(Actor actor, const TouchEvent& touch)
{
outOfBoundsData.functorCalled = true;
- size_t count = touch.GetPointCount();
+ size_t count = touch.GetPointCount();
// Read out of bounds data
- outOfBoundsData.point.deviceId = touch.GetDeviceId(count+1);
- outOfBoundsData.point.state = touch.GetState(count+1);
- outOfBoundsData.point.hitActor = touch.GetHitActor(count+1);
- outOfBoundsData.point.local = touch.GetLocalPosition(count+1);
- outOfBoundsData.point.screen = touch.GetScreenPosition(count+1);
+ outOfBoundsData.point.deviceId = touch.GetDeviceId(count + 1);
+ outOfBoundsData.point.state = touch.GetState(count + 1);
+ outOfBoundsData.point.hitActor = touch.GetHitActor(count + 1);
+ outOfBoundsData.point.local = touch.GetLocalPosition(count + 1);
+ outOfBoundsData.point.screen = touch.GetScreenPosition(count + 1);
return returnValue;
}
OutOfBoundsData& outOfBoundsData;
- bool returnValue;
+ bool returnValue;
};
-Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition )
+Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition)
{
Integration::TouchEvent touchEvent;
- Integration::Point point;
- point.SetState( state );
- point.SetScreenPosition( screenPosition );
- point.SetDeviceClass( Device::Class::TOUCH );
- point.SetDeviceSubclass( Device::Subclass::NONE );
- touchEvent.points.push_back( point );
+ Integration::Point point;
+ point.SetState(state);
+ point.SetScreenPosition(screenPosition);
+ point.SetDeviceClass(Device::Class::TOUCH);
+ point.SetDeviceSubclass(Device::Subclass::NONE);
+ touchEvent.points.push_back(point);
return touchEvent;
}
-} // anon namespace
+} // namespace
///////////////////////////////////////////////////////////////////////////////
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touch signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 localCoordinates;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- const TestPoint *point1 = &data.receivedTouch.GetPoint(0);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, point1->state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, point1->screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, point1->local, 0.1f, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ const TestPoint* point1 = &data.receivedTouch.GetPoint(0);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, point1->state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, point1->screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, point1->local, 0.1f, TEST_LOCATION);
data.Reset();
// Emit a motion signal
screenCoordinates.x = screenCoordinates.y = 11.0f;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, screenCoordinates ) );
- const TestPoint *point2 = &data.receivedTouch.GetPoint(0);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, point2->state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, point2->screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, point2->local, 0.1f, TEST_LOCATION );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
+ const TestPoint* point2 = &data.receivedTouch.GetPoint(0);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, point2->state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, point2->screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, point2->local, 0.1f, TEST_LOCATION);
data.Reset();
// Emit an up signal
screenCoordinates.x = screenCoordinates.y = 12.0f;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, screenCoordinates ) );
- const TestPoint *point3 = &data.receivedTouch.GetPoint(0);
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::UP, point3->state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, point3->screen, TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, point3->local, 0.1f, TEST_LOCATION );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
+ const TestPoint* point3 = &data.receivedTouch.GetPoint(0);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::UP, point3->state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, point3->screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, point3->local, 0.1f, TEST_LOCATION);
data.Reset();
// Emit a down signal where the actor is not present
screenCoordinates.x = screenCoordinates.y = 200.0f;
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTouchEventNormalProcessing02(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- HandleData handleData;
- TouchEventHandleFunctor functor( handleData );
- actor.TouchedSignal().Connect( &application, functor );
+ HandleData handleData;
+ TouchEventHandleFunctor functor(handleData);
+ actor.TouchedSignal().Connect(&application, functor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 localCoordinates;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( true, handleData.signalReceived, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, handleData.receivedTouchHandle.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, handleData.receivedTouchHandle.GetState(0), TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, handleData.receivedTouchHandle.GetScreenPosition(0), TEST_LOCATION );
- DALI_TEST_EQUALS( localCoordinates, handleData.receivedTouchHandle.GetLocalPosition(0), 0.1f, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(true, handleData.signalReceived, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, handleData.receivedTouchHandle.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, handleData.receivedTouchHandle.GetState(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, handleData.receivedTouchHandle.GetScreenPosition(0), TEST_LOCATION);
+ DALI_TEST_EQUALS(localCoordinates, handleData.receivedTouchHandle.GetLocalPosition(0), 0.1f, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTouchEventAPINegative(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- OutOfBoundsData data;
- OutOfBoundsFunctor functor( data, true );
- actor.TouchedSignal().Connect( &application, functor );
+ OutOfBoundsData data;
+ OutOfBoundsFunctor functor(data, true);
+ actor.TouchedSignal().Connect(&application, functor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 localCoordinates;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( -1, data.point.deviceId, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::FINISHED, data.point.state, TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.point.screen, TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2::ZERO, data.point.local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( ! data.point.hitActor );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(-1, data.point.deviceId, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::FINISHED, data.point.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.point.screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2::ZERO, data.point.local, 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(!data.point.hitActor);
END_TEST;
}
-
int UtcDaliTouchEventOutsideCameraNearFarPlanes(void)
{
TestApplication application;
- Integration::Scene scene = application.GetScene();
- Vector2 sceneSize = scene.GetSize();
+ Integration::Scene scene = application.GetScene();
+ Vector2 sceneSize = scene.GetSize();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::CENTER);
- actor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
scene.Add(actor);
// Render and notify
application.Render();
// Get the camera's near and far planes
- RenderTaskList taskList = scene.GetRenderTaskList();
- Dali::RenderTask task = taskList.GetTask(0);
- CameraActor camera = task.GetCameraActor();
- float nearPlane = camera.GetNearClippingPlane();
- float farPlane = camera.GetFarClippingPlane();
+ RenderTaskList taskList = scene.GetRenderTaskList();
+ Dali::RenderTask task = taskList.GetTask(0);
+ CameraActor camera = task.GetCameraActor();
+ float nearPlane = camera.GetNearClippingPlane();
+ float farPlane = camera.GetFarClippingPlane();
// Calculate the current distance of the actor from the camera
float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f);
- float distance = (sceneSize.y * 0.5f) / tanHalfFov;
+ float distance = (sceneSize.y * 0.5f) / tanHalfFov;
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
- Vector2 screenCoordinates( sceneSize.x * 0.5f, sceneSize.y * 0.5f );
+ Vector2 screenCoordinates(sceneSize.x * 0.5f, sceneSize.y * 0.5f);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a down signal where actor is just at the camera's near plane
- actor.SetProperty( Actor::Property::POSITION_Z, distance - nearPlane);
+ actor.SetProperty(Actor::Property::POSITION_Z, distance - nearPlane);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a down signal where actor is closer than the camera's near plane
- actor.SetProperty( Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f);
+ actor.SetProperty(Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a down signal where actor is just at the camera's far plane
- actor.SetProperty( Actor::Property::POSITION_Z, distance - farPlane);
+ actor.SetProperty(Actor::Property::POSITION_Z, distance - farPlane);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a down signal where actor is further than the camera's far plane
- actor.SetProperty( Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f);
+ actor.SetProperty(Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f);
// Render and notify
application.SendNotification();
application.Render();
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
{
// Emit an empty TouchEvent
Integration::TouchEvent event;
- application.ProcessEvent( event );
- tet_result( TET_FAIL );
+ application.ProcessEvent(event);
+ tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_ASSERT( e, "!event.points.empty()", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "!event.points.empty()", TEST_LOCATION);
}
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
// Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
// Emit another interrupted signal, our signal handler should not be called.
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
int UtcDaliTouchEventParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false);
+ actor.TouchedSignal().Connect(&application, functor);
// Connect to root actor's touched signal
- SignalData rootData;
- TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchedSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ TouchEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.TouchedSignal().Connect(&application, rootFunctor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 actorCoordinates, rootCoordinates;
- actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit a motion signal
screenCoordinates.x = screenCoordinates.y = 11.0f;
- actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit an up signal
screenCoordinates.x = screenCoordinates.y = 12.0f;
- actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, screenCoordinates ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, data.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::UP, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::UP, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::UP, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::UP, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit a down signal where the actor is not present, will hit the root actor though
screenCoordinates.x = screenCoordinates.y = 200.0f;
- rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION );
- DALI_TEST_EQUALS( rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.receivedTouch.points[0].hitActor );
+ rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
+ DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
END_TEST;
}
int UtcDaliTouchEventInterruptedParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false);
+ actor.TouchedSignal().Connect(&application, functor);
// Connect to root actor's touched signal
- SignalData rootData;
- TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchedSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ TouchEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.TouchedSignal().Connect(&application, rootFunctor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit an interrupted signal
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit another down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
rootData.Reset();
// Remove actor from scene
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
data.Reset();
rootData.Reset();
application.Render();
// Emit an interrupted signal, only root actor's signal should be called.
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit another interrupted state, none of the signal's should be called.
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, rootData.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Set actor to require leave events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
// Another motion outside of actor, no signalling
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(201.0f, 201.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
// We do not want to listen to leave events anymore
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
// Another motion event outside of actor, no signalling
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliTouchEventLeaveParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false);
+ actor.TouchedSignal().Connect(&application, functor);
// Connect to root actor's touched signal
- SignalData rootData;
- TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchedSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ TouchEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.TouchedSignal().Connect(&application, rootFunctor);
// Set actor to require leave events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
- rootActor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
+ rootActor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Emit a motion signal outside of actor, should be signalled with a Leave
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Another motion outside of actor, only rootActor signalled
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 201.0f, 201.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(201.0f, 201.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// Another motion event inside actor, signalled with motion
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 10.0f, 10.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
// We do not want to listen to leave events of actor anymore
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, false );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, false);
// Another motion event outside of root actor, only root signalled
- Vector2 sceneSize( application.GetScene().GetSize() );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( sceneSize.width + 10.0f, sceneSize.height + 10.0f )) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION );
+ Vector2 sceneSize(application.GetScene().GetSize());
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(sceneSize.width + 10.0f, sceneSize.height + 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, rootData.receivedTouch.points[0].state, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
// Change actor to insensitive
- actor.SetProperty( Actor::Property::SENSITIVE, false );
+ actor.SetProperty(Actor::Property::SENSITIVE, false);
// Emit a motion signal, signalled with an interrupted
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliTouchEventActorBecomesInsensitiveParentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false);
+ actor.TouchedSignal().Connect(&application, functor);
// Connect to root actor's touched signal
- SignalData rootData;
- TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchedSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ TouchEventFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.TouchedSignal().Connect(&application, rootFunctor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
data.Reset();
rootData.Reset();
application.Render();
// Make root actor insensitive
- rootActor.SetProperty( Actor::Property::SENSITIVE, false );
+ rootActor.SetProperty(Actor::Property::SENSITIVE, false);
// Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2 ( 200.0f, 200.0f )) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
END_TEST;
}
int UtcDaliTouchEventMultipleLayers(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
+ SignalData data;
+ TouchEventFunctor functor(data);
- Layer layer1 ( Layer::New() );
- layer1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer1 );
+ Layer layer1(Layer::New());
+ layer1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer1);
- Actor actor1 ( Actor::New() );
- actor1.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- actor1.SetProperty( Actor::Property::POSITION_Z, 1.0f ); // Should hit actor1 in this layer
- layer1.Add( actor1 );
+ Actor actor1(Actor::New());
+ actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ actor1.SetProperty(Actor::Property::POSITION_Z, 1.0f); // Should hit actor1 in this layer
+ layer1.Add(actor1);
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer1 and actor1
- layer1.TouchedSignal().Connect( &application, functor );
- actor1.TouchedSignal().Connect( &application, functor );
+ layer1.TouchedSignal().Connect(&application, functor);
+ actor1.TouchedSignal().Connect(&application, functor);
// Hit in hittable area, actor1 should be hit
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.touchedActor == actor1 );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.touchedActor == actor1);
data.Reset();
// Make layer1 insensitive, nothing should be hit
- layer1.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ layer1.SetProperty(Actor::Property::SENSITIVE, false);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Make layer1 sensitive again, again actor1 will be hit
- layer1.SetProperty( Actor::Property::SENSITIVE, true );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.touchedActor == actor1 );
+ layer1.SetProperty(Actor::Property::SENSITIVE, true);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.touchedActor == actor1);
data.Reset();
// Make rootActor insensitive, nothing should be hit
- rootActor.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ rootActor.SetProperty(Actor::Property::SENSITIVE, false);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Make rootActor sensitive
- rootActor.SetProperty( Actor::Property::SENSITIVE, true );
+ rootActor.SetProperty(Actor::Property::SENSITIVE, true);
// Add another layer
- Layer layer2 ( Layer::New() );
- layer2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- layer2.SetProperty( Actor::Property::POSITION_Z, 10.0f ); // Should hit layer2 in this layer rather than actor2
- application.GetScene().Add( layer2 );
+ Layer layer2(Layer::New());
+ layer2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ layer2.SetProperty(Actor::Property::POSITION_Z, 10.0f); // Should hit layer2 in this layer rather than actor2
+ application.GetScene().Add(layer2);
- Actor actor2 ( Actor::New() );
- actor2.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- layer2.Add( actor2 );
+ Actor actor2(Actor::New());
+ actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ layer2.Add(actor2);
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer2 and actor2
- layer2.TouchedSignal().Connect( &application, functor );
- actor2.TouchedSignal().Connect( &application, functor );
+ layer2.TouchedSignal().Connect(&application, functor);
+ actor2.TouchedSignal().Connect(&application, functor);
// Emit an event, should hit layer2
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
//DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
// Make layer2 insensitive, should hit actor1
- layer2.SetProperty( Actor::Property::SENSITIVE, false );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.touchedActor == actor1 );
+ layer2.SetProperty(Actor::Property::SENSITIVE, false);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.touchedActor == actor1);
data.Reset();
// Make layer2 sensitive again, should hit layer2
- layer2.SetProperty( Actor::Property::SENSITIVE, true );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ layer2.SetProperty(Actor::Property::SENSITIVE, true);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
//DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
data.Reset();
// Make layer2 invisible, render and notify
- layer2.SetProperty( Actor::Property::VISIBLE, false );
+ layer2.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render();
// Should hit actor1
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.touchedActor == actor1 );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(data.touchedActor == actor1);
data.Reset();
// Make rootActor invisible, render and notify
- rootActor.SetProperty( Actor::Property::VISIBLE, false );
+ rootActor.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render();
// Should not hit anything
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliTouchEventMultipleRenderTasks(void)
{
- TestApplication application;
- Integration::Scene scene ( application.GetScene() );
- Vector2 sceneSize ( scene.GetSize() );
+ TestApplication application;
+ Integration::Scene scene(application.GetScene());
+ Vector2 sceneSize(scene.GetSize());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
scene.Add(actor);
// Create render task
- Viewport viewport( sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f );
- RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() );
- renderTask.SetViewport( viewport );
- renderTask.SetInputEnabled( true );
+ Viewport viewport(sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f);
+ RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask());
+ renderTask.SetViewport(viewport);
+ renderTask.SetInputEnabled(true);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Disable input on renderTask, should not be hittable
- renderTask.SetInputEnabled( false );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ renderTask.SetInputEnabled(false);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliTouchEventMultipleRenderTasksWithChildLayer(void)
{
- TestApplication application;
- Integration::Scene scene ( application.GetScene() );
- Vector2 sceneSize ( scene.GetSize() );
+ TestApplication application;
+ Integration::Scene scene(application.GetScene());
+ Vector2 sceneSize(scene.GetSize());
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
scene.Add(actor);
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
actor.Add(layer);
// Create render task
- Viewport viewport( sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f );
- RenderTask renderTask ( application.GetScene().GetRenderTaskList().CreateTask() );
- renderTask.SetViewport( viewport );
- renderTask.SetInputEnabled( true );
- renderTask.SetSourceActor( actor );
+ Viewport viewport(sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f);
+ RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask());
+ renderTask.SetViewport(viewport);
+ renderTask.SetInputEnabled(true);
+ renderTask.SetSourceActor(actor);
// Render and notify
application.SendNotification();
application.Render();
// Connect to layer's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
- layer.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
+ layer.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Ensure renderTask actor can be hit too.
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Disable input on renderTask, should not be hittable
- renderTask.SetInputEnabled( false );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ renderTask.SetInputEnabled(false);
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliTouchEventOffscreenRenderTasks(void)
{
- TestApplication application;
- Integration::Scene scene ( application.GetScene() );
- Vector2 sceneSize ( scene.GetSize() );
+ TestApplication application;
+ Integration::Scene scene(application.GetScene());
+ Vector2 sceneSize(scene.GetSize());
// FrameBufferImage for offscreen RenderTask
FrameBuffer frameBuffer = FrameBuffer::New(sceneSize.width, sceneSize.height);
// Create a renderable actor to display the FrameBufferImage
Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture());
- renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
- renderableActor.SetProperty( Actor::Property::SIZE, Vector2( sceneSize.x, sceneSize.y ) );
- renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
- scene.Add( renderableActor );
+ renderableActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ renderableActor.SetProperty(Actor::Property::SIZE, Vector2(sceneSize.x, sceneSize.y));
+ renderableActor.ScaleBy(Vector3(1.0f, -1.0f, 1.0f)); // FIXME
+ scene.Add(renderableActor);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- scene.Add( actor );
- application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ scene.Add(actor);
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); // Ensure framebuffer connects
- scene.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
+ scene.GetRenderTaskList().GetTask(0u).SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION);
// Create a RenderTask
RenderTask renderTask = scene.GetRenderTaskList().CreateTask();
- renderTask.SetSourceActor( actor );
+ renderTask.SetSourceActor(actor);
renderTask.SetFrameBuffer(frameBuffer);
- renderTask.SetInputEnabled( true );
+ renderTask.SetInputEnabled(true);
// Create another RenderTask
- RenderTask renderTask2( scene.GetRenderTaskList().CreateTask() );
- renderTask2.SetInputEnabled( true );
+ RenderTask renderTask2(scene.GetRenderTaskList().CreateTask());
+ renderTask2.SetInputEnabled(true);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
int UtcDaliTouchEventMultipleRenderableActors(void)
{
- TestApplication application;
- Integration::Scene scene ( application.GetScene() );
- Vector2 sceneSize ( scene.GetSize() );
+ TestApplication application;
+ Integration::Scene scene(application.GetScene());
+ Vector2 sceneSize(scene.GetSize());
Actor parent = CreateRenderableActor();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
scene.Add(parent);
Actor actor = CreateRenderableActor();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(actor);
// Render and notify
application.Render();
// Connect to layer's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- parent.TouchedSignal().Connect( &application, functor );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ parent.TouchedSignal().Connect(&application, functor);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.touchedActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.touchedActor);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- RemoveActorFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ RemoveActorFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Register for leave events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Re-add, render and notify
application.Render();
// Emit another signal outside of actor's area, should not get anything as the scene has changed.
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Render and notify
application.Render();
// Emit another signal outside of actor's area, should not get anything as the scene has changed.
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Re-add actor back to scene, render and notify
application.Render();
// Emit another down event
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Completely delete the actor
actor.Reset();
// Emit event, should not crash and should not receive an event.
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 210.0f, 210.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Remove actor from scene
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
data.Reset();
// Render and notify
application.Render();
// Emit a move at the same point, we should not be signalled.
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Add a layer to overlap the actor
Layer layer = Layer::New();
- layer.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- layer.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- application.GetScene().Add( layer );
+ layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(layer);
layer.RaiseToTop();
// Render and notify
application.Render();
// Emit a few touch signals
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Set layer to consume all touch
- layer.SetProperty( Layer::Property::CONSUMES_TOUCH, true );
+ layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
// Render and notify
application.SendNotification();
application.Render();
// Emit the same signals again, should not receive
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 10.0f, 10.0f ) ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
int UtcDaliTouchEventLeaveActorReadded(void)
{
- TestApplication application;
+ TestApplication application;
Integration::Scene scene = application.GetScene();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
scene.Add(actor);
// Set actor to receive touch-events
- actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
+ actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
// Render and notify
application.SendNotification();
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down and motion
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 11.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(11.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Remove actor from scene and add again
- scene.Remove( actor );
- scene.Add( actor );
+ scene.Remove(actor);
+ scene.Add(actor);
// Emit a motion within the actor's bounds
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 12.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(12.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit a motion outside the actor's bounds
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 200.0f, 200.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::LEAVE, data.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
END_TEST;
int UtcDaliTouchEventClippedActor(void)
{
- TestApplication application;
+ TestApplication application;
Integration::Scene scene = application.GetScene();
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- scene.Add( actor );
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ scene.Add(actor);
Actor clippingActor = Actor::New();
- clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) );
- clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
- scene.Add( clippingActor );
+ clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
+ clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
+ scene.Add(clippingActor);
// Add a child to the clipped region.
Actor clippingChild = Actor::New();
- clippingChild.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) );
- clippingChild.SetProperty( Actor::Property::POSITION, Vector2( 25.0f, 25.0f ));
- clippingChild.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- clippingActor.Add( clippingChild );
+ clippingChild.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
+ clippingChild.SetProperty(Actor::Property::POSITION, Vector2(25.0f, 25.0f));
+ clippingChild.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ clippingActor.Add(clippingChild);
// Render and notify.
application.SendNotification();
application.Render();
// Connect to actor's touch signal.
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit an event within clipped area - no hit.
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Emit an event outside the clipped area but within the actor area, we should have a hit.
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 60.0f, 60.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(60.0f, 60.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
- clippingChild.TouchedSignal().Connect( &application, functor );
+ clippingChild.TouchedSignal().Connect(&application, functor);
// Emit an event inside part of the child which is within the clipped area, we should have a hit.
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 30.0f, 30.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(30.0f, 30.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
data.Reset();
// Render and notify
actor.Unparent();
// Should receive an interrupted event
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
data.Reset();
// Render and notify
parent.Unparent();
// Should receive an interrupted event
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false /* Do not consume */ );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false /* Do not consume */);
+ actor.TouchedSignal().Connect(&application, functor);
// Connect to parent's touched signal
- SignalData parentData;
- TouchEventFunctor parentFunctor( parentData );
- parent.TouchedSignal().Connect( &application, parentFunctor );
+ SignalData parentData;
+ TouchEventFunctor parentFunctor(parentData);
+ parent.TouchedSignal().Connect(&application, parentFunctor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == data.touchedActor );
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == parentData.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( parent == parentData.touchedActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == data.touchedActor);
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(parent == parentData.touchedActor);
data.Reset();
parentData.Reset();
actor.Unparent();
// Should receive an interrupted event for both actor & parent
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
parentData.Reset();
application.Render();
// Emit a motion signal
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
data.Reset();
parentData.Reset();
// Parent is now consumer, connect again to the touched signal of the actor so that it becomes the consumer
- SignalData secondData;
- TouchEventFunctor secondFunctor( secondData /* Consume */ );
- actor.TouchedSignal().Connect( &application, secondFunctor );
+ SignalData secondData;
+ TouchEventFunctor secondFunctor(secondData /* Consume */);
+ actor.TouchedSignal().Connect(&application, secondFunctor);
// Unparent the actor
actor.Unparent();
// Should receive an interrupted event for both actor functors & the parent as well as it was last consumer
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( true, secondData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, secondData.receivedTouch.points[0].state, TEST_LOCATION );
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, secondData.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
parentData.Reset();
secondData.Reset();
int UtcDaliTouchEventInterruptedDifferentConsumer(void)
{
TestApplication application;
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
Actor parent = Actor::New();
- parent.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- parent.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(parent);
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
parent.Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data, false /* Do not consume */ );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data, false /* Do not consume */);
+ actor.TouchedSignal().Connect(&application, functor);
// Connect to parent's touched signal
- SignalData parentData;
- TouchEventFunctor parentFunctor( parentData, false /* Do not consume */ );
- parent.TouchedSignal().Connect( &application, parentFunctor );
+ SignalData parentData;
+ TouchEventFunctor parentFunctor(parentData, false /* Do not consume */);
+ parent.TouchedSignal().Connect(&application, parentFunctor);
// Connect to root's touched signal and consume
- SignalData rootData;
- TouchEventFunctor rootFunctor( rootData );
- rootActor.TouchedSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ TouchEventFunctor rootFunctor(rootData);
+ rootActor.TouchedSignal().Connect(&application, rootFunctor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( actor == data.touchedActor );
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == parentData.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( parent == parentData.touchedActor );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_CHECK( actor == rootData.receivedTouch.points[0].hitActor );
- DALI_TEST_CHECK( rootActor == rootData.touchedActor );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(actor == data.touchedActor);
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(parent == parentData.touchedActor);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
+ DALI_TEST_CHECK(rootActor == rootData.touchedActor);
data.Reset();
parentData.Reset();
rootData.Reset();
// Root is now consumer, connect to the touched signal of the parent so that it becomes the consumer
- SignalData secondData;
- TouchEventFunctor secondFunctor( secondData /* Consume */ );
- parent.TouchedSignal().Connect( &application, secondFunctor );
+ SignalData secondData;
+ TouchEventFunctor secondFunctor(secondData /* Consume */);
+ parent.TouchedSignal().Connect(&application, secondFunctor);
// Emit an interrupted signal, all three should STILL be called
- application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
data.Reset();
parentData.Reset();
rootData.Reset();
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with an angle
- Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
- touchEvent.points[ 0 ].SetRadius( 100.0f );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION );
- DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION );
- DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION );
+ Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
+ touchEvent.points[0].SetRadius(100.0f);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION);
+ DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with an angle
- Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
- touchEvent.points[ 0 ].SetRadius( 100.0f, Vector2( 20.0f, 10.0f ) );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( 100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION );
- DALI_TEST_EQUALS( 20.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION );
- DALI_TEST_EQUALS( 10.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION );
+ Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
+ touchEvent.points[0].SetRadius(100.0f, Vector2(20.0f, 10.0f));
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION);
+ DALI_TEST_EQUALS(20.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(10.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with an angle
- Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
- touchEvent.points[ 0 ].SetAngle( Degree( 90.0f ) );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( Degree( 90.0f ), data.receivedTouch.points[0].angle, TEST_LOCATION );
+ Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
+ touchEvent.points[0].SetAngle(Degree(90.0f));
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(Degree(90.0f), data.receivedTouch.points[0].angle, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with an angle
- Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
- touchEvent.points[ 0 ].SetPressure( 10.0f );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION );
- DALI_TEST_EQUALS( 10.0f, data.receivedTouch.points[0].pressure, TEST_LOCATION );
+ Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
+ touchEvent.points[0].SetPressure(10.0f);
+ application.ProcessEvent(touchEvent);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ DALI_TEST_EQUALS(10.0f, data.receivedTouch.points[0].pressure, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
-
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with an angle
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
-
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- HandleData handleData;
- TouchEventHandleFunctor functor( handleData );
- actor.TouchedSignal().Connect( &application, functor );
+ HandleData handleData;
+ TouchEventHandleFunctor functor(handleData);
+ actor.TouchedSignal().Connect(&application, functor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Vector2 localCoordinates;
- actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
+ actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, screenCoordinates ) );
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
TouchEvent data = handleData.receivedTouchHandle;
- DALI_TEST_EQUALS( data.GetDeviceClass( -1 ), Device::Class::NONE, TEST_LOCATION );
- DALI_TEST_EQUALS( data.GetDeviceSubclass( -1 ), Device::Subclass::NONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(data.GetDeviceClass(-1), Device::Class::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.GetDeviceSubclass(-1), Device::Subclass::NONE, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- HandleData handleData;
- TouchEventHandleFunctor functor( handleData );
- actor.TouchedSignal().Connect( &application, functor );
+ HandleData handleData;
+ TouchEventHandleFunctor functor(handleData);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with MouseButton
- Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
- touchEvent.points[ 0 ].SetMouseButton( static_cast< MouseButton::Type >( 3 ) );
- application.ProcessEvent( touchEvent );
+ Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
+ touchEvent.points[0].SetMouseButton(static_cast<MouseButton::Type>(3));
+ application.ProcessEvent(touchEvent);
TouchEvent data = handleData.receivedTouchHandle;
- DALI_TEST_EQUALS( data.GetMouseButton( 0 ), MouseButton::SECONDARY, TEST_LOCATION );
+ DALI_TEST_EQUALS(data.GetMouseButton(0), MouseButton::SECONDARY, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- HandleData handleData;
- TouchEventHandleFunctor functor( handleData );
- actor.TouchedSignal().Connect( &application, functor );
+ HandleData handleData;
+ TouchEventHandleFunctor functor(handleData);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal with MouseButton
- Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
- touchEvent.points[ 0 ].SetMouseButton( static_cast< MouseButton::Type >( 2 ) );
- application.ProcessEvent( touchEvent );
+ Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
+ touchEvent.points[0].SetMouseButton(static_cast<MouseButton::Type>(2));
+ application.ProcessEvent(touchEvent);
TouchEvent data = handleData.receivedTouchHandle;
- DALI_TEST_EQUALS( data.GetMouseButton( 0 ), MouseButton::TERTIARY, TEST_LOCATION );
- DALI_TEST_EQUALS( data.GetMouseButton( 3 ), MouseButton::INVALID, TEST_LOCATION );
+ DALI_TEST_EQUALS(data.GetMouseButton(0), MouseButton::TERTIARY, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.GetMouseButton(3), MouseButton::INVALID, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's touched signal
- SignalData data;
- TouchEventFunctor functor( data );
- actor.TouchedSignal().Connect( &application, functor );
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Now motion outside of actor, we should not receive the event
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 110.0f, 110.0f ) ) );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(110.0f, 110.0f)));
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
// Up event, should receive an interrupted
- application.ProcessEvent( GenerateSingleTouch( PointState::FINISHED, Vector2( 110.0f, 110.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouch.GetPoint(0).state, PointState::INTERRUPTED, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::INTERRUPTED, TEST_LOCATION);
// Now set the capture property
- actor.SetProperty( DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
+ actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true);
// Emit a down signal
- application.ProcessEvent( GenerateSingleTouch( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Now motion outside of actor, we now SHOULD receive the event
- application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 110.0f, 110.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(110.0f, 110.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
data.Reset();
// Up event, we should receive it again, but as ended rather than interrupted
- application.ProcessEvent( GenerateSingleTouch( PointState::FINISHED, Vector2( 110.0f, 110.0f ) ) );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION );
+ application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION);
END_TEST;
}
int UtcDaliTouchEventIntegNewTouchEvent(void)
{
- uint32_t timestamp = 92858u;
- TouchPoint tp(1, PointState::STARTED, 34.4f, 123.89f, 5.0f, 7.0f);
+ uint32_t timestamp = 92858u;
+ TouchPoint tp(1, PointState::STARTED, 34.4f, 123.89f, 5.0f, 7.0f);
Dali::TouchEvent touchEvent = Integration::NewTouchEvent(timestamp, tp);
DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::STARTED, TEST_LOCATION );
- DALI_TEST_EQUALS(touchEvent.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION );
- DALI_TEST_EQUALS(touchEvent.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION );
-
+ DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::STARTED, TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(touchEvent.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION);
END_TEST;
}
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <limits>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
-#include <dali/internal/event/common/type-info-impl.h>
-#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/internal/event/common/type-info-impl.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
-using namespace Dali;
+#include <iostream>
+#include <limits>
+using namespace Dali;
namespace
{
-
// Stores data that is populated in the callback and will be read by the Test cases
struct SignalData
{
SignalData()
- : functorCalled( false ),
- voidFunctorCalled( false ),
- receivedGesture( ),
+ : functorCalled(false),
+ voidFunctorCalled(false),
+ receivedGesture(),
pressedActor()
- {}
+ {
+ }
void Reset()
{
- functorCalled = false;
+ functorCalled = false;
voidFunctorCalled = false;
receivedGesture.Reset();
pressedActor.Reset();
}
- bool functorCalled;
- bool voidFunctorCalled;
+ bool functorCalled;
+ bool voidFunctorCalled;
LongPressGesture receivedGesture;
- Actor pressedActor;
+ Actor pressedActor;
};
// Functor that sets the data when called
struct GestureReceivedFunctor
{
- GestureReceivedFunctor(SignalData& data) : signalData(data) { }
+ GestureReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
void operator()(Actor actor, LongPressGesture longPress)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedGesture = longPress;
- signalData.pressedActor = actor;
+ signalData.pressedActor = actor;
}
void operator()()
// Create function as Init function called
//
static bool CreateCustomInitCalled = false;
-BaseHandle CreateCustomInit(void)
+BaseHandle CreateCustomInit(void)
{
CreateCustomInitCalled = true;
return BaseHandle();
}
static bool CreateCustomNamedInitCalled = false;
-BaseHandle CreateCustomNamedInit(void)
+BaseHandle CreateCustomNamedInit(void)
{
CreateCustomNamedInitCalled = true;
return BaseHandle();
}
-const std::string scriptedName("PopupStyle");
-static TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
+const std::string scriptedName("PopupStyle");
+static TypeRegistration scriptedType(scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit);
// Property Registration
bool setPropertyCalled = false;
bool getPropertyCalled = false;
-void SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value)
{
setPropertyCalled = true;
}
-Property::Value GetProperty( BaseObject* object, Property::Index propertyIndex )
+Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex)
{
getPropertyCalled = true;
- return Property::Value( true );
+ return Property::Value(true);
}
-
-
/*******************************************************************************
*
* Custom Actor
{
struct MyTestCustomActor : public CustomActorImpl
{
- typedef Signal< void ()> SignalType;
- typedef Signal< void (float)> SignalTypeFloat;
+ typedef Signal<void()> SignalType;
+ typedef Signal<void(float)> SignalTypeFloat;
- MyTestCustomActor() : CustomActorImpl( ActorFlags() )
- { }
+ MyTestCustomActor()
+ : CustomActorImpl(ActorFlags())
+ {
+ }
virtual ~MyTestCustomActor()
- { }
+ {
+ }
void ResetCallStack()
{
}
// From CustomActorImpl
- virtual void OnSceneConnection( int depth )
+ virtual void OnSceneConnection(int depth)
{
}
virtual void OnSceneDisconnection()
}
virtual Vector3 GetNaturalSize()
{
- return Vector3( 0.0f, 0.0f, 0.0f );
+ return Vector3(0.0f, 0.0f, 0.0f);
}
- virtual float GetHeightForWidth( float width )
+ virtual float GetHeightForWidth(float width)
{
return 0.0f;
}
- virtual float GetWidthForHeight( float height )
+ virtual float GetWidthForHeight(float height)
{
return 0.0f;
}
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
{
}
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
{
}
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
{
}
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
+ virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
{
return 0.0f;
}
- virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
+ virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
{
}
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS)
{
return false;
}
public:
-
SignalType mSignal;
};
class MyTestCustomActor : public CustomActor
{
public:
-
- typedef Signal< void ()> SignalType;
- typedef Signal< void (float)> SignalTypeFloat;
+ typedef Signal<void()> SignalType;
+ typedef Signal<void(float)> SignalTypeFloat;
MyTestCustomActor()
{
static MyTestCustomActor New()
{
Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
- return MyTestCustomActor( *p ); // takes ownership
+ return MyTestCustomActor(*p); // takes ownership
}
virtual ~MyTestCustomActor()
{
}
- static MyTestCustomActor DownCast( BaseHandle handle )
+ static MyTestCustomActor DownCast(BaseHandle handle)
{
MyTestCustomActor result;
- CustomActor custom = Dali::CustomActor::DownCast( handle );
- if ( custom )
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
+ if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
- if (impl)
+ if(impl)
{
result = MyTestCustomActor(customImpl.GetOwner());
}
SignalType& GetCustomSignal()
{
Dali::RefObject& obj = GetImplementation();
- return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
+ return static_cast<Impl::MyTestCustomActor&>(obj).mSignal;
}
private:
-
MyTestCustomActor(Internal::CustomActor* internal)
: CustomActor(internal)
{
}
- MyTestCustomActor( Impl::MyTestCustomActor& impl )
- : CustomActor( impl )
+ MyTestCustomActor(Impl::MyTestCustomActor& impl)
+ : CustomActor(impl)
{
}
};
-
class MyTestCustomActor2 : public CustomActor
{
public:
-
struct Property
{
enum
{
- P1=Dali::PROPERTY_REGISTRATION_START_INDEX,
+ P1 = Dali::PROPERTY_REGISTRATION_START_INDEX,
P2
};
};
-
MyTestCustomActor2()
{
}
{
}
- static MyTestCustomActor2 DownCast( BaseHandle handle )
+ static MyTestCustomActor2 DownCast(BaseHandle handle)
{
MyTestCustomActor2 result;
- CustomActor custom = Dali::CustomActor::DownCast( handle );
- if ( custom )
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
+ if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
- if (impl)
+ if(impl)
{
result = MyTestCustomActor2(customImpl.GetOwner());
}
}
private:
-
MyTestCustomActor2(Internal::CustomActor* internal)
: CustomActor(internal)
{
}
- MyTestCustomActor2( Impl::MyTestCustomActor& impl )
- : CustomActor( impl )
+ MyTestCustomActor2(Impl::MyTestCustomActor& impl)
+ : CustomActor(impl)
{
}
};
-static TypeRegistration customTypeInit( typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true );
-
-PropertyRegistration P1( customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty );
-PropertyRegistration P2( customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty );
+static TypeRegistration customTypeInit(typeid(MyTestCustomActor2), typeid(Dali::CustomActor), CreateCustomInit, true);
+PropertyRegistration P1(customTypeInit, "propertyOne", MyTestCustomActor2::Property::P1, Property::INTEGER, &SetProperty, &GetProperty);
+PropertyRegistration P2(customTypeInit, "propertyTwo", MyTestCustomActor2::Property::P2, Property::STRING, &SetProperty, &GetProperty);
class MyTestCustomActor3 : public CustomActor
{
{
}
- static MyTestCustomActor3 DownCast( BaseHandle handle )
+ static MyTestCustomActor3 DownCast(BaseHandle handle)
{
MyTestCustomActor3 result;
- CustomActor custom = Dali::CustomActor::DownCast( handle );
- if ( custom )
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
+ if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
- if (impl)
+ if(impl)
{
result = MyTestCustomActor3(customImpl.GetOwner());
}
}
private:
-
MyTestCustomActor3(Internal::CustomActor* internal)
: CustomActor(internal)
{
}
- MyTestCustomActor3( Impl::MyTestCustomActor& impl )
- : CustomActor( impl )
+ MyTestCustomActor3(Impl::MyTestCustomActor& impl)
+ : CustomActor(impl)
{
}
};
-static TypeRegistration customTypeBadInit( typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false );
+static TypeRegistration customTypeBadInit(typeid(MyTestCustomActor3), typeid(Dali::CustomActor), NULL, false);
BaseHandle CreateCustom(void)
{
static std::string lastSignalConnectionCustom;
-bool DoConnectSignalCustom( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+bool DoConnectSignalCustom(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
{
lastSignalConnectionCustom = signalName;
- bool connected( true );
+ bool connected(true);
- Dali::BaseHandle handle(object);
+ Dali::BaseHandle handle(object);
MyTestCustomActor customActor = MyTestCustomActor::DownCast(handle);
- if( "sig1" == signalName )
+ if("sig1" == signalName)
{
- customActor.GetCustomSignal().Connect( tracker, functor );
+ customActor.GetCustomSignal().Connect(tracker, functor);
}
else
{
return connected;
}
-bool DoConnectSignalCustomFailure( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+bool DoConnectSignalCustomFailure(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
{
lastSignalConnectionCustom = "failed";
++mCurrentInstanceCount;
}
- CustomTestFunctor( const CustomTestFunctor& copyMe )
+ CustomTestFunctor(const CustomTestFunctor& copyMe)
{
++mTotalInstanceCount;
++mCurrentInstanceCount;
static int mCallbackCount;
};
-int CustomTestFunctor::mTotalInstanceCount = 0;
+int CustomTestFunctor::mTotalInstanceCount = 0;
int CustomTestFunctor::mCurrentInstanceCount = 0;
-int CustomTestFunctor::mCallbackCount = 0;
+int CustomTestFunctor::mCallbackCount = 0;
static void ResetFunctorCounts()
{
}
static std::string lastActionCustom;
-bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
+bool DoActionCustom(BaseObject* object, const std::string& actionName, const Property::Map& /*attributes*/)
{
lastActionCustom = actionName;
return true;
}
// Custom type registration
-static TypeRegistration customType1( typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom );
+static TypeRegistration customType1(typeid(MyTestCustomActor), typeid(Dali::CustomActor), CreateCustom);
// Custom signals
-static SignalConnectorType customSignalConnector1( customType1, "sig1", DoConnectSignalCustom );
-static SignalConnectorType customSignalConnector2( customType1, "sig2", DoConnectSignalCustomFailure );
-static const int TEST_SIGNAL_COUNT = 2;
+static SignalConnectorType customSignalConnector1(customType1, "sig1", DoConnectSignalCustom);
+static SignalConnectorType customSignalConnector2(customType1, "sig2", DoConnectSignalCustomFailure);
+static const int TEST_SIGNAL_COUNT = 2;
// Custom actions
-static TypeAction customAction1( customType1, "act1", DoActionCustom);
-static const int TEST_ACTION_COUNT = 1;
+static TypeAction customAction1(customType1, "act1", DoActionCustom);
+static const int TEST_ACTION_COUNT = 1;
class TestConnectionTracker : public ConnectionTracker
{
public:
-
TestConnectionTracker()
{
}
BaseHandle CreateNamedActorType()
{
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::NAME, "NamedActor" );
+ actor.SetProperty(Actor::Property::NAME, "NamedActor");
return actor;
}
-TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
-PropertyRegistration namedActorPropertyOne( namedActorType, "propName", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
+TypeRegistration namedActorType("MyNamedActor", typeid(Dali::Actor), CreateNamedActorType);
+PropertyRegistration namedActorPropertyOne(namedActorType, "propName", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty);
} // Anonymous namespace
TestApplication application;
TypeRegistry registry = TypeRegistry::Get();
- DALI_TEST_CHECK( registry );
+ DALI_TEST_CHECK(registry);
END_TEST;
}
TestApplication application;
TypeRegistry registry;
- DALI_TEST_CHECK( !registry );
+ DALI_TEST_CHECK(!registry);
END_TEST;
}
TestApplication application;
TypeRegistry registry = TypeRegistry::Get();
- DALI_TEST_CHECK( registry );
+ DALI_TEST_CHECK(registry);
- TypeRegistry copy( registry );
- DALI_TEST_CHECK( copy );
+ TypeRegistry copy(registry);
+ DALI_TEST_CHECK(copy);
- DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
+ DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == copy.GetTypeInfo("Actor").GetName());
END_TEST;
}
TestApplication application;
TypeRegistry registry = TypeRegistry::Get();
- DALI_TEST_CHECK( registry );
+ DALI_TEST_CHECK(registry);
TypeRegistry copy = registry;
- DALI_TEST_CHECK( copy );
- DALI_TEST_CHECK( registry == copy );
+ DALI_TEST_CHECK(copy);
+ DALI_TEST_CHECK(registry == copy);
- DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == copy.GetTypeInfo( "Actor" ).GetName() );
+ DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == copy.GetTypeInfo("Actor").GetName());
END_TEST;
}
TestApplication application;
TypeRegistry registry = TypeRegistry::Get();
- DALI_TEST_CHECK( registry );
- DALI_TEST_EQUALS( 16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
+ DALI_TEST_CHECK(registry);
+ DALI_TEST_EQUALS(16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == "Actor");
- TypeRegistry movedRegistry = std::move( registry );
- DALI_TEST_CHECK( movedRegistry );
- DALI_TEST_EQUALS( 16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( movedRegistry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
- DALI_TEST_CHECK( !registry );
+ TypeRegistry movedRegistry = std::move(registry);
+ DALI_TEST_CHECK(movedRegistry);
+ DALI_TEST_EQUALS(16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(movedRegistry.GetTypeInfo("Actor").GetName() == "Actor");
+ DALI_TEST_CHECK(!registry);
- Dali::TypeInfo info = movedRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( info );
- DALI_TEST_EQUALS( 2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( info.GetName() == "Actor" );
+ Dali::TypeInfo info = movedRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(info);
+ DALI_TEST_EQUALS(2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(info.GetName() == "Actor");
- Dali::TypeInfo movedInfo = std::move( info );
- DALI_TEST_CHECK( movedInfo );
- DALI_TEST_EQUALS( 2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( movedInfo.GetName() == "Actor" );
- DALI_TEST_CHECK( !info );
+ Dali::TypeInfo movedInfo = std::move(info);
+ DALI_TEST_CHECK(movedInfo);
+ DALI_TEST_EQUALS(2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(movedInfo.GetName() == "Actor");
+ DALI_TEST_CHECK(!info);
END_TEST;
}
TestApplication application;
TypeRegistry registry = TypeRegistry::Get();
- DALI_TEST_CHECK( registry );
- DALI_TEST_EQUALS( 16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( registry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
+ DALI_TEST_CHECK(registry);
+ DALI_TEST_EQUALS(16, registry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(registry.GetTypeInfo("Actor").GetName() == "Actor");
TypeRegistry movedRegistry;
- movedRegistry = std::move( registry );
- DALI_TEST_CHECK( movedRegistry );
- DALI_TEST_EQUALS( 16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( movedRegistry.GetTypeInfo( "Actor" ).GetName() == "Actor" );
- DALI_TEST_CHECK( !registry );
+ movedRegistry = std::move(registry);
+ DALI_TEST_CHECK(movedRegistry);
+ DALI_TEST_EQUALS(16, movedRegistry.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(movedRegistry.GetTypeInfo("Actor").GetName() == "Actor");
+ DALI_TEST_CHECK(!registry);
- Dali::TypeInfo info = movedRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( info );
- DALI_TEST_EQUALS( 2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( info.GetName() == "Actor" );
+ Dali::TypeInfo info = movedRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(info);
+ DALI_TEST_EQUALS(2, info.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(info.GetName() == "Actor");
Dali::TypeInfo movedInfo;
- movedInfo = std::move( info );
- DALI_TEST_CHECK( movedInfo );
- DALI_TEST_EQUALS( 2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_CHECK( movedInfo.GetName() == "Actor" );
- DALI_TEST_CHECK( !info );
+ movedInfo = std::move(info);
+ DALI_TEST_CHECK(movedInfo);
+ DALI_TEST_EQUALS(2, movedInfo.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(movedInfo.GetName() == "Actor");
+ DALI_TEST_CHECK(!info);
END_TEST;
}
TypeRegistry registry = TypeRegistry::Get();
TypeRegistry registry2;
registry2 = registry;
- DALI_TEST_CHECK( registry2 );
+ DALI_TEST_CHECK(registry2);
- DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
+ DALI_TEST_CHECK(registry2.GetTypeInfo("Actor").GetName() == registry2.GetTypeInfo("Actor").GetName());
END_TEST;
}
TypeInfo type;
// camera actor
- type = registry.GetTypeInfo( "CameraActor" );
- DALI_TEST_CHECK( type );
+ type = registry.GetTypeInfo("CameraActor");
+ DALI_TEST_CHECK(type);
CameraActor ca = CameraActor::DownCast(type.CreateInstance());
- DALI_TEST_CHECK( ca );
- application.GetScene().Add( ca );
+ DALI_TEST_CHECK(ca);
+ application.GetScene().Add(ca);
application.Render();
// animations
- type = registry.GetTypeInfo( "Animation" );
- DALI_TEST_CHECK( type );
+ type = registry.GetTypeInfo("Animation");
+ DALI_TEST_CHECK(type);
Animation an = Animation::DownCast(type.CreateInstance());
- DALI_TEST_CHECK( an );
+ DALI_TEST_CHECK(an);
an.Play();
application.Render();
TypeInfo type;
- type = registry.GetTypeInfo( "MyDummyActor" );
- DALI_TEST_CHECK( !type );
+ type = registry.GetTypeInfo("MyDummyActor");
+ DALI_TEST_CHECK(!type);
END_TEST;
}
int UtcDaliTypeRegistryGetTypeInfoFromTypeIdP(void)
{
- TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "CameraActor" );
- TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::CameraActor) );
+ TypeInfo named_type = TypeRegistry::Get().GetTypeInfo("CameraActor");
+ TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo(typeid(Dali::CameraActor));
- DALI_TEST_CHECK( named_type );
- DALI_TEST_CHECK( typeinfo_type );
+ DALI_TEST_CHECK(named_type);
+ DALI_TEST_CHECK(typeinfo_type);
// Check named and typeid are equivalent
- DALI_TEST_CHECK( named_type == typeinfo_type );
+ DALI_TEST_CHECK(named_type == typeinfo_type);
- DALI_TEST_CHECK( named_type.GetName() == typeinfo_type.GetName() );
- DALI_TEST_CHECK( named_type.GetBaseName() == typeinfo_type.GetBaseName() );
+ DALI_TEST_CHECK(named_type.GetName() == typeinfo_type.GetName());
+ DALI_TEST_CHECK(named_type.GetBaseName() == typeinfo_type.GetBaseName());
END_TEST;
}
int UtcDaliTypeRegistryGetTypeInfoFromTypeIdN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(Vector2) );
- DALI_TEST_CHECK( !typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(Vector2));
+ DALI_TEST_CHECK(!typeInfo);
END_TEST;
}
int UtcDaliTypeRegistryGetTypeNameCountP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo type;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeInfo type;
for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
{
- type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
- DALI_TEST_CHECK( type );
+ type = typeRegistry.GetTypeInfo(typeRegistry.GetTypeName(i));
+ DALI_TEST_CHECK(type);
}
END_TEST;
}
-
int UtcDaliTypeRegistryGetTypeNamesP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo type;
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeInfo type;
for(size_t i = 0; i < typeRegistry.GetTypeNameCount(); i++)
{
- type = typeRegistry.GetTypeInfo( typeRegistry.GetTypeName(i) );
- DALI_TEST_CHECK( type );
+ type = typeRegistry.GetTypeInfo(typeRegistry.GetTypeName(i));
+ DALI_TEST_CHECK(type);
}
END_TEST;
}
-
// Note: No negative test case for UtcDaliTypeRegistryTypeRegistration can be implemented.
int UtcDaliTypeRegistryTypeRegistrationNotCallingCreateOnInitP(void)
{
TestApplication application;
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
- DALI_TEST_CHECK( type );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor");
+ DALI_TEST_CHECK(type);
- TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
- DALI_TEST_CHECK( baseType );
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo("CustomActor");
+ DALI_TEST_CHECK(baseType);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
+ DALI_TEST_CHECK(handle);
- MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
- DALI_TEST_CHECK( customHandle );
+ MyTestCustomActor customHandle = MyTestCustomActor::DownCast(handle);
+ DALI_TEST_CHECK(customHandle);
- DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION);
- DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION);
{
TestConnectionTracker tracker;
- bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
- DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
- DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
+ bool connected = handle.ConnectSignal(&tracker, "sig1", CustomTestFunctor());
+ DALI_TEST_EQUALS(connected, true, TEST_LOCATION);
+ DALI_TEST_CHECK(lastSignalConnectionCustom == "sig1");
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION);
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION);
customHandle.GetCustomSignal().Emit();
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION);
}
// tracker should automatically disconnect here
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION);
// Test that functor is disconnected
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION);
customHandle.GetCustomSignal().Emit();
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1 /*not incremented*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION);
Property::Map attributes;
handle.DoAction("act1", attributes);
- DALI_TEST_CHECK( lastActionCustom == "act1" );
+ DALI_TEST_CHECK(lastActionCustom == "act1");
END_TEST;
}
{
TestApplication application;
- DALI_TEST_CHECK( "MyTestCustomActor2" == customTypeInit.RegisteredName() );
+ DALI_TEST_CHECK("MyTestCustomActor2" == customTypeInit.RegisteredName());
- DALI_TEST_CHECK( true == CreateCustomInitCalled );
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor2" );
- DALI_TEST_CHECK( type );
+ DALI_TEST_CHECK(true == CreateCustomInitCalled);
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor2");
+ DALI_TEST_CHECK(type);
END_TEST;
}
TestApplication application;
// Create Named Actor Type
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyNamedActor" );
- DALI_TEST_CHECK( type );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyNamedActor");
+ DALI_TEST_CHECK(type);
BaseHandle namedHandle = type.CreateInstance();
- DALI_TEST_CHECK( namedHandle );
- Actor namedActor( Actor::DownCast( namedHandle ) );
- DALI_TEST_CHECK( namedActor );
+ DALI_TEST_CHECK(namedHandle);
+ Actor namedActor(Actor::DownCast(namedHandle));
+ DALI_TEST_CHECK(namedActor);
- DALI_TEST_CHECK( namedActor.GetProperty< std::string >( Actor::Property::NAME ) == "NamedActor" );
- DALI_TEST_CHECK( type.GetName() == "MyNamedActor" );
- DALI_TEST_CHECK( type.GetBaseName() == "Actor" );
+ DALI_TEST_CHECK(namedActor.GetProperty<std::string>(Actor::Property::NAME) == "NamedActor");
+ DALI_TEST_CHECK(type.GetName() == "MyNamedActor");
+ DALI_TEST_CHECK(type.GetBaseName() == "Actor");
END_TEST;
}
{
TestApplication application;
- DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
+ DALI_TEST_CHECK(scriptedName == scriptedType.RegisteredName());
- TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
- DALI_TEST_CHECK( baseType );
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo(scriptedName);
+ DALI_TEST_CHECK(baseType);
BaseHandle handle = baseType.CreateInstance();
- DALI_TEST_CHECK( true == CreateCustomNamedInitCalled );
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( scriptedName );
- DALI_TEST_CHECK( type );
+ DALI_TEST_CHECK(true == CreateCustomNamedInitCalled);
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo(scriptedName);
+ DALI_TEST_CHECK(type);
END_TEST;
}
-
int UtcDaliTypeRegistryRegisteredNameN(void)
{
TestApplication application;
- DALI_TEST_CHECK( scriptedName == scriptedType.RegisteredName() );
+ DALI_TEST_CHECK(scriptedName == scriptedType.RegisteredName());
- TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( scriptedName );
- DALI_TEST_CHECK( baseType );
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo(scriptedName);
+ DALI_TEST_CHECK(baseType);
// should cause an assert because we're registering same type twice
// once statically at the start of this file, then again now
try
{
- TypeRegistration scriptedType( scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit );
- tet_result( TET_FAIL );
+ TypeRegistration scriptedType(scriptedName, typeid(Dali::CustomActor), CreateCustomNamedInit);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Duplicate type name in Type Registration", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Duplicate type name in Type Registration", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliTypeRegistrySignalConnectorTypeP(void)
{
ResetFunctorCounts();
TestApplication application;
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
- DALI_TEST_CHECK( type );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
+ DALI_TEST_CHECK(handle);
- MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
- DALI_TEST_CHECK( customHandle );
+ MyTestCustomActor customHandle = MyTestCustomActor::DownCast(handle);
+ DALI_TEST_CHECK(customHandle);
{
TestConnectionTracker tracker;
- bool connected = handle.ConnectSignal( &tracker, "sig1", CustomTestFunctor() );
- DALI_TEST_EQUALS( connected, true, TEST_LOCATION );
- DALI_TEST_CHECK( lastSignalConnectionCustom == "sig1" );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
+ bool connected = handle.ConnectSignal(&tracker, "sig1", CustomTestFunctor());
+ DALI_TEST_EQUALS(connected, true, TEST_LOCATION);
+ DALI_TEST_CHECK(lastSignalConnectionCustom == "sig1");
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION);
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION);
customHandle.GetCustomSignal().Emit();
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 1, TEST_LOCATION);
}
// tracker should automatically disconnect here
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION);
// Test that functor is disconnected
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1, TEST_LOCATION);
customHandle.GetCustomSignal().Emit();
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 1/*not incremented*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 1 /*not incremented*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0, TEST_LOCATION);
END_TEST;
}
TestApplication application;
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
- DALI_TEST_CHECK( type );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor");
+ DALI_TEST_CHECK(type);
- TypeInfo baseType = TypeRegistry::Get().GetTypeInfo( "CustomActor" );
- DALI_TEST_CHECK( baseType );
+ TypeInfo baseType = TypeRegistry::Get().GetTypeInfo("CustomActor");
+ DALI_TEST_CHECK(baseType);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
+ DALI_TEST_CHECK(handle);
- MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
- DALI_TEST_CHECK( customHandle );
+ MyTestCustomActor customHandle = MyTestCustomActor::DownCast(handle);
+ DALI_TEST_CHECK(customHandle);
- DALI_TEST_EQUALS( type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(type.GetActionCount(), TEST_ACTION_COUNT + baseType.GetActionCount(), TEST_LOCATION);
- DALI_TEST_EQUALS( type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(type.GetSignalCount(), TEST_SIGNAL_COUNT + baseType.GetSignalCount(), TEST_LOCATION);
{
TestConnectionTracker tracker;
- bool connected = handle.ConnectSignal( &tracker, "sig2", CustomTestFunctor() );
- DALI_TEST_EQUALS( connected, false/*This is supposed to fail*/, TEST_LOCATION );
- DALI_TEST_CHECK( lastSignalConnectionCustom == "failed" );
- DALI_TEST_EQUALS( CustomTestFunctor::mTotalInstanceCount, 2/*temporary copy + FunctorDelegate copy*/, TEST_LOCATION );
- DALI_TEST_EQUALS( CustomTestFunctor::mCurrentInstanceCount, 0/*deleted along with FunctorDelegate*/, TEST_LOCATION );
+ bool connected = handle.ConnectSignal(&tracker, "sig2", CustomTestFunctor());
+ DALI_TEST_EQUALS(connected, false /*This is supposed to fail*/, TEST_LOCATION);
+ DALI_TEST_CHECK(lastSignalConnectionCustom == "failed");
+ DALI_TEST_EQUALS(CustomTestFunctor::mTotalInstanceCount, 2 /*temporary copy + FunctorDelegate copy*/, TEST_LOCATION);
+ DALI_TEST_EQUALS(CustomTestFunctor::mCurrentInstanceCount, 0 /*deleted along with FunctorDelegate*/, TEST_LOCATION);
// Should be a NOOP
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION);
customHandle.GetCustomSignal().Emit();
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0 /*never called*/, TEST_LOCATION);
}
// tracker should have nothing to disconnect here
// Should be a NOOP
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0, TEST_LOCATION);
customHandle.GetCustomSignal().Emit();
- DALI_TEST_EQUALS( CustomTestFunctor::mCallbackCount, 0/*never called*/, TEST_LOCATION );
+ DALI_TEST_EQUALS(CustomTestFunctor::mCallbackCount, 0 /*never called*/, TEST_LOCATION);
END_TEST;
}
TestApplication application;
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
- DALI_TEST_CHECK( type );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
+ DALI_TEST_CHECK(handle);
Property::Map attributes;
- DALI_TEST_CHECK( handle.DoAction("act1", attributes) );
- DALI_TEST_CHECK( lastActionCustom == "act1" );
+ DALI_TEST_CHECK(handle.DoAction("act1", attributes));
+ DALI_TEST_CHECK(lastActionCustom == "act1");
END_TEST;
}
TestApplication application;
- TypeInfo type = TypeRegistry::Get().GetTypeInfo( "MyTestCustomActor" );
- DALI_TEST_CHECK( type );
+ TypeInfo type = TypeRegistry::Get().GetTypeInfo("MyTestCustomActor");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
+ DALI_TEST_CHECK(handle);
Property::Map attributes;
- DALI_TEST_CHECK( !handle.DoAction( "unknownAction", attributes ) );
+ DALI_TEST_CHECK(!handle.DoAction("unknownAction", attributes));
END_TEST;
}
int UtcDaliTypeRegistryPropertyRegistrationP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
- unsigned int initialPropertyCount( customActor.GetPropertyCount() );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
+ unsigned int initialPropertyCount(customActor.GetPropertyCount());
- std::string propertyName( "prop1" );
- int propertyIndex( PROPERTY_REGISTRATION_START_INDEX );
- Property::Type propertyType( Property::BOOLEAN );
- PropertyRegistration property1( customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty );
+ std::string propertyName("prop1");
+ int propertyIndex(PROPERTY_REGISTRATION_START_INDEX);
+ Property::Type propertyType(Property::BOOLEAN);
+ PropertyRegistration property1(customType1, propertyName, propertyIndex, propertyType, &SetProperty, &GetProperty);
// Check property count after registration
- unsigned int postRegistrationPropertyCount( customActor.GetPropertyCount() );
- DALI_TEST_EQUALS( initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION );
+ unsigned int postRegistrationPropertyCount(customActor.GetPropertyCount());
+ DALI_TEST_EQUALS(initialPropertyCount + 1u, postRegistrationPropertyCount, TEST_LOCATION);
// Add custom property and check property count
- customActor.RegisterProperty( "customProp1", true );
- unsigned int customPropertyCount( customActor.GetPropertyCount() );
- DALI_TEST_EQUALS( postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION );
+ customActor.RegisterProperty("customProp1", true);
+ unsigned int customPropertyCount(customActor.GetPropertyCount());
+ DALI_TEST_EQUALS(postRegistrationPropertyCount + 1u, customPropertyCount, TEST_LOCATION);
// Set the property, ensure SetProperty called
- DALI_TEST_CHECK( !setPropertyCalled );
- customActor.SetProperty( propertyIndex, false );
- DALI_TEST_CHECK( setPropertyCalled );
+ DALI_TEST_CHECK(!setPropertyCalled);
+ customActor.SetProperty(propertyIndex, false);
+ DALI_TEST_CHECK(setPropertyCalled);
// Get the property, ensure GetProperty called
- DALI_TEST_CHECK( !getPropertyCalled );
- (void)customActor.GetProperty< bool >( propertyIndex );
- DALI_TEST_CHECK( getPropertyCalled );
+ DALI_TEST_CHECK(!getPropertyCalled);
+ (void)customActor.GetProperty<bool>(propertyIndex);
+ DALI_TEST_CHECK(getPropertyCalled);
// Get the property using GetCurrentProperty and ensure GetProperty is called
getPropertyCalled = false;
- DALI_TEST_CHECK( !getPropertyCalled );
- customActor.GetCurrentProperty< bool >( propertyIndex );
- DALI_TEST_CHECK( getPropertyCalled );
+ DALI_TEST_CHECK(!getPropertyCalled);
+ customActor.GetCurrentProperty<bool>(propertyIndex);
+ DALI_TEST_CHECK(getPropertyCalled);
// Check the property name
- DALI_TEST_EQUALS( customActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
- DALI_TEST_EQUALS( typeInfo.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION);
+ DALI_TEST_EQUALS(typeInfo.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION);
// Check the property index
- DALI_TEST_EQUALS( customActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyIndex(propertyName), propertyIndex, TEST_LOCATION);
// Check the property type
- DALI_TEST_EQUALS( customActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyType(propertyIndex), propertyType, TEST_LOCATION);
// Check property count of type-info is 1
Property::IndexContainer indices;
- typeInfo.GetPropertyIndices( indices );
+ typeInfo.GetPropertyIndices(indices);
size_t typePropertyCount = typeInfo.GetPropertyCount();
- DALI_TEST_EQUALS( indices.Size(), Actor::New().GetPropertyCount() + 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( indices.Size(), typePropertyCount, TEST_LOCATION );
+ DALI_TEST_EQUALS(indices.Size(), Actor::New().GetPropertyCount() + 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(indices.Size(), typePropertyCount, TEST_LOCATION);
// Ensure indices returned from actor and customActor differ by two
Actor actor = Actor::New();
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
unsigned int actorIndices = indices.Size();
- customActor.GetPropertyIndices( indices );
+ customActor.GetPropertyIndices(indices);
unsigned int customActorIndices = indices.Size();
- DALI_TEST_EQUALS( actorIndices + 2u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
+ DALI_TEST_EQUALS(actorIndices + 2u, customActorIndices, TEST_LOCATION); // Custom property + registered property
END_TEST;
}
int UtcDaliTypeRegistryPropertyRegistrationN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Attempt to register a property type out-of-bounds index (less than)
try
{
- PropertyRegistration property1( customType1, "propName", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty );
- tet_result( TET_FAIL );
+ PropertyRegistration property1(customType1, "propName", PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN, &SetProperty, &GetProperty);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
// Attempt to register a property type out-of-bounds index (greater than)
try
{
- PropertyRegistration property1( customType1, "propName", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty );
- tet_result( TET_FAIL );
+ PropertyRegistration property1(customType1, "propName", PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN, &SetProperty, &GetProperty);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= PROPERTY_REGISTRATION_START_INDEX ) && ( index <= PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= PROPERTY_REGISTRATION_START_INDEX) && (index <= PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
END_TEST;
int UtcDaliTypeRegistryAnimatablePropertyRegistrationP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
application.GetScene().Add(customActor);
- unsigned int customPropertyCount( customActor.GetPropertyCount() );
+ unsigned int customPropertyCount(customActor.GetPropertyCount());
// Register animatable property
- std::string animatablePropertyName( "animatableProp1" );
- int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- Property::Type animatablePropertyType( Property::FLOAT );
- AnimatablePropertyRegistration animatableProperty( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
+ std::string animatablePropertyName("animatableProp1");
+ int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ Property::Type animatablePropertyType(Property::FLOAT);
+ AnimatablePropertyRegistration animatableProperty(customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType);
// Check property count after registration
- DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION);
// Set the animatable property value
- customActor.SetProperty( animatablePropertyIndex, 25.0f );
+ customActor.SetProperty(animatablePropertyIndex, 25.0f);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 25.f, TEST_LOCATION);
// Check the animatable property name
- DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyName(animatablePropertyIndex), animatablePropertyName, TEST_LOCATION);
// Check the animatable property index
- DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyIndex(animatablePropertyName), animatablePropertyIndex, TEST_LOCATION);
// Check the animatable property type
- DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyType(animatablePropertyIndex), animatablePropertyType, TEST_LOCATION);
// Check property count of type-info is 1
Property::IndexContainer indices;
- typeInfo.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION );
+ typeInfo.GetPropertyIndices(indices);
+ DALI_TEST_EQUALS(indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION);
// Ensure indices returned from actor and customActor differ by one
Actor actor = Actor::New();
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
unsigned int actorIndices = indices.Size();
- customActor.GetPropertyIndices( indices );
+ customActor.GetPropertyIndices(indices);
unsigned int customActorIndices = indices.Size();
- DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
+ DALI_TEST_EQUALS(actorIndices + 1u, customActorIndices, TEST_LOCATION); // Custom property + registered property
// check that the property is animatable
Animation animation = Animation::New(0.2f);
- animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 15.f, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(customActor, animatablePropertyIndex), 15.f, AlphaFunction::LINEAR);
animation.Play();
// Target value should change straight away
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 15.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 15.0f, TEST_LOCATION);
// Render and notify, animation play for 0.05 seconds
application.SendNotification();
application.Render(50);
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 22.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyIndex), 22.5f, TEST_LOCATION);
// Render and notify, animation play for another 0.1 seconds
application.SendNotification();
application.Render(100);
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyIndex), 17.5f, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryAnimatablePropertyRegistrationN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Attempt to register an animatable property type out-of-bounds index (less than)
try
{
- AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
- tet_result( TET_FAIL );
+ AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
// Attempt to register an animatable property type out-of-bounds index (greater than)
try
{
- AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
- tet_result( TET_FAIL );
+ AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
END_TEST;
int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
application.GetScene().Add(customActor);
- unsigned int customPropertyCount( customActor.GetPropertyCount() );
+ unsigned int customPropertyCount(customActor.GetPropertyCount());
// Register animatable property
- std::string animatablePropertyName( "animatableProp1" );
- int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, 10.f );
+ std::string animatablePropertyName("animatableProp1");
+ int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ AnimatablePropertyRegistration animatableProperty1(customType1, animatablePropertyName, animatablePropertyIndex, 10.f);
// Check property count after registration
- DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 10.f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 10.f, TEST_LOCATION);
// Check the animatable property name
- DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyName(animatablePropertyIndex), animatablePropertyName, TEST_LOCATION);
// Check the animatable property index
- DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyIndex(animatablePropertyName), animatablePropertyIndex, TEST_LOCATION);
// Check the animatable property type
- DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), Property::FLOAT, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyType(animatablePropertyIndex), Property::FLOAT, TEST_LOCATION);
// Check property count of type-info
Property::IndexContainer indices;
- typeInfo.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION );
+ typeInfo.GetPropertyIndices(indices);
+ DALI_TEST_EQUALS(indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION);
// Ensure indices returned from actor and customActor differ by one
Actor actor = Actor::New();
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
unsigned int actorIndices = indices.Size();
- customActor.GetPropertyIndices( indices );
+ customActor.GetPropertyIndices(indices);
unsigned int customActorIndices = indices.Size();
- DALI_TEST_EQUALS( actorIndices + 1u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
+ DALI_TEST_EQUALS(actorIndices + 1u, customActorIndices, TEST_LOCATION); // Custom property + registered property
// check that the property is animatable
Animation animation = Animation::New(0.2f);
- animation.AnimateTo( Property( customActor, animatablePropertyIndex ), 20.f, AlphaFunction::LINEAR );
+ animation.AnimateTo(Property(customActor, animatablePropertyIndex), 20.f, AlphaFunction::LINEAR);
animation.Play();
// Target value should change straight away
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 20.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 20.0f, TEST_LOCATION);
// Render and notify, animation play for 0.05 seconds
application.SendNotification();
application.Render(50);
- DALI_TEST_EQUALS( 0.25f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 12.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.25f, animation.GetCurrentProgress(), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyIndex), 12.5f, TEST_LOCATION);
// Render and notify, animation play for another 0.1 seconds
application.SendNotification();
application.Render(100);
- DALI_TEST_EQUALS( 0.75f, animation.GetCurrentProgress(), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 17.5f, TEST_LOCATION );
+ DALI_TEST_EQUALS(0.75f, animation.GetCurrentProgress(), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyIndex), 17.5f, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryAnimatablePropertyRegistrationWithDefaultN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Attempt to register an animatable property type out-of-bounds index (less than)
try
{
- AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false );
- tet_result( TET_FAIL );
+ AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, false);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
// Attempt to register an animatable property type out-of-bounds index (greater than)
try
{
- AnimatablePropertyRegistration property1( customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true );
- tet_result( TET_FAIL );
+ AnimatablePropertyRegistration property1(customType1, "animPropName", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, true);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
END_TEST;
int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
- unsigned int customPropertyCount( customActor.GetPropertyCount() );
+ unsigned int customPropertyCount(customActor.GetPropertyCount());
// Register animatable property
- std::string animatablePropertyName( "animatableProp1" );
- int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- Property::Type animatablePropertyType( Property::VECTOR2 );
- AnimatablePropertyRegistration animatableProperty1( customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType );
+ std::string animatablePropertyName("animatableProp1");
+ int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ Property::Type animatablePropertyType(Property::VECTOR2);
+ AnimatablePropertyRegistration animatableProperty1(customType1, animatablePropertyName, animatablePropertyIndex, animatablePropertyType);
// Check property count after registration
- DALI_TEST_EQUALS( customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(customPropertyCount + 1u, customActor.GetPropertyCount(), TEST_LOCATION);
// Set the animatable property value
- customActor.SetProperty( animatablePropertyIndex, Vector2(25.0f, 50.0f) );
+ customActor.SetProperty(animatablePropertyIndex, Vector2(25.0f, 50.0f));
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(25.0f, 50.0f), TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(animatablePropertyIndex), Vector2(25.0f, 50.0f), TEST_LOCATION);
// Check the animatable property name
- DALI_TEST_EQUALS( customActor.GetPropertyName( animatablePropertyIndex ), animatablePropertyName, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyName(animatablePropertyIndex), animatablePropertyName, TEST_LOCATION);
// Check the animatable property index
- DALI_TEST_EQUALS( customActor.GetPropertyIndex( animatablePropertyName ), animatablePropertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyIndex(animatablePropertyName), animatablePropertyIndex, TEST_LOCATION);
// Check the animatable property type
- DALI_TEST_EQUALS( customActor.GetPropertyType( animatablePropertyIndex ), animatablePropertyType, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetPropertyType(animatablePropertyIndex), animatablePropertyType, TEST_LOCATION);
// Check property count of type-info
Property::IndexContainer indices;
- typeInfo.GetPropertyIndices( indices );
- DALI_TEST_EQUALS( indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION );
+ typeInfo.GetPropertyIndices(indices);
+ DALI_TEST_EQUALS(indices.Size(), customActor.GetPropertyCount(), TEST_LOCATION);
// Register animatable property components
- std::string animatablePropertyComponentName1( "animatableProp1X" );
- int animatablePropertyComponentIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0 );
+ std::string animatablePropertyComponentName1("animatableProp1X");
+ int animatablePropertyComponentIndex1(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, animatablePropertyComponentName1, animatablePropertyComponentIndex1, animatablePropertyIndex, 0);
- std::string animatablePropertyComponentName2( "animatableProp1Y" );
- int animatablePropertyComponentIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1 );
+ std::string animatablePropertyComponentName2("animatableProp1Y");
+ int animatablePropertyComponentIndex2(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, animatablePropertyComponentName2, animatablePropertyComponentIndex2, animatablePropertyIndex, 1);
// Check property count after registration
- DALI_TEST_EQUALS( customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(customPropertyCount + 3u, customActor.GetPropertyCount(), TEST_LOCATION);
// Check the animatable property component value
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 25.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyComponentIndex1), 25.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyComponentIndex2), 50.0f, TEST_LOCATION);
// Set the animatable property component value
- customActor.SetProperty( animatablePropertyComponentIndex1, 150.0f );
+ customActor.SetProperty(animatablePropertyComponentIndex1, 150.0f);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 50.0f), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 50.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector2>(animatablePropertyIndex), Vector2(150.0f, 50.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyComponentIndex1), 150.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyComponentIndex2), 50.0f, TEST_LOCATION);
// Set the animatable property component value
- customActor.SetProperty( animatablePropertyComponentIndex2, 225.0f );
+ customActor.SetProperty(animatablePropertyComponentIndex2, 225.0f);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( animatablePropertyIndex ), Vector2(150.0f, 225.0f), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex1 ), 150.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector2>(animatablePropertyIndex), Vector2(150.0f, 225.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyComponentIndex1), 150.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyComponentIndex2), 225.0f, TEST_LOCATION);
// Ensure indices returned from actor and customActor differ by three
Actor actor = Actor::New();
- actor.GetPropertyIndices( indices );
+ actor.GetPropertyIndices(indices);
unsigned int actorIndices = indices.Size();
- customActor.GetPropertyIndices( indices );
+ customActor.GetPropertyIndices(indices);
unsigned int customActorIndices = indices.Size();
- DALI_TEST_EQUALS( actorIndices + 3u, customActorIndices, TEST_LOCATION ); // Custom property + registered property
+ DALI_TEST_EQUALS(actorIndices + 3u, customActorIndices, TEST_LOCATION); // Custom property + registered property
// Attempt to animate component property, it should not crash
- Animation animation = Animation::New( 1.0f );
- animation.AnimateTo( Property( customActor, animatablePropertyComponentIndex1 ), 200.0f );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateTo(Property(customActor, animatablePropertyComponentIndex1), 200.0f);
animation.Play();
// Check the property value
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( animatablePropertyIndex ), Vector2(200.0f, 225.0f), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex1 ), 200.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyComponentIndex2 ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(animatablePropertyIndex), Vector2(200.0f, 225.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyComponentIndex1), 200.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyComponentIndex2), 225.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector2AnimateByP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
- const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
const unsigned int xComponentIndex = index + 1;
const unsigned int yComponentIndex = index + 2;
- const Vector2 initialValue( 20.0f, 40.0f );
+ const Vector2 initialValue(20.0f, 40.0f);
// Register animatable property & its components
- AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
- AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
+ AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", index, initialValue);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, "animatableProp1X", xComponentIndex, index, 0);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, "animatableProp1Y", yComponentIndex, index, 1);
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(index), initialValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(xComponentIndex), initialValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(yComponentIndex), initialValue.y, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property current value
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( index ), initialValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector2>(index), initialValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(xComponentIndex), initialValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(yComponentIndex), initialValue.y, TEST_LOCATION);
// Do an AnimateBy
- const Vector2 targetValue( 45.0f, 53.0f );
- const Vector2 relativeValue( targetValue - initialValue );
+ const Vector2 targetValue(45.0f, 53.0f);
+ const Vector2 relativeValue(targetValue - initialValue);
- Animation animation = Animation::New( 1.0f );
- animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
- animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(customActor, xComponentIndex), relativeValue.x);
+ animation.AnimateBy(Property(customActor, yComponentIndex), relativeValue.y);
animation.Play();
// Target values should change straight away
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(xComponentIndex), targetValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(yComponentIndex), targetValue.y, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector3AnimateByP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
- const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
const unsigned int xComponentIndex = index + 1;
const unsigned int yComponentIndex = index + 2;
const unsigned int zComponentIndex = index + 3;
- const Vector3 initialValue( 20.0f, 40.0f, 50.0f );
+ const Vector3 initialValue(20.0f, 40.0f, 50.0f);
// Register animatable property & its components
- AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
- AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
+ AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", index, initialValue);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, "animatableProp1X", xComponentIndex, index, 0);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, "animatableProp1Y", yComponentIndex, index, 1);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent3(customType1, "animatableProp1Z", zComponentIndex, index, 2);
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(index), initialValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(xComponentIndex), initialValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(yComponentIndex), initialValue.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(zComponentIndex), initialValue.z, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property current value
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( index ), initialValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector3>(index), initialValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(xComponentIndex), initialValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(yComponentIndex), initialValue.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(zComponentIndex), initialValue.z, TEST_LOCATION);
// Do an AnimateBy
- const Vector3 targetValue( 45.0f, 53.0f, 25.0f );
- const Vector3 relativeValue( targetValue - initialValue );
+ const Vector3 targetValue(45.0f, 53.0f, 25.0f);
+ const Vector3 relativeValue(targetValue - initialValue);
- Animation animation = Animation::New( 1.0f );
- animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
- animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
- animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(customActor, xComponentIndex), relativeValue.x);
+ animation.AnimateBy(Property(customActor, yComponentIndex), relativeValue.y);
+ animation.AnimateBy(Property(customActor, zComponentIndex), relativeValue.z);
animation.Play();
// Target values should change straight away
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(xComponentIndex), targetValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(yComponentIndex), targetValue.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(zComponentIndex), targetValue.z, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationVector4AnimateByP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
- const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
+ const unsigned int index = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX;
const unsigned int xComponentIndex = index + 1;
const unsigned int yComponentIndex = index + 2;
const unsigned int zComponentIndex = index + 3;
const unsigned int wComponentIndex = index + 4;
- const Vector4 initialValue( 20.0f, 40.0f, 50.0f, 60.0f );
+ const Vector4 initialValue(20.0f, 40.0f, 50.0f, 60.0f);
// Register animatable property & its components
- AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", index, initialValue );
- AnimatablePropertyComponentRegistration animatablePropertyComponent1( customType1, "animatableProp1X", xComponentIndex, index, 0 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent2( customType1, "animatableProp1Y", yComponentIndex, index, 1 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent3( customType1, "animatableProp1Z", zComponentIndex, index, 2 );
- AnimatablePropertyComponentRegistration animatablePropertyComponent4( customType1, "animatableProp1W", wComponentIndex, index, 3 );
+ AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", index, initialValue);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent1(customType1, "animatableProp1X", xComponentIndex, index, 0);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent2(customType1, "animatableProp1Y", yComponentIndex, index, 1);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent3(customType1, "animatableProp1Z", zComponentIndex, index, 2);
+ AnimatablePropertyComponentRegistration animatablePropertyComponent4(customType1, "animatableProp1W", wComponentIndex, index, 3);
// Check the animatable property value
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(index), initialValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(xComponentIndex), initialValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(yComponentIndex), initialValue.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(zComponentIndex), initialValue.z, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(wComponentIndex), initialValue.w, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
// Check the animatable property current value
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( index ), initialValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( xComponentIndex ), initialValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( yComponentIndex ), initialValue.y, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( zComponentIndex ), initialValue.z, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( wComponentIndex ), initialValue.w, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector4>(index), initialValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(xComponentIndex), initialValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(yComponentIndex), initialValue.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(zComponentIndex), initialValue.z, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(wComponentIndex), initialValue.w, TEST_LOCATION);
// Do an AnimateBy
- const Vector4 targetValue( 45.0f, 53.0f, 25.0f, 13.0f );
- const Vector4 relativeValue( targetValue - initialValue );
-
- Animation animation = Animation::New( 1.0f );
- animation.AnimateBy( Property( customActor, xComponentIndex ), relativeValue.x );
- animation.AnimateBy( Property( customActor, yComponentIndex ), relativeValue.y );
- animation.AnimateBy( Property( customActor, zComponentIndex ), relativeValue.z );
- animation.AnimateBy( Property( customActor, wComponentIndex ), relativeValue.w );
+ const Vector4 targetValue(45.0f, 53.0f, 25.0f, 13.0f);
+ const Vector4 relativeValue(targetValue - initialValue);
+
+ Animation animation = Animation::New(1.0f);
+ animation.AnimateBy(Property(customActor, xComponentIndex), relativeValue.x);
+ animation.AnimateBy(Property(customActor, yComponentIndex), relativeValue.y);
+ animation.AnimateBy(Property(customActor, zComponentIndex), relativeValue.z);
+ animation.AnimateBy(Property(customActor, wComponentIndex), relativeValue.w);
animation.Play();
// Target values should change straight away
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( index ), targetValue, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( xComponentIndex ), targetValue.x, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( yComponentIndex ), targetValue.y, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( zComponentIndex ), targetValue.z, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( wComponentIndex ), targetValue.w, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(index), targetValue, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(xComponentIndex), targetValue.x, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(yComponentIndex), targetValue.y, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(zComponentIndex), targetValue.z, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(wComponentIndex), targetValue.w, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryAnimatablePropertyComponentRegistrationN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Register animatable property with the type of Vector2
- int animatablePropertyIndex1( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- AnimatablePropertyRegistration animatableProperty1( customType1, "animatableProp1", animatablePropertyIndex1, Property::VECTOR2 );
+ int animatablePropertyIndex1(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ AnimatablePropertyRegistration animatableProperty1(customType1, "animatableProp1", animatablePropertyIndex1, Property::VECTOR2);
// Attempt to register an animatable property component out-of-bounds index (less than)
try
{
- AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0 );
- tet_result( TET_FAIL );
+ AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX - 1, animatablePropertyIndex1, 0);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
// Attempt to register an animatable property component out-of-bounds index (greater than)
try
{
- AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0 );
- tet_result( TET_FAIL );
+ AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX + 1, animatablePropertyIndex1, 0);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX) && (index <= ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
// Register an animatable property component
- AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0 );
+ AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp1X", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1, animatablePropertyIndex1, 0);
// Attempt to register another animatable property component with the same component index
try
{
- AnimatablePropertyComponentRegistration propertyComponent2( customType1, "animatableProp1Y", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0 );
- tet_result( TET_FAIL );
+ AnimatablePropertyComponentRegistration propertyComponent2(customType1, "animatableProp1Y", ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2, animatablePropertyIndex1, 0);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property component already registered", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property component already registered", TEST_LOCATION);
}
// Register animatable property with the type of boolean
- int animatablePropertyIndex2( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2 );
- AnimatablePropertyRegistration animatableProperty2( customType1, "animatableProp2", animatablePropertyIndex2, Property::BOOLEAN );
+ int animatablePropertyIndex2(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2);
+ AnimatablePropertyRegistration animatableProperty2(customType1, "animatableProp2", animatablePropertyIndex2, Property::BOOLEAN);
// Attempt to register an animatable property component for the above property with boolean type
try
{
- AnimatablePropertyComponentRegistration propertyComponent1( customType1, "animatableProp2X", animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0 );
- tet_result( TET_FAIL );
+ AnimatablePropertyComponentRegistration propertyComponent1(customType1, "animatableProp2X", animatablePropertyIndex2 + 1, animatablePropertyIndex2, 0);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "Base property does not support component", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Base property does not support component", TEST_LOCATION);
}
END_TEST;
int UtcDaliTypeRegistryChildPropertyRegistrationP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
- unsigned int initialPropertyCount( customActor.GetPropertyCount() );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
+ unsigned int initialPropertyCount(customActor.GetPropertyCount());
// Register child properties to the parent
- std::string propertyName( "childProp1" );
- int propertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- Property::Type propertyType( Property::BOOLEAN );
- ChildPropertyRegistration childProperty1( customType1, propertyName, propertyIndex, propertyType );
-
- std::string propertyName2( "childProp2" );
- int propertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 );
- Property::Type propertyType2( Property::INTEGER );
- ChildPropertyRegistration childProperty2( customType1, propertyName2, propertyIndex2, propertyType2 );
-
- std::string propertyName3( "childProp3" );
- int propertyIndex3( CHILD_PROPERTY_REGISTRATION_START_INDEX + 2 );
- Property::Type propertyType3( Property::FLOAT );
- ChildPropertyRegistration childProperty3( customType1, propertyName3, propertyIndex3, propertyType3 );
-
- std::string propertyName4( "childProp4" );
- int propertyIndex4( CHILD_PROPERTY_REGISTRATION_START_INDEX + 3 );
- Property::Type propertyType4( Property::INTEGER );
- ChildPropertyRegistration childProperty4( customType1, propertyName4, propertyIndex4, propertyType4 );
+ std::string propertyName("childProp1");
+ int propertyIndex(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ Property::Type propertyType(Property::BOOLEAN);
+ ChildPropertyRegistration childProperty1(customType1, propertyName, propertyIndex, propertyType);
+
+ std::string propertyName2("childProp2");
+ int propertyIndex2(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ Property::Type propertyType2(Property::INTEGER);
+ ChildPropertyRegistration childProperty2(customType1, propertyName2, propertyIndex2, propertyType2);
+
+ std::string propertyName3("childProp3");
+ int propertyIndex3(CHILD_PROPERTY_REGISTRATION_START_INDEX + 2);
+ Property::Type propertyType3(Property::FLOAT);
+ ChildPropertyRegistration childProperty3(customType1, propertyName3, propertyIndex3, propertyType3);
+
+ std::string propertyName4("childProp4");
+ int propertyIndex4(CHILD_PROPERTY_REGISTRATION_START_INDEX + 3);
+ Property::Type propertyType4(Property::INTEGER);
+ ChildPropertyRegistration childProperty4(customType1, propertyName4, propertyIndex4, propertyType4);
// Check property count are not changed because the child properties will not be created for the parent
- DALI_TEST_EQUALS( initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialPropertyCount, customActor.GetPropertyCount(), TEST_LOCATION);
// check the child property type
- Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
- Property::Type type = typeInfoImpl.GetChildPropertyType( typeInfoImpl.GetChildPropertyIndex("childProp4") );
- DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
+ Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo);
+ Property::Type type = typeInfoImpl.GetChildPropertyType(typeInfoImpl.GetChildPropertyIndex("childProp4"));
+ DALI_TEST_EQUALS(type, Property::INTEGER, TEST_LOCATION);
- std::string unRegisteredChildName( typeInfoImpl.GetChildPropertyName( CHILD_PROPERTY_REGISTRATION_START_INDEX + 4 ) );
- DALI_TEST_EQUALS( unRegisteredChildName, "", TEST_LOCATION );
+ std::string unRegisteredChildName(typeInfoImpl.GetChildPropertyName(CHILD_PROPERTY_REGISTRATION_START_INDEX + 4));
+ DALI_TEST_EQUALS(unRegisteredChildName, "", TEST_LOCATION);
// Create a child actor
Actor childActor = Actor::New();
- DALI_TEST_CHECK( childActor );
- unsigned int initialChildActorPropertyCount( childActor.GetPropertyCount() );
+ DALI_TEST_CHECK(childActor);
+ unsigned int initialChildActorPropertyCount(childActor.GetPropertyCount());
// The type of child properties should be Property::None as the child hasn't registered any child property yet.
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), Property::NONE, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), Property::NONE, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), Property::NONE, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), Property::NONE, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex), Property::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex2), Property::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex3), Property::NONE, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex4), Property::NONE, TEST_LOCATION);
// Set the value for the first child property when the child actor doesn't have a parent yet
childActor.SetProperty(propertyIndex, true);
// Check that the first child property is dynamically created
- DALI_TEST_EQUALS( initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialChildActorPropertyCount + 1u, childActor.GetPropertyCount(), TEST_LOCATION);
// Check the first child property value
- DALI_TEST_EQUALS( childActor.GetProperty< bool >( propertyIndex ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetProperty<bool>(propertyIndex), true, TEST_LOCATION);
// Check the first child property type
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex), propertyType, TEST_LOCATION);
// Check that the first child property have no name, as it doesn't have a parent yet.
- DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), "", TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex), "", TEST_LOCATION);
// Check that the first property can't be accessed through its name, as it doesn't have a parent yet.
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), Property::INVALID_INDEX, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName), Property::INVALID_INDEX, TEST_LOCATION);
// Create a custom property for the child with the same name as the second child property registered to the parent
Property::Index customPropertyIndex = childActor.RegisterProperty(propertyName2, 100, Property::READ_WRITE);
// Check that the custom property is created
- DALI_TEST_EQUALS( initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialChildActorPropertyCount + 2u, childActor.GetPropertyCount(), TEST_LOCATION);
// Check the property value
- DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetProperty<int>(customPropertyIndex), 100, TEST_LOCATION);
// Check the property index
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), customPropertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName2), customPropertyIndex, TEST_LOCATION);
// Check the property type
- DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex), propertyType2, TEST_LOCATION);
// Check the property name
- DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex ), propertyName2, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyName(customPropertyIndex), propertyName2, TEST_LOCATION);
// Now add the child actor to the parent
- customActor.Add( childActor );
+ customActor.Add(childActor);
// Check that the first child property now has the correct name as previously registered to the parent
- DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION);
// Check that the child property index for the first child property can now be retrieved through its child property name
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName), propertyIndex, TEST_LOCATION);
// Check that the second child property now has the correct index as previously registered to the parent
- DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex2 ), propertyName2, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex2), propertyName2, TEST_LOCATION);
// Check that the second child property can be accessed through both its custom property index and its child property index
- DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex ), 100, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex2 ), 100, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex ), propertyType2, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex2 ), propertyType2, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetProperty<int>(customPropertyIndex), 100, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetProperty<int>(propertyIndex2), 100, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex), propertyType2, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex2), propertyType2, TEST_LOCATION);
// Check that the child property index for the second child property can now be retrieved through its child property name
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName2 ), propertyIndex2, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName2), propertyIndex2, TEST_LOCATION);
// Set the value for the third child property when the child actor is already added to the parent
childActor.SetProperty(propertyIndex3, 0.15f);
// Check that the third child property is dynamically created
- DALI_TEST_EQUALS( initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialChildActorPropertyCount + 3u, childActor.GetPropertyCount(), TEST_LOCATION);
// Check the third child property value
- DALI_TEST_EQUALS( childActor.GetProperty< float >( propertyIndex3 ), 0.15f, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetProperty<float>(propertyIndex3), 0.15f, TEST_LOCATION);
// Check the third child property type
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex3 ), propertyType3, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex3), propertyType3, TEST_LOCATION);
// Check the third child property name
- DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex3 ), propertyName3, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex3), propertyName3, TEST_LOCATION);
// Check the third child property index.
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName3 ), propertyIndex3, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName3), propertyIndex3, TEST_LOCATION);
// Create a custom property for the child with the same name as the fourth child property registered to the parent
Property::Index customPropertyIndex2 = childActor.RegisterProperty(propertyName4, 20, Property::READ_WRITE);
// Check that the custom property is created
- DALI_TEST_EQUALS( initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialChildActorPropertyCount + 4u, childActor.GetPropertyCount(), TEST_LOCATION);
// Check the fourth child property value
- DALI_TEST_EQUALS( childActor.GetProperty< int >( propertyIndex4 ), 20, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetProperty< int >( customPropertyIndex2 ), 20, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetProperty<int>(propertyIndex4), 20, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetProperty<int>(customPropertyIndex2), 20, TEST_LOCATION);
// Check the fourth child property type
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex4 ), propertyType4, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex2 ), propertyType4, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex4), propertyType4, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex2), propertyType4, TEST_LOCATION);
// Check the fourth child property name
- DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex4 ), propertyName4, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex2 ), propertyName4, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex4), propertyName4, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyName(customPropertyIndex2), propertyName4, TEST_LOCATION);
// Check the fourth child property index.
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName4 ), propertyIndex4, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName4), propertyIndex4, TEST_LOCATION);
// Now create another parent actor with different child properties registered
- TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyNamedActor" );
- DALI_TEST_CHECK( typeInfo2 );
+ TypeInfo typeInfo2 = typeRegistry.GetTypeInfo("MyNamedActor");
+ DALI_TEST_CHECK(typeInfo2);
BaseHandle handle2 = typeInfo2.CreateInstance();
- DALI_TEST_CHECK( handle2 );
- Actor customActor2 = Actor::DownCast( handle2 );
- DALI_TEST_CHECK( customActor2 );
+ DALI_TEST_CHECK(handle2);
+ Actor customActor2 = Actor::DownCast(handle2);
+ DALI_TEST_CHECK(customActor2);
// Register child properties to the new parent
- std::string newPropertyName( "newChildProp" );
- int newPropertyIndex( CHILD_PROPERTY_REGISTRATION_START_INDEX ); // The same index as the first child property "childProp1" in the old parent
- Property::Type newPropertyType( Property::VECTOR2 );
- ChildPropertyRegistration newChildProperty( namedActorType, newPropertyName, newPropertyIndex, newPropertyType );
+ std::string newPropertyName("newChildProp");
+ int newPropertyIndex(CHILD_PROPERTY_REGISTRATION_START_INDEX); // The same index as the first child property "childProp1" in the old parent
+ Property::Type newPropertyType(Property::VECTOR2);
+ ChildPropertyRegistration newChildProperty(namedActorType, newPropertyName, newPropertyIndex, newPropertyType);
- std::string newPropertyName2( "childProp3" ); // The same name as the third child property in the old parent
- int newPropertyIndex2( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1 ); // The same index as the second child property "childProp2" in the old parent
- Property::Type newPropertyType2( Property::FLOAT ); // The same type as the third child property in the old parent
- ChildPropertyRegistration newChildProperty2( namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2 );
+ std::string newPropertyName2("childProp3"); // The same name as the third child property in the old parent
+ int newPropertyIndex2(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1); // The same index as the second child property "childProp2" in the old parent
+ Property::Type newPropertyType2(Property::FLOAT); // The same type as the third child property in the old parent
+ ChildPropertyRegistration newChildProperty2(namedActorType, newPropertyName2, newPropertyIndex2, newPropertyType2);
// Now move the child actor to the new parent
- customActor2.Add( childActor );
+ customActor2.Add(childActor);
// "childProp1" is not a valid child property supported by the new parent, so nothing changed
- DALI_TEST_EQUALS( childActor.GetPropertyType( propertyIndex ), propertyType, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyName( propertyIndex ), propertyName, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( propertyName ), propertyIndex, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(propertyIndex), propertyType, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyName(propertyIndex), propertyName, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(propertyName), propertyIndex, TEST_LOCATION);
// "childProp3" is a valid child property supported by the new parent
// So it should get its new child property index and should just work
- DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex2 ), newPropertyType2, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex2 ), newPropertyName2, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName2 ), newPropertyIndex2, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetProperty< float >( newPropertyIndex2 ), 0.15f, TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(newPropertyIndex2), newPropertyType2, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyName(newPropertyIndex2), newPropertyName2, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(newPropertyName2), newPropertyIndex2, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetProperty<float>(newPropertyIndex2), 0.15f, TEST_LOCATION);
// Now register a custom property called "newChildProp"
- Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2( 10.0f, 10.0f ), Property::READ_WRITE);
+ Property::Index customPropertyIndex3 = childActor.RegisterProperty("newChildProp", Vector2(10.0f, 10.0f), Property::READ_WRITE);
// Check that the custom property is created
- DALI_TEST_EQUALS( initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION );
+ DALI_TEST_EQUALS(initialChildActorPropertyCount + 5u, childActor.GetPropertyCount(), TEST_LOCATION);
// This is a valid child property registered to the new parent
// So should be able to access it through both its custom property index and its registered child property index
- DALI_TEST_EQUALS( childActor.GetPropertyType( newPropertyIndex ), newPropertyType, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyType( customPropertyIndex3 ), newPropertyType, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetPropertyName( newPropertyIndex ), newPropertyName, TEST_LOCATION ); // This should return the new name, although the child property index remains the same
- DALI_TEST_EQUALS( childActor.GetPropertyName( customPropertyIndex3 ), newPropertyName, TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( newPropertyIndex ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( childActor.GetProperty< Vector2 >( customPropertyIndex3 ), Vector2( 10.0f, 10.0f ), TEST_LOCATION );
+ DALI_TEST_EQUALS(childActor.GetPropertyType(newPropertyIndex), newPropertyType, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyType(customPropertyIndex3), newPropertyType, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetPropertyName(newPropertyIndex), newPropertyName, TEST_LOCATION); // This should return the new name, although the child property index remains the same
+ DALI_TEST_EQUALS(childActor.GetPropertyName(customPropertyIndex3), newPropertyName, TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetProperty<Vector2>(newPropertyIndex), Vector2(10.0f, 10.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(childActor.GetProperty<Vector2>(customPropertyIndex3), Vector2(10.0f, 10.0f), TEST_LOCATION);
// Should return the child property index by given its name
- DALI_TEST_EQUALS( childActor.GetPropertyIndex( newPropertyName ), newPropertyIndex, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(childActor.GetPropertyIndex(newPropertyName), newPropertyIndex, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeRegistryChildPropertyRegistrationN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Attempt to register a child property type out-of-bounds index (less than)
try
{
- ChildPropertyRegistration property1( customType1, "propName", CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN );
- tet_result( TET_FAIL );
+ ChildPropertyRegistration property1(customType1, "propName", CHILD_PROPERTY_REGISTRATION_START_INDEX - 1, Property::BOOLEAN);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
// Attempt to register a child property type out-of-bounds index (greater than)
try
{
- ChildPropertyRegistration property1( customType1, "propName", CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN );
- tet_result( TET_FAIL );
+ ChildPropertyRegistration property1(customType1, "propName", CHILD_PROPERTY_REGISTRATION_MAX_INDEX + 1, Property::BOOLEAN);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "( index >= CHILD_PROPERTY_REGISTRATION_START_INDEX ) && ( index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX )", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "(index >= CHILD_PROPERTY_REGISTRATION_START_INDEX) && (index <= CHILD_PROPERTY_REGISTRATION_MAX_INDEX)", TEST_LOCATION);
}
END_TEST;
}
-
/*******************************************************************************
*
* Action through the base handle
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("Actor");
+ DALI_TEST_CHECK(type);
BaseHandle hdl = type.CreateInstance();
- DALI_TEST_CHECK( hdl );
+ DALI_TEST_CHECK(hdl);
Actor a = Actor::DownCast(hdl);
- DALI_TEST_CHECK( a );
+ DALI_TEST_CHECK(a);
- a.SetProperty( Actor::Property::VISIBLE,false);
+ a.SetProperty(Actor::Property::VISIBLE, false);
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK(!a.GetCurrentProperty< bool >( Actor::Property::VISIBLE ));
+ DALI_TEST_CHECK(!a.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
Property::Map attributes;
application.SendNotification();
application.Render(0);
- DALI_TEST_CHECK(a.GetCurrentProperty< bool >( Actor::Property::VISIBLE ));
+ DALI_TEST_CHECK(a.GetCurrentProperty<bool>(Actor::Property::VISIBLE));
- DALI_TEST_CHECK(!hdl.DoAction("unknownAction", attributes));
+ DALI_TEST_CHECK(!hdl.DoAction("unknownAction", attributes));
END_TEST;
}
int UtcDaliPropertyRegistrationFunctions(void)
{
TestApplication application;
- int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 10;
// Attempt to register a property without a setter
try
{
- PropertyRegistration property1( customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, &GetProperty );
- tet_result( TET_PASS );
+ PropertyRegistration property1(customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, &GetProperty);
+ tet_result(TET_PASS);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
// Attempt to register a property without a getter
try
{
- PropertyRegistration property1( customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, NULL );
- tet_result( TET_FAIL );
+ PropertyRegistration property1(customType1, "propName", propertyIndex++, Property::BOOLEAN, NULL, NULL);
+ tet_result(TET_FAIL);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "! \"GetProperty", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "! \"GetProperty", TEST_LOCATION);
}
END_TEST;
}
int UtcDaliPropertyRegistrationAddSameIndex(void)
{
TestApplication application;
- int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 100;
// Add one property with a valid property index
- PropertyRegistration property1( customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
+ PropertyRegistration property1(customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty);
// Attempt to add another property with the same index
try
{
- PropertyRegistration property2( customType1, "propName2", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
+ PropertyRegistration property2(customType1, "propName2", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "! \"Property index already added", TEST_LOCATION);
}
int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 100;
// Add one property with a valid property index
- AnimatablePropertyRegistration property3( customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN );
+ AnimatablePropertyRegistration property3(customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN);
// Attempt to add another property with the same index
try
{
- AnimatablePropertyRegistration property4( customType1, "animPropName2", animatablePropertyIndex, Property::BOOLEAN );
+ AnimatablePropertyRegistration property4(customType1, "animPropName2", animatablePropertyIndex, Property::BOOLEAN);
}
- catch ( DaliException& e )
+ catch(DaliException& e)
{
- DALI_TEST_ASSERT( e, "! \"Property index already added", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "! \"Property index already added", TEST_LOCATION);
}
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyWritableP(void)
{
TestApplication application;
- int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
- int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
+ int propertyIndex1 = PROPERTY_REGISTRATION_START_INDEX + 200;
+ int propertyIndex2 = PROPERTY_REGISTRATION_START_INDEX + 201;
// Add two properties, one with SetProperty, one without
- PropertyRegistration property1( customType1, "propNameReadwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty );
- PropertyRegistration property2( customType1, "propNameReadonly", propertyIndex2, Property::BOOLEAN, NULL, &GetProperty );
+ PropertyRegistration property1(customType1, "propNameReadwrite", propertyIndex1, Property::BOOLEAN, &SetProperty, &GetProperty);
+ PropertyRegistration property2(customType1, "propNameReadonly", propertyIndex2, Property::BOOLEAN, NULL, &GetProperty);
// Create custom-actor
- TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
// Check whether properties are writable
- DALI_TEST_CHECK( customActor.IsPropertyWritable( propertyIndex1 ) );
- DALI_TEST_CHECK( ! customActor.IsPropertyWritable( propertyIndex2 ) );
-
+ DALI_TEST_CHECK(customActor.IsPropertyWritable(propertyIndex1));
+ DALI_TEST_CHECK(!customActor.IsPropertyWritable(propertyIndex2));
// Check the property is writable in the type registry
- Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
+ Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo);
- DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( propertyIndex1 ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(typeInfoImpl.IsPropertyWritable(propertyIndex1), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyWritableN(void)
{
- TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
- Internal::TypeInfo& typeInfoImpl = GetImplementation( typeInfo );
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor));
+ Internal::TypeInfo& typeInfoImpl = GetImplementation(typeInfo);
- DALI_TEST_EQUALS( typeInfoImpl.IsPropertyWritable( Actor::Property::COLOR), true, TEST_LOCATION );
+ DALI_TEST_EQUALS(typeInfoImpl.IsPropertyWritable(Actor::Property::COLOR), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyAnimatable(void)
{
TestApplication application;
- int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
- int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 400;
+ int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 400;
// These properties are not animatable
- PropertyRegistration property1( customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty );
+ PropertyRegistration property1(customType1, "propName", propertyIndex, Property::BOOLEAN, &SetProperty, &GetProperty);
// These properties are animatable
- AnimatablePropertyRegistration property2( customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN );
+ AnimatablePropertyRegistration property2(customType1, "animPropName", animatablePropertyIndex, Property::BOOLEAN);
// Create custom-actor
- TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
// Check if animatable
- DALI_TEST_CHECK( ! customActor.IsPropertyAnimatable( propertyIndex ) );
- DALI_TEST_CHECK( customActor.IsPropertyAnimatable( animatablePropertyIndex ) );
+ DALI_TEST_CHECK(!customActor.IsPropertyAnimatable(propertyIndex));
+ DALI_TEST_CHECK(customActor.IsPropertyAnimatable(animatablePropertyIndex));
// Create another instance of custom-actor
BaseHandle handle2 = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle2 );
- Actor customActor2 = Actor::DownCast( handle2 );
- DALI_TEST_CHECK( customActor2 );
+ DALI_TEST_CHECK(handle2);
+ Actor customActor2 = Actor::DownCast(handle2);
+ DALI_TEST_CHECK(customActor2);
// Check if animatable
- DALI_TEST_CHECK( ! customActor2.IsPropertyAnimatable( propertyIndex ) );
- DALI_TEST_CHECK( customActor2.IsPropertyAnimatable( animatablePropertyIndex ) );
+ DALI_TEST_CHECK(!customActor2.IsPropertyAnimatable(propertyIndex));
+ DALI_TEST_CHECK(customActor2.IsPropertyAnimatable(animatablePropertyIndex));
END_TEST;
}
int UtcDaliPropertyRegistrationUnregisteredGetAndSet(void)
{
TestApplication application;
- int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
- int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
+ int propertyIndex = PROPERTY_REGISTRATION_START_INDEX + 2000;
+ int animatablePropertyIndex = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 2000;
// Create custom-actor
- TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = TypeRegistry::Get().GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
// Try to set an index that hasn't been registered, this is a no-op for now, to be fixed in future
- customActor.SetProperty( propertyIndex, true );
-// DALI_TEST_EQUALS( true, customActor.GetProperty( propertyIndex ).Get<bool>(), TEST_LOCATION);
+ customActor.SetProperty(propertyIndex, true);
+ // DALI_TEST_EQUALS( true, customActor.GetProperty( propertyIndex ).Get<bool>(), TEST_LOCATION);
// Try to set an index that hasn't been registered
- customActor.SetProperty( animatablePropertyIndex, true );
- DALI_TEST_EQUALS( true, customActor.GetProperty( animatablePropertyIndex ).Get<bool>(), TEST_LOCATION);
+ customActor.SetProperty(animatablePropertyIndex, true);
+ DALI_TEST_EQUALS(true, customActor.GetProperty(animatablePropertyIndex).Get<bool>(), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliLongPressGestureDetectorTypeRegistry(void)
{
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Register Type
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "LongPressGestureDetector" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("LongPressGestureDetector");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
- LongPressGestureDetector detector = LongPressGestureDetector::DownCast( handle );
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(handle);
+ LongPressGestureDetector detector = LongPressGestureDetector::DownCast(handle);
+ DALI_TEST_CHECK(detector);
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
detector.Attach(actor);
// Connect to signal through type
- handle.ConnectSignal( &application, "longPressDetected", functor );
+ handle.ConnectSignal(&application, "longPressDetected", functor);
// Render and notify
application.SendNotification();
application.Render();
// Emit gesture
- TestGenerateLongPress( application, 50.0f, 10.0f );
- TestEndLongPress( application, 50.0f, 10.0f );
+ TestGenerateLongPress(application, 50.0f, 10.0f);
+ TestEndLongPress(application, 50.0f, 10.0f);
DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Register Type
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "PanGestureDetector" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("PanGestureDetector");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
- PanGestureDetector detector = PanGestureDetector::DownCast( handle );
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(handle);
+ PanGestureDetector detector = PanGestureDetector::DownCast(handle);
+ DALI_TEST_CHECK(detector);
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
detector.Attach(actor);
// Connect to signal through type
- handle.ConnectSignal( &application, "panDetected", functor );
+ handle.ConnectSignal(&application, "panDetected", functor);
// Render and notify
application.SendNotification();
application.Render();
// Emit gesture
- TestGenerateMiniPan( application );
+ TestGenerateMiniPan(application);
DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Register Type
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "PinchGestureDetector" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("PinchGestureDetector");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
- PinchGestureDetector detector = PinchGestureDetector::DownCast( handle );
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(handle);
+ PinchGestureDetector detector = PinchGestureDetector::DownCast(handle);
+ DALI_TEST_CHECK(detector);
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
detector.Attach(actor);
// Connect to signal through type
- handle.ConnectSignal( &application, "pinchDetected", functor );
+ handle.ConnectSignal(&application, "pinchDetected", functor);
// Render and notify
application.SendNotification();
application.Render();
// Emit gesture
- TestGeneratePinch( application );
+ TestGeneratePinch(application);
DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Register Type
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "RotationGestureDetector" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("RotationGestureDetector");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
- RotationGestureDetector detector = RotationGestureDetector::DownCast( handle );
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(handle);
+ RotationGestureDetector detector = RotationGestureDetector::DownCast(handle);
+ DALI_TEST_CHECK(detector);
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
detector.Attach(actor);
// Connect to signal through type
- handle.ConnectSignal( &application, "rotationDetected", functor );
+ handle.ConnectSignal(&application, "rotationDetected", functor);
// Render and notify
application.SendNotification();
application.Render();
// Emit gesture
- TestGenerateRotation( application );
+ TestGenerateRotation(application);
DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
END_TEST;
TestApplication application;
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Register Type
TypeInfo type;
- type = TypeRegistry::Get().GetTypeInfo( "TapGestureDetector" );
- DALI_TEST_CHECK( type );
+ type = TypeRegistry::Get().GetTypeInfo("TapGestureDetector");
+ DALI_TEST_CHECK(type);
BaseHandle handle = type.CreateInstance();
- DALI_TEST_CHECK( handle );
- TapGestureDetector detector = TapGestureDetector::DownCast( handle );
- DALI_TEST_CHECK( detector );
+ DALI_TEST_CHECK(handle);
+ TapGestureDetector detector = TapGestureDetector::DownCast(handle);
+ DALI_TEST_CHECK(detector);
// Attach actor to detector
- SignalData data;
- GestureReceivedFunctor functor( data );
+ SignalData data;
+ GestureReceivedFunctor functor(data);
detector.Attach(actor);
// Connect to signal through type
- handle.ConnectSignal( &application, "tapDetected", functor );
+ handle.ConnectSignal(&application, "tapDetected", functor);
// Render and notify
application.SendNotification();
application.Render();
// Emit gesture
- TestGenerateTap( application, 50.0, 10.0, 100 );
+ TestGenerateTap(application, 50.0, 10.0, 100);
DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
END_TEST;
int UtcDaliTypeRegistryNamedType(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
// Create a normal actor
- BaseHandle actorHandle = typeRegistry.GetTypeInfo( "Actor" ).CreateInstance();
- DALI_TEST_CHECK( actorHandle );
- Actor actor( Actor::DownCast( actorHandle ) );
- DALI_TEST_CHECK( actor );
- unsigned int actorPropertyCount( actor.GetPropertyCount() );
+ BaseHandle actorHandle = typeRegistry.GetTypeInfo("Actor").CreateInstance();
+ DALI_TEST_CHECK(actorHandle);
+ Actor actor(Actor::DownCast(actorHandle));
+ DALI_TEST_CHECK(actor);
+ unsigned int actorPropertyCount(actor.GetPropertyCount());
// Create Named Actor Type
- BaseHandle namedHandle = typeRegistry.GetTypeInfo( "MyNamedActor" ).CreateInstance();
- DALI_TEST_CHECK( namedHandle );
- Actor namedActor( Actor::DownCast( namedHandle ) );
- DALI_TEST_CHECK( namedActor );
- unsigned int namedActorPropertyCount( namedActor.GetPropertyCount() );
+ BaseHandle namedHandle = typeRegistry.GetTypeInfo("MyNamedActor").CreateInstance();
+ DALI_TEST_CHECK(namedHandle);
+ Actor namedActor(Actor::DownCast(namedHandle));
+ DALI_TEST_CHECK(namedActor);
+ unsigned int namedActorPropertyCount(namedActor.GetPropertyCount());
- DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
+ DALI_TEST_CHECK(namedActorPropertyCount > actorPropertyCount);
END_TEST;
}
int UtcDaliTypeInfoGetActionNameP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
- DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
+ DALI_TEST_CHECK(0 != typeInfo.GetActionCount());
std::string name = typeInfo.GetActionName(0);
- DALI_TEST_EQUALS( name, "show", TEST_LOCATION );
-
+ DALI_TEST_EQUALS(name, "show", TEST_LOCATION);
- TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
+ TypeInfo typeInfo2 = typeRegistry.GetTypeInfo("MyTestCustomActor");
// search for show action in base class, given a derived class
bool foundChildAction = false;
- for( std::size_t i = 0; i < typeInfo2.GetActionCount(); i++ )
+ for(std::size_t i = 0; i < typeInfo2.GetActionCount(); i++)
{
-
- std::string name = typeInfo2.GetActionName( i );
- if( name == "show")
- {
- foundChildAction = true;
- }
-
+ std::string name = typeInfo2.GetActionName(i);
+ if(name == "show")
+ {
+ foundChildAction = true;
+ }
}
- DALI_TEST_EQUALS( foundChildAction, true, TEST_LOCATION );
-
+ DALI_TEST_EQUALS(foundChildAction, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeInfoGetActionNameN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
- DALI_TEST_CHECK( 0 != typeInfo.GetActionCount() );
+ DALI_TEST_CHECK(0 != typeInfo.GetActionCount());
std::string name = typeInfo.GetActionName(std::numeric_limits<size_t>::max());
- DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, name.size(), TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeInfoGetSignalNameP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
- DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
+ DALI_TEST_CHECK(0 != typeInfo.GetSignalCount());
std::string name = typeInfo.GetSignalName(0);
- DALI_TEST_EQUALS( name, "hovered", TEST_LOCATION );
+ DALI_TEST_EQUALS(name, "hovered", TEST_LOCATION);
- TypeInfo typeInfo2 = typeRegistry.GetTypeInfo( "MyTestCustomActor" );
+ TypeInfo typeInfo2 = typeRegistry.GetTypeInfo("MyTestCustomActor");
// search for signal in base class, given a derived class
bool foundSignal = false;
- for( std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++ )
+ for(std::size_t i = 0; i < typeInfo2.GetSignalCount(); i++)
{
- std::string name = typeInfo2.GetSignalName( i );
- if( name == "hovered")
+ std::string name = typeInfo2.GetSignalName(i);
+ if(name == "hovered")
{
foundSignal = true;
}
}
- DALI_TEST_EQUALS( foundSignal, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(foundSignal, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeInfoGetSignalNameN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
- DALI_TEST_CHECK( 0 != typeInfo.GetSignalCount() );
+ DALI_TEST_CHECK(0 != typeInfo.GetSignalCount());
std::string name = typeInfo.GetSignalName(std::numeric_limits<size_t>::max());
- DALI_TEST_EQUALS( 0u, name.size(), TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, name.size(), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTypeInfoGetCreatorP(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
- DALI_TEST_EQUALS( createFn != NULL, true, TEST_LOCATION );
- if( createFn )
+ DALI_TEST_EQUALS(createFn != NULL, true, TEST_LOCATION);
+ if(createFn)
{
// try calling it:
BaseHandle handle = createFn();
- DALI_TEST_EQUALS( (bool)handle, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)handle, true, TEST_LOCATION);
}
END_TEST;
int UtcDaliTypeInfoGetCreatorN(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor3" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("MyTestCustomActor3");
+ DALI_TEST_CHECK(typeInfo);
TypeInfo::CreateFunction createFn = typeInfo.GetCreator();
- DALI_TEST_EQUALS( createFn == NULL, true, TEST_LOCATION );
+ DALI_TEST_EQUALS(createFn == NULL, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeInfoGetPropertyCountP1(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "Actor" );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("Actor");
+ DALI_TEST_CHECK(typeInfo);
size_t actorPropertyCount = typeInfo.GetPropertyCount();
- DALI_TEST_EQUALS( actorPropertyCount, Actor::New().GetPropertyCount(), TEST_LOCATION ); // No event only props
+ DALI_TEST_EQUALS(actorPropertyCount, Actor::New().GetPropertyCount(), TEST_LOCATION); // No event only props
END_TEST;
}
int UtcDaliTypeInfoGetPropertyCountP2(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( "MyTestCustomActor2" );
- DALI_TEST_CHECK( typeInfo );
- size_t propertyCount = typeInfo.GetPropertyCount();
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("MyTestCustomActor2");
+ DALI_TEST_CHECK(typeInfo);
+ size_t propertyCount = typeInfo.GetPropertyCount();
Property::IndexContainer indices;
- typeInfo.GetPropertyIndices( indices );
+ typeInfo.GetPropertyIndices(indices);
- DALI_TEST_EQUALS( propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION );
- DALI_TEST_EQUALS( propertyCount, Actor::New().GetPropertyCount() + 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(propertyCount > 0 && propertyCount <= indices.Size(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(propertyCount, Actor::New().GetPropertyCount() + 2, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGet01(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- tet_infoline( "Register a type registered animatable property and ensure set/get behaviour works synchronously" );
+ tet_infoline("Register a type registered animatable property and ensure set/get behaviour works synchronously");
// Register animatable property
- const int animatablePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- AnimatablePropertyRegistration animatableProperty( customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT );
+ const int animatablePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ AnimatablePropertyRegistration animatableProperty(customType1, "animatableProp1", animatablePropertyIndex, Property::FLOAT);
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
application.GetScene().Add(customActor);
- tet_infoline( "Set the value and ensure it changes straight away" );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
- customActor.SetProperty( animatablePropertyIndex, 25.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
+ tet_infoline("Set the value and ensure it changes straight away");
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 0.0f, TEST_LOCATION);
+ customActor.SetProperty(animatablePropertyIndex, 25.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 25.0f, TEST_LOCATION);
- tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 0.0f, TEST_LOCATION );
+ tet_infoline("Check latest scene-graph value is unchanged");
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyIndex), 0.0f, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
- tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
+ tet_infoline("Check values after rendering and both retrieval methods should return the latest");
- DALI_TEST_EQUALS( customActor.GetProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( animatablePropertyIndex ), 25.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(animatablePropertyIndex), 25.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(animatablePropertyIndex), 25.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector2(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" );
+ tet_infoline("Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set");
// Register the animatable propeties
- const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- const int componentZeroPropertyIndex( basePropertyIndex + 1 );
- const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
- AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector2( 13.0f, 24.0f ) );
- AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
- AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
+ const int basePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ const int componentZeroPropertyIndex(basePropertyIndex + 1);
+ const int componentOnePropertyIndex(componentZeroPropertyIndex + 1);
+ AnimatablePropertyRegistration baseAnimatableProperty(customType1, "baseProp", basePropertyIndex, Vector2(13.0f, 24.0f));
+ AnimatablePropertyComponentRegistration componentZeroAnimatableProperty(customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0);
+ AnimatablePropertyComponentRegistration componentOneAnimatableProperty(customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1);
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
application.GetScene().Add(customActor);
- tet_infoline( "Get the component values, they should be the default value of the base-property" );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
+ tet_infoline("Get the component values, they should be the default value of the base-property");
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 13.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 24.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(basePropertyIndex), Vector2(13.0f, 24.0f), TEST_LOCATION);
- tet_infoline( "Set a component value and ensure it changes for the base property as well" );
- customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 24.0f ), TEST_LOCATION );
+ tet_infoline("Set a component value and ensure it changes for the base property as well");
+ customActor.SetProperty(componentZeroPropertyIndex, 125.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(basePropertyIndex), Vector2(125.0f, 24.0f), TEST_LOCATION);
- customActor.SetProperty( componentOnePropertyIndex, 225.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
+ customActor.SetProperty(componentOnePropertyIndex, 225.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(basePropertyIndex), Vector2(125.0f, 225.0f), TEST_LOCATION);
- tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 13.0f, 24.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
+ tet_infoline("Check latest scene-graph value is unchanged");
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector2>(basePropertyIndex), Vector2(13.0f, 24.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentZeroPropertyIndex), 13.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentOnePropertyIndex), 24.0f, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
- tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
+ tet_infoline("Check values after rendering and both retrieval methods should return the latest");
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(basePropertyIndex), Vector2(125.0f, 225.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector2 >( basePropertyIndex ), Vector2( 125.0f, 225.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector2>(basePropertyIndex), Vector2(125.0f, 225.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
- tet_infoline( "Set the base property value and ensure the component values reflect the change" );
- customActor.SetProperty( basePropertyIndex, Vector2( 1.0f, 2.0f ) );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector2 >( basePropertyIndex ), Vector2( 1.0f, 2.0f ), TEST_LOCATION );
+ tet_infoline("Set the base property value and ensure the component values reflect the change");
+ customActor.SetProperty(basePropertyIndex, Vector2(1.0f, 2.0f));
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector2>(basePropertyIndex), Vector2(1.0f, 2.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector3(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" );
+ tet_infoline("Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set");
// Register the animatable propeties
- const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- const int componentZeroPropertyIndex( basePropertyIndex + 1 );
- const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
- const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
- AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector3( 13.0f, 24.0f, 35.0 ) );
- AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
- AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
- AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
+ const int basePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ const int componentZeroPropertyIndex(basePropertyIndex + 1);
+ const int componentOnePropertyIndex(componentZeroPropertyIndex + 1);
+ const int componentTwoPropertyIndex(componentOnePropertyIndex + 1);
+ AnimatablePropertyRegistration baseAnimatableProperty(customType1, "baseProp", basePropertyIndex, Vector3(13.0f, 24.0f, 35.0));
+ AnimatablePropertyComponentRegistration componentZeroAnimatableProperty(customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0);
+ AnimatablePropertyComponentRegistration componentOneAnimatableProperty(customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1);
+ AnimatablePropertyComponentRegistration componentTwoAnimatableProperty(customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2);
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
application.GetScene().Add(customActor);
- tet_infoline( "Get the component values, they should be the default value of the base-property" );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
+ tet_infoline("Get the component values, they should be the default value of the base-property");
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 13.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 24.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 35.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(basePropertyIndex), Vector3(13.0f, 24.0f, 35.0f), TEST_LOCATION);
- tet_infoline( "Set a component value and ensure it changes for the base property as well" );
- customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 24.0f, 35.0f ), TEST_LOCATION );
+ tet_infoline("Set a component value and ensure it changes for the base property as well");
+ customActor.SetProperty(componentZeroPropertyIndex, 125.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(basePropertyIndex), Vector3(125.0f, 24.0f, 35.0f), TEST_LOCATION);
- customActor.SetProperty( componentOnePropertyIndex, 225.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 35.0f ), TEST_LOCATION );
+ customActor.SetProperty(componentOnePropertyIndex, 225.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(basePropertyIndex), Vector3(125.0f, 225.0f, 35.0f), TEST_LOCATION);
- customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
+ customActor.SetProperty(componentTwoPropertyIndex, 325.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 325.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(basePropertyIndex), Vector3(125.0f, 225.0f, 325.0f), TEST_LOCATION);
- tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 13.0f, 24.0f, 35.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
+ tet_infoline("Check latest scene-graph value is unchanged");
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector3>(basePropertyIndex), Vector3(13.0f, 24.0f, 35.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentZeroPropertyIndex), 13.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentOnePropertyIndex), 24.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentTwoPropertyIndex), 35.0f, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
- tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
+ tet_infoline("Check values after rendering and both retrieval methods should return the latest");
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(basePropertyIndex), Vector3(125.0f, 225.0f, 325.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 325.0f, TEST_LOCATION);
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector3 >( basePropertyIndex ), Vector3( 125.0f, 225.0f, 325.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector3>(basePropertyIndex), Vector3(125.0f, 225.0f, 325.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentTwoPropertyIndex), 325.0f, TEST_LOCATION);
- tet_infoline( "Set the base property value and ensure the component values reflect the change" );
- customActor.SetProperty( basePropertyIndex, Vector3( 1.0f, 2.0f, 3.0f ) );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector3 >( basePropertyIndex ), Vector3( 1.0f, 2.0f, 3.0f ), TEST_LOCATION );
+ tet_infoline("Set the base property value and ensure the component values reflect the change");
+ customActor.SetProperty(basePropertyIndex, Vector3(1.0f, 2.0f, 3.0f));
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 3.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector3>(basePropertyIndex), Vector3(1.0f, 2.0f, 3.0f), TEST_LOCATION);
END_TEST;
}
int UtcDaliPropertyRegistrationPropertyAnimatableSynchronousSetGetWithComponentsVector4(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- tet_infoline( "Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set" );
+ tet_infoline("Register a type registered animatable property that has component indices and ensure set/get behaviour works synchronously and is the same regardless of how the property is set");
// Register the animatable propeties
- const int basePropertyIndex( ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX );
- const int componentZeroPropertyIndex( basePropertyIndex + 1 );
- const int componentOnePropertyIndex( componentZeroPropertyIndex + 1 );
- const int componentTwoPropertyIndex( componentOnePropertyIndex + 1 );
- const int componentThreePropertyIndex( componentTwoPropertyIndex + 1 );
- AnimatablePropertyRegistration baseAnimatableProperty( customType1, "baseProp", basePropertyIndex, Vector4( 13.0f, 24.0f, 35.0, 47.0f ) );
- AnimatablePropertyComponentRegistration componentZeroAnimatableProperty( customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0 );
- AnimatablePropertyComponentRegistration componentOneAnimatableProperty( customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1 );
- AnimatablePropertyComponentRegistration componentTwoAnimatableProperty( customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2 );
- AnimatablePropertyComponentRegistration componentThreeAnimatableProperty( customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3 );
+ const int basePropertyIndex(ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX);
+ const int componentZeroPropertyIndex(basePropertyIndex + 1);
+ const int componentOnePropertyIndex(componentZeroPropertyIndex + 1);
+ const int componentTwoPropertyIndex(componentOnePropertyIndex + 1);
+ const int componentThreePropertyIndex(componentTwoPropertyIndex + 1);
+ AnimatablePropertyRegistration baseAnimatableProperty(customType1, "baseProp", basePropertyIndex, Vector4(13.0f, 24.0f, 35.0, 47.0f));
+ AnimatablePropertyComponentRegistration componentZeroAnimatableProperty(customType1, "componentZeroProp", componentZeroPropertyIndex, basePropertyIndex, 0);
+ AnimatablePropertyComponentRegistration componentOneAnimatableProperty(customType1, "componentOneProp", componentOnePropertyIndex, basePropertyIndex, 1);
+ AnimatablePropertyComponentRegistration componentTwoAnimatableProperty(customType1, "componentTwoProp", componentTwoPropertyIndex, basePropertyIndex, 2);
+ AnimatablePropertyComponentRegistration componentThreeAnimatableProperty(customType1, "componentThreeProp", componentThreePropertyIndex, basePropertyIndex, 3);
// Check property count before property registration
- TypeInfo typeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( typeInfo );
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(typeInfo);
BaseHandle handle = typeInfo.CreateInstance();
- DALI_TEST_CHECK( handle );
- Actor customActor = Actor::DownCast( handle );
- DALI_TEST_CHECK( customActor );
+ DALI_TEST_CHECK(handle);
+ Actor customActor = Actor::DownCast(handle);
+ DALI_TEST_CHECK(customActor);
application.GetScene().Add(customActor);
- tet_infoline( "Get the component values, they should be the default value of the base-property" );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
-
- tet_infoline( "Set a component value and ensure it changes for the base property as well" );
- customActor.SetProperty( componentZeroPropertyIndex, 125.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
-
- customActor.SetProperty( componentOnePropertyIndex, 225.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 35.0f, 47.0f ), TEST_LOCATION );
-
- customActor.SetProperty( componentTwoPropertyIndex, 325.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 47.0f ), TEST_LOCATION );
-
- customActor.SetProperty( componentThreePropertyIndex, 435.0f );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
-
- tet_infoline( "Check latest scene-graph value is unchanged" );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 13.0f, 24.0f, 35.0f, 47.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 13.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 24.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 35.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 47.0f, TEST_LOCATION );
+ tet_infoline("Get the component values, they should be the default value of the base-property");
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 13.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 24.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 35.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentThreePropertyIndex), 47.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(13.0f, 24.0f, 35.0f, 47.0f), TEST_LOCATION);
+
+ tet_infoline("Set a component value and ensure it changes for the base property as well");
+ customActor.SetProperty(componentZeroPropertyIndex, 125.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(125.0f, 24.0f, 35.0f, 47.0f), TEST_LOCATION);
+
+ customActor.SetProperty(componentOnePropertyIndex, 225.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(125.0f, 225.0f, 35.0f, 47.0f), TEST_LOCATION);
+
+ customActor.SetProperty(componentTwoPropertyIndex, 325.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 325.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 47.0f), TEST_LOCATION);
+
+ customActor.SetProperty(componentThreePropertyIndex, 435.0f);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentThreePropertyIndex), 435.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 435.0f), TEST_LOCATION);
+
+ tet_infoline("Check latest scene-graph value is unchanged");
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector4>(basePropertyIndex), Vector4(13.0f, 24.0f, 35.0f, 47.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentZeroPropertyIndex), 13.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentOnePropertyIndex), 24.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentTwoPropertyIndex), 35.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentThreePropertyIndex), 47.0f, TEST_LOCATION);
// Render and notify
application.SendNotification();
application.Render();
- tet_infoline( "Check values after rendering and both retrieval methods should return the latest" );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
+ tet_infoline("Check values after rendering and both retrieval methods should return the latest");
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 435.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 325.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentThreePropertyIndex), 435.0f, TEST_LOCATION);
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< Vector4 >( basePropertyIndex ), Vector4( 125.0f, 225.0f, 325.0f, 435.0f ), TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentZeroPropertyIndex ), 125.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentOnePropertyIndex ), 225.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentTwoPropertyIndex ), 325.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetCurrentProperty< float >( componentThreePropertyIndex ), 435.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<Vector4>(basePropertyIndex), Vector4(125.0f, 225.0f, 325.0f, 435.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentZeroPropertyIndex), 125.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentOnePropertyIndex), 225.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentTwoPropertyIndex), 325.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetCurrentProperty<float>(componentThreePropertyIndex), 435.0f, TEST_LOCATION);
- tet_infoline( "Set the base property value and ensure the component values reflect the change" );
- customActor.SetProperty( basePropertyIndex, Vector4( 1.0f, 2.0f, 3.0f, 4.0f ) );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentZeroPropertyIndex ), 1.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentOnePropertyIndex ), 2.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentTwoPropertyIndex ), 3.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< float >( componentThreePropertyIndex ), 4.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( customActor.GetProperty< Vector4 >( basePropertyIndex ), Vector4( 1.0f, 2.0f, 3.0f, 4.0f ), TEST_LOCATION );
+ tet_infoline("Set the base property value and ensure the component values reflect the change");
+ customActor.SetProperty(basePropertyIndex, Vector4(1.0f, 2.0f, 3.0f, 4.0f));
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentZeroPropertyIndex), 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentOnePropertyIndex), 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentTwoPropertyIndex), 3.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<float>(componentThreePropertyIndex), 4.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(customActor.GetProperty<Vector4>(basePropertyIndex), Vector4(1.0f, 2.0f, 3.0f, 4.0f), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTypeInfoRegisterChildProperties01(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- tet_infoline( "Register child properties on a type via name" );
+ tet_infoline("Register child properties on a type via name");
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
- auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( customActorTypeInfo );
- DALI_TEST_CHECK( myCustomTypeInfo );
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(CustomActor));
+ auto myCustomTypeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(customActorTypeInfo);
+ DALI_TEST_CHECK(myCustomTypeInfo);
- const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
- const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+ const Property::Index WIDTH_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const Property::Index HEIGHT_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ const Property::Index MARGIN_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
- ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
- ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
- ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER);
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER);
+ ChildPropertyRegistration(myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS);
auto customActor = MyTestCustomActor::New();
- application.GetScene().Add( customActor );
+ application.GetScene().Add(customActor);
auto child = Actor::New();
- customActor.Add( child );
+ customActor.Add(child);
- child.SetProperty( WIDTH_SPECIFICATION, 33 );
+ child.SetProperty(WIDTH_SPECIFICATION, 33);
- auto value = child.GetProperty( WIDTH_SPECIFICATION );
- DALI_TEST_EQUALS( value, Property::Value(33), TEST_LOCATION );
+ auto value = child.GetProperty(WIDTH_SPECIFICATION);
+ DALI_TEST_EQUALS(value, Property::Value(33), TEST_LOCATION);
- child.SetProperty( HEIGHT_SPECIFICATION, 44 );
- value = child.GetProperty( HEIGHT_SPECIFICATION );
- DALI_TEST_EQUALS( value, Property::Value(44), TEST_LOCATION );
+ child.SetProperty(HEIGHT_SPECIFICATION, 44);
+ value = child.GetProperty(HEIGHT_SPECIFICATION);
+ DALI_TEST_EQUALS(value, Property::Value(44), TEST_LOCATION);
- child.SetProperty( MARGIN_SPECIFICATION, Extents(10, 10, 10, 10) );
- value = child.GetProperty( MARGIN_SPECIFICATION );
- DALI_TEST_EQUALS( value, Property::Value(Extents(10,10,10,10)), TEST_LOCATION );
+ child.SetProperty(MARGIN_SPECIFICATION, Extents(10, 10, 10, 10));
+ value = child.GetProperty(MARGIN_SPECIFICATION);
+ DALI_TEST_EQUALS(value, Property::Value(Extents(10, 10, 10, 10)), TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTypeInfoRegisterChildProperties02(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
-
- tet_infoline( "Register child properties on a type via name" );
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
- auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( customActorTypeInfo );
- DALI_TEST_CHECK( myCustomTypeInfo );
+ tet_infoline("Register child properties on a type via name");
- const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
- const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(CustomActor));
+ auto myCustomTypeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(customActorTypeInfo);
+ DALI_TEST_CHECK(myCustomTypeInfo);
- ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
- ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
- ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+ const Property::Index WIDTH_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const Property::Index HEIGHT_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ const Property::Index MARGIN_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER);
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER);
+ ChildPropertyRegistration(myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS);
- auto index = customActorTypeInfo.GetChildPropertyIndex( "widthSpecification" );
- DALI_TEST_EQUALS( index, WIDTH_SPECIFICATION, TEST_LOCATION );
+ auto index = customActorTypeInfo.GetChildPropertyIndex("widthSpecification");
+ DALI_TEST_EQUALS(index, WIDTH_SPECIFICATION, TEST_LOCATION);
- index = customActorTypeInfo.GetChildPropertyIndex( "heightSpecification" );
- DALI_TEST_EQUALS( index, HEIGHT_SPECIFICATION, TEST_LOCATION );
+ index = customActorTypeInfo.GetChildPropertyIndex("heightSpecification");
+ DALI_TEST_EQUALS(index, HEIGHT_SPECIFICATION, TEST_LOCATION);
- index = customActorTypeInfo.GetChildPropertyIndex( "marginSpecification" );
- DALI_TEST_EQUALS( index, Property::INVALID_INDEX, TEST_LOCATION );
+ index = customActorTypeInfo.GetChildPropertyIndex("marginSpecification");
+ DALI_TEST_EQUALS(index, Property::INVALID_INDEX, TEST_LOCATION);
- index = myCustomTypeInfo.GetChildPropertyIndex( "marginSpecification" );
- DALI_TEST_EQUALS( index, MARGIN_SPECIFICATION, TEST_LOCATION );
+ index = myCustomTypeInfo.GetChildPropertyIndex("marginSpecification");
+ DALI_TEST_EQUALS(index, MARGIN_SPECIFICATION, TEST_LOCATION);
+ auto name = customActorTypeInfo.GetChildPropertyName(WIDTH_SPECIFICATION);
+ DALI_TEST_EQUALS(name, "widthSpecification", TEST_LOCATION);
- auto name = customActorTypeInfo.GetChildPropertyName( WIDTH_SPECIFICATION );
- DALI_TEST_EQUALS( name, "widthSpecification", TEST_LOCATION );
+ name = customActorTypeInfo.GetChildPropertyName(HEIGHT_SPECIFICATION);
+ DALI_TEST_EQUALS(name, "heightSpecification", TEST_LOCATION);
- name = customActorTypeInfo.GetChildPropertyName( HEIGHT_SPECIFICATION );
- DALI_TEST_EQUALS( name, "heightSpecification", TEST_LOCATION );
+ name = myCustomTypeInfo.GetChildPropertyName(MARGIN_SPECIFICATION);
+ DALI_TEST_EQUALS(name, "marginSpecification", TEST_LOCATION);
- name = myCustomTypeInfo.GetChildPropertyName( MARGIN_SPECIFICATION );
- DALI_TEST_EQUALS( name, "marginSpecification", TEST_LOCATION );
+ auto type = customActorTypeInfo.GetChildPropertyType(WIDTH_SPECIFICATION);
+ DALI_TEST_EQUALS(type, Property::INTEGER, TEST_LOCATION);
+ type = customActorTypeInfo.GetChildPropertyType(HEIGHT_SPECIFICATION);
+ DALI_TEST_EQUALS(type, Property::INTEGER, TEST_LOCATION);
- auto type = customActorTypeInfo.GetChildPropertyType( WIDTH_SPECIFICATION );
- DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
-
- type = customActorTypeInfo.GetChildPropertyType( HEIGHT_SPECIFICATION );
- DALI_TEST_EQUALS( type, Property::INTEGER, TEST_LOCATION );
-
- type = myCustomTypeInfo.GetChildPropertyType( MARGIN_SPECIFICATION );
- DALI_TEST_EQUALS( type, Property::EXTENTS, TEST_LOCATION );
-
+ type = myCustomTypeInfo.GetChildPropertyType(MARGIN_SPECIFICATION);
+ DALI_TEST_EQUALS(type, Property::EXTENTS, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTypeInfoRegisterChildProperties03(void)
{
TestApplication application;
- TypeRegistry typeRegistry = TypeRegistry::Get();
+ TypeRegistry typeRegistry = TypeRegistry::Get();
- tet_infoline( "Check registered child properties can be retrieved" );
+ tet_infoline("Check registered child properties can be retrieved");
- auto customActorTypeInfo = typeRegistry.GetTypeInfo( typeid(CustomActor) );
- auto myCustomTypeInfo = typeRegistry.GetTypeInfo( typeid(MyTestCustomActor) );
- DALI_TEST_CHECK( customActorTypeInfo );
- DALI_TEST_CHECK( myCustomTypeInfo );
+ auto customActorTypeInfo = typeRegistry.GetTypeInfo(typeid(CustomActor));
+ auto myCustomTypeInfo = typeRegistry.GetTypeInfo(typeid(MyTestCustomActor));
+ DALI_TEST_CHECK(customActorTypeInfo);
+ DALI_TEST_CHECK(myCustomTypeInfo);
- const Property::Index WIDTH_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX );
- const Property::Index HEIGHT_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
- const Property::Index MARGIN_SPECIFICATION( CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
+ const Property::Index WIDTH_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX);
+ const Property::Index HEIGHT_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 1);
+ const Property::Index MARGIN_SPECIFICATION(CHILD_PROPERTY_REGISTRATION_START_INDEX + 100);
- ChildPropertyRegistration( customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER );
- ChildPropertyRegistration( customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER );
- ChildPropertyRegistration( myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS );
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), "widthSpecification", WIDTH_SPECIFICATION, Property::INTEGER);
+ ChildPropertyRegistration(customActorTypeInfo.GetName(), "heightSpecification", HEIGHT_SPECIFICATION, Property::INTEGER);
+ ChildPropertyRegistration(myCustomTypeInfo.GetName(), "marginSpecification", MARGIN_SPECIFICATION, Property::EXTENTS);
Property::IndexContainer indices;
- myCustomTypeInfo.GetChildPropertyIndices( indices );
+ myCustomTypeInfo.GetChildPropertyIndices(indices);
- auto result = std::find( indices.Begin(), indices.End(), WIDTH_SPECIFICATION );
- DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
+ auto result = std::find(indices.Begin(), indices.End(), WIDTH_SPECIFICATION);
+ DALI_TEST_EQUALS(result != indices.End(), true, TEST_LOCATION);
- result = std::find( indices.Begin(), indices.End(), HEIGHT_SPECIFICATION );
- DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
+ result = std::find(indices.Begin(), indices.End(), HEIGHT_SPECIFICATION);
+ DALI_TEST_EQUALS(result != indices.End(), true, TEST_LOCATION);
- result = std::find( indices.Begin(), indices.End(), MARGIN_SPECIFICATION );
- DALI_TEST_EQUALS( result != indices.End(), true, TEST_LOCATION );
+ result = std::find(indices.Begin(), indices.End(), MARGIN_SPECIFICATION);
+ DALI_TEST_EQUALS(result != indices.End(), true, TEST_LOCATION);
END_TEST;
}
int UtcDaliTypeInfoGetActionNameNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
unsigned long arg1(0u);
int UtcDaliTypeInfoGetSignalNameNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
unsigned long arg1(0u);
int UtcDaliTypeInfoGetCreatorNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.GetCreator();
int UtcDaliTypeInfoGetBaseNameNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.GetBaseName();
int UtcDaliTypeInfoCreateInstanceNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.CreateInstance();
int UtcDaliTypeInfoGetActionCountNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.GetActionCount();
int UtcDaliTypeInfoGetSignalCountNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.GetSignalCount();
int UtcDaliTypeInfoGetPropertyNameNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
int arg1(0);
int UtcDaliTypeInfoGetPropertyCountNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.GetPropertyCount();
int UtcDaliTypeInfoGetPropertyIndicesNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
Dali::Vector<int> arg1;
int UtcDaliTypeInfoGetChildPropertyNameNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
int arg1(0);
int UtcDaliTypeInfoGetChildPropertyTypeNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
int arg1(0);
int UtcDaliTypeInfoGetChildPropertyIndexNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
std::string arg1;
int UtcDaliTypeInfoGetChildPropertyIndicesNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
Dali::Vector<int> arg1;
int UtcDaliTypeInfoGetNameNegative(void)
{
TestApplication application;
- Dali::TypeInfo instance;
+ Dali::TypeInfo instance;
try
{
instance.GetName();
int UtcDaliTypeRegistryGetTypeInfoNegative01(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TypeRegistry instance;
try
{
int UtcDaliTypeRegistryGetTypeInfoNegative02(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TypeRegistry instance;
try
{
int UtcDaliTypeRegistryGetTypeNameNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TypeRegistry instance;
try
{
int UtcDaliTypeRegistryGetTypeNameCountNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::TypeRegistry instance;
try
{
*
*/
-#include <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
/// Compare a uint16_t value with an unsigned int
-void DALI_TEST_EQUALS( uint16_t value1, unsigned int value2, const char* location )
+void DALI_TEST_EQUALS(uint16_t value1, unsigned int value2, const char* location)
{
- ::DALI_TEST_EQUALS< uint16_t >( value1, static_cast< uint16_t >( value2 ), location );
+ ::DALI_TEST_EQUALS<uint16_t>(value1, static_cast<uint16_t>(value2), location);
}
} // unnamed namespace
{
Uint16Pair v;
- DALI_TEST_EQUALS( v.GetX(), 0u, TEST_LOCATION );
- DALI_TEST_EQUALS( v.GetY(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS(v.GetX(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.GetY(), 0u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairConstructor02P(void)
{
- Uint16Pair v( 10u, 10u );
+ Uint16Pair v(10u, 10u);
- DALI_TEST_EQUALS( v.GetX(), 10u, TEST_LOCATION );
- DALI_TEST_EQUALS( v.GetY(), 10u, TEST_LOCATION );
+ DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairCopyConstructor(void)
{
- Uint16Pair u( 5u, 5u );
- Uint16Pair v( u );
- DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
+ Uint16Pair u(5u, 5u);
+ Uint16Pair v(u);
+ DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairMoveConstructor(void)
{
- Uint16Pair u( 5u, 5u );
- Uint16Pair v = std::move( u );
- DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
+ Uint16Pair u(5u, 5u);
+ Uint16Pair v = std::move(u);
+ DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairCopyAssignment(void)
{
- Uint16Pair u( 5u, 5u );
+ Uint16Pair u(5u, 5u);
Uint16Pair v;
v = u;
- DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
+ DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairMoveAssignment(void)
{
- Uint16Pair u( 5u, 5u );
+ Uint16Pair u(5u, 5u);
Uint16Pair v;
- v = std::move( u );
- DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
+ v = std::move(u);
+ DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairGetWidthP(void)
{
- Uint16Pair v( 5u ,5u );
- DALI_TEST_EQUALS( v.GetWidth(), 5u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairGetHeightP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetHeight(), 5u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairGetXP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairGetYP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairSetXP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
- v.SetX( 10u );
- DALI_TEST_EQUALS( v.GetX(), 10u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
+ v.SetX(10u);
+ DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairSetWidthP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetWidth(), 5u, TEST_LOCATION );
- v.SetWidth( 10u );
- DALI_TEST_EQUALS( v.GetWidth(), 10u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION);
+ v.SetWidth(10u);
+ DALI_TEST_EQUALS(v.GetWidth(), 10u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairSetYP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
- v.SetY( 10u );
- DALI_TEST_EQUALS( v.GetY(), 10u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
+ v.SetY(10u);
+ DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairSetHeightP(void)
{
- Uint16Pair v( 5u, 5u );
- DALI_TEST_EQUALS( v.GetHeight(), 5u, TEST_LOCATION );
- v.SetHeight( 10u );
- DALI_TEST_EQUALS( v.GetHeight(), 10u, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION);
+ v.SetHeight(10u);
+ DALI_TEST_EQUALS(v.GetHeight(), 10u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairEqualsP(void)
{
- Uint16Pair v( 5u, 5u );
- Uint16Pair u( 5u, 5u );
- DALI_TEST_EQUALS( v == u, true, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ Uint16Pair u(5u, 5u);
+ DALI_TEST_EQUALS(v == u, true, TEST_LOCATION);
- v = Uint16Pair( 5u, 4u );
- u = Uint16Pair( 5u, 5u );
- DALI_TEST_EQUALS( v == u, false, TEST_LOCATION );
+ v = Uint16Pair(5u, 4u);
+ u = Uint16Pair(5u, 5u);
+ DALI_TEST_EQUALS(v == u, false, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairNotEqualsP(void)
{
- Uint16Pair v( 5u, 5u );
- Uint16Pair u( 5u, 5u );
- DALI_TEST_EQUALS( v != u, false, TEST_LOCATION );
+ Uint16Pair v(5u, 5u);
+ Uint16Pair u(5u, 5u);
+ DALI_TEST_EQUALS(v != u, false, TEST_LOCATION);
- v = Uint16Pair( 5u, 4u );
- u = Uint16Pair( 5u, 5u );
- DALI_TEST_EQUALS( v != u, true, TEST_LOCATION );
+ v = Uint16Pair(5u, 4u);
+ u = Uint16Pair(5u, 5u);
+ DALI_TEST_EQUALS(v != u, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairLessThanP(void)
{
- Uint16Pair u( 5u, 5u );
- Uint16Pair v( 6u, 6u );
- DALI_TEST_EQUALS( u < v, true, TEST_LOCATION );
+ Uint16Pair u(5u, 5u);
+ Uint16Pair v(6u, 6u);
+ DALI_TEST_EQUALS(u < v, true, TEST_LOCATION);
- u = Uint16Pair( 0u, 1u );
- v = Uint16Pair( 1u, 0u );
- DALI_TEST_EQUALS( v < u, true, TEST_LOCATION );
+ u = Uint16Pair(0u, 1u);
+ v = Uint16Pair(1u, 0u);
+ DALI_TEST_EQUALS(v < u, true, TEST_LOCATION);
- u = Uint16Pair( 1u, 0u );
- v = Uint16Pair( 0u, 1u );
- DALI_TEST_EQUALS( v < u, false, TEST_LOCATION );
+ u = Uint16Pair(1u, 0u);
+ v = Uint16Pair(0u, 1u);
+ DALI_TEST_EQUALS(v < u, false, TEST_LOCATION);
END_TEST;
}
Uint16Pair u;
Uint16Pair v;
- u = Uint16Pair( 0u, 1u );
- v = Uint16Pair( 1u, 0u );
- DALI_TEST_EQUALS( u > v, true, TEST_LOCATION );
+ u = Uint16Pair(0u, 1u);
+ v = Uint16Pair(1u, 0u);
+ DALI_TEST_EQUALS(u > v, true, TEST_LOCATION);
- u = Uint16Pair( 1u, 0u );
- v = Uint16Pair( 0u, 1u );
- DALI_TEST_EQUALS( v > u, true, TEST_LOCATION );
+ u = Uint16Pair(1u, 0u);
+ v = Uint16Pair(0u, 1u);
+ DALI_TEST_EQUALS(v > u, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairFromFloatVecP(void)
{
- Dali::Vector2 v2( 5.f, 5.f );
+ Dali::Vector2 v2(5.f, 5.f);
- Uint16Pair u = Uint16Pair::FromFloatVec2( v2 );
- DALI_TEST_EQUALS( u.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( u.GetY(), 5u, TEST_LOCATION );
+ Uint16Pair u = Uint16Pair::FromFloatVec2(v2);
+ DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
- Dali::Vector3 v3( 5.f, 5.f, 5.f );
+ Dali::Vector3 v3(5.f, 5.f, 5.f);
- u = Uint16Pair::FromFloatVec2( v3 );
- DALI_TEST_EQUALS( u.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( u.GetY(), 5u, TEST_LOCATION );
+ u = Uint16Pair::FromFloatVec2(v3);
+ DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
int UtcDaliUint16PairFromFloatArrayP(void)
{
- float array[] = { 5.f, 5.f };
+ float array[] = {5.f, 5.f};
- Uint16Pair u = Uint16Pair::FromFloatArray( array );
- DALI_TEST_EQUALS( u.GetX(), 5u, TEST_LOCATION );
- DALI_TEST_EQUALS( u.GetY(), 5u, TEST_LOCATION );
+ Uint16Pair u = Uint16Pair::FromFloatArray(array);
+ DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
END_TEST;
}
#define ENABLE_VECTOR_ASSERTS
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
const Dali::VectorBase::SizeType ZERO(0);
/// Compare a short with an int
-void DALI_TEST_EQUALS( short value1, int value2, const char* location )
+void DALI_TEST_EQUALS(short value1, int value2, const char* location)
{
- ::DALI_TEST_EQUALS< short >( value1, static_cast< short >( value2 ), location );
+ ::DALI_TEST_EQUALS<short>(value1, static_cast<short>(value2), location);
}
/// Compare a char with an int
-void DALI_TEST_EQUALS( char value1, int value2, const char* location )
+void DALI_TEST_EQUALS(char value1, int value2, const char* location)
{
- ::DALI_TEST_EQUALS< char >( value1, static_cast< char >( value2 ), location );
+ ::DALI_TEST_EQUALS<char>(value1, static_cast<char>(value2), location);
}
} // unnamed namespace
{
tet_infoline("Testing Dali::Vector<int>");
- Vector< int > intvector;
+ Vector<int> intvector;
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
intvector.Clear();
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
intvector.Release();
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<int>");
- Vector< int > intvector;
+ Vector<int> intvector;
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
- intvector.PushBack( 11 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION );
+ intvector.PushBack(11);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), intvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(11, intvector[0], TEST_LOCATION);
- intvector.PushBack( 99 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( 99, intvector[ 1 ], TEST_LOCATION );
+ intvector.PushBack(99);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), intvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(99, intvector[1], TEST_LOCATION);
- intvector.PushBack( 34 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(6), intvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 99, intvector[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 34, intvector[ 2 ], TEST_LOCATION );
+ intvector.PushBack(34);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(6), intvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(11, intvector[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(99, intvector[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(34, intvector[2], TEST_LOCATION);
intvector.Clear();
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(6), intvector.Capacity(), TEST_LOCATION );
- intvector.PushBack( 123 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 123, intvector[ 0 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(6), intvector.Capacity(), TEST_LOCATION);
+ intvector.PushBack(123);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(123, intvector[0], TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<int>::Copy");
- Vector< int > intvector;
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
+ Vector<int> intvector;
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
- intvector.PushBack( 99 );
- intvector.PushBack( 11 );
- intvector.PushBack( 34 );
+ intvector.PushBack(99);
+ intvector.PushBack(11);
+ intvector.PushBack(34);
// copy construct
- Vector< int > intvector2( intvector );
+ Vector<int> intvector2(intvector);
- DALI_TEST_EQUALS( intvector2.Count(), intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( intvector2.Capacity(), intvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( intvector2[ 0 ], intvector[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( intvector2[ 1 ], intvector[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( intvector2[ 2 ], intvector[ 2 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(intvector2.Count(), intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(intvector2.Capacity(), intvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(intvector2[0], intvector[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(intvector2[1], intvector[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(intvector2[2], intvector[2], TEST_LOCATION);
// assign
- Vector< int > intvector3;
- DALI_TEST_EQUALS( ZERO, intvector3.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector3.Capacity(), TEST_LOCATION );
+ Vector<int> intvector3;
+ DALI_TEST_EQUALS(ZERO, intvector3.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector3.Capacity(), TEST_LOCATION);
intvector2 = intvector3;
- DALI_TEST_EQUALS( intvector2.Count(), intvector3.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( intvector2.Capacity(), intvector3.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(intvector2.Count(), intvector3.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(intvector2.Capacity(), intvector3.Capacity(), TEST_LOCATION);
// copy empty
- Vector< int > intvector4;
- intvector4.Reserve( 100 );
- DALI_TEST_EQUALS( ZERO, intvector4.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(100), intvector4.Capacity(), TEST_LOCATION );
+ Vector<int> intvector4;
+ intvector4.Reserve(100);
+ DALI_TEST_EQUALS(ZERO, intvector4.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(100), intvector4.Capacity(), TEST_LOCATION);
intvector3 = intvector4;
- DALI_TEST_EQUALS( ZERO, intvector3.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(100), intvector3.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector3.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(100), intvector3.Capacity(), TEST_LOCATION);
// self copy
intvector4 = intvector4;
- DALI_TEST_EQUALS( ZERO, intvector4.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(100), intvector4.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, intvector4.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(100), intvector4.Capacity(), TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<short>::Resize");
- Vector< short > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
-
- vector.Resize( 10u );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(10), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION );
-
- vector.Resize( 4u );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION );
-
- vector.Resize( 4u );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION );
-
- vector.Resize( 0u );
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION );
-
- vector.Resize( 12u, 123 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(12), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(12), vector.Capacity(), TEST_LOCATION );
-
- DALI_TEST_EQUALS( vector[ 0 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 5 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 6 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 7 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 8 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 9 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 10 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 11 ], 123, TEST_LOCATION );
-
- vector.Resize( 13u, 321 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(13), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(13), vector.Capacity(), TEST_LOCATION );
-
- DALI_TEST_EQUALS( vector[ 0 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 5 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 6 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 7 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 8 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 9 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 10 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 11 ], 123, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 12 ], 321, TEST_LOCATION );
+ Vector<short> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
+
+ vector.Resize(10u);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(10), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION);
+
+ vector.Resize(4u);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION);
+
+ vector.Resize(4u);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION);
+
+ vector.Resize(0u);
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(10), vector.Capacity(), TEST_LOCATION);
+
+ vector.Resize(12u, 123);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(12), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(12), vector.Capacity(), TEST_LOCATION);
+
+ DALI_TEST_EQUALS(vector[0], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[5], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[6], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[7], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[8], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[9], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[10], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[11], 123, TEST_LOCATION);
+
+ vector.Resize(13u, 321);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(13), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(13), vector.Capacity(), TEST_LOCATION);
+
+ DALI_TEST_EQUALS(vector[0], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[5], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[6], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[7], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[8], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[9], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[10], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[11], 123, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[12], 321, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<short>::Erase");
- Vector< char > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
- vector.PushBack( 1 );
- vector.PushBack( 2 );
- vector.PushBack( 3 );
- vector.PushBack( 4 );
- vector.PushBack( 5 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(5), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 5, TEST_LOCATION );
-
- vector.Erase( vector.Begin() );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 5, TEST_LOCATION );
-
- Vector< char >::Iterator ret = vector.Erase( std::find( vector.Begin(), vector.End(), 4 ) );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 5, TEST_LOCATION );
- DALI_TEST_EQUALS( *ret, 5, TEST_LOCATION );
+ Vector<char> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
+ vector.PushBack(1);
+ vector.PushBack(2);
+ vector.PushBack(3);
+ vector.PushBack(4);
+ vector.PushBack(5);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(5), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 5, TEST_LOCATION);
+
+ vector.Erase(vector.Begin());
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 5, TEST_LOCATION);
+
+ Vector<char>::Iterator ret = vector.Erase(std::find(vector.Begin(), vector.End(), 4));
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(*ret, 5, TEST_LOCATION);
// try erasing last
- vector.PushBack( 99 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 99, TEST_LOCATION );
- ret = vector.Erase( vector.End() - 1 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ret, vector.End(), TEST_LOCATION );
+ vector.PushBack(99);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 99, TEST_LOCATION);
+ ret = vector.Erase(vector.End() - 1);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ret, vector.End(), TEST_LOCATION);
try
{
// illegal erase, one past the end
- vector.Erase( vector.End() );
+ vector.Erase(vector.End());
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
// illegal erase, one before the begin
- vector.Erase( vector.Begin() - 1u );
+ vector.Erase(vector.Begin() - 1u);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 5, TEST_LOCATION);
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 5, TEST_LOCATION );
-
- vector.Erase( vector.Begin() + 1 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 5, TEST_LOCATION );
+ vector.Erase(vector.Begin() + 1);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 5, TEST_LOCATION);
- vector.Erase( vector.Begin() + 1 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION );
+ vector.Erase(vector.Begin() + 1);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION);
try
{
// illegal erase, one past the end
- vector.Erase( vector.Begin() + 1 );
+ vector.Erase(vector.Begin() + 1);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 2, TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 2, TEST_LOCATION);
- vector.Erase( vector.Begin() );
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
+ vector.Erase(vector.Begin());
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
try
{
// illegal erase, one before the beginning
- vector.Erase( vector.Begin() - 1 );
+ vector.Erase(vector.Begin() - 1);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.Begin(), vector.End(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.Begin(), vector.End(), TEST_LOCATION);
- Vector< char >::Iterator endIter = vector.End();
- for( Vector< char >::Iterator iter = vector.Begin(); iter != endIter; ++iter )
+ Vector<char>::Iterator endIter = vector.End();
+ for(Vector<char>::Iterator iter = vector.Begin(); iter != endIter; ++iter)
{
tet_result(TET_FAIL);
}
- vector.PushBack( 3 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION );
+ vector.PushBack(3);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION);
vector.Clear();
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector.Begin(), vector.End(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector.Begin(), vector.End(), TEST_LOCATION);
endIter = vector.End();
- for( Vector< char >::Iterator iter = vector.Begin(); iter != endIter; ++iter )
+ for(Vector<char>::Iterator iter = vector.Begin(); iter != endIter; ++iter)
{
tet_result(TET_FAIL);
}
// test a vector of pointers
- Vector< int* > ptrVector;
- DALI_TEST_EQUALS( ZERO, ptrVector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ptrVector.Begin(), ptrVector.End(), TEST_LOCATION );
+ Vector<int*> ptrVector;
+ DALI_TEST_EQUALS(ZERO, ptrVector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ptrVector.Begin(), ptrVector.End(), TEST_LOCATION);
int* pointer = NULL;
- ptrVector.PushBack( pointer );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), ptrVector.Count(), TEST_LOCATION );
-
- Vector< int* >::Iterator ptriter = std::find( ptrVector.Begin(), ptrVector.End(), pointer );
- ptriter = ptrVector.Erase( ptriter );
- DALI_TEST_EQUALS( ZERO, ptrVector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ptrVector.Begin(), ptrVector.End(), TEST_LOCATION );
- DALI_TEST_EQUALS( ptrVector.Begin(), ptriter, TEST_LOCATION );
+ ptrVector.PushBack(pointer);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), ptrVector.Count(), TEST_LOCATION);
+
+ Vector<int*>::Iterator ptriter = std::find(ptrVector.Begin(), ptrVector.End(), pointer);
+ ptriter = ptrVector.Erase(ptriter);
+ DALI_TEST_EQUALS(ZERO, ptrVector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ptrVector.Begin(), ptrVector.End(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ptrVector.Begin(), ptriter, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliVectorDoubleRemove(void)
{
tet_infoline("Testing Dali::Vector<double>::Remove");
- Vector< double > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
-
- vector.PushBack( 11.1 );
- vector.PushBack( 22.2 );
- vector.PushBack( 33.3 );
- vector.PushBack( 44.4 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 11.1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 22.2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 33.3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 44.4, TEST_LOCATION );
-
- Vector< double >::Iterator res = std::find( vector.Begin(), vector.End(), 22.2 );
- DALI_TEST_EQUALS( 22.2, *res, TEST_LOCATION );
- vector.Remove( res );
- res = std::find( vector.Begin(), vector.End(), 22.2 );
- DALI_TEST_EQUALS( vector.End(), res, TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 11.1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 44.4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 33.3, TEST_LOCATION );
-
- vector.Remove( vector.End() - 1 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 11.1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 44.4, TEST_LOCATION );
-
- vector.Remove( vector.Begin() );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 44.4, TEST_LOCATION );
+ Vector<double> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+
+ vector.PushBack(11.1);
+ vector.PushBack(22.2);
+ vector.PushBack(33.3);
+ vector.PushBack(44.4);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 11.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 22.2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 33.3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 44.4, TEST_LOCATION);
+
+ Vector<double>::Iterator res = std::find(vector.Begin(), vector.End(), 22.2);
+ DALI_TEST_EQUALS(22.2, *res, TEST_LOCATION);
+ vector.Remove(res);
+ res = std::find(vector.Begin(), vector.End(), 22.2);
+ DALI_TEST_EQUALS(vector.End(), res, TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 11.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 44.4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 33.3, TEST_LOCATION);
+
+ vector.Remove(vector.End() - 1);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 11.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 44.4, TEST_LOCATION);
+
+ vector.Remove(vector.Begin());
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 44.4, TEST_LOCATION);
try
{
// illegal erase, one past the end
- vector.Remove( vector.Begin() + 1 );
+ vector.Remove(vector.Begin() + 1);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 44.4, TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 44.4, TEST_LOCATION);
- vector.Remove( vector.Begin() );
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
+ vector.Remove(vector.Begin());
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
try
{
// illegal erase, one before the beginning
- vector.Remove( vector.Begin() - 1 );
+ vector.Remove(vector.Begin() - 1);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
{
tet_infoline("Testing Dali::Vector<int>::Swap");
- Vector< int > intvector;
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
-
- intvector.PushBack( 11 );
- intvector.PushBack( 22 );
- intvector.PushBack( 33 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION );
-
- Vector< int > intvector2;
- DALI_TEST_EQUALS( ZERO, intvector2.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector2.Capacity(), TEST_LOCATION );
-
- intvector2.Swap( intvector );
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), intvector2.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 11, intvector2[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 22, intvector2[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 33, intvector2[ 2 ], TEST_LOCATION );
-
- intvector.PushBack( 99 );
- intvector.PushBack( 88 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Count(), TEST_LOCATION );
-
- intvector.Swap( intvector2 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector2.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 99, intvector2[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 88, intvector2[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 22, intvector[ 1 ], TEST_LOCATION );
- DALI_TEST_EQUALS( 33, intvector[ 2 ], TEST_LOCATION );
-
- Vector< int > empty;
- intvector.Swap( empty );
- DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
+ Vector<int> intvector;
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
+
+ intvector.PushBack(11);
+ intvector.PushBack(22);
+ intvector.PushBack(33);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION);
+
+ Vector<int> intvector2;
+ DALI_TEST_EQUALS(ZERO, intvector2.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector2.Capacity(), TEST_LOCATION);
+
+ intvector2.Swap(intvector);
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), intvector2.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(11, intvector2[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(22, intvector2[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(33, intvector2[2], TEST_LOCATION);
+
+ intvector.PushBack(99);
+ intvector.PushBack(88);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), intvector.Count(), TEST_LOCATION);
+
+ intvector.Swap(intvector2);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), intvector2.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(99, intvector2[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(88, intvector2[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(11, intvector[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(22, intvector[1], TEST_LOCATION);
+ DALI_TEST_EQUALS(33, intvector[2], TEST_LOCATION);
+
+ Vector<int> empty;
+ intvector.Swap(empty);
+ DALI_TEST_EQUALS(ZERO, intvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intvector.Capacity(), TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<float>::Begin");
- Vector< float > floatvector;
- DALI_TEST_EQUALS( ZERO, floatvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, floatvector.Capacity(), TEST_LOCATION );
+ Vector<float> floatvector;
+ DALI_TEST_EQUALS(ZERO, floatvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, floatvector.Capacity(), TEST_LOCATION);
- floatvector.PushBack( 0.9f );
- floatvector.PushBack( 1.1f );
- floatvector.PushBack( 1.2f );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), floatvector.Count(), TEST_LOCATION );
+ floatvector.PushBack(0.9f);
+ floatvector.PushBack(1.1f);
+ floatvector.PushBack(1.2f);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), floatvector.Count(), TEST_LOCATION);
- Vector< float >::Iterator iter = floatvector.Begin();
- int index = 0;
- for( ; iter != floatvector.End(); ++iter, ++index )
+ Vector<float>::Iterator iter = floatvector.Begin();
+ int index = 0;
+ for(; iter != floatvector.End(); ++iter, ++index)
{
std::cout << "value " << *iter << std::endl;
- DALI_TEST_EQUALS( *iter, floatvector[ index ], TEST_LOCATION );
+ DALI_TEST_EQUALS(*iter, floatvector[index], TEST_LOCATION);
}
- DALI_TEST_EQUALS( 3, index, TEST_LOCATION );
+ DALI_TEST_EQUALS(3, index, TEST_LOCATION);
- iter = std::find( floatvector.Begin(), floatvector.End(), 1.1f );
- DALI_TEST_EQUALS( 1.1f, *iter, TEST_LOCATION );
+ iter = std::find(floatvector.Begin(), floatvector.End(), 1.1f);
+ DALI_TEST_EQUALS(1.1f, *iter, TEST_LOCATION);
floatvector.Clear();
- iter = std::find( floatvector.Begin(), floatvector.End(), 1.1f );
- DALI_TEST_EQUALS( floatvector.End(), iter, TEST_LOCATION );
+ iter = std::find(floatvector.Begin(), floatvector.End(), 1.1f);
+ DALI_TEST_EQUALS(floatvector.End(), iter, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector< std::pair< int, float > >");
- Vector< std::pair< int, float > > pairvector;
- DALI_TEST_EQUALS( ZERO, pairvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, pairvector.Capacity(), TEST_LOCATION );
+ Vector<std::pair<int, float> > pairvector;
+ DALI_TEST_EQUALS(ZERO, pairvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, pairvector.Capacity(), TEST_LOCATION);
- pairvector.PushBack( std::make_pair( 5, 0.1f ) );
- pairvector.PushBack( std::make_pair( 3, 0.2f ) );
- pairvector.PushBack( std::make_pair( 4, 0.3f ) );
- pairvector.PushBack( std::make_pair( 1, 0.4f ) );
- pairvector.PushBack( std::make_pair( 2, 0.5f ) );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(5), pairvector.Count(), TEST_LOCATION );
+ pairvector.PushBack(std::make_pair(5, 0.1f));
+ pairvector.PushBack(std::make_pair(3, 0.2f));
+ pairvector.PushBack(std::make_pair(4, 0.3f));
+ pairvector.PushBack(std::make_pair(1, 0.4f));
+ pairvector.PushBack(std::make_pair(2, 0.5f));
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(5), pairvector.Count(), TEST_LOCATION);
- Vector< std::pair< int, float > >::Iterator iter = pairvector.Begin();
- int index = 0;
- for( ; iter != pairvector.End(); ++iter, ++index )
+ Vector<std::pair<int, float> >::Iterator iter = pairvector.Begin();
+ int index = 0;
+ for(; iter != pairvector.End(); ++iter, ++index)
{
std::cout << "pair " << (*iter).first << ":" << (*iter).second << std::endl;
- DALI_TEST_EQUALS( (*iter).first, pairvector[ index ].first, TEST_LOCATION );
- DALI_TEST_EQUALS( (*iter).second, pairvector[ index ].second, TEST_LOCATION );
+ DALI_TEST_EQUALS((*iter).first, pairvector[index].first, TEST_LOCATION);
+ DALI_TEST_EQUALS((*iter).second, pairvector[index].second, TEST_LOCATION);
}
END_TEST;
}
tet_infoline("Testing Dali::Vector< int* > exception handling");
// empty vector
- Vector< int* > pointervector;
+ Vector<int*> pointervector;
try
{
- int* value = NULL;
- pointervector[ 1 ] = value;
- tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ int* value = NULL;
+ pointervector[1] = value;
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "VectorBase::mData", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "VectorBase::mData", TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
int* value = NULL;
- value = pointervector[ 0 ];
+ value = pointervector[0];
(void)value; // to "use" the value
- tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "VectorBase::mData", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "VectorBase::mData", TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
- Vector< int* >::Iterator iter = pointervector.Begin();
- if( iter != pointervector.End() )
+ Vector<int*>::Iterator iter = pointervector.Begin();
+ if(iter != pointervector.End())
{
tet_result(TET_FAIL);
}
try
{
- pointervector.Erase( pointervector.Begin() );
- tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ pointervector.Erase(pointervector.Begin());
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
iter = pointervector.Begin();
- if( iter != pointervector.End() )
+ if(iter != pointervector.End())
{
tet_result(TET_FAIL);
}
try
{
- pointervector.Remove( pointervector.Begin() );
- tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ pointervector.Remove(pointervector.Begin());
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(iterator < End()) && (iterator >= Begin())", TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
iter = pointervector.Begin();
- if( iter != pointervector.End() )
+ if(iter != pointervector.End())
{
tet_result(TET_FAIL);
}
// reserve 0 space
- pointervector.Reserve( 0 );
+ pointervector.Reserve(0);
iter = pointervector.Begin();
- if( iter != pointervector.End() )
+ if(iter != pointervector.End())
{
tet_result(TET_FAIL);
}
// reserve 1 space
- pointervector.Reserve( 1 );
+ pointervector.Reserve(1);
iter = pointervector.Begin();
- if( iter != pointervector.End() )
+ if(iter != pointervector.End())
{
tet_result(TET_FAIL);
}
try
{
- int* value = NULL;
- pointervector[ 1 ] = value;
- tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ int* value = NULL;
+ pointervector[1] = value;
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < VectorBase::Count()", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "index < VectorBase::Count()", TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
- int* value = pointervector[ 1 ];
+ int* value = pointervector[1];
(void)value; // to "use" the value
- tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < VectorBase::Count()", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "index < VectorBase::Count()", TEST_LOCATION);
}
catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
tet_infoline("Testing multiple Dali::Vector's");
// create multiple vectors
- Vector< std::pair< float, float > > pairvector;
- DALI_TEST_EQUALS( ZERO, pairvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, pairvector.Capacity(), TEST_LOCATION );
- Vector< double > doublevector;
- DALI_TEST_EQUALS( ZERO, doublevector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, doublevector.Capacity(), TEST_LOCATION );
- Vector< int* > intptrvector;
- DALI_TEST_EQUALS( ZERO, intptrvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intptrvector.Capacity(), TEST_LOCATION );
- Vector< Dali::Actor* > actorptrvector;
- DALI_TEST_EQUALS( ZERO, actorptrvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, actorptrvector.Capacity(), TEST_LOCATION );
- Vector< long > longvector;
- DALI_TEST_EQUALS( ZERO, longvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, longvector.Capacity(), TEST_LOCATION );
- Vector< char > charvector;
- DALI_TEST_EQUALS( ZERO, charvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, charvector.Capacity(), TEST_LOCATION );
+ Vector<std::pair<float, float> > pairvector;
+ DALI_TEST_EQUALS(ZERO, pairvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, pairvector.Capacity(), TEST_LOCATION);
+ Vector<double> doublevector;
+ DALI_TEST_EQUALS(ZERO, doublevector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, doublevector.Capacity(), TEST_LOCATION);
+ Vector<int*> intptrvector;
+ DALI_TEST_EQUALS(ZERO, intptrvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intptrvector.Capacity(), TEST_LOCATION);
+ Vector<Dali::Actor*> actorptrvector;
+ DALI_TEST_EQUALS(ZERO, actorptrvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, actorptrvector.Capacity(), TEST_LOCATION);
+ Vector<long> longvector;
+ DALI_TEST_EQUALS(ZERO, longvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, longvector.Capacity(), TEST_LOCATION);
+ Vector<char> charvector;
+ DALI_TEST_EQUALS(ZERO, charvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, charvector.Capacity(), TEST_LOCATION);
// add items
static unsigned int acidCount = 10000;
- int* ptr = NULL;
- for( unsigned int i = 0; i < acidCount; ++i )
+ int* ptr = NULL;
+ for(unsigned int i = 0; i < acidCount; ++i)
{
- pairvector.PushBack( std::make_pair( i, i ) );
- doublevector.PushBack( (double)i );
- intptrvector.PushBack( (int*)ptr );
- actorptrvector.PushBack( (Dali::Actor*)ptr );
- longvector.PushBack( (long)i );
- charvector.PushBack( (char)i );
+ pairvector.PushBack(std::make_pair(i, i));
+ doublevector.PushBack((double)i);
+ intptrvector.PushBack((int*)ptr);
+ actorptrvector.PushBack((Dali::Actor*)ptr);
+ longvector.PushBack((long)i);
+ charvector.PushBack((char)i);
}
- DALI_TEST_EQUALS( acidCount, pairvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(acidCount, pairvector.Count(), TEST_LOCATION);
std::size_t pairCapacity = pairvector.Capacity();
- DALI_TEST_EQUALS( acidCount, doublevector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(acidCount, doublevector.Count(), TEST_LOCATION);
std::size_t doubleCapacity = doublevector.Capacity();
- DALI_TEST_EQUALS( acidCount, intptrvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(acidCount, intptrvector.Count(), TEST_LOCATION);
std::size_t intptrCapacity = intptrvector.Capacity();
- DALI_TEST_EQUALS( acidCount, actorptrvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(acidCount, actorptrvector.Count(), TEST_LOCATION);
std::size_t actorptrCapacity = actorptrvector.Capacity();
- DALI_TEST_EQUALS( acidCount, longvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(acidCount, longvector.Count(), TEST_LOCATION);
std::size_t longCapacity = longvector.Capacity();
- DALI_TEST_EQUALS( acidCount, charvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(acidCount, charvector.Count(), TEST_LOCATION);
std::size_t charCapacity = charvector.Capacity();
- tet_printf("Dali::Vector< pair > capacity after %d pushbacks is %d", acidCount, pairCapacity );
- tet_printf("Dali::Vector< double > capacity after %d pushbacks is %d", acidCount, doubleCapacity );
- tet_printf("Dali::Vector< int* > capacity after %d pushbacks is %d", acidCount, intptrCapacity );
- tet_printf("Dali::Vector< Actor* > capacity after %d pushbacks is %d", acidCount, actorptrCapacity );
- tet_printf("Dali::Vector< long > capacity after %d pushbacks is %d", acidCount, longCapacity );
- tet_printf("Dali::Vector< char > capacity after %d pushbacks is %d", acidCount, charCapacity );
+ tet_printf("Dali::Vector< pair > capacity after %d pushbacks is %d", acidCount, pairCapacity);
+ tet_printf("Dali::Vector< double > capacity after %d pushbacks is %d", acidCount, doubleCapacity);
+ tet_printf("Dali::Vector< int* > capacity after %d pushbacks is %d", acidCount, intptrCapacity);
+ tet_printf("Dali::Vector< Actor* > capacity after %d pushbacks is %d", acidCount, actorptrCapacity);
+ tet_printf("Dali::Vector< long > capacity after %d pushbacks is %d", acidCount, longCapacity);
+ tet_printf("Dali::Vector< char > capacity after %d pushbacks is %d", acidCount, charCapacity);
// erase items
- for( unsigned int i = 0; i < acidCount; ++i )
- {
- pairvector.Erase( pairvector.Begin() + ( i % pairvector.Count() ) );
- doublevector.Erase( doublevector.Begin() + ( i % doublevector.Count() ) );
- intptrvector.Erase( intptrvector.Begin() + ( i % intptrvector.Count() ) );
- actorptrvector.Erase( actorptrvector.Begin() + ( i % actorptrvector.Count() ) );
- longvector.Erase( longvector.Begin() + ( i % longvector.Count() ) );
- charvector.Erase( charvector.Begin() + ( i % charvector.Count() ) );
- }
- DALI_TEST_EQUALS( ZERO, pairvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( pairCapacity, pairvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, doublevector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( doubleCapacity, doublevector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, intptrvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( intptrCapacity, intptrvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, actorptrvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( actorptrCapacity, actorptrvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, longvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( longCapacity, longvector.Capacity(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, charvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( charCapacity, charvector.Capacity(), TEST_LOCATION );
+ for(unsigned int i = 0; i < acidCount; ++i)
+ {
+ pairvector.Erase(pairvector.Begin() + (i % pairvector.Count()));
+ doublevector.Erase(doublevector.Begin() + (i % doublevector.Count()));
+ intptrvector.Erase(intptrvector.Begin() + (i % intptrvector.Count()));
+ actorptrvector.Erase(actorptrvector.Begin() + (i % actorptrvector.Count()));
+ longvector.Erase(longvector.Begin() + (i % longvector.Count()));
+ charvector.Erase(charvector.Begin() + (i % charvector.Count()));
+ }
+ DALI_TEST_EQUALS(ZERO, pairvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(pairCapacity, pairvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, doublevector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(doubleCapacity, doublevector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, intptrvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(intptrCapacity, intptrvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, actorptrvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(actorptrCapacity, actorptrvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, longvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(longCapacity, longvector.Capacity(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, charvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(charCapacity, charvector.Capacity(), TEST_LOCATION);
END_TEST;
}
int UtcDaliVectorPushBack(void)
{
- tet_infoline( "Testing Dali::Vector< int* >PushBack(Element)" );
+ tet_infoline("Testing Dali::Vector< int* >PushBack(Element)");
Vector<unsigned int> vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
- vector.Reserve( 2u );
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 2u, vector.Capacity(), TEST_LOCATION );
+ vector.Reserve(2u);
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, vector.Capacity(), TEST_LOCATION);
- vector.PushBack( 0u );
- vector.PushBack( 1u );
- vector.PushBack( 2u );
+ vector.PushBack(0u);
+ vector.PushBack(1u);
+ vector.PushBack(2u);
- DALI_TEST_EQUALS( 3u, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 6u, vector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(3u, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(6u, vector.Capacity(), TEST_LOCATION);
- vector.PushBack( 3u );
+ vector.PushBack(3u);
- DALI_TEST_EQUALS( 4u, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 6u, vector.Capacity(), TEST_LOCATION );
+ DALI_TEST_EQUALS(4u, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(6u, vector.Capacity(), TEST_LOCATION);
- DALI_TEST_EQUALS( 0u, vector[0u], TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, vector[1u], TEST_LOCATION );
- DALI_TEST_EQUALS( 2u, vector[2u], TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, vector[3u], TEST_LOCATION );
+ DALI_TEST_EQUALS(0u, vector[0u], TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, vector[1u], TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, vector[2u], TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, vector[3u], TEST_LOCATION);
END_TEST;
}
int UtcDaliVectorInsert01(void)
{
- tet_infoline( "Testing Dali::Vector< int* >Insert(Iterator, Element)" );
+ tet_infoline("Testing Dali::Vector< int* >Insert(Iterator, Element)");
// Test order of array inserted-into:
- Vector< unsigned int > orderedVector;
- orderedVector.PushBack( 9u );
- for( unsigned int i = 8u; i <= 8u; --i )
+ Vector<unsigned int> orderedVector;
+ orderedVector.PushBack(9u);
+ for(unsigned int i = 8u; i <= 8u; --i)
{
- orderedVector.Insert( orderedVector.Begin(), i );
- DALI_TEST_EQUALS( 10u - i, orderedVector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( i, orderedVector[0u], TEST_LOCATION );
+ orderedVector.Insert(orderedVector.Begin(), i);
+ DALI_TEST_EQUALS(10u - i, orderedVector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(i, orderedVector[0u], TEST_LOCATION);
}
- for( unsigned int i = 0u; i < 10u; ++i )
+ for(unsigned int i = 0u; i < 10u; ++i)
{
- DALI_TEST_EQUALS( i, orderedVector[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(i, orderedVector[i], TEST_LOCATION);
}
// Test insertion out of range in non-empty array throws:
try
{
- orderedVector.Insert( orderedVector.Begin() + 99u, 99u );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ orderedVector.Insert(orderedVector.Begin() + 99u, 99u);
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf( "Assertion test failed - wrong Exception\n" );
- tet_result( TET_FAIL );
+ tet_printf("Assertion test failed - wrong Exception\n");
+ tet_result(TET_FAIL);
}
try
{
- orderedVector.Insert( orderedVector.Begin() - 1u, 99u );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
- tet_result( TET_FAIL );
+ orderedVector.Insert(orderedVector.Begin() - 1u, 99u);
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
+ tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf( "Assertion test failed - wrong Exception\n" );
- tet_result( TET_FAIL );
+ tet_printf("Assertion test failed - wrong Exception\n");
+ tet_result(TET_FAIL);
}
// Test insertion part-way through a largish array retains ordering:
// Build vector with hole in sequence:
- Vector< unsigned int > longerVector;
- const unsigned int insertionPoint = 131571u;
- const unsigned int finalLength = 262143u;
- for( unsigned int i = 0u; i < insertionPoint; ++i )
+ Vector<unsigned int> longerVector;
+ const unsigned int insertionPoint = 131571u;
+ const unsigned int finalLength = 262143u;
+ for(unsigned int i = 0u; i < insertionPoint; ++i)
{
- longerVector.PushBack( i );
+ longerVector.PushBack(i);
}
- for( unsigned int i = insertionPoint; i < finalLength; ++i )
+ for(unsigned int i = insertionPoint; i < finalLength; ++i)
{
- longerVector.PushBack( i + 1 );
+ longerVector.PushBack(i + 1);
}
// Fill the hole in the sequence:
- longerVector.Insert( longerVector.Begin() + insertionPoint, insertionPoint );
+ longerVector.Insert(longerVector.Begin() + insertionPoint, insertionPoint);
// Check the sequence is monotonically increasing by one every time:
- for( unsigned int i = 0u; i <= finalLength; ++i )
+ for(unsigned int i = 0u; i <= finalLength; ++i)
{
- DALI_TEST_EQUALS( i, longerVector[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(i, longerVector[i], TEST_LOCATION);
}
// Insert into an empty vector
- Vector< unsigned int > vector;
+ Vector<unsigned int> vector;
- vector.Insert( vector.End(), orderedVector.Begin(), orderedVector.End() );
- for( unsigned int i = 0u; i < 10u; ++i )
+ vector.Insert(vector.End(), orderedVector.Begin(), orderedVector.End());
+ for(unsigned int i = 0u; i < 10u; ++i)
{
- DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION);
}
vector.Clear();
- vector.Insert( vector.Begin(), orderedVector.Begin(), orderedVector.End() );
- for( unsigned int i = 0u; i < 10u; ++i )
+ vector.Insert(vector.Begin(), orderedVector.Begin(), orderedVector.End());
+ for(unsigned int i = 0u; i < 10u; ++i)
{
- DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION);
}
// Insert nothing.
- vector.Insert( vector.Begin(), orderedVector.Begin(), orderedVector.Begin() );
- for( unsigned int i = 0u; i < 10u; ++i )
+ vector.Insert(vector.Begin(), orderedVector.Begin(), orderedVector.Begin());
+ for(unsigned int i = 0u; i < 10u; ++i)
{
- DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION);
}
- vector.Insert( vector.Begin() + 5, vector.Begin() + 5, vector.Begin() + 5 );
- for( unsigned int i = 0u; i < 10u; ++i )
+ vector.Insert(vector.Begin() + 5, vector.Begin() + 5, vector.Begin() + 5);
+ for(unsigned int i = 0u; i < 10u; ++i)
{
- DALI_TEST_EQUALS( i, vector[i], TEST_LOCATION );
+ DALI_TEST_EQUALS(i, vector[i], TEST_LOCATION);
}
// AutoInsert
vector.Clear();
- vector.PushBack( 0u );
- vector.PushBack( 1u );
- vector.PushBack( 2u );
- vector.PushBack( 3u );
-
- vector.Insert( vector.Begin() + 2, vector.Begin(), vector.End() );
- DALI_TEST_EQUALS( 8u, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, vector[0u], TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, vector[1u], TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, vector[2u], TEST_LOCATION );
- DALI_TEST_EQUALS( 1u, vector[3u], TEST_LOCATION );
- DALI_TEST_EQUALS( 2u, vector[4u], TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, vector[5u], TEST_LOCATION );
- DALI_TEST_EQUALS( 2u, vector[6u], TEST_LOCATION );
- DALI_TEST_EQUALS( 3u, vector[7u], TEST_LOCATION );
+ vector.PushBack(0u);
+ vector.PushBack(1u);
+ vector.PushBack(2u);
+ vector.PushBack(3u);
+
+ vector.Insert(vector.Begin() + 2, vector.Begin(), vector.End());
+ DALI_TEST_EQUALS(8u, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, vector[0u], TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, vector[1u], TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, vector[2u], TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, vector[3u], TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, vector[4u], TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, vector[5u], TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, vector[6u], TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, vector[7u], TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<char>::Insert(Iterator,Iterator,Iterator)");
- Vector< char > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
- vector.PushBack( 1 );
- vector.PushBack( 2 );
- vector.PushBack( 3 );
- vector.PushBack( 4 );
- vector.PushBack( 5 );
-
- Vector< char > vector2;
- DALI_TEST_EQUALS( ZERO, vector2.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector2.Capacity(), TEST_LOCATION );
- vector2.PushBack( 6 );
- vector2.PushBack( 7 );
- vector2.PushBack( 8 );
- vector2.PushBack( 9 );
- vector2.PushBack( 10 );
+ Vector<char> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
+ vector.PushBack(1);
+ vector.PushBack(2);
+ vector.PushBack(3);
+ vector.PushBack(4);
+ vector.PushBack(5);
+
+ Vector<char> vector2;
+ DALI_TEST_EQUALS(ZERO, vector2.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector2.Capacity(), TEST_LOCATION);
+ vector2.PushBack(6);
+ vector2.PushBack(7);
+ vector2.PushBack(8);
+ vector2.PushBack(9);
+ vector2.PushBack(10);
// Test insert at end
- vector.Insert( vector.End(), vector2.Begin(), vector2.Begin() + 1u );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(6), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 5, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 5 ], 6, TEST_LOCATION );
+ vector.Insert(vector.End(), vector2.Begin(), vector2.Begin() + 1u);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(6), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[5], 6, TEST_LOCATION);
// Test insert at begin
- vector.Insert( vector.Begin(), vector2.Begin()+1, vector2.Begin() + 2u );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(7), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 7, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 5 ], 5, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 6 ], 6, TEST_LOCATION );
+ vector.Insert(vector.Begin(), vector2.Begin() + 1, vector2.Begin() + 2u);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(7), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 7, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[5], 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[6], 6, TEST_LOCATION);
// Test insert in the middle
- vector.Insert( vector.Begin() + 3, vector2.Begin()+3, vector2.End() );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(9), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 7, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 9, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 10, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 5 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 6 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 7 ], 5, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 8 ], 6, TEST_LOCATION );
+ vector.Insert(vector.Begin() + 3, vector2.Begin() + 3, vector2.End());
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(9), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 7, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 9, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 10, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[5], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[6], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[7], 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[8], 6, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<char>::Insert(Iterator,Iterator,Iterator) asserts");
- Vector< char > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
- vector.PushBack( 1 );
- vector.PushBack( 2 );
-
- Vector< char > vector2;
- DALI_TEST_EQUALS( ZERO, vector2.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector2.Capacity(), TEST_LOCATION );
- vector2.PushBack( 6 );
- vector2.PushBack( 7 );
- vector2.PushBack( 8 );
- vector2.PushBack( 9 );
- vector2.PushBack( 10 );
+ Vector<char> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
+ vector.PushBack(1);
+ vector.PushBack(2);
+
+ Vector<char> vector2;
+ DALI_TEST_EQUALS(ZERO, vector2.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector2.Capacity(), TEST_LOCATION);
+ vector2.PushBack(6);
+ vector2.PushBack(7);
+ vector2.PushBack(8);
+ vector2.PushBack(9);
+ vector2.PushBack(10);
try
{
- vector.Insert( vector.Begin() + 3u, vector2.Begin(), vector2.End() );
+ vector.Insert(vector.Begin() + 3u, vector2.Begin(), vector2.End());
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
- vector.Insert( vector.Begin() - 1u, vector2.Begin(), vector2.End() );
+ vector.Insert(vector.Begin() - 1u, vector2.Begin(), vector2.End());
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( at <= End() ) && ( at >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(at <= End()) && (at >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
- vector.Insert( vector.End(), vector2.End(), vector2.Begin() );
+ vector.Insert(vector.End(), vector2.End(), vector2.Begin());
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( from <= to )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(from <= to)", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
END_TEST;
- }
-
+}
int UtcDaliVectorIntEraseRange(void)
{
tet_infoline("Testing Dali::Vector<char>::Erase(Iterator,Iterator)");
- Vector< char > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
+ Vector<char> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
// Try to delete from empty vector.
- vector.Erase( vector.Begin(), vector.End() );
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
-
- vector.PushBack( 1 );
- vector.PushBack( 2 );
- vector.PushBack( 3 );
- vector.PushBack( 4 );
- vector.PushBack( 5 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(5), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 2, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 4 ], 5, TEST_LOCATION );
-
- Vector< char >::Iterator ret;
-
- ret = vector.Erase( vector.Begin() + 1u, vector.Begin() + 2u );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 1, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 3, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 5, TEST_LOCATION );
- DALI_TEST_EQUALS( *ret, 3, TEST_LOCATION );
-
- ret = vector.Erase( vector.Begin(), vector.Begin() + 2 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 5, TEST_LOCATION );
- DALI_TEST_EQUALS( *ret, 4, TEST_LOCATION );
+ vector.Erase(vector.Begin(), vector.End());
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
+
+ vector.PushBack(1);
+ vector.PushBack(2);
+ vector.PushBack(3);
+ vector.PushBack(4);
+ vector.PushBack(5);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(5), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 2, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[4], 5, TEST_LOCATION);
+
+ Vector<char>::Iterator ret;
+
+ ret = vector.Erase(vector.Begin() + 1u, vector.Begin() + 2u);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 3, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(*ret, 3, TEST_LOCATION);
+
+ ret = vector.Erase(vector.Begin(), vector.Begin() + 2);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(2), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 5, TEST_LOCATION);
+ DALI_TEST_EQUALS(*ret, 4, TEST_LOCATION);
// try erasing last
- vector.PushBack( 99 );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 99, TEST_LOCATION );
- ret = vector.Erase( vector.Begin() + 1u, vector.End() );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( ret, vector.End(), TEST_LOCATION );
+ vector.PushBack(99);
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 99, TEST_LOCATION);
+ ret = vector.Erase(vector.Begin() + 1u, vector.End());
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(1), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(ret, vector.End(), TEST_LOCATION);
// try erasing all
- vector.PushBack( 100 );
- vector.PushBack( 101 );
- vector.PushBack( 102 );
+ vector.PushBack(100);
+ vector.PushBack(101);
+ vector.PushBack(102);
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 4, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 100, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 101, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 3 ], 102, TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(4), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 4, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 100, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 101, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[3], 102, TEST_LOCATION);
- ret = vector.Erase( vector.Begin(), vector.End() );
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(0), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ret, vector.End(), TEST_LOCATION );
+ ret = vector.Erase(vector.Begin(), vector.End());
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(0), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ret, vector.End(), TEST_LOCATION);
// try erase from Iterator to the same Iterator.
- vector.PushBack( 100 );
- vector.PushBack( 101 );
- vector.PushBack( 102 );
+ vector.PushBack(100);
+ vector.PushBack(101);
+ vector.PushBack(102);
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 100, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 101, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 102, TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 100, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 101, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 102, TEST_LOCATION);
- ret = vector.Erase( vector.Begin() + 1, vector.Begin() + 1 );
+ ret = vector.Erase(vector.Begin() + 1, vector.Begin() + 1);
- DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 0 ], 100, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 1 ], 101, TEST_LOCATION );
- DALI_TEST_EQUALS( vector[ 2 ], 102, TEST_LOCATION );
+ DALI_TEST_EQUALS(static_cast<Dali::VectorBase::SizeType>(3), vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[0], 100, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[1], 101, TEST_LOCATION);
+ DALI_TEST_EQUALS(vector[2], 102, TEST_LOCATION);
- DALI_TEST_EQUALS( *ret, 101, TEST_LOCATION );
+ DALI_TEST_EQUALS(*ret, 101, TEST_LOCATION);
END_TEST;
}
{
tet_infoline("Testing Dali::Vector<char>::Erase(Iterator,Iterator) asserts");
- Vector< char > vector;
- DALI_TEST_EQUALS( ZERO, vector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, vector.Capacity(), TEST_LOCATION );
-
+ Vector<char> vector;
+ DALI_TEST_EQUALS(ZERO, vector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, vector.Capacity(), TEST_LOCATION);
// Add some elements.
- vector.PushBack( 1 );
- vector.PushBack( 2 );
+ vector.PushBack(1);
+ vector.PushBack(2);
// first out of bounds
try
{
- vector.Erase( vector.Begin() + 3u, vector.Begin() + 4u );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ vector.Erase(vector.Begin() + 3u, vector.Begin() + 4u);
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( first <= End() ) && ( first >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(first <= End()) && (first >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
- vector.Erase( vector.Begin() - 1u, vector.End() );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ vector.Erase(vector.Begin() - 1u, vector.End());
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( first <= End() ) && ( first >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(first <= End()) && (first >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
- vector.Erase( vector.Begin(), vector.Begin() + 3u );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ vector.Erase(vector.Begin(), vector.Begin() + 3u);
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( last <= End() ) && ( last >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(last <= End()) && (last >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
try
{
- vector.Erase( vector.Begin(), vector.Begin() - 1u );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ vector.Erase(vector.Begin(), vector.Begin() - 1u);
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( last <= End() ) && ( last >= Begin() )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(last <= End()) && (last >= Begin())", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
- vector.PushBack( 3 );
+ vector.PushBack(3);
// first > last
try
{
- vector.Erase( vector.Begin() + 2u, vector.Begin() + 1u );
- tet_printf( "Assertion expected, but not occurred at %s\n", TEST_LOCATION );
+ vector.Erase(vector.Begin() + 2u, vector.Begin() + 1u);
+ tet_printf("Assertion expected, but not occurred at %s\n", TEST_LOCATION);
tet_result(TET_FAIL);
}
- catch( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "( first <= last )", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "(first <= last)", TEST_LOCATION);
}
- catch( ... )
+ catch(...)
{
- tet_printf("Assertion test failed - wrong Exception\n" );
+ tet_printf("Assertion test failed - wrong Exception\n");
tet_result(TET_FAIL);
}
{
tet_infoline("Testing Dali::Vector< Vector2 >");
- Vector< Vector2 > classvector;
- DALI_TEST_EQUALS( ZERO, classvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, classvector.Capacity(), TEST_LOCATION );
+ Vector<Vector2> classvector;
+ DALI_TEST_EQUALS(ZERO, classvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, classvector.Capacity(), TEST_LOCATION);
- classvector.PushBack( Vector2() );
+ classvector.PushBack(Vector2());
- DALI_TEST_EQUALS( 1u, classvector.Count(), TEST_LOCATION );
- DALI_TEST_GREATER( classvector.Capacity(), ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(1u, classvector.Count(), TEST_LOCATION);
+ DALI_TEST_GREATER(classvector.Capacity(), ZERO, TEST_LOCATION);
- classvector.PushBack( Vector2( 0.1f, 0.2f ) );
+ classvector.PushBack(Vector2(0.1f, 0.2f));
- DALI_TEST_EQUALS( 2u, classvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(2u, classvector.Count(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(), classvector[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( Vector2( 0.1f, 0.2f ), classvector[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector2(), classvector[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.1f, 0.2f), classvector[1], TEST_LOCATION);
tet_result(TET_PASS); // for now
END_TEST;
{
tet_infoline("Testing Dali::Vector< Vector3 >");
- Vector< Vector3 > classvector;
- DALI_TEST_EQUALS( ZERO, classvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, classvector.Capacity(), TEST_LOCATION );
+ Vector<Vector3> classvector;
+ DALI_TEST_EQUALS(ZERO, classvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, classvector.Capacity(), TEST_LOCATION);
- classvector.PushBack( Vector3() );
+ classvector.PushBack(Vector3());
- DALI_TEST_EQUALS( 1u, classvector.Count(), TEST_LOCATION );
- DALI_TEST_GREATER( classvector.Capacity(), ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(1u, classvector.Count(), TEST_LOCATION);
+ DALI_TEST_GREATER(classvector.Capacity(), ZERO, TEST_LOCATION);
- classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+ classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f));
- DALI_TEST_EQUALS( 2u, classvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(2u, classvector.Count(), TEST_LOCATION);
- DALI_TEST_EQUALS( Vector3(), classvector[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), classvector[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(), classvector[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), classvector[1], TEST_LOCATION);
tet_result(TET_PASS); // for now
END_TEST;
{
tet_infoline("Testing Dali::Vector< Matrix >");
- Vector< Matrix > classvector;
- DALI_TEST_EQUALS( ZERO, classvector.Count(), TEST_LOCATION );
- DALI_TEST_EQUALS( ZERO, classvector.Capacity(), TEST_LOCATION );
+ Vector<Matrix> classvector;
+ DALI_TEST_EQUALS(ZERO, classvector.Count(), TEST_LOCATION);
+ DALI_TEST_EQUALS(ZERO, classvector.Capacity(), TEST_LOCATION);
- classvector.PushBack( Matrix() );
+ classvector.PushBack(Matrix());
- DALI_TEST_EQUALS( 1u, classvector.Count(), TEST_LOCATION );
- DALI_TEST_GREATER( classvector.Capacity(), ZERO, TEST_LOCATION );
+ DALI_TEST_EQUALS(1u, classvector.Count(), TEST_LOCATION);
+ DALI_TEST_GREATER(classvector.Capacity(), ZERO, TEST_LOCATION);
- classvector.PushBack( Matrix::IDENTITY );
+ classvector.PushBack(Matrix::IDENTITY);
- DALI_TEST_EQUALS( 2u, classvector.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS(2u, classvector.Count(), TEST_LOCATION);
- DALI_TEST_EQUALS( Matrix(), classvector[ 0 ], TEST_LOCATION );
- DALI_TEST_EQUALS( Matrix::IDENTITY, classvector[ 1 ], TEST_LOCATION );
+ DALI_TEST_EQUALS(Matrix(), classvector[0], TEST_LOCATION);
+ DALI_TEST_EQUALS(Matrix::IDENTITY, classvector[1], TEST_LOCATION);
tet_result(TET_PASS); // for now
END_TEST;
int UtcDaliVectorCpp11ForP(void)
{
- Vector< Vector3 > classvector;
- for ( auto i : classvector )
+ Vector<Vector3> classvector;
+ for(auto i : classvector)
{
std::ignore = i;
- tet_result( TET_FAIL );
+ tet_result(TET_FAIL);
}
- classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
- classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
- classvector.PushBack( Vector3( 0.1f, 0.2f, 0.3f ) );
+ classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f));
+ classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f));
+ classvector.PushBack(Vector3(0.1f, 0.2f, 0.3f));
- for ( auto i : classvector )
+ for(auto i : classvector)
{
- DALI_TEST_EQUALS( Vector3( 0.1f, 0.2f, 0.3f ), i, TEST_LOCATION );
+ DALI_TEST_EQUALS(Vector3(0.1f, 0.2f, 0.3f), i, TEST_LOCATION);
}
END_TEST;
movedFrom.PushBack(Vector3::NEGATIVE_ZAXIS);
Vector<Vector3> movedTo(std::move(movedFrom));
- DALI_TEST_EQUALS( movedTo.Size(), 3u, TEST_LOCATION);
- DALI_TEST_EQUALS( movedFrom.Size(), 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(movedTo.Size(), 3u, TEST_LOCATION);
+ DALI_TEST_EQUALS(movedFrom.Size(), 0u, TEST_LOCATION);
END_TEST;
}
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <cmath> // isfinite
#include <iostream>
#include <sstream>
-#include <cmath> // isfinite
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
using namespace Dali;
int UtcDaliVector2Constructor01P(void)
{
TestApplication application;
- Vector2 vec2;
+ Vector2 vec2;
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);
+ 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 UtcDaliVector2Constructor03P(void)
{
TestApplication application;
- float array[] = {1.f,1.f};
- Vector2 vec2(array);
+ 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 UtcDaliVector2Constructor04P(void)
{
TestApplication application;
- Vector3 vec3(1.f,1.f,1.f);
- Vector3 vec2(vec3);
+ 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 UtcDaliVector2Constructor05P(void)
{
TestApplication application;
- Vector4 vec4(1.f,1.f,1.f,1.f);
- Vector2 vec2(vec4);
+ Vector4 vec4(1.f, 1.f, 1.f, 1.f);
+ Vector2 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 UtcDaliVector2ConstructorUint16PairP(void)
{
TestApplication application;
- Uint16Pair pair( 20, 30 );
- Vector2 vec2(pair);
+ Uint16Pair pair(20, 30);
+ Vector2 vec2(pair);
DALI_TEST_EQUALS(vec2.x, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec2.y, 30.0f, 0.001, TEST_LOCATION);
END_TEST;
int UtcDaliVector2CopyConstructor01P(void)
{
TestApplication application;
- float array[] = {1.f,1.f};
- Vector2 vec2;
+ 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);
int UtcDaliVector2CopyConstructor02P(void)
{
TestApplication application;
- Vector3 vec3(1.f,1.f,1.f);
- Vector3 vec2;
+ 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);
int UtcDaliVector2CopyConstructor03P(void)
{
TestApplication application;
- Vector4 vec4(1.f,1.f,1.f,1.f);
- Vector3 vec2;
+ 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);
int UtcDaliVector2CopyConstructor04P(void)
{
TestApplication application;
- Vector2 vec0( 10.f, 20.f );
- Vector2 vec1( vec0 );
+ Vector2 vec0(10.f, 20.f);
+ Vector2 vec1(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
END_TEST;
int UtcDaliVector2MoveConstructor(void)
{
TestApplication application;
- Vector2 vec0( 10.f, 20.f );
- Vector2 vec1 = std::move( vec0 );
+ Vector2 vec0(10.f, 20.f);
+ Vector2 vec1 = std::move(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
int UtcDaliVector2CopyAssignment(void)
{
TestApplication application;
- Vector2 vec0( 10.f, 20.f );
- Vector2 vec1;
+ Vector2 vec0(10.f, 20.f);
+ Vector2 vec1;
vec1 = vec0;
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
int UtcDaliVector2MoveAssignment(void)
{
TestApplication application;
- Vector2 vec0( 10.f, 20.f );
- Vector2 vec1;
- vec1 = std::move( vec0 );
+ Vector2 vec0(10.f, 20.f);
+ Vector2 vec1;
+ vec1 = std::move(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
int UtcDaliVector2AssignP(void)
{
TestApplication application;
- Vector2 v1(10.0f, 20.0f);
- Vector2 r0(11.0f, 22.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(11.0f, 22.0f);
v1 = r0;
DALI_TEST_EQUALS(v1, r0, TEST_LOCATION);
int UtcDaliVector2AssignP02(void)
{
TestApplication application;
- Vector2 v1(10.0f, 20.0f);
- Vector4 r0(11.0f, 22.0f, 33.f, 44.f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector4 r0(11.0f, 22.0f, 33.f, 44.f);
v1 = r0;
DALI_TEST_EQUALS(v1, Vector2(r0.x, r0.y), TEST_LOCATION);
int UtcDaliVector2AssignP03(void)
{
TestApplication application;
- Vector2 v1(10.0f, 20.0f);
- Vector3 r0(11.0f, 22.0f, 33.f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector3 r0(11.0f, 22.0f, 33.f);
v1 = r0;
DALI_TEST_EQUALS(v1, Vector2(r0.x, r0.y), TEST_LOCATION);
int UtcDaliVector2AddP(void)
{
TestApplication application;
- Vector2 v0(1.0f, 2.0f);
- Vector2 v1(10.0f, 20.0f);
- Vector2 r0(11.0f, 22.0f);
+ Vector2 v0(1.0f, 2.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(11.0f, 22.0f);
- Vector2 v2 = v0+v1;
+ 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);
+ 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);
int UtcDaliVector2SubtractP(void)
{
TestApplication application;
- Vector2 v0(11.0f, 22.0f);
- Vector2 v1(10.0f, 20.0f);
- Vector2 r0(1.0f, 2.0f);
+ Vector2 v0(11.0f, 22.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(1.0f, 2.0f);
- Vector2 v2 = v0-v1;
+ 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);
+ 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);
int UtcDaliVector2NegateP(void)
{
TestApplication application;
- Vector2 v1(10.0f, 20.0f);
- Vector2 r0(-10.0f, -20.0f);
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(-10.0f, -20.0f);
Vector2 v2 = -v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
int UtcDaliVector2Multiply01P(void)
{
TestApplication application;
- Vector2 v0(2.0f, 3.0f);
- Vector2 v1(10.0f, 20.0f);
- Vector2 r0(20.0f, 60.0f);
+ 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);
int UtcDaliVector2Multiply02P(void)
{
TestApplication application;
- Vector2 v0(2.0f, 3.0f);
- Vector2 r0(20.0f, 30.0f);
+ Vector2 v0(2.0f, 3.0f);
+ Vector2 r0(20.0f, 30.0f);
Vector2 v2 = v0 * 10.f;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
int UtcDaliVector2MultiplyAssign01P(void)
{
TestApplication application;
- Vector2 v0(2.0f, 3.0f);
- Vector2 v1(10.0f, 20.0f);
- Vector2 r0(20.0f, 60.0f);
+ 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);
int UtcDaliVector2MultiplyAssign02P(void)
{
TestApplication application;
- Vector2 v0(2.0f, 3.0f);
- Vector2 r0(20.0f, 30.0f);
+ Vector2 v0(2.0f, 3.0f);
+ Vector2 r0(20.0f, 30.0f);
v0 *= 10.f;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
int UtcDaliVector2Divide01P(void)
{
TestApplication application;
- Vector2 v0(1.0f, 1.0f);
- Vector2 v1(2.0f, 3.0f);
- Vector2 v2(4.0f, 9.0f);
+ Vector2 v0(1.0f, 1.0f);
+ Vector2 v1(2.0f, 3.0f);
+ Vector2 v2(4.0f, 9.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(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 UtcDaliVector2Divide02P(void)
{
TestApplication application;
- Vector2 v0(1.0f, 1.0f);
- Vector2 v1(3.0f, 3.0f);
- Vector2 v2(9.0f, 9.0f);
+ 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);
+ 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 v0(1.0f, 1.0f);
+ Vector2 v1(2.0f, 3.0f);
+ Vector2 v2(4.0f, 9.0f);
Vector2 v4(v0);
v4 /= v0;
int UtcDaliVector2DivideAssign02P(void)
{
TestApplication application;
- Vector2 v0(1.0f, 1.0f);
- Vector2 v1(3.0f, 3.0f);
+ Vector2 v0(1.0f, 1.0f);
+ Vector2 v1(3.0f, 3.0f);
Vector2 v4(v0);
v4 /= 1.f;
int UtcDaliVector2EqualsP(void)
{
TestApplication application;
- Vector2 v0(1.0f, 2.0f);
- Vector2 v1(1.0f, 2.0f);
+ Vector2 v0(1.0f, 2.0f);
+ Vector2 v1(1.0f, 2.0f);
DALI_TEST_CHECK(v0 == v1);
int UtcDaliVector2NotEqualsP(void)
{
TestApplication application;
- Vector2 v0(1.0f, 2.0f);
- Vector2 v1(1.0f, 2.0f);
+ Vector2 v0(1.0f, 2.0f);
+ Vector2 v1(1.0f, 2.0f);
Vector2 v2 = Vector2(0.0f, 2.0f);
DALI_TEST_CHECK(v0 != v2);
int UtcDaliVector2OperatorSubscriptP(void)
{
TestApplication application;
- Vector2 testVector(1.0f, 2.0f);
+ 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 );
+ 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 );
+ DALI_TEST_EQUALS(testVector.x, 3.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(testVector.y, 4.0f, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector2OperatorSubscriptN(void)
{
TestApplication application;
- Vector2 testVector(1.0f, 2.0f);
+ Vector2 testVector(1.0f, 2.0f);
try
{
(void)w; // Suppress unused variable warning
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "Vector element index out of bounds", TEST_LOCATION);
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "Vector element index out of bounds", TEST_LOCATION);
}
END_TEST;
int UtcDaliVector2OperatorConstSubscriptP(void)
{
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 );
+ 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);
+ const Vector2 testVector2(3.0f, 4.0f);
try
{
(void)w; // Suppress unused variable warning
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "Vector element index out of bounds" , TEST_LOCATION);
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "Vector element index out of bounds", TEST_LOCATION);
}
-
END_TEST;
}
-
int UtcDaliVector2LengthP(void)
{
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);
+ Vector2 v(1.0f, 2.0f);
+ DALI_TEST_EQUALS(v.Length(), sqrtf(v.x * v.x + v.y * v.y), 0.001f, TEST_LOCATION);
Vector2 v1(0.0f, 0.0f);
DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION);
int UtcDaliVector2LengthSquaredP(void)
{
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 v(1.0f, 2.0f);
+ DALI_TEST_EQUALS(v.LengthSquared(), v.x * v.x + v.y * v.y, 0.001f, TEST_LOCATION);
Vector2 v1(0.0f, 0.0f);
DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION);
int UtcDaliVector2NormalizeP(void)
{
TestApplication application;
- for (float f=0.0f; f<6.0f; f+=1.0f)
+ for(float f = 0.0f; f < 6.0f; f += 1.0f)
{
- Vector2 v(cosf(f)*10.0f, cosf(f+1.0f)*10.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);
}
int UtcDaliVector2NormalizeN(void)
{
TestApplication application;
- Vector2 v(0.0f, 0.0f);
+ Vector2 v(0.0f, 0.0f);
v.Normalize();
DALI_TEST_EQUALS(v.LengthSquared(), 0.0f, 0.00001f, TEST_LOCATION);
END_TEST;
Vector2 min(1.0f, 4.0f);
Vector2 max(9.0f, 6.0f);
- v0.Clamp( min, max );
- v1.Clamp( min, max );
- v2.Clamp( min, max );
- v3.Clamp( min, max );
- v4.Clamp( min, max );
+ v0.Clamp(min, max);
+ v1.Clamp(min, max);
+ v2.Clamp(min, max);
+ v3.Clamp(min, max);
+ v4.Clamp(min, max);
- DALI_TEST_EQUALS( v0, Vector2(2.0f, 4.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v1, Vector2(1.0f, 4.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v2, Vector2(9.0f, 5.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v3, Vector2(8.0f, 6.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v4, Vector2(4.9f, 5.1f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(v0, Vector2(2.0f, 4.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v1, Vector2(1.0f, 4.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v2, Vector2(9.0f, 5.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v3, Vector2(8.0f, 6.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v4, Vector2(4.9f, 5.1f), 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector2AsFloatP(void)
{
TestApplication application;
- Vector2 vec2(1.f,1.f);
- float* p = vec2.AsFloat();
+ Vector2 vec2(1.f, 1.f);
+ float* p = vec2.AsFloat();
- DALI_TEST_EQUALS( p[0], 1.f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( p[1], 1.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(p[0], 1.f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(p[1], 1.f, 0.01f, TEST_LOCATION);
p[0] = 2.f;
p[1] = 2.f;
- DALI_TEST_EQUALS( p[0], 2.f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( p[1], 2.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(p[0], 2.f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(p[1], 2.f, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector2ConstAsFloatP(void)
{
TestApplication application;
- Vector2 vec2(1.f,1.f);
- const float* p = vec2.AsFloat();
+ Vector2 vec2(1.f, 1.f);
+ const float* p = vec2.AsFloat();
- DALI_TEST_EQUALS( p[0], 1.f, 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( p[1], 1.f, 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(p[0], 1.f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(p[1], 1.f, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector2XWidthP(void)
{
TestApplication application;
- Vector2 vec2(1.f,1.f);
+ 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 );
+ DALI_TEST_EQUALS(vec2.x, 1.f, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(vec2.width, 1.f, 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector2YHeightP(void)
{
TestApplication application;
- Vector2 vec2(1.f,1.f);
+ 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 );
+ 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 UtcDaliVector2OStreamOperatorP(void)
{
- TestApplication application;
+ TestApplication application;
std::ostringstream oss;
Vector2 vector(1, 2);
std::string expectedOutput = "[1, 2]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ 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);
+ 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);
+ 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;
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 );
+ 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;
}
-
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <cmath> // isfinite
#include <iostream>
#include <sstream>
-#include <cmath> // isfinite
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
using namespace Dali;
int UtcDaliVector3Constructor01P(void)
{
TestApplication application;
- Vector3 va;
+ Vector3 va;
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);
int UtcDaliVector3Constructor02P(void)
{
TestApplication application;
- Vector3 va(1.f, 1.f, 1.f);
+ 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);
int UtcDaliVector3Constructor03P(void)
{
TestApplication application;
- float array [] = {1.f, 1.f, 1.f};
- Vector3 va(array);
+ 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);
int UtcDaliVector3Constructor04P(void)
{
TestApplication application;
- Vector2 vec2(1.f,1.f);
- Vector3 va(vec2);
+ 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);
int UtcDaliVector3Constructor05P(void)
{
TestApplication application;
- Vector4 vec4(1.f, 1.f, 1.f, 1.f);
- Vector3 va(vec4);
+ 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);
int UtcDaliVector3CopyConstructor(void)
{
TestApplication application;
- Vector3 vec0( 10.f, 20.f, 30.0f );
- Vector3 vec1( vec0 );
+ Vector3 vec0(10.f, 20.f, 30.0f);
+ Vector3 vec1(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION);
int UtcDaliVector3MoveConstructor(void)
{
TestApplication application;
- Vector3 vec0( 10.f, 20.f, 30.0f );
- Vector3 vec1 = std::move( vec0 );
+ Vector3 vec0(10.f, 20.f, 30.0f);
+ Vector3 vec1 = std::move(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION);
int UtcDaliVector3CopyAssignment(void)
{
TestApplication application;
- Vector3 vec0( 10.f, 20.f, 30.0f );
- Vector3 vec1;
+ Vector3 vec0(10.f, 20.f, 30.0f);
+ Vector3 vec1;
vec1 = vec0;
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
int UtcDaliVector3MoveAssignment(void)
{
TestApplication application;
- Vector3 vec0( 10.f, 20.f, 30.0f );
- Vector3 vec1;
- vec1 = std::move( vec0 );
+ Vector3 vec0(10.f, 20.f, 30.0f);
+ Vector3 vec1;
+ vec1 = std::move(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION);
int UtcDaliVector3Assign01P(void)
{
TestApplication application;
- Vector3 v0;
- const float array[] = { 1.0f, 2.0f, 3.0f };
- v0 = (const float*)array;
+ 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);
int UtcDaliVector3Assign02P(void)
{
TestApplication application;
- Vector2 vec2_q(1.0f, 2.0f);
- Vector3 vec3a;
+ Vector2 vec2_q(1.0f, 2.0f);
+ Vector3 vec3a;
vec3a = vec2_q;
DALI_TEST_EQUALS(vec3a.x, 1.0f, 0.001f, TEST_LOCATION);
int UtcDaliVector3Assign03P(void)
{
TestApplication application;
- Vector4 vec4_q(4.0f, 3.0f, 2.0f, 1.0f);
- Vector3 vec3b;
+ Vector4 vec4_q(4.0f, 3.0f, 2.0f, 1.0f);
+ Vector3 vec3b;
vec3b = vec4_q;
DALI_TEST_EQUALS(vec3b.x, 4.0f, 0.001f, TEST_LOCATION);
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 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;
+ Vector3 v2 = v0 + v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
int UtcDaliVector3Add02P(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 v0(1.0f, 2.0f, 3.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(11.0f, 22.0f, 33.0f);
v0 += v1;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
int UtcDaliVector3Subtract01P(void)
{
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 v0(11.0f, 22.0f, 33.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(1.0f, 2.0f, 3.0f);
- Vector3 v2 = v0-v1;
+ Vector3 v2 = v0 - v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
int UtcDaliVector3Subtract02P(void)
{
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 v0(11.0f, 22.0f, 33.0f);
+ Vector3 v1(10.0f, 20.0f, 30.0f);
+ Vector3 r0(1.0f, 2.0f, 3.0f);
v0 -= v1;
DALI_TEST_EQUALS(v0, r0, TEST_LOCATION);
int UtcDaliVector3Multiply01P(void)
{
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);
+ 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);
int UtcDaliVector3Multiply02P(void)
{
TestApplication application;
- Vector3 v0(2.0f, 3.0f, 4.0f);
- Vector3 r0(20.0f, 30.0f, 40.0f);
- Vector3 v2 = v0 * 10.f;
+ 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;
}
int UtcDaliVector3Multiply03P(void)
{
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);
+ 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;
int UtcDaliVector3Multiply04P(void)
{
TestApplication application;
- Vector3 v0(2.0f, 3.0f, 4.0f);
- Vector3 r0(20.0f, 30.0f, 40.0f);
+ 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;
int UtcDaliVector3Multiply05P(void)
{
TestApplication application;
- Vector3 vec3(Vector3::YAXIS);
- Quaternion rotation(Radian(Math::PI_2), Vector3::ZAXIS);
- Vector3 result(-Vector3::XAXIS);
+ 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 );
+ DALI_TEST_EQUALS(vec3, result, 0.001, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector3Divide01P(void)
{
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(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);
+ 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 UtcDaliVector3Divide02P(void)
{
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;
+ 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;
}
int UtcDaliVector3Divide03P(void)
{
TestApplication application;
- Vector3 v0(3.0f, 6.0f, 9.0f);
- Vector3 v1(1.0f, 2.0f, 3.0f);
- Vector3 v2 = v0 / 3.f;
+ 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;
}
int UtcDaliVector3Divide04P(void)
{
TestApplication application;
- Vector3 v0(3.0f, 6.0f, 9.0f);
- Vector3 v1(1.0f, 1.0f, 1.0f);
- Vector3 v4(v0);
+ 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, v1, TEST_LOCATION);
END_TEST;
int UtcDaliVector3Divide05P(void)
{
TestApplication application;
- Vector3 v0(3.0f, 6.0f, 9.0f);
- Vector3 v1(1.0f, 2.0f, 3.0f);
- Vector3 v4(v0);
+ 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;
}
-
int UtcDaliVector3NegateP(void)
{
TestApplication application;
- Vector3 v1(10.0f, 20.0f, 30.f);
- Vector3 r0(-10.0f, -20.0f, -30.f);
+ Vector3 v1(10.0f, 20.0f, 30.f);
+ Vector3 r0(-10.0f, -20.0f, -30.f);
Vector3 v2 = -v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
int UtcDaliVector3EqualsP(void)
{
TestApplication application;
- Vector3 v0(1.0f, 2.0f, 3.0f);
- Vector3 v1(1.0f, 2.0f, 3.0f);
+ Vector3 v0(1.0f, 2.0f, 3.0f);
+ Vector3 v1(1.0f, 2.0f, 3.0f);
DALI_TEST_CHECK(v0 == v1);
END_TEST;
int UtcDaliVector3NotEqualsP(void)
{
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);
+ 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);
v2 = Vector3(1.0f, 0.0f, 3.0f);
int UtcDaliVector3OperatorSubscriptP(void)
{
TestApplication application;
- Vector3 testVector(1.0f, 2.0f, 3.0f);
+ Vector3 testVector(1.0f, 2.0f, 3.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[0], 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(testVector[1], 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(testVector[2], 3.0f, TEST_LOCATION);
// write array subscripts/read struct memebers
testVector[0] = 4.0f;
testVector[1] = 5.0f;
testVector[2] = 6.0f;
- DALI_TEST_EQUALS( testVector.x, 4.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector.y, 5.0f, TEST_LOCATION );
- DALI_TEST_EQUALS( testVector.z, 6.0f, TEST_LOCATION );
+ DALI_TEST_EQUALS(testVector.x, 4.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(testVector.y, 5.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(testVector.z, 6.0f, TEST_LOCATION);
// write struct members/read array subscripts
testVector.x = 7.0f;
testVector.y = 8.0f;
testVector.z = 9.0f;
- 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 );
+ 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);
+ Vector3 testVector(1.0f, 2.0f, 3.0f);
// write struct members/read array subscripts
const Vector3 testVector2(1.0f, 2.0f, 3.0f);
- const float& x = testVector2[0];
- const float& y = testVector2[1];
- const float& z ( testVector2[2] );
+ const float& x = testVector2[0];
+ const float& y = testVector2[1];
+ const float& z(testVector2[2]);
- 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(x, 1.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(y, 2.0f, TEST_LOCATION);
+ DALI_TEST_EQUALS(z, 3.0f, TEST_LOCATION);
try
{
(void)w; // Suppress unused variable warning
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 3", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "index < 3", TEST_LOCATION);
}
try
(void)w; // Suppress unused variable warning
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
+ DALI_TEST_PRINT_ASSERT(e);
DALI_TEST_ASSERT(e, "index < 3", 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)
+ 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);
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) );
-
+ 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 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);
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 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);
int UtcDaliVector3NormalizeP(void)
{
TestApplication application;
- for (float f=0.0f; f<6.0f; f+=1.0f)
+ 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);
+ 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 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 );
+ 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 );
+ 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);
+ float values[] = {0.0f, 1.0f, 2.0f};
+ Vector3 v0(values);
- for (int i=0;i<3;++i)
+ for(int i = 0; i < 3; ++i)
{
DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION);
}
int UtcDaliVector3ConstAsFloatP(void)
{
TestApplication application;
- float values[] = {0.0f, 1.0f, 2.0f};
- Vector3 v0(values);
+ float values[] = {0.0f, 1.0f, 2.0f};
+ Vector3 v0(values);
const Vector3 v1(values);
- for (int i=0;i<3;++i)
+ for(int i = 0; i < 3; ++i)
{
DALI_TEST_EQUALS(v1.AsFloat()[i], values[i], TEST_LOCATION);
}
int UtcDaliVector3ConstAsVectorXYP(void)
{
TestApplication application;
- float values[] = {0.0f, 1.0f, 2.0f};
- const Vector3 v0(values);
+ 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);
+ float values[] = {0.0f, 1.0f, 2.0f};
+ Vector3 v0(values);
DALI_TEST_EQUALS(v0.GetVectorXY().x, values[0], TEST_LOCATION);
DALI_TEST_EQUALS(v0.GetVectorXY().y, values[1], TEST_LOCATION);
int UtcDaliVector3ConstAsVectorXZP(void)
{
TestApplication application;
- float values[] = {0.0f, 1.0f, 2.0f};
- const Vector3 v0(values);
+ float values[] = {0.0f, 1.0f, 2.0f};
+ const Vector3 v0(values);
DALI_TEST_EQUALS(v0.GetVectorYZ().x, values[1], TEST_LOCATION);
DALI_TEST_EQUALS(v0.GetVectorYZ().y, values[2], TEST_LOCATION);
int UtcDaliVector3AsVectorXZP(void)
{
TestApplication application;
- float values[] = {0.0f, 1.0f, 2.0f};
- Vector3 v0(values);
+ 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);
int UtcDaliVector3OStreamOperatorP(void)
{
- TestApplication application;
+ TestApplication application;
std::ostringstream oss;
Vector3 vector(1, 2, 3);
std::string expectedOutput = "[1, 2, 3]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ 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);
+ 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);
+ 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 );
+ 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 );
+ 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 UtcDaliVector3ConstantsP(void)
{
TestApplication application;
- Vector3 va = Vector3::ZERO;
- Vector3 vb = Vector3::ONE;
- Vector3 vc = Vector3::XAXIS;
+ 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(vc.z, 0.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
-
*
*/
+#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
#include <iostream>
#include <sstream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
using namespace Dali;
void utc_dali_vector4_startup(void)
int UtcDaliVector4Constructor03P(void)
{
- float f [] = {1.0f, 2.0f, 3.0f, 4.f};
+ 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);
int UtcDaliVector4CopyConstructor(void)
{
TestApplication application;
- Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f );
- Vector4 vec1( vec0 );
+ Vector4 vec0(10.f, 20.f, 30.0f, 40.0f);
+ Vector4 vec1(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION);
int UtcDaliVector4MoveConstructor(void)
{
TestApplication application;
- Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f );
- Vector4 vec1 = std::move( vec0 );
+ Vector4 vec0(10.f, 20.f, 30.0f, 40.0f);
+ Vector4 vec1 = std::move(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION);
int UtcDaliVector4CopyAssignment(void)
{
TestApplication application;
- Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f );
- Vector4 vec1;
+ Vector4 vec0(10.f, 20.f, 30.0f, 40.0f);
+ Vector4 vec1;
vec1 = vec0;
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
int UtcDaliVector4MoveAssignment(void)
{
TestApplication application;
- Vector4 vec0( 10.f, 20.f, 30.0f, 40.0f );
- Vector4 vec1;
- vec1 = std::move( vec0 );
+ Vector4 vec0(10.f, 20.f, 30.0f, 40.0f);
+ Vector4 vec1;
+ vec1 = std::move(vec0);
DALI_TEST_EQUALS(vec1.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.y, 20.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(vec1.z, 30.0f, 0.001, TEST_LOCATION);
int UtcDaliVector4Assign01P(void)
{
- Vector4 v0;
- const float array[] = { 1.0f, 2.0f, 3.0f, 4.f };
- v0 = (const float*)array;
+ 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, 0.0f, 0.001f, TEST_LOCATION);
DALI_TEST_EQUALS(v0.z, 0.0f, 0.001f, TEST_LOCATION);
v0.w = v0.z = 99.f;
- v0 = vec2;
+ 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);
Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
Vector4 r0(11.0f, 22.0f, 33.0f, 44.0f);
- Vector4 v2 = v0+v1;
+ Vector4 v2 = v0 + v1;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
Vector4 v1(10.0f, 20.0f, 30.0f, 40.0f);
Vector4 r0(1.0f, 2.0f, 3.0f, 4.0f);
- Vector4 v2 = v0-v1;
+ Vector4 v2 = v0 - v1;
DALI_TEST_EQUALS(v2, 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 v1(10.0f, 20.0f, 30.0f, 40.0f);
Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f);
Vector4 v2 = v0 * v1;
int UtcDaliVector4Multiply02P(void)
{
- Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ 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;
+ 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 v1(10.0f, 20.0f, 30.0f, 40.0f);
Vector4 r0(20.0f, 60.0f, 120.0f, 200.0f);
v0 *= v1;
int UtcDaliVector4Multiply04P(void)
{
- Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
const Vector4 r0(20.0f, 40.0f, 80.0f, 160.0f);
- Vector4 v2(r0);
+ Vector4 v2(r0);
v0 *= 10.0f;
DALI_TEST_EQUALS(v2, r0, TEST_LOCATION);
END_TEST;
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);
-
+ 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);
+ 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);
+ 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);
int UtcDaliVector4Divide04P(void)
{
- Vector4 v0(2.0f, 4.0f, 8.0f, 16.0f);
+ 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);
+ 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;
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 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);
int UtcDaliVector4EqualsP(void)
{
- Vector4 v0(1.0f, 2.0f, 3.0f, 4.0f);
- Vector4 v1(1.0f, 2.0f, 3.0f, 4.0f);
+ 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 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);
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 );
+ 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[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 );
+ 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.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 );
+ 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] );
+ 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 );
+ 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
{
(void)w; // Suppress unused variable warning
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "index < 4", TEST_LOCATION);
}
try
(void)w; // Suppress unused variable warning
tet_result(TET_FAIL);
}
- catch (Dali::DaliException& e)
+ catch(Dali::DaliException& e)
{
- DALI_TEST_PRINT_ASSERT( e );
- DALI_TEST_ASSERT( e, "index < 4", TEST_LOCATION );
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_ASSERT(e, "index < 4", TEST_LOCATION);
}
END_TEST;
}
DALI_TEST_EQUALS(Vector4(1.0f, 0.0f, 0.0f, 1.0f).Dot(Vector4(1.0f, 0.0f, 0.0f, 1.0f)), 1.0f, TEST_LOCATION);
// Test v0 . v0 and v0 . v1 (v1 is always 90 degrees out of phase with v0)
- for (float x = 0; x<6.0f; x+=1.0f)
+ for(float x = 0; x < 6.0f; x += 1.0f)
{
// vectors rotating in the XY plane.
Vector4 v0(cosf(x), sinf(x), 0.0f, 1.0f);
DALI_TEST_EQUALS(Vector4(1.0f, 0.0f, 0.0f, 1.0f).Dot(Vector3(1.0f, 0.0f, 0.0f)), 1.0f, TEST_LOCATION);
// Test v0 . v0b and v0 . v1 (v1 is always 90 degrees out of phase with v0)
- for (float x = 0; x<6.0f; x+=1.0f)
+ for(float x = 0; x < 6.0f; x += 1.0f)
{
// vectors rotating in the XY plane.
Vector4 v0(cosf(x), sinf(x), 0.0f, 1.0f);
DALI_TEST_EQUALS(v0.Dot(v0b), 1.0f, 0.0001f, TEST_LOCATION);
// vectors rotating in the XZ plane.
- v0 = Vector4(cosf(x), 0.0f, sinf(x), 0.0f);
+ v0 = Vector4(cosf(x), 0.0f, sinf(x), 0.0f);
v0b = Vector3(cosf(x), 0.0f, sinf(x));
- v1 = Vector3(sinf(x), 0.0f, -cosf(x));
+ v1 = Vector3(sinf(x), 0.0f, -cosf(x));
DALI_TEST_EQUALS(v0.Dot(v1), 0.0f, 0.0001f, TEST_LOCATION);
DALI_TEST_EQUALS(v0.Dot(v0b), 1.0f, 0.0001f, TEST_LOCATION);
}
DALI_TEST_EQUALS(Vector4(1.0f, 0.0f, 0.0f, 1.0f).Dot4(Vector4(1.0f, 0.0f, 0.0f, 1.0f)), 2.0f, TEST_LOCATION);
- for (float x = 0; x<6.0f; x+=1.0f)
+ for(float x = 0; x < 6.0f; x += 1.0f)
{
Vector4 v0(cosf(x), sinf(x), 0.0f, 1.0f);
Vector4 v1(sinf(x), -cosf(x), 0.0f, 1.0f);
v0.Normalize();
Vector4 v1 = v0 * 2.0f;
- DALI_TEST_EQUALS(v0.Dot4(v1), 2.0f + 3.0f*6.0f, 0.001f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v0.Dot4(v1), 2.0f + 3.0f * 6.0f, 0.001f, TEST_LOCATION);
END_TEST;
}
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 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);
DALI_TEST_EQUALS(v0.Cross(v1), result, 0.001f, TEST_LOCATION);
END_TEST;
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);
+ DALI_TEST_EQUALS(v.Length(), sqrtf(v.x * v.x + v.y * v.y + v.z * v.z), 0.001f, TEST_LOCATION);
Vector4 v1(0.0f, 0.0f, 0.0f, 0.0f);
DALI_TEST_EQUALS(v1.Length(), 0.0f, TEST_LOCATION);
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);
+ DALI_TEST_EQUALS(v.LengthSquared(), v.x * v.x + v.y * v.y + v.z * v.z, 0.001f, TEST_LOCATION);
Vector4 v1(0.0f, 0.0f, 0.0f, 0.0f);
DALI_TEST_EQUALS(v1.LengthSquared(), 0.0f, TEST_LOCATION);
int UtcDaliVector4NormalizeP(void)
{
- for (float f=0.0f; f<6.0f; f+=1.0f)
+ 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);
+ 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 min(1.0f, -2.0f, -8.0f, -16.0f);
Vector4 max(2.0f, 4.0f, 4.0f, -8.0f);
- v0.Clamp( min, max );
- v1.Clamp( min, max );
- v2.Clamp( min, max );
- v3.Clamp( min, max );
- v4.Clamp( min, max );
+ v0.Clamp(min, max);
+ v1.Clamp(min, max);
+ v2.Clamp(min, max);
+ v3.Clamp(min, max);
+ v4.Clamp(min, max);
- DALI_TEST_EQUALS( v0, Vector4( 2.0f, 0.8f, 0.0f, -8.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v1, Vector4( 1.0f, 2.0f, 4.0f, -10.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v2, Vector4( 2.0f, 4.0f, 0.0f, -8.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v3, Vector4( 2.0f, 4.0f, 4.0f, -16.0f), 0.01f, TEST_LOCATION );
- DALI_TEST_EQUALS( v4, Vector4( 2.0f, 4.0f, 4.0f, -8.0f), 0.01f, TEST_LOCATION );
+ DALI_TEST_EQUALS(v0, Vector4(2.0f, 0.8f, 0.0f, -8.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v1, Vector4(1.0f, 2.0f, 4.0f, -10.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v2, Vector4(2.0f, 4.0f, 0.0f, -8.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v3, Vector4(2.0f, 4.0f, 4.0f, -16.0f), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(v4, Vector4(2.0f, 4.0f, 4.0f, -8.0f), 0.01f, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector4AsFloatP(void)
{
- float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
+ float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
Vector4 v0(values);
- for (int i=0;i<4;++i)
+ for(int i = 0; i < 4; ++i)
{
DALI_TEST_EQUALS(v0.AsFloat()[i], values[i], TEST_LOCATION);
}
int UtcDaliVector4ConstAsFloatP(void)
{
- float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
+ float values[] = {0.0f, 1.0f, 2.0f, 3.0f};
Vector4 v0(values);
const Vector4 v1(values);
- for (int i=0;i<4;++i)
+ for(int i = 0; i < 4; ++i)
{
DALI_TEST_EQUALS(v1.AsFloat()[i], values[i], TEST_LOCATION);
}
std::string expectedOutput = "[1, 2, 3, 4]";
- DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ DALI_TEST_EQUALS(oss.str(), expectedOutput, TEST_LOCATION);
END_TEST;
}
int UtcDaliVector4ConstantsP(void)
{
- float f[] = {2.0f, 3.0f, 4.0f, 5.0f};
+ 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);
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
TestApplication application;
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+ texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat );
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
- DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
END_TEST;
}
int UtcDaliVertexBufferNew02(void)
{
TestApplication application;
- VertexBuffer vertexBuffer;
- DALI_TEST_EQUALS( (bool)vertexBuffer, false, TEST_LOCATION );
+ VertexBuffer vertexBuffer;
+ DALI_TEST_EQUALS((bool)vertexBuffer, false, TEST_LOCATION);
END_TEST;
}
TestApplication application;
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+ texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat );
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
- BaseHandle handle(vertexBuffer);
+ BaseHandle handle(vertexBuffer);
VertexBuffer vertexBuffer2 = VertexBuffer::DownCast(handle);
- DALI_TEST_EQUALS( (bool)vertexBuffer2, true, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)vertexBuffer2, true, TEST_LOCATION);
END_TEST;
}
{
TestApplication application;
- Handle handle = Handle::New(); // Create a custom object
+ Handle handle = Handle::New(); // Create a custom object
VertexBuffer vertexBuffer = VertexBuffer::DownCast(handle);
- DALI_TEST_EQUALS( (bool)vertexBuffer, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)vertexBuffer, false, TEST_LOCATION);
END_TEST;
}
VertexBuffer vertexBufferCopy(vertexBuffer);
- DALI_TEST_EQUALS( (bool)vertexBufferCopy, true, TEST_LOCATION );
- DALI_TEST_EQUALS( vertexBufferCopy.GetSize(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)vertexBufferCopy, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(vertexBufferCopy.GetSize(), 0u, TEST_LOCATION);
END_TEST;
}
VertexBuffer vertexBuffer = CreateVertexBuffer();
VertexBuffer vertexBuffer2;
- DALI_TEST_EQUALS( (bool)vertexBuffer2, false, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)vertexBuffer2, false, TEST_LOCATION);
vertexBuffer2 = vertexBuffer;
- DALI_TEST_EQUALS( (bool)vertexBuffer2, true, TEST_LOCATION );
- DALI_TEST_EQUALS( vertexBuffer2.GetSize(), 0u, TEST_LOCATION );
+ DALI_TEST_EQUALS((bool)vertexBuffer2, true, TEST_LOCATION);
+ DALI_TEST_EQUALS(vertexBuffer2.GetSize(), 0u, TEST_LOCATION);
END_TEST;
}
TestApplication application;
VertexBuffer vertexBuffer = CreateVertexBuffer();
- DALI_TEST_CHECK( vertexBuffer );
- DALI_TEST_EQUALS( 1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, vertexBuffer.GetSize(), TEST_LOCATION );
+ DALI_TEST_CHECK(vertexBuffer);
+ DALI_TEST_EQUALS(1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, vertexBuffer.GetSize(), TEST_LOCATION);
- VertexBuffer move = std::move( vertexBuffer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, move.GetSize(), TEST_LOCATION );
- DALI_TEST_CHECK( !vertexBuffer );
+ VertexBuffer move = std::move(vertexBuffer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, move.GetSize(), TEST_LOCATION);
+ DALI_TEST_CHECK(!vertexBuffer);
END_TEST;
}
TestApplication application;
VertexBuffer vertexBuffer = CreateVertexBuffer();
- DALI_TEST_CHECK( vertexBuffer );
- DALI_TEST_EQUALS( 1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, vertexBuffer.GetSize(), TEST_LOCATION );
+ DALI_TEST_CHECK(vertexBuffer);
+ DALI_TEST_EQUALS(1, vertexBuffer.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, vertexBuffer.GetSize(), TEST_LOCATION);
VertexBuffer move;
- move = std::move( vertexBuffer );
- DALI_TEST_CHECK( move );
- DALI_TEST_EQUALS( 1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION );
- DALI_TEST_EQUALS( 0u, move.GetSize(), TEST_LOCATION );
- DALI_TEST_CHECK( !vertexBuffer );
+ move = std::move(vertexBuffer);
+ DALI_TEST_CHECK(move);
+ DALI_TEST_EQUALS(1, move.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0u, move.GetSize(), TEST_LOCATION);
+ DALI_TEST_CHECK(!vertexBuffer);
END_TEST;
}
TestApplication application;
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+ texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
{
- VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat );
- DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION );
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
+ DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
const float halfQuadSize = .5f;
- struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+ struct TexturedQuadVertex
+ {
+ Vector2 position;
+ Vector2 textureCoordinates;
+ };
TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+ {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+ {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+ {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
- vertexBuffer.SetData( texturedQuadVertexData, 4 );
+ vertexBuffer.SetData(texturedQuadVertexData, 4);
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer );
+ geometry.AddVertexBuffer(vertexBuffer);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
application.SendNotification();
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
-
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ application.GetGlAbstraction().GetBufferDataCalls();
- DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION);
}
// end of scope to let the buffer and geometry die; do another notification and render to get the deletion processed
application.SendNotification();
TestApplication application;
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
+ texturedQuadVertexFormat["aPosition"] = Property::VECTOR2;
texturedQuadVertexFormat["aVertexCoord"] = Property::VECTOR2;
- VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat );
- DALI_TEST_EQUALS( (bool)vertexBuffer, true, TEST_LOCATION );
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
+ DALI_TEST_EQUALS((bool)vertexBuffer, true, TEST_LOCATION);
const float halfQuadSize = .5f;
- struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; };
+ struct TexturedQuadVertex
+ {
+ Vector2 position;
+ Vector2 textureCoordinates;
+ };
TexturedQuadVertex texturedQuadVertexData[4] = {
- { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) },
- { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) },
- { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) },
- { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } };
+ {Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f)},
+ {Vector2(halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f)},
+ {Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f)},
+ {Vector2(halfQuadSize, halfQuadSize), Vector2(1.f, 1.f)}};
- vertexBuffer.SetData( texturedQuadVertexData, 4 );
+ vertexBuffer.SetData(texturedQuadVertexData, 4);
Geometry geometry = Geometry::New();
- geometry.AddVertexBuffer( vertexBuffer );
+ geometry.AddVertexBuffer(vertexBuffer);
- Shader shader = CreateShader();
+ Shader shader = CreateShader();
Renderer renderer = Renderer::New(geometry, shader);
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE,Vector3::ONE * 100.f);
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector3::ONE * 100.f);
actor.AddRenderer(renderer);
application.GetScene().Add(actor);
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
application.GetGlAbstraction().GetBufferDataCalls();
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION);
}
// Re-upload the data on the vertexBuffer
- vertexBuffer.SetData( texturedQuadVertexData, 4 );
+ vertexBuffer.SetData(texturedQuadVertexData, 4);
application.SendNotification();
application.Render(0);
application.GetGlAbstraction().GetBufferSubDataCalls();
const TestGlAbstraction::BufferDataCalls& bufferDataCalls =
- application.GetGlAbstraction().GetBufferDataCalls();
+ application.GetGlAbstraction().GetBufferDataCalls();
- DALI_TEST_EQUALS( bufferSubDataCalls.size(), 1u, TEST_LOCATION );
- DALI_TEST_EQUALS( bufferDataCalls.size(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferSubDataCalls.size(), 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(bufferDataCalls.size(), 1u, TEST_LOCATION);
- if ( bufferSubDataCalls.size() )
+ if(bufferSubDataCalls.size())
{
- DALI_TEST_EQUALS( bufferSubDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION );
+ DALI_TEST_EQUALS(bufferSubDataCalls[0], sizeof(texturedQuadVertexData), TEST_LOCATION);
}
}
TestApplication application;
Property::Map texturedQuadVertexFormat;
- texturedQuadVertexFormat["aPosition"] = Property::MAP;
+ texturedQuadVertexFormat["aPosition"] = Property::MAP;
texturedQuadVertexFormat["aVertexCoord"] = Property::STRING;
try
{
- VertexBuffer vertexBuffer = VertexBuffer::New( texturedQuadVertexFormat );
+ VertexBuffer vertexBuffer = VertexBuffer::New(texturedQuadVertexFormat);
tet_result(TET_FAIL);
}
- catch ( Dali::DaliException& e )
+ catch(Dali::DaliException& e)
{
- DALI_TEST_ASSERT( e, "Property::Type not supported in VertexBuffer", TEST_LOCATION );
+ DALI_TEST_ASSERT(e, "Property::Type not supported in VertexBuffer", TEST_LOCATION);
}
END_TEST;
}
-
int UtcDaliVertexBufferSetDataNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::VertexBuffer instance;
try
{
- void* arg1(nullptr);
+ void* arg1(nullptr);
unsigned long arg2(0u);
- instance.SetData(arg1,arg2);
+ instance.SetData(arg1, arg2);
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
int UtcDaliVertexBufferGetSizeNegative(void)
{
- TestApplication application;
+ TestApplication application;
Dali::VertexBuffer instance;
try
{
*
*/
-#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
using namespace Dali;
namespace
{
-
/*******************************************************************************
*
* Custom Actor
{
struct MyTestCustomActor : public CustomActorImpl
{
- typedef Signal< void ()> SignalType;
- typedef Signal< void (float)> SignalTypeFloat;
+ typedef Signal<void()> SignalType;
+ typedef Signal<void(float)> SignalTypeFloat;
- MyTestCustomActor() : CustomActorImpl( ActorFlags() )
- { }
+ MyTestCustomActor()
+ : CustomActorImpl(ActorFlags())
+ {
+ }
virtual ~MyTestCustomActor()
- { }
+ {
+ }
void ResetCallStack()
{
}
// From CustomActorImpl
- virtual void OnSceneConnection( int depth )
+ virtual void OnSceneConnection(int depth)
{
}
virtual void OnSceneDisconnection()
}
virtual Vector3 GetNaturalSize()
{
- return Vector3( 0.0f, 0.0f, 0.0f );
+ return Vector3(0.0f, 0.0f, 0.0f);
}
- virtual float GetHeightForWidth( float width )
+ virtual float GetHeightForWidth(float width)
{
return 0.0f;
}
- virtual float GetWidthForHeight( float height )
+ virtual float GetWidthForHeight(float height)
{
return 0.0f;
}
- virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+ virtual void OnRelayout(const Vector2& size, RelayoutContainer& container)
{
}
- virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
+ virtual void OnSetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
{
}
- virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
+ virtual void OnCalculateRelayoutSize(Dimension::Type dimension)
{
}
- virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
+ virtual float CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
{
return 0.0f;
}
- virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
+ virtual void OnLayoutNegotiated(float size, Dimension::Type dimension)
{
}
- virtual bool RelayoutDependentOnChildren( Dimension::Type dimension = Dimension::ALL_DIMENSIONS )
+ virtual bool RelayoutDependentOnChildren(Dimension::Type dimension = Dimension::ALL_DIMENSIONS)
{
return false;
}
public:
-
SignalType mSignal;
};
class MyTestCustomActor : public CustomActor
{
public:
-
- typedef Signal< void ()> SignalType;
- typedef Signal< void (float)> SignalTypeFloat;
+ typedef Signal<void()> SignalType;
+ typedef Signal<void(float)> SignalTypeFloat;
MyTestCustomActor()
{
static MyTestCustomActor New()
{
Impl::MyTestCustomActor* p = new Impl::MyTestCustomActor;
- return MyTestCustomActor( *p ); // takes ownership
+ return MyTestCustomActor(*p); // takes ownership
}
virtual ~MyTestCustomActor()
{
}
- static MyTestCustomActor DownCast( BaseHandle handle )
+ static MyTestCustomActor DownCast(BaseHandle handle)
{
MyTestCustomActor result;
- CustomActor custom = Dali::CustomActor::DownCast( handle );
- if ( custom )
+ CustomActor custom = Dali::CustomActor::DownCast(handle);
+ if(custom)
{
CustomActorImpl& customImpl = custom.GetImplementation();
Impl::MyTestCustomActor* impl = dynamic_cast<Impl::MyTestCustomActor*>(&customImpl);
- if (impl)
+ if(impl)
{
result = MyTestCustomActor(customImpl.GetOwner());
}
SignalType& GetCustomSignal()
{
Dali::RefObject& obj = GetImplementation();
- return static_cast<Impl::MyTestCustomActor&>( obj ).mSignal;
+ return static_cast<Impl::MyTestCustomActor&>(obj).mSignal;
}
MyTestCustomActor(Internal::CustomActor* internal)
{
}
- MyTestCustomActor( Impl::MyTestCustomActor& impl )
- : CustomActor( impl )
+ MyTestCustomActor(Impl::MyTestCustomActor& impl)
+ : CustomActor(impl)
{
}
};
-}
+} // namespace
int UtcDaliWeakHandleBaseConstructorVoid(void)
{
TestApplication application;
tet_infoline("Testing Dali::WeakHandleBase::WeakHandleBase(BaseHandle)");
- BaseHandle emptyHandle;
+ BaseHandle emptyHandle;
WeakHandleBase emptyObject(emptyHandle);
DALI_TEST_CHECK(!emptyObject.GetBaseHandle());
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
- Animation animation = Animation::New( 1.0f );
- WeakHandleBase animationObject( animation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() == animation );
+ Animation animation = Animation::New(1.0f);
+ WeakHandleBase animationObject(animation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() == animation);
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandleBase object( actor );
- DALI_TEST_CHECK( object.GetBaseHandle() == actor);
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandleBase object(actor);
+ DALI_TEST_CHECK(object.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandleBase move = std::move( object );
- DALI_TEST_CHECK(move.GetBaseHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetBaseHandle() ); // object moved
+ WeakHandleBase move = std::move(object);
+ DALI_TEST_CHECK(move.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetBaseHandle()); // object moved
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandleBase object( actor );
- DALI_TEST_CHECK( object.GetBaseHandle() == actor);
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandleBase object(actor);
+ DALI_TEST_CHECK(object.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
WeakHandleBase move;
- move = std::move( object );
- DALI_TEST_CHECK(move.GetBaseHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetBaseHandle() ); // object moved
+ move = std::move(object);
+ DALI_TEST_CHECK(move.GetBaseHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetBaseHandle()); // object moved
END_TEST;
}
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
- Actor differentActor = Actor::New();
+ Actor differentActor = Actor::New();
WeakHandleBase aDifferentWeakHandleBase(differentActor);
DALI_TEST_CHECK(!(object == aDifferentWeakHandleBase));
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
- Actor differentActor = Actor::New();
+ Actor differentActor = Actor::New();
WeakHandleBase aDifferentWeakHandleBase(differentActor);
DALI_TEST_CHECK(object != aDifferentWeakHandleBase);
TestApplication application;
tet_infoline("Testing Dali::WeakHandleBase::GetBaseHandle()");
- Handle emptyHandle;
+ Handle emptyHandle;
WeakHandleBase emptyObject(emptyHandle);
DALI_TEST_CHECK(!emptyObject.GetBaseHandle());
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
WeakHandleBase theSameObject = WeakHandleBase(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == theSameObject.GetBaseHandle());
- Actor differentActor = Actor::New();
+ Actor differentActor = Actor::New();
WeakHandleBase aDifferentWeakHandleBase(differentActor);
DALI_TEST_CHECK(object.GetBaseHandle() != aDifferentWeakHandleBase.GetBaseHandle());
- Animation animation = Animation::New( 1.0f );
- WeakHandleBase animationObject( animation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() == animation );
+ Animation animation = Animation::New(1.0f);
+ WeakHandleBase animationObject(animation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() == animation);
- WeakHandleBase theSameAnimationObject = WeakHandleBase( animation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() == theSameAnimationObject.GetBaseHandle() );
+ WeakHandleBase theSameAnimationObject = WeakHandleBase(animation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() == theSameAnimationObject.GetBaseHandle());
- Animation differentAnimation = Animation::New( 1.0f );
- WeakHandleBase aDifferentAnimationObject( differentAnimation );
- DALI_TEST_CHECK( animationObject.GetBaseHandle() != aDifferentAnimationObject.GetBaseHandle() );
+ Animation differentAnimation = Animation::New(1.0f);
+ WeakHandleBase aDifferentAnimationObject(differentAnimation);
+ DALI_TEST_CHECK(animationObject.GetBaseHandle() != aDifferentAnimationObject.GetBaseHandle());
END_TEST;
}
int UtcDaliWeakHandleBaseReset(void)
{
TestApplication application;
- tet_infoline( "Testing Daku::WeakHandleBase::Reset()" );
+ tet_infoline("Testing Daku::WeakHandleBase::Reset()");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandleBase object(actor);
DALI_TEST_CHECK(object.GetBaseHandle() == actor);
TestApplication application;
tet_infoline("Testing Dali::WeakHandle::GetHandle()");
- Actor actor = Actor::New();
+ Actor actor = Actor::New();
WeakHandle<Actor> object(actor);
DALI_TEST_CHECK(object.GetHandle() == actor);
- MyTestCustomActor customActor = MyTestCustomActor::New();
+ MyTestCustomActor customActor = MyTestCustomActor::New();
WeakHandle<MyTestCustomActor> customObject(customActor);
DALI_TEST_CHECK(customObject.GetHandle() == customActor);
DALI_TEST_CHECK(object.GetHandle() != customObject.GetHandle());
- Animation animation = Animation::New( 1.0f );
- WeakHandle<Animation> animationObject( animation );
- DALI_TEST_CHECK( animationObject.GetHandle() == animation );
+ Animation animation = Animation::New(1.0f);
+ WeakHandle<Animation> animationObject(animation);
+ DALI_TEST_CHECK(animationObject.GetHandle() == animation);
animation.Reset();
- DALI_TEST_CHECK( animationObject.GetHandle() == Animation() );
+ DALI_TEST_CHECK(animationObject.GetHandle() == Animation());
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandle<Actor> object( actor );
- DALI_TEST_CHECK( object.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandle<Actor> object(actor);
+ DALI_TEST_CHECK(object.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandle<Actor> move = std::move( object );
- DALI_TEST_CHECK( move.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetHandle() ); // object moved
+ WeakHandle<Actor> move = std::move(object);
+ DALI_TEST_CHECK(move.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetHandle()); // object moved
END_TEST;
}
TestApplication application;
Actor actor = Actor::New();
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
- WeakHandle<Actor> object( actor );
- DALI_TEST_CHECK( object.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
+ WeakHandle<Actor> object(actor);
+ DALI_TEST_CHECK(object.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
WeakHandle<Actor> move;
- move = std::move( object );
- DALI_TEST_CHECK( move.GetHandle() == actor );
- DALI_TEST_EQUALS( 1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION ); // reference count of the actor is not increased
- DALI_TEST_CHECK( !object.GetHandle() ); // object moved
+ move = std::move(object);
+ DALI_TEST_CHECK(move.GetHandle() == actor);
+ DALI_TEST_EQUALS(1, actor.GetBaseObject().ReferenceCount(), TEST_LOCATION); // reference count of the actor is not increased
+ DALI_TEST_CHECK(!object.GetHandle()); // object moved
END_TEST;
}
*
*/
-#include <iostream>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/wheel-event-integ.h>
-#include <dali/devel-api/events/wheel-event-devel.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/wheel-event-devel.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
using namespace Dali;
namespace
{
-
// Key Event Test references
-const static unsigned int SHIFT_MODIFIER = 0x1;
-const static unsigned int CTRL_MODIFIER = 0x2;
-const static unsigned int ALT_MODIFIER = 0x4;
-const static unsigned int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER;
-
+const static unsigned int SHIFT_MODIFIER = 0x1;
+const static unsigned int CTRL_MODIFIER = 0x2;
+const static unsigned int ALT_MODIFIER = 0x4;
+const static unsigned int SHIFT_AND_CTRL_MODIFIER = SHIFT_MODIFIER | CTRL_MODIFIER;
// Stores data that is populated in the callback and will be read by the TET cases
struct SignalData
{
SignalData()
: functorCalled(false)
- {}
+ {
+ }
void Reset()
{
wheeledActor.Reset();
}
- bool functorCalled;
+ bool functorCalled;
WheelEvent receivedWheelEvent;
- Actor wheeledActor;
+ Actor wheeledActor;
};
// Functor that sets the data when called
struct WheelEventReceivedFunctor
{
- WheelEventReceivedFunctor( SignalData& data ) : signalData( data ) { }
+ WheelEventReceivedFunctor(SignalData& data)
+ : signalData(data)
+ {
+ }
- bool operator()( Actor actor, const WheelEvent& wheelEvent )
+ bool operator()(Actor actor, const WheelEvent& wheelEvent)
{
- signalData.functorCalled = true;
+ signalData.functorCalled = true;
signalData.receivedWheelEvent = wheelEvent;
- signalData.wheeledActor = actor;
+ signalData.wheeledActor = actor;
return true;
}
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(Dali::WheelEvent::MOUSE_WHEEL, event.GetType(), TEST_LOCATION); // check type
- DALI_TEST_EQUALS(1, event.GetDirection(), TEST_LOCATION); // check direction
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(Vector2(1.0f, 1.0f), event.GetPoint(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(1, event.GetDelta(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(1000u, event.GetTime(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1, event.GetDirection(), TEST_LOCATION); // check direction
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(Vector2(1.0f, 1.0f), event.GetPoint(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1, event.GetDelta(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1000u, event.GetTime(), TEST_LOCATION); // check modifier
END_TEST;
}
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION);
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION);
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION);
- DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier
+ DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier
END_TEST;
}
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
- DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used
+ DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used
DALI_TEST_EQUALS(false, event.IsShiftModifier(), TEST_LOCATION);
END_TEST;
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
- DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used
+ DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used
DALI_TEST_EQUALS(false, event.IsCtrlModifier(), TEST_LOCATION);
END_TEST;
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
- DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used
DALI_TEST_EQUALS(false, event.IsAltModifier(), TEST_LOCATION);
END_TEST;
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(true, event.IsCtrlModifier() && event.IsShiftModifier(), TEST_LOCATION);
- Dali::WheelEvent newEvent = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+ Dali::WheelEvent newEvent = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
DALI_TEST_EQUALS(false, newEvent.IsCtrlModifier() && newEvent.IsShiftModifier(), TEST_LOCATION);
END_TEST;
}
{
TestApplication application; // Reset all test adapter return codes
- Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
- DALI_TEST_CHECK( event );
+ Dali::WheelEvent event = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+ DALI_TEST_CHECK(event);
DALI_TEST_EQUALS(true, event.IsCtrlModifier() || event.IsAltModifier(), TEST_LOCATION);
- Dali::WheelEvent newEvent = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+ Dali::WheelEvent newEvent = DevelWheelEvent::New(Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
DALI_TEST_EQUALS(false, newEvent.IsCtrlModifier() && newEvent.IsAltModifier(), TEST_LOCATION);
END_TEST;
}
TestApplication application; // Reset all test adapter return codes
Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
application.GetScene().Add(actor);
// Render and notify
application.Render();
// Connect to actor's wheel event signal
- SignalData data;
- WheelEventReceivedFunctor functor( data );
- actor.WheelEventSignal().Connect( &application, functor );
+ SignalData data;
+ WheelEventReceivedFunctor functor(data);
+ actor.WheelEventSignal().Connect(&application, functor);
- Vector2 screenCoordinates( 10.0f, 10.0f );
+ Vector2 screenCoordinates(10.0f, 10.0f);
Integration::WheelEvent event(Integration::WheelEvent::MOUSE_WHEEL, 0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u);
// Emit a wheel signal
- application.ProcessEvent( event );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( actor == data.wheeledActor );
+ application.ProcessEvent(event);
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(actor == data.wheeledActor);
DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, data.receivedWheelEvent.GetType(), TEST_LOCATION); // check type
- DALI_TEST_EQUALS(0, data.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction
- DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(screenCoordinates, data.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(1, data.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(1000u, data.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0, data.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(screenCoordinates, data.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1, data.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1000u, data.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier
data.Reset();
// Emit a wheel signal where the actor is not present, will hit the root actor though
- Actor rootActor( application.GetScene().GetRootLayer() );
+ Actor rootActor(application.GetScene().GetRootLayer());
// Connect to root actor's wheel event signal
- SignalData rootData;
- WheelEventReceivedFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.WheelEventSignal().Connect( &application, rootFunctor );
+ SignalData rootData;
+ WheelEventReceivedFunctor rootFunctor(rootData); // Consumes signal
+ rootActor.WheelEventSignal().Connect(&application, rootFunctor);
screenCoordinates.x = screenCoordinates.y = 300.0f;
Integration::WheelEvent newEvent(Integration::WheelEvent::MOUSE_WHEEL, 0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u);
- application.ProcessEvent( newEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( rootActor == rootData.wheeledActor );
+ application.ProcessEvent(newEvent);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
+ DALI_TEST_CHECK(rootActor == rootData.wheeledActor);
DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, rootData.receivedWheelEvent.GetType(), TEST_LOCATION); // check type
- DALI_TEST_EQUALS(0, rootData.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction
- DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(screenCoordinates, rootData.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(1, rootData.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier
- DALI_TEST_EQUALS(1000u, rootData.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(0, rootData.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction
+ DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(screenCoordinates, rootData.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1, rootData.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier
+ DALI_TEST_EQUALS(1000u, rootData.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier
// Remove actor from the scene
- application.GetScene().Remove( actor );
+ application.GetScene().Remove(actor);
// Render and notify
application.SendNotification();
application.Render();
// Emit a move at the same point, we should not be signalled.
- application.ProcessEvent( event );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
+ application.ProcessEvent(event);
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
data.Reset();
END_TEST;
}
*
*/
-#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/camera-actor.h>
namespace Dali
{