-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * 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.
+ *
+ */
#include <iostream>
#include <stdlib.h>
-#include <dali/dali.h>
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
#include <dali/integration-api/events/long-press-gesture-event.h>
#include <dali/integration-api/events/pinch-gesture-event.h>
#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/hover-event-integ.h>
using namespace Dali;
receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
receivedGesture.localPoint = Vector2(0.0f, 0.0f);
- pressedActor = NULL;
+ pressedActor.Reset();
}
bool functorCalled;
{
return true;
}
+ virtual bool OnHoverEvent(const HoverEvent& event)
+ {
+ return true;
+ }
virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
{
return true;
return Actor::New();
}
+ virtual Vector3 GetNaturalSize()
+ {
+ return Vector3( 0.0f, 0.0f, 0.0f );
+ }
+
public:
SignalType mSignal;
}
};
+BaseHandle CreateNamedActorType()
+{
+ Actor actor = Actor::New();
+ actor.SetName( "NamedActor" );
+ return actor;
+}
+
+TypeRegistration namedActorType( "MyNamedActor", typeid(Dali::Actor), CreateNamedActorType );
+PropertyRegistration namedActorPropertyOne( namedActorType, "prop-name", PROPERTY_REGISTRATION_START_INDEX, Property::BOOLEAN, &SetProperty, &GetProperty );
+
} // Anonymous namespace
Stage::GetCurrent().Add( ia );
application.Render();
- type = registry.GetTypeInfo( "TextActor" );
- DALI_TEST_CHECK( type );
- TextActor ta = TextActor::DownCast(type.CreateInstance());
- DALI_TEST_CHECK( ta );
- Stage::GetCurrent().Add( ta );
- application.Render();
-
type = registry.GetTypeInfo( "CameraActor" );
DALI_TEST_CHECK( type );
CameraActor ca = CameraActor::DownCast(type.CreateInstance());
// Check named and typeid are equivalent
int UtcDaliTypeRegistryNameEquivalence(void)
{
- TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "TextActor" );
- TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::TextActor) );
+ TypeInfo named_type = TypeRegistry::Get().GetTypeInfo( "ImageActor" );
+ TypeInfo typeinfo_type = TypeRegistry::Get().GetTypeInfo( typeid(Dali::ImageActor) );
DALI_TEST_CHECK( named_type );
DALI_TEST_CHECK( typeinfo_type );
MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
DALI_TEST_CHECK( customHandle );
- DALI_TEST_EQUALS( type.GetActions().size(), TEST_ACTION_COUNT + baseType.GetActions().size(), TEST_LOCATION );
- DALI_TEST_EQUALS( type.GetSignals().size(), TEST_SIGNAL_COUNT + baseType.GetSignals().size(), TEST_LOCATION );
+ TypeInfo::NameContainer names;
+ type.GetActions(names);
+ TypeInfo::NameContainer baseNames;
+ baseType.GetActions(baseNames);
+ DALI_TEST_EQUALS( names.size(), TEST_ACTION_COUNT + baseNames.size(), TEST_LOCATION );
+
+ names.clear();
+ type.GetSignals(names);
+
+ baseNames.clear();
+ baseType.GetSignals(baseNames);
+
+ DALI_TEST_EQUALS( names.size(), TEST_SIGNAL_COUNT + baseNames.size(), TEST_LOCATION );
{
TestConnectionTracker tracker;
MyTestCustomActor customHandle = MyTestCustomActor::DownCast( handle );
DALI_TEST_CHECK( customHandle );
- DALI_TEST_EQUALS( type.GetActions().size(), TEST_ACTION_COUNT + baseType.GetActions().size(), TEST_LOCATION );
- DALI_TEST_EQUALS( type.GetSignals().size(), TEST_SIGNAL_COUNT + baseType.GetSignals().size(), TEST_LOCATION );
+ TypeInfo::NameContainer names;
+ TypeInfo::NameContainer baseNames;
+
+ type.GetActions(names);
+ baseType.GetActions(baseNames);
+
+ DALI_TEST_EQUALS( names.size(), TEST_ACTION_COUNT + baseNames.size(), TEST_LOCATION );
+
+ names.clear();
+ baseNames.clear();
+
+ type.GetSignals(names);
+ baseType.GetSignals(baseNames);
+
+ DALI_TEST_EQUALS( names.size(), TEST_SIGNAL_COUNT + baseNames.size(), TEST_LOCATION );
{
TestConnectionTracker tracker;
DALI_TEST_EQUALS(true, data.voidFunctorCalled, TEST_LOCATION);
END_TEST;
}
+
+int UtcDaliTypeRegistryNamedType(void)
+{
+ TestApplication application;
+ 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() );
+
+ // 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() );
+
+ DALI_TEST_CHECK( namedActorPropertyCount > actorPropertyCount );
+ END_TEST;
+}