--- /dev/null
+#ifndef __TEST_INTRUSIVE_PTR_H__
+#define __TEST_INTRUSIVE_PTR_H__
+
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <iostream>
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+
+namespace Dali
+{
+
+template <typename T>
+struct UtcCoverageIntrusivePtr
+{
+ typedef IntrusivePtr<T> (*Creator)();
+
+ void Check( Creator creator)
+ {
+ IntrusivePtr<T> a = creator();
+ IntrusivePtr<T> b = creator();
+
+ DALI_TEST_CHECK( a.Get() );
+
+ a.Reset();
+
+ T* pB = b.Detach();
+
+ a.Reset(pB);
+
+ DALI_TEST_CHECK(a);
+
+ a.Reset();
+
+ };
+
+};
+
+} // Dali
+
+#endif
+
+
}
-int UtcDaliGestureDetectorConstructorNegative(void)
+int UtcDaliGestureDetectorConstructorN(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorConstructorPositive(void)
+int UtcDaliGestureDetectorConstructorP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorDownCast(void)
+int UtcDaliGestureDetectorAssignP(void)
+{
+ TestApplication application;
+
+ // Use pan gesture as GestureDetector cannot be created.
+ GestureDetector detector = PanGestureDetector::New();
+ GestureDetector detector2;
+
+ detector2 = detector;
+
+ Actor actor = Actor::New();
+
+ try
+ {
+ detector2.Attach(actor);
+ tet_result(TET_PASS);
+ }
+ catch (DaliException& e)
+ {
+ DALI_TEST_PRINT_ASSERT( e );
+ tet_result(TET_FAIL);
+ }
+ END_TEST;
+}
+
+int UtcDaliGestureDetectorDownCastP(void)
{
TestApplication application;
tet_infoline("Testing Dali::GestureDetector::DownCast()");
END_TEST;
}
-int UtcDaliGestureDetectorAttachPositive(void)
+int UtcDaliGestureDetectorAttachP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorAttachNegative(void)
+int UtcDaliGestureDetectorAttachN(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorDetachPositive(void)
+int UtcDaliGestureDetectorDetachP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorDetachNegative01(void)
+int UtcDaliGestureDetectorDetachN01(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorDetachNegative02(void)
+int UtcDaliGestureDetectorDetachN02(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorDetachNegative03(void)
+int UtcDaliGestureDetectorDetachN03(void)
{
TestApplication application;
TestGestureManager& gestureManager = application.GetGestureManager();
END_TEST;
}
-int UtcDaliGestureDetectorDetachAll(void)
+int UtcDaliGestureDetectorDetachAllP(void)
{
TestApplication application;
END_TEST;
}
-int UtcDaliGestureDetectorDetachAllNegative(void)
+int UtcDaliGestureDetectorDetachAllN(void)
{
TestApplication application;
TestGestureManager& gestureManager = application.GetGestureManager();
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <test-native-image.h>
using namespace Dali;
END_TEST;
}
+
+
int UtcDaliIntrusivePtrOperatorBooleanTypeP(void)
{
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 );
+
+ typedef void (IntrusivePtr<Counted>::*BoolIdiomFunc)() const;
+ 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_EQUALS( operator!=( counted2.Get(), countedSubclass2 ), false, TEST_LOCATION );
END_TEST;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
// Positive test case for a method
-int UtcDaliLongPressGestureDetectorConstructor(void)
+int UtcDaliLongPressGestureDetectorConstructorP(void)
{
TestApplication application;
{
TestApplication application;
- LongPressGestureDetector detector = LongPressGestureDetector::New();;
+ LongPressGestureDetector detector;
+ detector = LongPressGestureDetector::New();;
- LongPressGestureDetector copy = detector;
+ LongPressGestureDetector copy;
+ copy = detector;
DALI_TEST_CHECK( detector );
DALI_TEST_CHECK( detector == copy );
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <test-native-image.h>
+#include <test-intrusive-ptr.h>
using namespace Dali;
test_return_value = TET_PASS;
}
+IntrusivePtr<TestNativeImage> Creator()
+{
+ return TestNativeImage::New(10,10);
+}
+
+int UtcDaliIntrusivePtrTestNativeImage(void)
+{
+ UtcCoverageIntrusivePtr<TestNativeImage> pointer;
+
+ pointer.Check(Creator);
+
+ END_TEST;
+}
+
int UtcDaliNativeImageNew(void)
{
TestApplication application;
PanGestureDetector detector = PanGestureDetector::New();;
- PanGestureDetector copy = detector;
+ PanGestureDetector assign;
+ assign = detector;
DALI_TEST_CHECK( detector );
- DALI_TEST_CHECK( detector == copy );
+ DALI_TEST_CHECK( detector == assign );
END_TEST;
}
PinchGestureDetector detector = PinchGestureDetector::New();;
- PinchGestureDetector copy = detector;
+ PinchGestureDetector assign;
+ assign = detector;
DALI_TEST_CHECK( detector );
- DALI_TEST_CHECK( detector == copy );
+ DALI_TEST_CHECK( detector == assign );
END_TEST;
}
#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/devel-api/dynamics/dynamics.h>
#include <dali-test-suite-utils.h>
END_TEST;
}
+int UtcDaliStageAssign(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ Stage stage2;
+ stage2 = stage;
+
+ DALI_TEST_CHECK(stage2);
+ END_TEST;
+}
+
int UtcDaliStageIsInstalled(void)
{
DALI_TEST_CHECK(!Stage::IsInstalled());
END_TEST;
}
+int UtcDaliStageInitializeDynamicsP(void)
+{
+ TestApplication application;
+ Stage stage = Stage::GetCurrent();
+ DynamicsWorld world = stage.InitializeDynamics( DynamicsWorldConfig::New() );
+
+#if !defined(DYNAMICS_SUPPORT)
+ DALI_TEST_CHECK(true);
+#else
+ DALI_TEST_CHECK( world );
+#endif
+
+ END_TEST;
+}
+
int UtcDaliStageGetLayerCount(void)
{
TestApplication application;
{
TestApplication application;
- TapGestureDetector detector = TapGestureDetector::New();;
+ TapGestureDetector detector = TapGestureDetector::New();
TapGestureDetector copy( detector );
DALI_TEST_CHECK( detector );
TapGestureDetector detector = TapGestureDetector::New();;
- TapGestureDetector copy = detector;
+ TapGestureDetector assign;
+ assign = detector;
DALI_TEST_CHECK( detector );
- DALI_TEST_CHECK( detector == copy );
+ DALI_TEST_CHECK( detector == assign );
END_TEST;
}
END_TEST;
}
+int UtcDaliTypeRegistryAssignP(void)
+{
+ TestApplication application;
+
+ TypeRegistry registry = TypeRegistry::Get();
+ TypeRegistry registry2;
+ registry2 = registry;
+ DALI_TEST_CHECK( registry2 );
+
+ DALI_TEST_CHECK( registry2.GetTypeInfo( "Actor" ).GetName() == registry2.GetTypeInfo( "Actor" ).GetName() );
+
+ END_TEST;
+}
+
int UtcDaliTypeRegistryGetTypeInfoFromTypeNameP(void)
{
TestApplication application;
{
TestApplication application;
Vector4 vec4(1.f,1.f,1.f,1.f);
- Vector3 vec2(vec4);
+ 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;
END_TEST;
}
+int UtcDaliVector2AssignP(void)
+{
+ TestApplication application;
+ Vector2 v1(10.0f, 20.0f);
+ Vector2 r0(11.0f, 22.0f);
+
+ v1 = r0;
+ DALI_TEST_EQUALS(v1, r0, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliVector2AssignP02(void)
+{
+ TestApplication application;
+ 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);
+ END_TEST;
+}
+
+int UtcDaliVector2AssignP03(void)
+{
+ TestApplication application;
+ 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);
+ END_TEST;
+}
+
int UtcDaliVector2AddP(void)
{
TestApplication application;
return mPtr ? &IntrusivePtr::ThisIsSaferThanReturningVoidStar : 0;
}
+ /**
+ * @brief Detach pointer from intrusive ptr counting.
+ *
+ * Use with care.
+ */
+ T* Detach()
+ {
+ T* ptr = mPtr;
+ mPtr = 0;
+ return ptr;
+ }
+
private:
/**