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 #ifndef PEN_TEST_H 17 #define PEN_TEST_H 18 19 #include "draw/canvas.h" 20 21 namespace OHOS { 22 namespace Rosen { 23 namespace Drawing { 24 class PenTest { 25 public: 26 using TestFunc = std::function<void(Canvas&, uint32_t, uint32_t)>; GetInstance()27 inline static PenTest& GetInstance() 28 { 29 static PenTest penTestCase; 30 return penTestCase; 31 } 32 33 static void TestPenColor(Canvas& canvas, uint32_t width, uint32_t height); 34 static void TestPenAlpha(Canvas& canvas, uint32_t width, uint32_t height); 35 static void TestPenWidth(Canvas& canvas, uint32_t width, uint32_t height); 36 static void TestPenMiterLimit(Canvas& canvas, uint32_t width, uint32_t height); 37 static void TestPenCapStyle(Canvas& canvas, uint32_t width, uint32_t height); 38 static void TestPenJoinStyle(Canvas& canvas, uint32_t width, uint32_t height); 39 static void TestPenBlendMode(Canvas& canvas, uint32_t width, uint32_t height); 40 static void TestPenAntiAlias(Canvas& canvas, uint32_t width, uint32_t height); 41 static void TestPenPathEffect(Canvas& canvas, uint32_t width, uint32_t height); 42 static void TestPenFilter(Canvas& canvas, uint32_t width, uint32_t height); 43 static void TestPenReset(Canvas& canvas, uint32_t width, uint32_t height); 44 45 std::vector<TestFunc> PenTestCase(); 46 47 private: 48 PenTest() = default; 49 virtual ~PenTest() = default; 50 }; 51 } // namespace Drawing 52 } // namespace Rosen 53 } // namespace OHOS 54 #endif // PEN_TEST_H