/*
- * 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-toolkit-test-suite-utils.h>
#include <dali/integration-api/events/key-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali-toolkit/devel-api/controls/alignment/alignment.h>
#include <dali-toolkit/dali-toolkit.h>
using namespace Dali;
{
ToolkitTestApplication application;
- //Te ensure the object is registered after creation
- ObjectRegistry registry = Stage::GetCurrent().GetObjectRegistry();
+ //To ensure the object is registered after creation
+ ObjectRegistry registry = application.GetCore().GetObjectRegistry();
DALI_TEST_CHECK( registry );
gObjectCreatedCallBackCalled = false;
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
alignment.SetAlignmentType(type);
DALI_TEST_CHECK(alignment.GetAlignmentType() & type);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New();
DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalLeft);
DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalRight);
DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalCenter, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalTop);
DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalTop);
DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalTop);
DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalTop, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalLeft, Alignment::VerticalBottom);
DALI_TEST_EQUALS(Alignment::HorizontalLeft | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalCenter, Alignment::VerticalBottom);
DALI_TEST_EQUALS(Alignment::HorizontalCenter | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
Alignment alignment = Alignment::New(Alignment::HorizontalRight, Alignment::VerticalBottom);
DALI_TEST_EQUALS(Alignment::HorizontalRight | Alignment::VerticalBottom, alignment.GetAlignmentType(), TEST_LOCATION);
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
{
Alignment alignment = Alignment::New();
alignment.Add(Actor::New());
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
application.Render();
application.SendNotification();
}
ToolkitTestApplication application;
Alignment alignment = Alignment::New();
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
application.Render();
application.SendNotification();
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
END_TEST;
}
ToolkitTestApplication application;
Alignment alignment = Alignment::New();
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
application.Render();
application.SendNotification();
Vector2 size( 100.0f, 200.0f );
- alignment.SetSize(size);
+ alignment.SetProperty( Actor::Property::SIZE, size);
application.Render();
application.SendNotification();
DALI_TEST_EQUALS(size, alignment.GetTargetSize().GetVectorXY(), TEST_LOCATION);
- Stage::GetCurrent().Remove(alignment);
+ application.GetScene().Remove(alignment);
END_TEST;
}
///////////////////////////////////////////////////////////////////////////////
-static bool TouchCallback(Actor actor, const TouchData& event)
+static bool TouchCallback(Actor actor, const TouchEvent& event)
{
return false;
}
ToolkitTestApplication application;
Alignment alignment = Alignment::New();
- alignment.SetSize(100.0f, 100.0f);
+ alignment.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
alignment.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
alignment.TouchSignal().Connect(&TouchCallback);
ToolkitTestApplication application;
Alignment alignment = Alignment::New();
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
alignment.SetKeyInputFocus();
ToolkitTestApplication application;
Alignment alignment = Alignment::New();
- Stage::GetCurrent().Add(alignment);
+ application.GetScene().Add(alignment);
Animation animation = Animation::New(100.0f);
animation.AnimateTo( Property( alignment, Actor::Property::SIZE ), Vector3( 100.0f, 150.0f, 200.0f ) );