-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * 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 <iostream>
#include <stdlib.h>
-#include <dali/dali.h>
+#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
Rect<float> rect(10.0f, 20.0f, 400.0f, 200.0f);
- Rect<float> r2 = rect;
+ Rect<float> r2(rect);
DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION);
{
TestApplication application;
+ Vector4 vec4(10.0f, 20.0f, 400.0f, 200.0f);
+
+ Rect<float> rect(vec4);
+
+ DALI_TEST_EQUALS(rect.x, 10.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rect.y, 20.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rect.width, 400.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rect.height, 200.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliRectMoveConstructor(void)
+{
+ TestApplication application;
+
Rect<float> rect(10.0f, 20.0f, 400.0f, 200.0f);
- Rect<float> r2(rect);
+ Rect<float> r2 = std::move( rect );
DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION);
DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION);
END_TEST;
}
+int UtcDaliRectMoveAssignmentOperator(void)
+{
+ TestApplication application;
+
+ Rect<float> rect(10.0f, 20.0f, 400.0f, 200.0f);
+
+ Rect<float> r2;
+ r2 = std::move( rect );
+
+ DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r2.width, 400.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r2.height, 200.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliRectAssignmentOperatorRect(void)
+{
+ TestApplication application;
+
+ Rect<float> rect(10.0f, 20.0f, 400.0f, 200.0f);
+
+ Rect<float> r2;
+ r2 = rect;
+
+ DALI_TEST_EQUALS(r2.x, 10.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r2.y, 20.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r2.width, 400.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(r2.height, 200.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliRectAssignmentOperatorVector4(void)
+{
+ TestApplication application;
+
+ Vector4 vec4(10.0f, 20.0f, 400.0f, 200.0f);
+
+ Rect<float> rect;
+ rect = vec4;
+
+ DALI_TEST_EQUALS(rect.x, 10.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rect.y, 20.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rect.width, 400.0f, 0.001, TEST_LOCATION);
+ DALI_TEST_EQUALS(rect.height, 200.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
int UtcDaliRectSet(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliRectLeft(void)
+{
+ TestApplication application;
+
+ Rect<float> rf(10.0f, 20.0f, 400.0f, 200.0f);
+
+ DALI_TEST_EQUALS(rf.Left(), 10.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
+
int UtcDaliRectRight(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliRectTop(void)
+{
+ TestApplication application;
+
+ Rect<float> rf(10.0f, 20.0f, 400.0f, 200.0f);
+
+ DALI_TEST_EQUALS(rf.Top(), 20.0f, 0.001, TEST_LOCATION);
+ END_TEST;
+}
int UtcDaliRectBottom(void)
{
DALI_TEST_CHECK(ri1 == ri1p);
END_TEST;
}
+
+int UtcDaliRectOStreamOperatorP(void)
+{
+ TestApplication application;
+ std::ostringstream oss;
+
+ Rect<int> rect( 1, 2, 10, 10 );
+
+ oss << rect;
+
+ std::string expectedOutput = "[1, 2, 10, 10]";
+
+ DALI_TEST_EQUALS( oss.str(), expectedOutput, TEST_LOCATION);
+ END_TEST;
+}