Fix crash issue when we decode some bmp
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor-internal / utc-Dali-BmpLoader.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dali-test-suite-utils.h>
19 #include <stdlib.h>
20 #include <iostream>
21
22 #include <dali/internal/imaging/common/loader-bmp.h>
23 #include "image-loaders.h"
24
25 using namespace Dali;
26
27 namespace
28 {
29 static const LoadFunctions BmpLoaders(TizenPlatform::LoadBmpHeader, TizenPlatform::LoadBitmapFromBmp);
30
31 } // Unnamed namespace.
32
33 int UtcDaliBmp24bpp(void)
34 {
35   ImageDetails image(TEST_IMAGE_DIR "/flag-24bpp.bmp", 32u, 32u);
36
37   TestImageLoading(image, BmpLoaders);
38
39   END_TEST;
40 }
41 int UtcDaliBmpRGB8(void)
42 {
43   ImageDetails image(TEST_IMAGE_DIR "/w3c_home_256.bmp", 72u, 48u);
44
45   TestImageLoading(image, BmpLoaders);
46
47   END_TEST;
48 }