2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "dali-scene-loader/public-api/mesh-definition.h"
21 #include <dali-test-suite-utils.h>
24 using namespace Dali::SceneLoader;
26 int UtcDaliMeshDefinitionBlobApplyMinMaxBothMinMaxApplied(void)
28 using Container = std::vector<float>;
30 Container buffer = { 4.0f, 6.0f, 8.0f, 10.0f, 12.0f };
31 Container minValues = { 5.0f };
32 Container maxValues = { 10.0f };
33 Container result = {5.0f, 6.0f, 8.0f, 10.0f, 10.0f};
35 MeshDefinition::Blob::ApplyMinMax(minValues, maxValues, 5, buffer.data());
37 for( auto i = 0u; i < result.size(); ++i)
39 DALI_TEST_EQUALS(buffer[i], result[i], TEST_LOCATION);
45 int UtcDaliMeshDefinitionBlobApplyMinMaxOnlyMin(void)
47 using Container = std::vector<float>;
49 Container buffer = { 4.0f, 6.0f, 8.0f, 10.0f, 12.0f };
50 Container minValues = { 5.0f };
51 Container maxValues = {};
52 Container result = {5.0f, 6.0f, 8.0f, 10.0f, 12.0f};
54 MeshDefinition::Blob::ApplyMinMax(minValues, maxValues, 5, buffer.data());
56 for( auto i = 0u; i < result.size(); ++i)
58 DALI_TEST_EQUALS(buffer[i], result[i], TEST_LOCATION);
64 int UtcDaliMeshDefinitionBlobApplyMinMaxOnlyMax(void)
66 using Container = std::vector<float>;
68 Container buffer = { 4.0f, 6.0f, 8.0f, 10.0f, 12.0f };
69 Container minValues = { };
70 Container maxValues = { 10.0f };
71 Container result = {4.0f, 6.0f, 8.0f, 10.0f, 10.0f};
73 MeshDefinition::Blob::ApplyMinMax(minValues, maxValues, 5, buffer.data());
75 for( auto i = 0u; i < result.size(); ++i)
77 DALI_TEST_EQUALS(buffer[i], result[i], TEST_LOCATION);
83 int UtcDaliMeshDefinitionBlobApplyMinMaxBothEmpty(void)
85 using Container = std::vector<float>;
87 Container buffer = { 4.0f, 6.0f, 8.0f, 10.0f, 12.0f };
90 Container result = {4.0f, 6.0f, 8.0f, 10.0f, 12.0f};
92 MeshDefinition::Blob::ApplyMinMax(minValues, maxValues, 5, buffer.data());
94 for( auto i = 0u; i < result.size(); ++i)
96 DALI_TEST_EQUALS(buffer[i], result[i], TEST_LOCATION);