utc-Dali-ScrollViewEffect.cpp
utc-Dali-StyleManager.cpp
utc-Dali-SuperBlurView.cpp
+ utc-Dali-Toolkit.cpp
)
# Append list of test harness files (Won't get parsed for test cases)
test_return_value = TET_PASS;
}
+class TestCallback : public ConnectionTracker
+{
+public:
+ TestCallback( Dali::Toolkit::GaussianBlurView& blurView )
+ : mBlurView( blurView )
+ {
+ mFinished = false;
+ }
+ void Connect()
+ {
+ mBlurView.FinishedSignal().Connect( this, &TestCallback::OnFinished );
+ }
+
+ void OnFinished( Dali::Toolkit::GaussianBlurView source )
+ {
+ mFinished = true;
+ }
+
+ bool mFinished;
+ Dali::Toolkit::GaussianBlurView& mBlurView;
+};
// Negative test case for a method
int UtcDaliGaussianBlurViewUninitialized(void)
DALI_TEST_CHECK( view.GetBlurredRenderTarget() == renderTarget );
END_TEST;
}
+
+int UtcDaliGaussianBlurViewActivateOnce(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurActivateOnce");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, true);
+ DALI_TEST_CHECK( view );
+
+ RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u == taskList.GetTaskCount() );
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(Actor::New());
+ Stage::GetCurrent().Add(view);
+ view.ActivateOnce();
+
+ RenderTaskList taskList2 = Stage::GetCurrent().GetRenderTaskList();
+ DALI_TEST_CHECK( 1u != taskList2.GetTaskCount() );
+ application.Render();
+
+ END_TEST;
+}
+
+int UtcDaliGaussianBlurViewFinishedSignalN(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliGaussianBlurViewSetGetRenderTarget");
+
+ Toolkit::GaussianBlurView view = Toolkit::GaussianBlurView::New(5, 1.5f, Pixel::RGB888, 0.5f, 0.5f, true);
+ DALI_TEST_CHECK( view );
+
+ view.SetParentOrigin(ParentOrigin::CENTER);
+ view.SetSize(Stage::GetCurrent().GetSize());
+ view.Add(Actor::New());
+ Stage::GetCurrent().Add(view);
+ view.Activate();
+
+ TestCallback callback( view );
+ DALI_TEST_CHECK( callback.mFinished == false );
+
+ callback.Connect();
+
+ view.Deactivate();
+ application.SendNotification();
+
+ // FinishedSignal is only for ActivateOnce()
+ DALI_TEST_CHECK( callback.mFinished == false );
+
+ END_TEST;
+}
END_TEST;
}
+int UtcDaliItemRangeIntersection(void)
+{
+ ToolkitTestApplication application;
+
+ unsigned int uBeginItemFirst = 100u, uEndItemFirst = 300u;
+ unsigned int uBeginItemSecond = 290u, uEndItemSecond = 400;
+ unsigned int uInterBeginCheck=290u , uInterEndCheck=301u;
+ bool bIsInThisRange = false, bOutOfThisRange = false;
+
+ Toolkit::ItemRange objItemRangeFirst(uBeginItemFirst, uEndItemFirst);
+ Toolkit::ItemRange objItemRangeSecond(uBeginItemSecond, uEndItemSecond);
+ ItemRange itmInterSect = objItemRangeFirst.Intersection(objItemRangeSecond);
+
+ bIsInThisRange = itmInterSect.Within(uInterBeginCheck);
+ DALI_TEST_EQUALS(bIsInThisRange, true, TEST_LOCATION );
+
+ bOutOfThisRange = itmInterSect.Within(uInterEndCheck);
+ DALI_TEST_EQUALS(bOutOfThisRange, false, TEST_LOCATION );
+
+ END_TEST;
+}
END_TEST;
}
+int UtcDaliToolkitScrollViewConstraintsMove(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewConstraintsMove");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ // Add an Actor to ScrollView,
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetPosition( TEST_ACTOR_POSITION );
+ Wait(application);
+ const Vector2 target = Vector2(100.0f, 100.0f);
+ const Vector2 target2 = Vector2(200.0f, 200.0f);
+ Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, MoveActorConstraint );
+ constraint.AddSource( Source(scrollView, ScrollView::Property::SCROLL_POSITION) );
+ constraint.SetRemoveAction(Constraint::Discard);
+ scrollView.ApplyConstraintToChildren(constraint);
+ scrollView.ScrollTo( target, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
+ scrollView.ScrollTo( target2 );
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliToolkitScrollViewConstraintsWrap(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitScrollViewConstraintsWrap");
+
+ // Set up a scrollView...
+ ScrollView scrollView = ScrollView::New();
+ Stage::GetCurrent().Add( scrollView );
+ Vector2 stageSize = Stage::GetCurrent().GetSize();
+ scrollView.SetSize(stageSize);
+ scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT);
+ scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+
+ // Position rulers.
+ RulerPtr rulerX = new DefaultRuler();
+ RulerPtr rulerY = new DefaultRuler();
+ rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) );
+ rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) );
+ scrollView.SetRulerX(rulerX);
+ scrollView.SetRulerY(rulerY);
+
+ // Add an Actor to ScrollView,
+ Actor a = Actor::New();
+ scrollView.Add(a);
+ a.SetPosition( TEST_ACTOR_POSITION );
+ Wait(application);
+
+ const Vector2 target = Vector2(100.0f, 100.0f);
+ const Vector2 target2 = Vector2(200.0f, 200.0f);
+
+ Constraint constraint = Constraint::New<Vector3>( scrollView, Actor::Property::POSITION, WrapActorConstraint );
+ constraint.AddSource( LocalSource( Actor::Property::SCALE ) );
+ constraint.AddSource( LocalSource( Actor::Property::ANCHOR_POINT ) );
+ constraint.AddSource( LocalSource( Actor::Property::SIZE ) );
+ constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MIN ) );
+ constraint.AddSource( Source( scrollView, Toolkit::Scrollable::Property::SCROLL_POSITION_MAX ) );
+ constraint.AddSource( Source( scrollView, Toolkit::ScrollView::Property::WRAP ) );
+ constraint.SetRemoveAction(Constraint::Discard);
+ scrollView.ApplyConstraintToChildren(constraint);
+
+ scrollView.ScrollTo( target, 0.0f );
+ Wait(application);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target, TEST_LOCATION );
+ scrollView.ScrollTo( target2 );
+ Wait(application, RENDER_DELAY_SCROLL);
+ DALI_TEST_EQUALS( scrollView.GetCurrentScrollPosition(), target2, TEST_LOCATION );
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 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-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+using namespace Dali;
+using namespace Toolkit;
+
+void dali_toolkit_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void dali_toolkit_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcToolkitIsVertical(void)
+{
+ ToolkitTestApplication application;
+
+ bool bRet = false;
+
+ tet_infoline(" UtcToolkitIsVertical");
+ bRet = IsVertical(ControlOrientation::Up);
+ DALI_TEST_EQUALS( bRet, true, TEST_LOCATION );
+
+ bRet = IsVertical(ControlOrientation::Down);
+ DALI_TEST_EQUALS( bRet, true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcToolkitIsHorizontal(void)
+{
+ ToolkitTestApplication application;
+
+ bool bRet = false;
+
+ tet_infoline(" UtcToolkitIsHorizontal");
+ bRet = IsHorizontal(ControlOrientation::Left);
+ DALI_TEST_EQUALS( bRet, true, TEST_LOCATION );
+
+ bRet = IsHorizontal(ControlOrientation::Right);
+ DALI_TEST_EQUALS( bRet, true, TEST_LOCATION );
+
+ END_TEST;
+}
+