• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
32 using namespace OHOS;
33 using namespace Rosen;
34 using namespace Drawing;
35 using namespace std;
36 
37 using TestFunc = std::function<void(Canvas&, uint32_t, uint32_t)>;
38 
TestHello()39 static void TestHello()
40 {
41     std::cout << "Drawing module test start.\n";
42     std::cout << "If you want to get more information, \n";
43     std::cout << "please type 'hilog | grep Drawing' in another hdc shell window\n";
44     std::cout << "-------------------------------------------------------\n";
45 }
46 
main()47 int main()
48 {
49     TestHello();
50     std::map<string, std::vector<TestFunc>> testFuncMap;
51 
52     testFuncMap.insert(pair<string, std::vector<TestFunc>>("BitmapTest", BitmapTest::GetInstance().BitmapTestCase()));
53     testFuncMap.insert(pair<string, std::vector<TestFunc>>("CameraTest", CameraTest::GetInstance().CameraTestCase()));
54     testFuncMap.insert(pair<string, std::vector<TestFunc>>("FilterTest", FilterTest::GetInstance().FilterTestCase()));
55     testFuncMap.insert(pair<string, std::vector<TestFunc>>("ImageTest", ImageTest::GetInstance().ImageTestCase()));
56     testFuncMap.insert(pair<string, std::vector<TestFunc>>("MatrixTest", MatrixTest::GetInstance().MatrixTestCase()));
57     testFuncMap.insert(pair<string, std::vector<TestFunc>>("PathTest", PathTest::GetInstance().PathTestCase()));
58     testFuncMap.insert(pair<string, std::vector<TestFunc>>("ShaderTest", ShaderTest::GetInstance().ShaderTestCase()));
59     testFuncMap.insert(pair<string, std::vector<TestFunc>>("ShadowTest", ShadowTest::GetInstance().ShadowTestCase()));
60 
61     DrawingSample m;
62     m.SetDraw(testFuncMap).Run();
63     std::cout << "Drawing module test end.\n";
64     return 0;
65 }