1 /* 2 * Copyright (c) 2021 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 "display_gfx.h" 21 #include "display_gralloc.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define __FILENAME__ (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__) 28 29 #ifndef DISPLAY_TEST_CHK_RETURN_NOT_VALUE 30 #define DISPLAY_TEST_CHK_RETURN_NOT_VALUE(val, ret, ...) \ 31 do { \ 32 if (val) { \ 33 __VA_ARGS__; \ 34 return; \ 35 } \ 36 } while (0) 37 #endif 38 39 #ifndef DISPLAY_TEST_CHK_RETURN 40 #define DISPLAY_TEST_CHK_RETURN(val, ret, ...) \ 41 do { \ 42 if (val) { \ 43 __VA_ARGS__; \ 44 return (ret); \ 45 } \ 46 } while (0) 47 #endif 48 49 #define DISPLAY_TEST_LOGD(format, ...) \ 50 do { \ 51 printf("[%s@%s:%d] " format "\n", __FUNCTION__, __FILENAME__, __LINE__, ##__VA_ARGS__); \ 52 } while (0) 53 54 #define DISPLAY_TEST_LOGE(format, ...) \ 55 do { \ 56 printf("\033[0;32;31m" \ 57 "[%s@%s:%d] " format "\033[m" \ 58 "\n", \ 59 __FUNCTION__, __FILENAME__, __LINE__, ##__VA_ARGS__); \ 60 } while (0) 61 62 #ifdef __cplusplus 63 } 64 #endif 65 #endif // DISPLAY_TEST_H 66