2 * Copyright (c) 2022 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.
18 #include <dali-toolkit-test-suite-utils.h>
19 #include <dali-toolkit/dali-toolkit.h>
20 #include <dali/dali.h>
25 using namespace Dali::Toolkit;
29 // Resolution: 50*50, pixel format: RGBA8888
30 static const char* gImage_50_RGBA = TEST_RESOURCE_DIR "/icon-delete.png";
32 // Resolution: 128*128, pixel format: RGB888
33 static const char* gImage_128_RGB = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
35 void VerifyLoad(PixelData pixelData, uint32_t width, uint32_t height)
37 DALI_TEST_CHECK(pixelData);
38 DALI_TEST_EQUALS<unsigned int>(pixelData.GetWidth(), width, TEST_LOCATION);
39 DALI_TEST_EQUALS<unsigned int>(pixelData.GetHeight(), height, TEST_LOCATION);
42 } // anonymous namespace
44 int UtcDaliSyncImageLoaderLoad(void)
46 PixelData pixelData = Toolkit::SyncImageLoader::Load(gImage_50_RGBA);
48 DALI_TEST_CHECK(pixelData);
53 int UtcDaliSyncImageLoaderLoadWithDimensions(void)
55 PixelData pixelData = Toolkit::SyncImageLoader::Load(gImage_50_RGBA, ImageDimensions(25, 25));
57 VerifyLoad(pixelData, 25u, 25u);
62 int UtcDaliSyncImageLoaderLoadWithAllOptions(void)
64 PixelData pixelData = Toolkit::SyncImageLoader::Load(gImage_128_RGB, ImageDimensions(100, 100), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, true);
66 VerifyLoad(pixelData, 100u, 100u);