Merge "Add utc test cases" into tizen
authorHyunJu Shin <hyunjushin@samsung.com>
Mon, 25 May 2015 08:41:14 +0000 (01:41 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 25 May 2015 08:41:14 +0000 (01:41 -0700)
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/utc-Dali-TableView.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp [new file with mode: 0644]
dali-toolkit/dali-toolkit.h

index c4d8c35..72c0782 100644 (file)
@@ -35,6 +35,7 @@ SET(TC_SOURCES
    utc-Dali-TableView.cpp
    utc-Dali-TextField.cpp
    utc-Dali-TextLabel.cpp
+   utc-Dali-TextSelectionPopup.cpp
    utc-Dali-ToolBar.cpp
    utc-Dali-WaterEffect.cpp
    utc-Dali-Button.cpp
index 45dd92c..30f0cda 100644 (file)
@@ -41,6 +41,7 @@ const char* const PROPERTY_NAME_COLUMNS = "columns";
 const char* const PROPERTY_NAME_CELL_PADDING = "cell-padding";
 const char* const PROPERTY_NAME_LAYOUT_ROWS = "layout-rows";
 const char* const PROPERTY_NAME_LAYOUT_COLUMNS = "layout-columns";
+const Vector2 CELL_SIZE( 10, 10 );
 
 static bool gObjectCreatedCallBackCalled;
 
@@ -77,9 +78,9 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor&
   actor2 = Actor::New();
   actor3 = Actor::New();
 
-  actor1.SetSize( Dali::Vector2( 10, 10 ) );
-  actor2.SetSize( Dali::Vector2( 10, 10 ) );
-  actor3.SetSize( Dali::Vector2( 10, 10 ) );
+  actor1.SetSize( CELL_SIZE );
+  actor2.SetSize( CELL_SIZE );
+  actor3.SetSize( CELL_SIZE );
 
   tableView.AddChild( actor1, TableView::CellPosition( 0, 0 ) );
   tableView.AddChild( actor2, TableView::CellPosition( 0, 1 ) );
@@ -88,6 +89,17 @@ static void SetupTableViewAndActors(TableView& tableView, Actor& actor1, Actor&
 
 } // namespace
 
+int UtcDaliTableViewCtorCopyP(void)
+{
+  TestApplication application;
+
+  TableView actor1 = TableView::New(10,10);
+  TableView actor2( actor1 );
+
+  DALI_TEST_EQUALS( actor1, actor2, TEST_LOCATION );
+  END_TEST;
+}
+
 int UtcDaliTableViewNew(void)
 {
   ToolkitTestApplication application;
@@ -143,6 +155,42 @@ int UtcDaliTableViewMetricsPadding(void)
 }
 
 // Test adjusting the metric values for the cell.
+int UtcDaliTableViewMetricsFit(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline("UtcDaliTableViewMetricsFit");
+
+  TableView tableView;
+  Actor actor1;
+  Actor actor2;
+  Actor actor3;
+
+  SetupTableViewAndActors(tableView, actor1, actor2, actor3);
+  application.SendNotification();
+  application.Render();
+
+  // 1. check that with no fixed width/heights, actors are in default position.
+  DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
+
+  // 2. check that with a fixed width & height, actors to the right and below are offsetted.
+  tableView.SetFitHeight(0);
+  tableView.SetFitWidth(0);
+  DALI_TEST_EQUALS( tableView.IsFitHeight(0), true, TEST_LOCATION );
+  DALI_TEST_EQUALS( tableView.IsFitWidth(0), true, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( actor1.GetCurrentPosition(), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor2.GetCurrentPosition(), Vector3(10.0f, 0.0f, 0.0f), TEST_LOCATION );
+  DALI_TEST_EQUALS( actor3.GetCurrentPosition(), Vector3(0.0f, 10.0f, 0.0f), TEST_LOCATION );
+  END_TEST;
+}
+
+// Test adjusting the metric values for the cell.
 int UtcDaliTableViewMetricsFixed(void)
 {
   ToolkitTestApplication application;
diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp
new file mode 100644 (file)
index 0000000..d4914f5
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014 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_textselectionpopup_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void dali_textselectionpopup_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+int UtcDaliToolkitTextSelectionPopupNewP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup textSelectionPopup;
+
+  DALI_TEST_CHECK( !textSelectionPopup );
+
+  textSelectionPopup = TextSelectionPopup::New();
+
+  DALI_TEST_CHECK( textSelectionPopup );
+  END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupConstructorP(void)
+{
+  TextSelectionPopup textSelectionPopup;
+
+  DALI_TEST_CHECK( !textSelectionPopup );
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupCopyConstructorP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup textSelectionPopup;
+
+  textSelectionPopup = TextSelectionPopup::New();
+  TextSelectionPopup copy( textSelectionPopup );
+
+  DALI_TEST_CHECK( copy == textSelectionPopup );
+
+  END_TEST;
+}
+
+
+int UtcDaliToolkitTextSelectionPopupDestructorP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup* textSelectionPopup = new TextSelectionPopup;
+  delete textSelectionPopup;
+
+  DALI_TEST_CHECK( true );
+
+  END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupAssignmentOperatorP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New();
+  TextSelectionPopup copy;
+  copy = textSelectionPopup;
+
+  DALI_TEST_CHECK( copy == textSelectionPopup );
+  END_TEST;
+}
+
+int UtcDaliToolkitTextSelectionPopupDownCastP(void)
+{
+  ToolkitTestApplication application;
+  TextSelectionPopup textSelectionPopup;
+  textSelectionPopup = TextSelectionPopup::New();
+
+  TextSelectionPopup cast = TextSelectionPopup::DownCast( textSelectionPopup );
+
+  DALI_TEST_CHECK( cast );
+
+  END_TEST;
+}
index 9cef6c3..eeeaa44 100644 (file)
@@ -44,6 +44,7 @@
 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-field.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+#include <dali-toolkit/public-api/controls/text-controls/text-selection-popup.h>
 #include <dali-toolkit/public-api/focus-manager/focus-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>