コード例 #1
0
ファイル: utc-Dali-Page.cpp プロジェクト: Tarnyko/dal-toolkit
static void UtcDaliPageAddGetTitleBarControl()
{
  ToolkitTestApplication application;
  tet_infoline( "UtcDaliPageAddGetTitleBarControl" );

  Page naviItem = Page::New();
  ActorContainer container = naviItem.GetControlsOnTitleBar();
  // Check that the container is empty in the beginning
  DALI_TEST_CHECK( container.empty() );

  // Add control, check whether adding successfully, also check the container size
  PushButton firstControl = PushButton::New();
  DALI_TEST_CHECK( naviItem.AddControlToTitleBar(firstControl) );
  container = naviItem.GetControlsOnTitleBar();
  DALI_TEST_CHECK( container.size() == 1 );

  // The control adding fails, as the control itself is uninitialized
  PushButton secondControl;
  DALI_TEST_CHECK( !naviItem.AddControlToTitleBar(secondControl) );
  container = naviItem.GetControlsOnTitleBar();
  DALI_TEST_CHECK( container.size() == 1 );

  // Add control, check whether adding successfully, also check the container size
  PushButton thirdControl = PushButton::New();
  DALI_TEST_CHECK( naviItem.AddControlToTitleBar(thirdControl) );
  container = naviItem.GetControlsOnTitleBar();
  DALI_TEST_CHECK( container.size() == 2 );

  // check the content of the three successfully added Controls
  DALI_TEST_CHECK( container[0] == firstControl );
  DALI_TEST_CHECK( container[1] == thirdControl );
}