1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DISPLAY_TEST_H 17 #define DISPLAY_TEST_H 18 #include <cstring> 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include "display_gfx.h" 22 #include "display_gralloc.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 #define __FILENAMES__ (strrchr("/" __FILE__, '/') + 1) 28 #ifndef DISPLAY_TEST_CHK_RETURN_NOT_VALUE 29 #define DISPLAY_TEST_CHK_RETURN_NOT_VALUE(val, ret, ...) \ 30 do { \ 31 if (val) { \ 32 __VA_ARGS__; \ 33 return; \ 34 } \ 35 } while (0) 36 #endif 37 38 #ifndef DISPLAY_TEST_CHK_RETURN 39 #define DISPLAY_TEST_CHK_RETURN(val, ret, ...) \ 40 do { \ 41 if (val) { \ 42 __VA_ARGS__; \ 43 return (ret); \ 44 } \ 45 } while (0) 46 #endif 47 48 #define DISPLAY_TEST_LOGI(format, ...) \ 49 do { \ 50 printf("[%s@%s:%d] " format "\n", __FUNCTION__, __FILENAMES__, __LINE__, ##__VA_ARGS__); \ 51 } while (0) 52 53 #define DISPLAY_TEST_LOGE(format, ...) \ 54 do { \ 55 printf("\033[0;32;31m" \ 56 "[%s@%s:%d] " format "\033[m" \ 57 "\n", \ 58 __FUNCTION__, __FILENAMES__, __LINE__, ##__VA_ARGS__); \ 59 } while (0) 60 61 #ifdef __cplusplus 62 } 63 #endif 64 #endif // DISPLAY_TEST_H 65