-//
-// 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/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/mouse-wheel-event-integ.h>
#include <dali/integration-api/events/key-event-integ.h>
mTargetSize( Vector3::ZERO )
{
SetRequiresMouseWheelEvents(true);
+ SetRequiresHoverEvents(true);
}
/**
AddToCallStacks("OnTouchEvent");
return true;
}
+ virtual bool OnHoverEvent(const HoverEvent& event)
+ {
+ AddToCallStacks("OnHoverEvent");
+ return true;
+ }
virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
{
AddToCallStacks("OnMouseWheelEvent");
}
}
+ virtual Vector3 GetNaturalSize()
+ {
+ return Vector3( 0.0f, 0.0f, 0.0f );
+ }
+
void SetDaliProperty(std::string s)
{
Self().SetProperty(mDaliProperty, s) ;
{
return true;
}
+ virtual bool OnHoverEvent(const HoverEvent& event)
+ {
+ return true;
+ }
virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
{
return true;
{
return Actor();
}
+
+ virtual Vector3 GetNaturalSize()
+ {
+ return Vector3( 0.0f, 0.0f, 0.0f );
+ }
};
} ; // namespace Impl
return GetImpl().mTargetSize;
}
+ virtual Vector3 GetNaturalSize()
+ {
+ return Vector3( 0.0f, 0.0f, 0.0f );
+ }
+
private:
TestCustomActor( Impl::TestCustomActor& impl ) : CustomActor( impl )
END_TEST;
}
+int UtcDaliCustomActorOnHoverEvent(void)
+{
+ TestApplication application;
+ tet_infoline("Testing Dali::CustomActor::OnHoverEvent()");
+
+ TestCustomActor custom = TestCustomActor::New();
+ DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+
+ // set size for custom actor
+ custom.SetSize( 100, 100 );
+ // add the custom actor to stage
+ Stage::GetCurrent().Add( custom );
+ custom.ResetCallStack();
+
+ // Render and notify a couple of times
+ application.SendNotification();
+ application.Render();
+ application.SendNotification();
+ application.Render();
+
+ // simulate a hover event
+ Dali::TouchPoint point( 0, TouchPoint::Motion, 1, 1 );
+ Dali::Integration::HoverEvent event;
+ event.AddPoint( point );
+ application.ProcessEvent( event );
+
+ DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
+ DALI_TEST_EQUALS( "OnHoverEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
+ END_TEST;
+}
+
int UtcDaliCustomActorOnMouseWheelEvent(void)
{
TestApplication application;