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.
18 #include <dali-test-suite-utils.h>
22 #include <dali/internal/imaging/common/loader-ico.h>
23 #include "image-loaders.h"
29 static const LoadFunctions IcoLoaders(TizenPlatform::LoadIcoHeader, TizenPlatform::LoadBitmapFromIco);
31 // Golden master image data for each icon type:
32 // Note: The bottom right corner of each image is fully transparent.
33 // Note: The first 4 sets of data *happen* to be the same, but could be different depending on the image converted.
34 // In this case as the original image contains few colors, they can easily fit inside an 8bit palette, thus
35 // Causing no image degradation.
37 uint32_t ImageCheckData_Ico4x4_32bpp_8alpha[] = {
38 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
40 uint32_t ImageCheckData_Ico4x4_24bpp[] = {
41 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
43 uint32_t ImageCheckData_Ico4x4_8bpp[] = {
44 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
46 uint32_t ImageCheckData_Ico4x4_4bpp[] = {
47 0xff0000ff, 0x00ff00ff, 0x0000ffff, 0xff00ffff, 0xc04040ff, 0x40c040ff, 0x4040c0ff, 0xffff00ff, 0xa06060ff, 0x60a060ff, 0x6060a0ff, 0x00ffffff, 0xffffffff, 0x808080ff, 0x000000ff, 0x00000000};
49 uint32_t ImageCheckData_Ico4x4_1bpp[] = {
50 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA18783ff, 0xA1878300};
52 } // Unnamed namespace.
54 int UtcDaliIco32bpp8alpha(void)
56 ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-32bpp.ico", 4u, 4u);
58 CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_32bpp_8alpha);
63 int UtcDaliIco24bpp1alpha(void)
65 ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-24bpp.ico", 4u, 4u);
67 CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_24bpp);
72 int UtcDaliIco8bpp1alpha(void)
74 ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-8bpp.ico", 4u, 4u);
76 CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_8bpp);
81 int UtcDaliIco4bpp1alpha(void)
83 ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-4bpp.ico", 4u, 4u);
85 CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_4bpp);
90 int UtcDaliIco1bpp1alpha(void)
92 ImageDetails image(TEST_IMAGE_DIR "/test-image-4x4-1bpp.ico", 4u, 4u);
94 CompareLoadedImageData(image, IcoLoaders, ImageCheckData_Ico4x4_1bpp);