X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Futc-Dali-NavigationView.cpp;h=09f0ba5c1d6562df9ab2be24f87234cf95984b34;hb=e483020277e28cd5f93a93cf50119edaac49a9e9;hp=f6b99298bd5eb562194d899d1e0dcfd4b459f2ee;hpb=c01b6a044893962dbc4ec47aeca60bf3b5d09766;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 f6b9929..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); - application.GetScene().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; } @@ -119,16 +119,16 @@ int UtcDaliNavigationViewPush(void) // 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; } @@ -141,29 +141,27 @@ int UtcDaliNavigationViewPop(void) // 1 Create Navigation View NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); // 2 Push initial Actor Actor testParentActor1 = Actor::New(); - testParentActor1.SetProperty( Dali::Actor::Property::NAME,"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.SetProperty( Dali::Actor::Property::NAME,"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.GetProperty< std::string >( Dali::Actor::Property::NAME ) , "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; } @@ -176,36 +174,35 @@ int UtcDaliNavigationViewPushAndPop(void) // 1 Create Navigation View NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); // 2 Push initial Actor Actor testParentActor1 = Actor::New(); - testParentActor1.SetProperty( Dali::Actor::Property::NAME,"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.SetProperty( Dali::Actor::Property::NAME,"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.SetProperty( Dali::Actor::Property::NAME,"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.GetProperty< std::string >( Dali::Actor::Property::NAME ) , "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.GetProperty< std::string >( Dali::Actor::Property::NAME ) , "TestParentActor2", TEST_LOCATION ); - + DALI_TEST_EQUALS(poppedActor2.GetProperty(Dali::Actor::Property::NAME), "TestParentActor2", TEST_LOCATION); END_TEST; } @@ -218,40 +215,38 @@ int UtcDaliNavigationViewPreventLastPop(void) // 1 Create Navigation View NavigationView naviView = NavigationView::New(); - stage.Add( naviView ); + stage.Add(naviView); // 2 Push initial Actor Actor testParentActor1 = Actor::New(); - testParentActor1.SetProperty( Dali::Actor::Property::NAME,"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.SetProperty( Dali::Actor::Property::NAME,"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.GetProperty< std::string >( Dali::Actor::Property::NAME ) , "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.GetProperty< std::string >( Dali::Actor::Property::NAME ); - 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; }