2 * Copyright (c) 2016 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/dali.h>
21 #include <dali-toolkit-test-suite-utils.h>
22 #include <dali-toolkit/dali-toolkit.h>
25 using namespace Dali::Toolkit;
30 // Resolution: 50*50, pixel format: RGBA8888
31 static const char* gImage_50_RGBA = TEST_RESOURCE_DIR "/icon-delete.png";
33 // Resolution: 128*128, pixel format: RGB888
34 static const char* gImage_128_RGB = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
37 void VerifyLoad( PixelData pixelData, uint32_t width, uint32_t height )
39 DALI_TEST_CHECK( pixelData );
40 DALI_TEST_EQUALS<unsigned int>( pixelData.GetWidth(), width, TEST_LOCATION );
41 DALI_TEST_EQUALS<unsigned int>( pixelData.GetHeight(), height, TEST_LOCATION );
44 } // anonymous namespace
47 int UtcDaliSyncImageLoaderLoad(void)
49 PixelData pixelData = Toolkit::SyncImageLoader::Load( gImage_50_RGBA );
51 DALI_TEST_EQUALS<bool>( pixelData, true, TEST_LOCATION );
56 int UtcDaliSyncImageLoaderLoadWithDimensions(void)
58 PixelData pixelData = Toolkit::SyncImageLoader::Load( gImage_50_RGBA, ImageDimensions( 25, 25 ) );
60 VerifyLoad( pixelData, 25u, 25u );
65 int UtcDaliSyncImageLoaderLoadWithAllOptions(void)
67 PixelData pixelData = Toolkit::SyncImageLoader::Load( gImage_128_RGB, ImageDimensions( 100, 100 ), FittingMode::SCALE_TO_FILL, SamplingMode::BOX_THEN_LINEAR, true );
69 VerifyLoad( pixelData, 100u, 100u );