• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * SPDX-License-Identifier: Apache-2.0
3  * Copyright (c) 2025 Huawei Device 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
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 #ifndef DDGR_TEST_DTK_DTK_TEST_EXT_H
17 #define DDGR_TEST_DTK_DTK_TEST_EXT_H
18 
19 #include "dtk_test_register.h"
20 
21 namespace OHOS {
22 namespace Rosen {
23 template<typename T>
24 class EmptyMixin {};
25 
26 #define DEF_DTK_CLASS(classUniqueId, test_case_name, test_level, test_case_index, mixin)                    \
27 class Dtk_##classUniqueId : public OHOS::Rosen::TestBase, public mixin<Dtk_##classUniqueId> {     \
28 public:                                                                                                 \
29     Dtk_##classUniqueId() : TestBase() {}                                                            \
30     virtual ~Dtk_##classUniqueId() = default;                                                        \
31 protected:                                                                                              \
32     friend class mixin<Dtk_##classUniqueId>;                                                         \
33     void OnRecording() override;                                                                        \
34 };                                                                                                      \
35 bool DTK_UNIQUE_ID_##classUniqueId =                                                                 \
36     OHOS::Rosen::DtkTestRegister::Instance()->regist(#test_case_name,                                \
37     []()->std::shared_ptr<OHOS::Rosen::TestBase> {return std::make_shared<Dtk_##classUniqueId>();},  \
38     test_level, test_case_index);                                                                       \
39 void Dtk_##classUniqueId::OnRecording()
40 
41 #define DEF_DTK_CLASS_UNIQUE_ID(file_line, test_case_name, test_level, test_case_index, mixin) \
42 DEF_DTK_CLASS(test_case_name##_##file_line, test_case_name, test_level, test_case_index, mixin)
43 
44 #define DEF_DTK_CLASS_UNIQUE_ID_2(file_line, test_case_name, test_level, test_case_index, mixin) \
45 DEF_DTK_CLASS_UNIQUE_ID(file_line, test_case_name, test_level, test_case_index, mixin)
46 
47 #define DEF_DTK(test_case_name, test_level, test_case_index) \
48 DEF_DTK_CLASS_UNIQUE_ID_2(__LINE__, test_case_name, test_level, test_case_index, EmptyMixin)
49 
50 #define DEF_DTK_MIXIN(test_case_name, test_level, test_case_index, mixin) \
51 DEF_DTK_CLASS_UNIQUE_ID_2(__LINE__, test_case_name, test_level, test_case_index, mixin)
52 } // namespace Rosen
53 } // namespace OHOS
54 #endif // DDGR_TEST_DTK_DTK_TEST_EXT_H