X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-NavigationView.cpp;h=09f0ba5c1d6562df9ab2be24f87234cf95984b34;hb=1621192f7b42f1fa210d6bdf12d853629304bea3;hp=e91b2cc6715041173a0047133b2cf747267c495f;hpb=709f6618b60d366c84e259564c53b6ef0c43b717;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/utc-Dali-NavigationView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-NavigationView.cpp index e91b2cc..09f0ba5 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-NavigationView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-NavigationView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -15,12 +15,12 @@ * */ -#include -#include -#include #include #include #include +#include +#include +#include using namespace Dali; using namespace Toolkit; @@ -40,16 +40,16 @@ int UtcDaliNavigationTypeRegistry(void) ToolkitTestApplication application; TypeRegistry typeRegistry = TypeRegistry::Get(); - DALI_TEST_CHECK( typeRegistry ); + DALI_TEST_CHECK(typeRegistry); - TypeInfo typeInfo = typeRegistry.GetTypeInfo( "NavigationView" ); - DALI_TEST_CHECK( typeInfo ); + TypeInfo typeInfo = typeRegistry.GetTypeInfo("NavigationView"); + DALI_TEST_CHECK(typeInfo); BaseHandle handle = typeInfo.CreateInstance(); - DALI_TEST_CHECK( handle ); + DALI_TEST_CHECK(handle); - NavigationView view = NavigationView::DownCast( handle ); - DALI_TEST_CHECK( view ); + NavigationView view = NavigationView::DownCast(handle); + DALI_TEST_CHECK(view); END_TEST; } @@ -59,12 +59,12 @@ int UtcDaliNavigationViewNew(void) ToolkitTestApplication application; NavigationView navigationView; - DALI_TEST_CHECK( !navigationView ); + DALI_TEST_CHECK(!navigationView); navigationView = NavigationView::New(); - DALI_TEST_CHECK( navigationView ); + DALI_TEST_CHECK(navigationView); - Stage::GetCurrent().Add( navigationView ); + application.GetScene().Add(navigationView); application.SendNotification(); application.Render(); @@ -77,20 +77,20 @@ int UtcDaliNavigationViewCopyAndAssignment(void) ToolkitTestApplication application; NavigationView view = NavigationView::New(); - DALI_TEST_CHECK( view ); + DALI_TEST_CHECK(view); - NavigationView copy( view ); - DALI_TEST_CHECK( copy == view ); + NavigationView copy(view); + DALI_TEST_CHECK(copy == view); NavigationView assign; - DALI_TEST_CHECK( !assign ); + DALI_TEST_CHECK(!assign); assign = view; - DALI_TEST_CHECK( assign == view ); + DALI_TEST_CHECK(assign == view); // Self assignment assign = assign; - DALI_TEST_CHECK( assign ); - DALI_TEST_CHECK( assign == view ); + DALI_TEST_CHECK(assign); + DALI_TEST_CHECK(assign == view); END_TEST; } @@ -100,13 +100,13 @@ int UtcDaliNavigationViewDownCast(void) ToolkitTestApplication application; BaseHandle view = NavigationView::New(); - DALI_TEST_CHECK( NavigationView::DownCast( view ) ); + DALI_TEST_CHECK(NavigationView::DownCast(view)); BaseHandle empty; - DALI_TEST_CHECK( ! NavigationView::DownCast( empty ) ); + DALI_TEST_CHECK(!NavigationView::DownCast(empty)); BaseHandle another = Actor::New(); - DALI_TEST_CHECK( ! NavigationView::DownCast( another ) ); + DALI_TEST_CHECK(!NavigationView::DownCast(another)); END_TEST; } @@ -115,20 +115,20 @@ int UtcDaliNavigationViewPush(void) { ToolkitTestApplication application; - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); // 1 Create and Add Navigation View to stage, actor count should be zero NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); - DALI_TEST_EQUALS( naviView.GetChildCount(), 0, TEST_LOCATION ); + DALI_TEST_EQUALS(naviView.GetChildCount(), 0, TEST_LOCATION); // 2 Add Actor to Navigation View, actor count should increase to 1 Actor TestParentActor1 = Actor::New(); - naviView.Push( TestParentActor1 ); + naviView.Push(TestParentActor1); - DALI_TEST_EQUALS( naviView.GetChildCount(), 1, TEST_LOCATION ); + DALI_TEST_EQUALS(naviView.GetChildCount(), 1, TEST_LOCATION); END_TEST; } @@ -137,33 +137,31 @@ int UtcDaliNavigationViewPop(void) { ToolkitTestApplication application; - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); // 1 Create Navigation View NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); // 2 Push initial Actor Actor testParentActor1 = Actor::New(); - testParentActor1.SetName("TestParentActor1"); - naviView.Push( testParentActor1 ); - DALI_TEST_EQUALS( naviView.GetChildCount(), 1 , TEST_LOCATION ); + testParentActor1.SetProperty(Dali::Actor::Property::NAME, "TestParentActor1"); + naviView.Push(testParentActor1); + DALI_TEST_EQUALS(naviView.GetChildCount(), 1, TEST_LOCATION); // 3 Push Second Actor which contains a child actor Actor testParentActor2 = Actor::New(); - testParentActor2.SetName("TestParentActor2"); + testParentActor2.SetProperty(Dali::Actor::Property::NAME, "TestParentActor2"); Actor testChildActor1 = Actor::New(); - testParentActor2.Add( testChildActor1 ); - naviView.Push( testParentActor2 ); - + testParentActor2.Add(testChildActor1); + naviView.Push(testParentActor2); // 4 Pop head actor, it should be TestParentActor2 Actor poppedActor = naviView.Pop(); - DALI_TEST_EQUALS( poppedActor.GetName() , "TestParentActor2", TEST_LOCATION ); + DALI_TEST_EQUALS(poppedActor.GetProperty(Dali::Actor::Property::NAME), "TestParentActor2", TEST_LOCATION); // 5 Navigation View child count should be 1 - DALI_TEST_EQUALS( naviView.GetChildCount(), 1 , TEST_LOCATION ); - + DALI_TEST_EQUALS(naviView.GetChildCount(), 1, TEST_LOCATION); END_TEST; } @@ -172,40 +170,39 @@ int UtcDaliNavigationViewPushAndPop(void) { ToolkitTestApplication application; - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); // 1 Create Navigation View NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); // 2 Push initial Actor Actor testParentActor1 = Actor::New(); - testParentActor1.SetName("TestParentActor1"); - naviView.Push( testParentActor1 ); - DALI_TEST_EQUALS( naviView.GetChildCount(), 1 , TEST_LOCATION ); + testParentActor1.SetProperty(Dali::Actor::Property::NAME, "TestParentActor1"); + naviView.Push(testParentActor1); + DALI_TEST_EQUALS(naviView.GetChildCount(), 1, TEST_LOCATION); // 3 Push Second Actor which contains a child actor Actor testParentActor2 = Actor::New(); - testParentActor2.SetName("TestParentActor2"); + testParentActor2.SetProperty(Dali::Actor::Property::NAME, "TestParentActor2"); Actor testChildActor1 = Actor::New(); - testParentActor2.Add( testChildActor1 ); - naviView.Push( testParentActor2 ); + testParentActor2.Add(testChildActor1); + naviView.Push(testParentActor2); // 3 Push third Actor which contains a child actor Actor testParentActor3 = Actor::New(); - testParentActor3.SetName("TestParentActor3"); + testParentActor3.SetProperty(Dali::Actor::Property::NAME, "TestParentActor3"); Actor testChildActor2 = Actor::New(); - testParentActor2.Add( testChildActor2 ); - naviView.Push( testParentActor3 ); + testParentActor2.Add(testChildActor2); + naviView.Push(testParentActor3); // 4 Pop head actor, it should be TestParentActor3 Actor poppedActor = naviView.Pop(); - DALI_TEST_EQUALS( poppedActor.GetName() , "TestParentActor3", TEST_LOCATION ); + DALI_TEST_EQUALS(poppedActor.GetProperty(Dali::Actor::Property::NAME), "TestParentActor3", TEST_LOCATION); // 5 Pop head actor, it should be TestParentActor2 Actor poppedActor2 = naviView.Pop(); - DALI_TEST_EQUALS( poppedActor2.GetName() , "TestParentActor2", TEST_LOCATION ); - + DALI_TEST_EQUALS(poppedActor2.GetProperty(Dali::Actor::Property::NAME), "TestParentActor2", TEST_LOCATION); END_TEST; } @@ -214,44 +211,42 @@ int UtcDaliNavigationViewPreventLastPop(void) { ToolkitTestApplication application; - Stage stage = Stage::GetCurrent(); + Integration::Scene stage = application.GetScene(); // 1 Create Navigation View NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); // 2 Push initial Actor Actor testParentActor1 = Actor::New(); - testParentActor1.SetName("TestParentActor1"); - naviView.Push( testParentActor1 ); - DALI_TEST_EQUALS( naviView.GetChildCount(), 1 , TEST_LOCATION ); + testParentActor1.SetProperty(Dali::Actor::Property::NAME, "TestParentActor1"); + naviView.Push(testParentActor1); + DALI_TEST_EQUALS(naviView.GetChildCount(), 1, TEST_LOCATION); // 3 Push Second Actor which contains a child actor Actor testParentActor2 = Actor::New(); - testParentActor2.SetName("TestParentActor2"); + testParentActor2.SetProperty(Dali::Actor::Property::NAME, "TestParentActor2"); Actor testChildActor1 = Actor::New(); - testParentActor2.Add( testChildActor1 ); - naviView.Push( testParentActor2 ); + testParentActor2.Add(testChildActor1); + naviView.Push(testParentActor2); // 4 Pop head actor, it should be TestParentActor2 Actor poppedActor1 = naviView.Pop(); - DALI_TEST_EQUALS( poppedActor1.GetName() , "TestParentActor2", TEST_LOCATION ); - + DALI_TEST_EQUALS(poppedActor1.GetProperty(Dali::Actor::Property::NAME), "TestParentActor2", TEST_LOCATION); // 5 Try to Pop head actor, Should be empty hence can not get name of Actor Actor poppedActorEmpty = naviView.Pop(); try { - const std::string hasNoName = poppedActorEmpty.GetName(); - tet_infoline( hasNoName.c_str() ); - DALI_TEST_CHECK( false ); // should not get here + const std::string hasNoName = poppedActorEmpty.GetProperty(Dali::Actor::Property::NAME); + tet_infoline(hasNoName.c_str()); + DALI_TEST_CHECK(false); // should not get here } - catch( ... ) + catch(...) { - DALI_TEST_CHECK( true ); + DALI_TEST_CHECK(true); } - END_TEST; }