Revert "[Tizen] Appendix log for ttrace + Print keycode and timestamp"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Degree.cpp
index be2cbd0..b5905ab 100644 (file)
@@ -1,8 +1,25 @@
-#include <iostream>
+/*
+ * Copyright (c) 2020 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 <stdlib.h>
-#include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
+#include <dali/public-api/dali-core.h>
+#include <stdlib.h>
+
+#include <iostream>
 
 using namespace Dali;
 
@@ -16,89 +33,98 @@ void utc_dali_degree_cleanup(void)
   test_return_value = TET_PASS;
 }
 
-
 // Positive test case for constructors
 int UtcDaliDegreeConstructors01(void)
 {
   TestApplication application;
 
   // Default constructor, does not initialise the value
-  Degree degree0( 0.0f );
+  Degree degree0(0.0f);
 
-  // Test float assignment operator
-  degree0 = 180.0f;
-  DALI_TEST_EQUALS( float(degree0), 180.0f, 0.001f, TEST_LOCATION );
+  // Test assignment operator
+  degree0 = Degree(180.0f);
+  DALI_TEST_EQUALS(degree0.degree, 180.0f, 0.001f, TEST_LOCATION);
 
   // Constructor from float value
-  Degree degree1( 180.0f );
-  DALI_TEST_EQUALS( float(degree1), 180.0f, 0.001f, TEST_LOCATION );
+  Degree degree1(180.0f);
+  DALI_TEST_EQUALS(degree1.degree, 180.0f, 0.001f, TEST_LOCATION);
 
   // Constructor from a Radian
-  Degree degree2( Radian( Math::PI ) );
-  DALI_TEST_EQUALS( float(degree2), 180.0f, 0.001f, TEST_LOCATION );
+  Degree degree2(Radian(Math::PI));
+  DALI_TEST_EQUALS(degree2.degree, 180.0f, 0.001f, TEST_LOCATION);
 
-  // Assignment from Radian
-  Degree degree3( 0.0f );
-  degree3 = Radian( Math::PI );
-  DALI_TEST_EQUALS( float(degree3), 180.0f, 0.001f, TEST_LOCATION );
   END_TEST;
 }
 
-// Positive test case for comparison
-int UtcDaliDegreeComparison01(void)
+int UtcDaliDegreeCopyConstructor(void)
 {
-  TestApplication application;
+  Degree degree0(90.0f);
+  Degree degree1(degree0);
+  DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
 
-  // Comparison between radians
-  Degree degree0( 90.0f );
-  Degree degree1( 90.0f );
-  Degree degree2( 180.0f );
+  END_TEST;
+}
 
-  DALI_TEST_CHECK( degree0 == degree1 );
-  DALI_TEST_CHECK( degree0 != degree2 );
+int UtcDaliDegreeMoveConstructor(void)
+{
+  Degree degree0(90.0f);
+  Degree degree1 = std::move(degree0);
+  DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
 
-  // Comparison between radian to degree
-  Degree degree3( 180.0f );
-  Degree degree4( 90.0f );
-  Radian radian0( Math::PI );
+  END_TEST;
+}
 
-  DALI_TEST_CHECK( degree3 == radian0 );
-  DALI_TEST_CHECK( degree4 != radian0 );
+int UtcDaliDegreeCopyAssignment(void)
+{
+  Degree degree0(90.0f);
+  Degree degree1;
+  degree1 = degree0;
+  DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
 
-  // Comparison with float
-  Degree degree5( 90.0f );
+  END_TEST;
+}
 
-  DALI_TEST_CHECK( degree5 == 90.0f );
-  DALI_TEST_CHECK( degree5 != 180.0f );
+int UtcDaliDegreeMoveAssignment(void)
+{
+  Degree degree0(90.0f);
+  Degree degree1;
+  degree1 = std::move(degree0);
+  DALI_TEST_EQUALS(degree1.degree, 90.0f, 0.001f, TEST_LOCATION);
 
   END_TEST;
 }
 
-
-// test case for cast operators
-int UtcDaliDegreeCastOperators01(void)
+// Positive test case for comparison
+int UtcDaliDegreeComparison01(void)
 {
-  TestApplication application;  // Exceptions require TestApplication
+  TestApplication application;
 
-  Degree degree0( 180.0f );
+  // Comparison between degrees
+  Degree degree0(90.0f);
+  Degree degree1(90.0f);
+  Degree degree2(180.0f);
 
-  const float& value0( degree0 );
-  DALI_TEST_EQUALS( value0, 180.0f, 0.001f, TEST_LOCATION );
+  DALI_TEST_CHECK(degree0 == degree1);
+  DALI_TEST_CHECK(degree0 != degree2);
 
-  degree0 = 90.0f;
-  DALI_TEST_EQUALS( value0, 90.0f, 0.001f, TEST_LOCATION );
+  // Comparison between radian to degree
+  Degree degree3(180.0f);
+  Degree degree4(90.0f);
+  Radian radian0(Math::PI);
 
-  float& value1( degree0 );
-  DALI_TEST_EQUALS( value1, 90.0f, 0.001f, TEST_LOCATION );
+  DALI_TEST_CHECK(degree3 == Degree(radian0));
+  DALI_TEST_CHECK(degree4 != Degree(radian0));
 
-  value1 = 180.0f;
-  DALI_TEST_EQUALS( float(degree0), 180.0f, 0.001f, TEST_LOCATION );
-  END_TEST;
-}
+  // Comparison with float
+  Degree degree5(90.0f);
 
+  DALI_TEST_CHECK(degree5.degree == 90.0f);
+  DALI_TEST_CHECK(degree5.degree != 180.0f);
 
+  END_TEST;
+}
 
-int UtcDaliDegreeCastOperatorEquals(void)
+int UtcDaliDegreeOperatorEquals(void)
 {
   TestApplication application;
 
@@ -112,7 +138,7 @@ int UtcDaliDegreeCastOperatorEquals(void)
   END_TEST;
 }
 
-int UtcDaliDegreeCastOperatorNotEquals(void)
+int UtcDaliDegreeOperatorNotEquals(void)
 {
   TestApplication application;
 
@@ -125,27 +151,3 @@ int UtcDaliDegreeCastOperatorNotEquals(void)
   DALI_TEST_EQUALS(a != c, true, TEST_LOCATION);
   END_TEST;
 }
-
-int UtcDaliDegreeCastOperatorLessThan(void)
-{
-  TestApplication application;
-
-  Degree a(45.0f);
-  Degree b(90.0f);
-  Degree c(180.0f);
-  Degree d(360.0f);
-  Degree e(-180.0f);
-
-  DALI_TEST_EQUALS(a < a, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(a < b, true, TEST_LOCATION);
-  DALI_TEST_EQUALS(a < c, true, TEST_LOCATION);
-  DALI_TEST_EQUALS(a < d, true, TEST_LOCATION);
-  DALI_TEST_EQUALS(a < e, false, TEST_LOCATION);
-
-  DALI_TEST_EQUALS(b < a, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(b < b, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(c < b, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(d < b, false, TEST_LOCATION);
-  DALI_TEST_EQUALS(e < b, true, TEST_LOCATION);
-  END_TEST;
-}