1 /*
2 * Copyright (c) 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 #include <iostream>
17 #include <string>
18 #include <unordered_map>
19
20 #include "drawing_sample.h"
21
22 #include "bitmap_test.h"
23 #include "camera_test.h"
24 #include "filter_test.h"
25 #include "image_test.h"
26 #include "matrix_test.h"
27 #include "path_effect_test.h"
28 #include "path_test.h"
29 #include "shader_test.h"
30 #include "shadow_test.h"
31 #include "pen_test.h"
32
33 using namespace OHOS;
34 using namespace Rosen;
35 using namespace Drawing;
36 using namespace std;
37
38 using TestFunc = std::function<void(Canvas&, uint32_t, uint32_t)>;
39
TestHello()40 static void TestHello()
41 {
42 std::cout << "Drawing module test start.\n";
43 std::cout << "If you want to get more information, \n";
44 std::cout << "please type 'hilog | grep Drawing' in another hdc shell window\n";
45 std::cout << "-------------------------------------------------------\n";
46 }
47
main()48 int main()
49 {
50 TestHello();
51 std::map<string, std::vector<TestFunc>> testFuncMap;
52
53 testFuncMap.insert(pair<string, std::vector<TestFunc>>("BitmapTest", BitmapTest::GetInstance().BitmapTestCase()));
54 testFuncMap.insert(pair<string, std::vector<TestFunc>>("CameraTest", CameraTest::GetInstance().CameraTestCase()));
55 testFuncMap.insert(pair<string, std::vector<TestFunc>>("FilterTest", FilterTest::GetInstance().FilterTestCase()));
56 testFuncMap.insert(pair<string, std::vector<TestFunc>>("ImageTest", ImageTest::GetInstance().ImageTestCase()));
57 testFuncMap.insert(pair<string, std::vector<TestFunc>>("MatrixTest", MatrixTest::GetInstance().MatrixTestCase()));
58 testFuncMap.insert(pair<string, std::vector<TestFunc>>("PathTest", PathTest::GetInstance().PathTestCase()));
59 testFuncMap.insert(pair<string, std::vector<TestFunc>>("ShaderTest", ShaderTest::GetInstance().ShaderTestCase()));
60 testFuncMap.insert(pair<string, std::vector<TestFunc>>("ShadowTest", ShadowTest::GetInstance().ShadowTestCase()));
61 testFuncMap.insert(pair<string, std::vector<TestFunc>>("PenTest", PenTest::GetInstance().PenTestCase()));
62
63 DrawingSample m;
64 m.SetDraw(testFuncMap).Run();
65 std::cout << "Drawing module test end.\n";
66 return 0;
67 }