mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
tdd 删除ace_ohos_unittest_base
Signed-off-by: kangchongtao <kangchongtao@huawei.com>
This commit is contained in:
parent
0143393a94
commit
67c47ba872
@ -83,56 +83,6 @@ foreach(item, ace_platforms) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(item, ace_platforms) {
|
|
||||||
platform = item.name
|
|
||||||
if (platform == "ohos") {
|
|
||||||
ohos_source_set("ace_ohos_unittest_base") {
|
|
||||||
subsystem_name = ace_engine_subsystem
|
|
||||||
part_name = ace_engine_part
|
|
||||||
testonly = true
|
|
||||||
sources = [
|
|
||||||
"$ace_root/test/mock/adapter/mock_ace_container.cpp",
|
|
||||||
"$ace_root/test/mock/base/mock_download_manager.cpp",
|
|
||||||
"$ace_root/test/mock/base/mock_drag_window.cpp",
|
|
||||||
"$ace_root/test/mock/base/mock_foldable_window.cpp",
|
|
||||||
"$ace_root/test/mock/base/mock_subwindow.cpp",
|
|
||||||
"$ace_root/test/mock/core/common/mock_ace_application_info.cpp",
|
|
||||||
"$ace_root/test/mock/core/common/mock_resource_adapter.cpp",
|
|
||||||
"$ace_root/test/mock/interfaces/mock_ace_forward_compatibility.cpp",
|
|
||||||
]
|
|
||||||
|
|
||||||
if (is_ohos_standard_system) {
|
|
||||||
sources -= [
|
|
||||||
"$ace_root/test/mock/base/mock_download_manager.cpp",
|
|
||||||
"$ace_root/test/mock/core/common/mock_resource_adapter.cpp",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
configs = [
|
|
||||||
"$ace_root:ace_test_config",
|
|
||||||
"$ace_root:ace_coverage_config",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps = [
|
|
||||||
"$ace_root/adapter/ohos/osal:ace_osal_ohos_ohos",
|
|
||||||
"$ace_root/frameworks/base:ace_base_ohos",
|
|
||||||
"$ace_root/frameworks/base/resource:ace_resource",
|
|
||||||
"$ace_root/frameworks/bridge:framework_bridge_ohos",
|
|
||||||
"$ace_root/frameworks/core:ace_core_ohos",
|
|
||||||
"$ace_root/frameworks/core/components/theme:build_theme_code",
|
|
||||||
"//third_party/googletest:gmock_main",
|
|
||||||
"//third_party/googletest:gtest_main",
|
|
||||||
]
|
|
||||||
|
|
||||||
external_deps = [
|
|
||||||
"ability_runtime:abilitykit_native",
|
|
||||||
"c_utils:utils",
|
|
||||||
"napi:ace_napi",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Config for reduceing eh_frame section on aosp platform to save rom size.
|
# Config for reduceing eh_frame section on aosp platform to save rom size.
|
||||||
config("reduce_eh_frame_config") {
|
config("reduce_eh_frame_config") {
|
||||||
if (!use_mingw_win && !use_mac && !use_linux) {
|
if (!use_mingw_win && !use_mac && !use_linux) {
|
||||||
|
@ -27,23 +27,28 @@
|
|||||||
#include "test/mock/core/rosen/testing_data.h"
|
#include "test/mock/core/rosen/testing_data.h"
|
||||||
#include "test/mock/core/rosen/testing_draw_cmd_list.h"
|
#include "test/mock/core/rosen/testing_draw_cmd_list.h"
|
||||||
#include "test/mock/core/rosen/testing_filter.h"
|
#include "test/mock/core/rosen/testing_filter.h"
|
||||||
|
#include "test/mock/core/rosen/testing_font.h"
|
||||||
#include "test/mock/core/rosen/testing_font_collection.h"
|
#include "test/mock/core/rosen/testing_font_collection.h"
|
||||||
#include "test/mock/core/rosen/testing_image.h"
|
#include "test/mock/core/rosen/testing_image.h"
|
||||||
#include "test/mock/core/rosen/testing_image_info.h"
|
|
||||||
#include "test/mock/core/rosen/testing_image_filter.h"
|
#include "test/mock/core/rosen/testing_image_filter.h"
|
||||||
|
#include "test/mock/core/rosen/testing_image_info.h"
|
||||||
#include "test/mock/core/rosen/testing_mask_filter.h"
|
#include "test/mock/core/rosen/testing_mask_filter.h"
|
||||||
#include "test/mock/core/rosen/testing_path.h"
|
#include "test/mock/core/rosen/testing_path.h"
|
||||||
#include "test/mock/core/rosen/testing_path_effect.h"
|
#include "test/mock/core/rosen/testing_path_effect.h"
|
||||||
#include "test/mock/core/rosen/testing_pen.h"
|
#include "test/mock/core/rosen/testing_pen.h"
|
||||||
|
#include "test/mock/core/rosen/testing_picture.h"
|
||||||
#include "test/mock/core/rosen/testing_point.h"
|
#include "test/mock/core/rosen/testing_point.h"
|
||||||
#include "test/mock/core/rosen/testing_point3.h"
|
#include "test/mock/core/rosen/testing_point3.h"
|
||||||
#include "test/mock/core/rosen/testing_recording_canvas.h"
|
#include "test/mock/core/rosen/testing_recording_canvas.h"
|
||||||
#include "test/mock/core/rosen/testing_recording_path_effect.h"
|
#include "test/mock/core/rosen/testing_recording_path_effect.h"
|
||||||
#include "test/mock/core/rosen/testing_sampling_options.h"
|
#include "test/mock/core/rosen/testing_sampling_options.h"
|
||||||
|
#include "test/mock/core/rosen/testing_save_layer_ops.h"
|
||||||
#include "test/mock/core/rosen/testing_scalar.h"
|
#include "test/mock/core/rosen/testing_scalar.h"
|
||||||
#include "test/mock/core/rosen/testing_shader_effect.h"
|
#include "test/mock/core/rosen/testing_shader_effect.h"
|
||||||
#include "test/mock/core/rosen/testing_shadowflags.h"
|
#include "test/mock/core/rosen/testing_shadowflags.h"
|
||||||
|
#include "test/mock/core/rosen/testing_text_blob.h"
|
||||||
#include "test/mock/core/rosen/testing_text_style.h"
|
#include "test/mock/core/rosen/testing_text_style.h"
|
||||||
|
#include "test/mock/core/rosen/testing_typeface.h"
|
||||||
#include "test/mock/core/rosen/testing_typography.h"
|
#include "test/mock/core/rosen/testing_typography.h"
|
||||||
#include "test/mock/core/rosen/testing_typography_create.h"
|
#include "test/mock/core/rosen/testing_typography_create.h"
|
||||||
#include "test/mock/core/rosen/testing_typography_style.h"
|
#include "test/mock/core/rosen/testing_typography_style.h"
|
||||||
@ -107,6 +112,17 @@ using RSDrawCmdList = Testing::TestingDrawCmdList;
|
|||||||
using RSRecordingPath = Testing::TestingPath;
|
using RSRecordingPath = Testing::TestingPath;
|
||||||
using RSImageInfo = Testing::TestingImageInfo;
|
using RSImageInfo = Testing::TestingImageInfo;
|
||||||
using RSRecordingPathEffect = Testing::TestingRecordingPathEffect;
|
using RSRecordingPathEffect = Testing::TestingRecordingPathEffect;
|
||||||
|
using RSTypeface = Testing::TestingTypeface;
|
||||||
|
using RSTextBlob = Testing::TestingTextBlob;
|
||||||
|
using RSFont = Testing::TestingFont;
|
||||||
|
using RSTextEncoding = Testing::TestingTextEncoding;
|
||||||
|
#ifdef USE_ROSEN_DRAWING
|
||||||
|
using RSRecordingColorFilter = Testing::TestingColorFilter;
|
||||||
|
using RSRecordingImageFilter = Testing::TestingImageFilter;
|
||||||
|
using RSSaveLayerOps = Testing::TestingSaveLayerOps;
|
||||||
|
using RSRecordingShaderEffect = Testing::TestingShaderEffect;
|
||||||
|
using RSPicture = Testing::TestingPicture;
|
||||||
|
#endif
|
||||||
#ifdef USE_GRAPHIC_TEXT_GINE
|
#ifdef USE_GRAPHIC_TEXT_GINE
|
||||||
using RSTextRectHeightStyle = Testing::TestingTypographyProperties::TextRectHeightStyle;
|
using RSTextRectHeightStyle = Testing::TestingTypographyProperties::TextRectHeightStyle;
|
||||||
using RSTextRectWidthStyle = Testing::TestingTypographyProperties::TextRectWidthStyle;
|
using RSTextRectWidthStyle = Testing::TestingTypographyProperties::TextRectWidthStyle;
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
MOCK_METHOD1(DrawRoundRect, void(const TestingRoundRect& roundRect));
|
MOCK_METHOD1(DrawRoundRect, void(const TestingRoundRect& roundRect));
|
||||||
MOCK_METHOD3(DrawBitmap, void(const TestingBitmap& bitmap, const float px, const float py));
|
MOCK_METHOD3(DrawBitmap, void(const TestingBitmap& bitmap, const float px, const float py));
|
||||||
MOCK_METHOD1(DrawBackground, void(const TestingBrush& brush));
|
MOCK_METHOD1(DrawBackground, void(const TestingBrush& brush));
|
||||||
MOCK_METHOD2(ClipRect, void(const TestingRect& rect, ClipOp op));
|
MOCK_METHOD3(ClipRect, void(const TestingRect& rect, ClipOp op, bool doAntiAlias));
|
||||||
MOCK_METHOD3(ClipPath, void(const TestingPath& rect, ClipOp op, bool doAntiAlias));
|
MOCK_METHOD3(ClipPath, void(const TestingPath& rect, ClipOp op, bool doAntiAlias));
|
||||||
MOCK_METHOD3(
|
MOCK_METHOD3(
|
||||||
DrawImageRect, void(const TestingImage& image, const TestingRect& dst, const TestingSamplingOptions& sampling));
|
DrawImageRect, void(const TestingImage& image, const TestingRect& dst, const TestingSamplingOptions& sampling));
|
||||||
|
@ -71,6 +71,13 @@ public:
|
|||||||
virtual void SetAlpha(uint32_t alpha) {}
|
virtual void SetAlpha(uint32_t alpha) {}
|
||||||
virtual void SetAlphaF(float a) {}
|
virtual void SetAlphaF(float a) {}
|
||||||
virtual void SetARGB(int r, int g, int b, int a) {}
|
virtual void SetARGB(int r, int g, int b, int a) {}
|
||||||
|
virtual void Reset() {}
|
||||||
|
const TestingFilter& GetFilter() const
|
||||||
|
{
|
||||||
|
return filer_;
|
||||||
|
}
|
||||||
|
|
||||||
|
TestingFilter filer_;
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_BRUSH_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_BRUSH_H
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "testing_brush.h"
|
#include "testing_brush.h"
|
||||||
#include "testing_color.h"
|
#include "testing_color.h"
|
||||||
#include "testing_image.h"
|
#include "testing_image.h"
|
||||||
|
#include "testing_matrix.h"
|
||||||
#include "testing_path.h"
|
#include "testing_path.h"
|
||||||
#include "testing_pen.h"
|
#include "testing_pen.h"
|
||||||
#include "testing_point.h"
|
#include "testing_point.h"
|
||||||
@ -27,6 +28,7 @@
|
|||||||
#include "testing_rect.h"
|
#include "testing_rect.h"
|
||||||
#include "testing_round_rect.h"
|
#include "testing_round_rect.h"
|
||||||
#include "testing_sampling_options.h"
|
#include "testing_sampling_options.h"
|
||||||
|
#include "testing_save_layer_ops.h"
|
||||||
#include "testing_shadowflags.h"
|
#include "testing_shadowflags.h"
|
||||||
|
|
||||||
namespace OHOS::Ace::Testing {
|
namespace OHOS::Ace::Testing {
|
||||||
@ -95,7 +97,7 @@ public:
|
|||||||
virtual void DrawCircle(const TestingPoint& center, float radius) {}
|
virtual void DrawCircle(const TestingPoint& center, float radius) {}
|
||||||
virtual void DrawRoundRect(const TestingRoundRect& roundRect) {}
|
virtual void DrawRoundRect(const TestingRoundRect& roundRect) {}
|
||||||
virtual void DrawBackground(const TestingBrush& brush) {}
|
virtual void DrawBackground(const TestingBrush& brush) {}
|
||||||
virtual void ClipRect(const TestingRect& rect, ClipOp op) {}
|
virtual void ClipRect(const TestingRect& rect, ClipOp op = ClipOp::INTERSECT, bool doAntiAlias = false) {}
|
||||||
virtual void Scale(float sx, float sy) {}
|
virtual void Scale(float sx, float sy) {}
|
||||||
virtual void ClipPath(const TestingPath& path, ClipOp op, bool doAntiAlias) {}
|
virtual void ClipPath(const TestingPath& path, ClipOp op, bool doAntiAlias) {}
|
||||||
virtual void DrawOval(const TestingRect& oval) {}
|
virtual void DrawOval(const TestingRect& oval) {}
|
||||||
@ -106,6 +108,15 @@ public:
|
|||||||
const TestingSamplingOptions& sampling,
|
const TestingSamplingOptions& sampling,
|
||||||
SrcRectConstraint constraint = SrcRectConstraint::STRICT_SRC_RECT_CONSTRAINT)
|
SrcRectConstraint constraint = SrcRectConstraint::STRICT_SRC_RECT_CONSTRAINT)
|
||||||
{}
|
{}
|
||||||
|
virtual void SaveLayer(const TestingSaveLayerOps& saveLayerOps) {}
|
||||||
|
virtual uint32_t GetSaveCount() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void RestoreToCount(uint32_t count) {}
|
||||||
|
|
||||||
|
virtual void ConcatMatrix(const TestingMatrix& matrix) {}
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_CANVAS_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_CANVAS_H
|
||||||
|
@ -30,6 +30,26 @@ public:
|
|||||||
{
|
{
|
||||||
return std::make_shared<TestingColorFilter>();
|
return std::make_shared<TestingColorFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingColorFilter> CreateSrgbGammaToLinear()
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingColorFilter>();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingColorFilter> CreateLinearToSrgbGamma()
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingColorFilter>();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingColorFilter> CreateLumaColorFilter()
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingColorFilter>();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingColorFilter> CreateComposeColorFilter(TestingColorFilter& f1, TestingColorFilter& f2)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingColorFilter>();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_COLOR_FILTER_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_COLOR_FILTER_H
|
||||||
|
@ -21,12 +21,14 @@
|
|||||||
namespace OHOS::Ace::Testing {
|
namespace OHOS::Ace::Testing {
|
||||||
class TestingColorMatrix {
|
class TestingColorMatrix {
|
||||||
public:
|
public:
|
||||||
|
typedef float scalar;
|
||||||
TestingColorMatrix() = default;
|
TestingColorMatrix() = default;
|
||||||
virtual ~TestingColorMatrix() = default;
|
virtual ~TestingColorMatrix() = default;
|
||||||
|
|
||||||
constexpr static int MATRIX_SIZE = 20;
|
constexpr static int MATRIX_SIZE = 20;
|
||||||
|
|
||||||
virtual void SetArray(const float src[MATRIX_SIZE]) {}
|
virtual void SetArray(const float src[MATRIX_SIZE]) {}
|
||||||
|
virtual void SetScale(scalar sr, scalar sg, scalar sb, scalar sa) {}
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_COLOR_MATRIX_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_COLOR_MATRIX_H
|
||||||
|
26
test/mock/core/rosen/testing_font.h
Normal file
26
test/mock/core/rosen/testing_font.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_FONT_H
|
||||||
|
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_FONT_H
|
||||||
|
|
||||||
|
namespace OHOS::Ace::Testing {
|
||||||
|
class TestingFont {
|
||||||
|
public:
|
||||||
|
TestingFont() = default;
|
||||||
|
~TestingFont() = default;
|
||||||
|
};
|
||||||
|
} // namespace OHOS::Ace::Testing
|
||||||
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_FONT_H
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "test/mock/core/rosen/testing_color_filter.h"
|
||||||
#include "testing_shader_effect.h"
|
#include "testing_shader_effect.h"
|
||||||
|
|
||||||
namespace OHOS::Ace::Testing {
|
namespace OHOS::Ace::Testing {
|
||||||
@ -32,6 +33,7 @@ enum class FilterType {
|
|||||||
|
|
||||||
class TestingImageFilter {
|
class TestingImageFilter {
|
||||||
public:
|
public:
|
||||||
|
typedef float scalar;
|
||||||
TestingImageFilter() = default;
|
TestingImageFilter() = default;
|
||||||
~TestingImageFilter() = default;
|
~TestingImageFilter() = default;
|
||||||
|
|
||||||
@ -40,6 +42,25 @@ public:
|
|||||||
{
|
{
|
||||||
return std::make_shared<TestingImageFilter>();
|
return std::make_shared<TestingImageFilter>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingImageFilter> CreateColorFilterImageFilter(
|
||||||
|
const TestingColorFilter& cf, std::shared_ptr<TestingImageFilter> input)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingImageFilter>();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingImageFilter> CreateArithmeticImageFilter(const std::vector<scalar>& coefficients,
|
||||||
|
bool enforcePMColor, std::shared_ptr<TestingImageFilter> background,
|
||||||
|
std::shared_ptr<TestingImageFilter> foreground)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingImageFilter>();
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingImageFilter> CreateOffsetImageFilter(
|
||||||
|
scalar dx, scalar dy, std::shared_ptr<TestingImageFilter> input)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingImageFilter>();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_IMAGE_FILTER_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_IMAGE_FILTER_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -30,10 +30,12 @@ enum class BlurType {
|
|||||||
|
|
||||||
class TestingMaskFilter {
|
class TestingMaskFilter {
|
||||||
public:
|
public:
|
||||||
|
typedef float scalar;
|
||||||
TestingMaskFilter() = default;
|
TestingMaskFilter() = default;
|
||||||
~TestingMaskFilter() = default;
|
~TestingMaskFilter() = default;
|
||||||
|
|
||||||
static std::shared_ptr<TestingMaskFilter> CreateBlurMaskFilter(BlurType /* blurType */, float /* sigma */)
|
static std::shared_ptr<TestingMaskFilter> CreateBlurMaskFilter(
|
||||||
|
BlurType blurType, scalar sigma, bool respectCTM = true)
|
||||||
{
|
{
|
||||||
return std::make_shared<TestingMaskFilter>();
|
return std::make_shared<TestingMaskFilter>();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "testing_point.h"
|
#include "testing_point.h"
|
||||||
#include "testing_rect.h"
|
#include "testing_rect.h"
|
||||||
|
#include "testing_round_rect.h"
|
||||||
|
|
||||||
namespace OHOS::Ace::Testing {
|
namespace OHOS::Ace::Testing {
|
||||||
enum class TestingPathDirection {
|
enum class TestingPathDirection {
|
||||||
@ -42,6 +43,10 @@ enum class TestingPathOp {
|
|||||||
REVERSE_DIFFERENCE,
|
REVERSE_DIFFERENCE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PathDirection {
|
||||||
|
CW_DIRECTION,
|
||||||
|
CCW_DIRECTION,
|
||||||
|
};
|
||||||
class TestingPath {
|
class TestingPath {
|
||||||
public:
|
public:
|
||||||
TestingPath() = default;
|
TestingPath() = default;
|
||||||
@ -58,6 +63,8 @@ public:
|
|||||||
TestingPathDirection dir = TestingPathDirection::CW_DIRECTION)
|
TestingPathDirection dir = TestingPathDirection::CW_DIRECTION)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
virtual void AddRoundRect(const TestingRoundRect& roundRect, PathDirection dir = PathDirection::CW_DIRECTION) {}
|
||||||
|
|
||||||
virtual void AddPath(const TestingPath& src) {}
|
virtual void AddPath(const TestingPath& src) {}
|
||||||
|
|
||||||
virtual void MoveTo(float xs, float ys) {}
|
virtual void MoveTo(float xs, float ys) {}
|
||||||
@ -78,6 +85,7 @@ public:
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
virtual void AddOval(const TestingRect& oval, PathDirection dir = PathDirection::CW_DIRECTION) {}
|
||||||
|
|
||||||
virtual bool BuildFromSVGString(const std::string& str)
|
virtual bool BuildFromSVGString(const std::string& str)
|
||||||
{
|
{
|
||||||
@ -89,6 +97,22 @@ public:
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
virtual void SetFillStyle(TestingPathFillType fillStyle) {}
|
virtual void SetFillStyle(TestingPathFillType fillStyle) {}
|
||||||
|
|
||||||
|
virtual bool IsValid() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual float GetLength(bool forceClosed) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool GetPositionAndTangent(
|
||||||
|
float distance, TestingPoint& position, TestingPoint& tangent, bool forceClosed) const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PATH_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PATH_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -54,6 +54,7 @@ public:
|
|||||||
virtual void SetMiterLimit(float limit) {}
|
virtual void SetMiterLimit(float limit) {}
|
||||||
virtual void SetAlpha(uint32_t alpha) {}
|
virtual void SetAlpha(uint32_t alpha) {}
|
||||||
virtual void SetAlphaF(float alpha) {}
|
virtual void SetAlphaF(float alpha) {}
|
||||||
|
virtual void Reset() {}
|
||||||
virtual std::shared_ptr<TestingShaderEffect> GetShaderEffect()
|
virtual std::shared_ptr<TestingShaderEffect> GetShaderEffect()
|
||||||
{
|
{
|
||||||
return std::make_shared<TestingShaderEffect>();
|
return std::make_shared<TestingShaderEffect>();
|
||||||
|
26
test/mock/core/rosen/testing_picture.h
Normal file
26
test/mock/core/rosen/testing_picture.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PICTURE_H
|
||||||
|
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PICTURE_H
|
||||||
|
|
||||||
|
namespace OHOS::Ace::Testing {
|
||||||
|
class TestingPicture {
|
||||||
|
public:
|
||||||
|
TestingPicture() = default;
|
||||||
|
~TestingPicture() = default;
|
||||||
|
};
|
||||||
|
} // namespace OHOS::Ace::Testing
|
||||||
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PICTURE_H
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -66,6 +66,11 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend bool operator==(const TestingPoint& p1, const TestingPoint& p2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float x_;
|
float x_;
|
||||||
float y_;
|
float y_;
|
||||||
|
31
test/mock/core/rosen/testing_save_layer_ops.h
Normal file
31
test/mock/core/rosen/testing_save_layer_ops.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SAVE_LAYER_OPS_H
|
||||||
|
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SAVE_LAYER_OPS_H
|
||||||
|
|
||||||
|
#include "test/mock/core/rosen/testing_brush.h"
|
||||||
|
#include "test/mock/core/rosen/testing_rect.h"
|
||||||
|
|
||||||
|
namespace OHOS::Ace::Testing {
|
||||||
|
class TestingSaveLayerOps {
|
||||||
|
public:
|
||||||
|
TestingSaveLayerOps() = default;
|
||||||
|
~TestingSaveLayerOps() = default;
|
||||||
|
|
||||||
|
TestingSaveLayerOps(const TestingRect* bounds, const TestingBrush* brush, uint32_t saveLayerFlags = 0) {}
|
||||||
|
};
|
||||||
|
} // namespace OHOS::Ace::Testing
|
||||||
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SAVE_LAYER_OPS_H
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
* Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
@ -31,6 +31,8 @@ enum class TileMode {
|
|||||||
};
|
};
|
||||||
class TestingShaderEffect {
|
class TestingShaderEffect {
|
||||||
public:
|
public:
|
||||||
|
typedef uint32_t ColorQuad;
|
||||||
|
typedef float scalar;
|
||||||
TestingShaderEffect() = default;
|
TestingShaderEffect() = default;
|
||||||
~TestingShaderEffect() = default;
|
~TestingShaderEffect() = default;
|
||||||
|
|
||||||
@ -47,6 +49,18 @@ public:
|
|||||||
{
|
{
|
||||||
return std::make_shared<TestingShaderEffect>();
|
return std::make_shared<TestingShaderEffect>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingShaderEffect> CreateRadialGradient(const TestingPoint& centerPt, scalar radius,
|
||||||
|
const std::vector<ColorQuad>& colors, const std::vector<scalar>& pos, TileMode mode)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingShaderEffect>();
|
||||||
|
}
|
||||||
|
static std::shared_ptr<TestingShaderEffect> CreateTwoPointConical(const TestingPoint& startPt, scalar startRadius,
|
||||||
|
const TestingPoint& endPt, scalar endRadius, const std::vector<ColorQuad>& colors,
|
||||||
|
const std::vector<scalar>& pos, TileMode mode, const TestingMatrix* matrix)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingShaderEffect>();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // namespace OHOS::Ace::Testing
|
} // namespace OHOS::Ace::Testing
|
||||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SHADER_EFFECT_H
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_SHADER_EFFECT_H
|
||||||
|
39
test/mock/core/rosen/testing_text_blob.h
Normal file
39
test/mock/core/rosen/testing_text_blob.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TEXT_BLOB_H
|
||||||
|
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TEXT_BLOB_H
|
||||||
|
|
||||||
|
namespace OHOS::Ace::Testing {
|
||||||
|
|
||||||
|
enum class TestingTextEncoding {
|
||||||
|
UTF8,
|
||||||
|
UTF16,
|
||||||
|
UTF32,
|
||||||
|
GLYPH_ID,
|
||||||
|
};
|
||||||
|
|
||||||
|
class TestingTextBlob {
|
||||||
|
public:
|
||||||
|
TestingTextBlob() = default;
|
||||||
|
~TestingTextBlob() = default;
|
||||||
|
static std::shared_ptr<TestingTextBlob> MakeFromText(const void* text, size_t byteLength,
|
||||||
|
const TestingFont& font,TestingTextEncoding encoding = TestingTextEncoding::UTF8)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingTextBlob>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace OHOS::Ace::Testing
|
||||||
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TEXT_BLOB_H
|
31
test/mock/core/rosen/testing_typeface.h
Normal file
31
test/mock/core/rosen/testing_typeface.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPEFACE_H
|
||||||
|
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPEFACE_H
|
||||||
|
|
||||||
|
namespace OHOS::Ace::Testing {
|
||||||
|
class TestingTypeface {
|
||||||
|
public:
|
||||||
|
TestingTypeface() = default;
|
||||||
|
~TestingTypeface() = default;
|
||||||
|
|
||||||
|
static std::shared_ptr<TestingTypeface> MakeFromFile(const char path[], int index = 0)
|
||||||
|
{
|
||||||
|
return std::make_shared<TestingTypeface>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace OHOS::Ace::Testing
|
||||||
|
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_TYPEFACE_H
|
20
test/mock/core/svg/mock_image_painter_utils.cpp
Normal file
20
test/mock/core/svg/mock_image_painter_utils.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "core/components_ng/render/adapter/image_painter_utils.h"
|
||||||
|
|
||||||
|
namespace OHOS::Ace {
|
||||||
|
void NG::ImagePainterUtils::ClipRRect(RSCanvas& canvas, const RSRect& dstRect, const BorderRadiusArray& radiusXY) {}
|
||||||
|
} // namespace OHOS::Ace
|
31
test/mock/core/svg/mock_rosen_svg_painter.cpp
Normal file
31
test/mock/core/svg/mock_rosen_svg_painter.cpp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "test/mock/core/rosen/testing_canvas.h"
|
||||||
|
#include "test/mock/core/rosen/testing_matrix.h"
|
||||||
|
#include "test/mock/core/rosen/testing_point.h"
|
||||||
|
|
||||||
|
#include "core/components/common/painter/rosen_svg_painter.h"
|
||||||
|
|
||||||
|
namespace OHOS::Ace {
|
||||||
|
void RosenSvgPainter::SetMask(RSCanvas* canvas) {}
|
||||||
|
RSMatrix RosenSvgPainter::ToDrawingMatrix(const Matrix4& matrix4)
|
||||||
|
{
|
||||||
|
RSMatrix matrix;
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RosenSvgPainter::StringToPoints(const char str[], std::vector<Testing::TestingPoint>& points) {}
|
||||||
|
} // namespace OHOS::Ace
|
28
test/mock/core/svg/mock_shared_transition_effect.cpp
Normal file
28
test/mock/core/svg/mock_shared_transition_effect.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "core/animation/shared_transition_effect.h"
|
||||||
|
|
||||||
|
namespace OHOS::Ace {
|
||||||
|
RefPtr<SharedTransitionEffect> SharedTransitionEffect::GetSharedTransitionEffect(
|
||||||
|
SharedTransitionEffectType effect, const ShareId& shareId)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedTransitionEffect::SharedTransitionEffect(const ShareId& shareId, SharedTransitionEffectType type)
|
||||||
|
: shareId_(shareId), type_(type)
|
||||||
|
{}
|
||||||
|
} // namespace OHOS::Ace
|
@ -92,7 +92,8 @@ group("core_pattern_unittest") {
|
|||||||
"toggle:toggle_test_ng",
|
"toggle:toggle_test_ng",
|
||||||
"video:video_test_ng",
|
"video:video_test_ng",
|
||||||
"waterflow:water_flow_test_ng",
|
"waterflow:water_flow_test_ng",
|
||||||
"web:web_pattern_unit_test",
|
|
||||||
|
# "web:web_pattern_unit_test",
|
||||||
"xcomponent:xcomponent_test_ng",
|
"xcomponent:xcomponent_test_ng",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -535,7 +535,7 @@ HWTEST_F(CalendarTestNg, CalendarTest005, TestSize.Level1)
|
|||||||
calendarModelNG.SetCalendarDay(calendarDay);
|
calendarModelNG.SetCalendarDay(calendarDay);
|
||||||
|
|
||||||
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
paintMethod->DrawWeekAndDates(rsCanvas, Offset(0, 0));
|
paintMethod->DrawWeekAndDates(rsCanvas, Offset(0, 0));
|
||||||
EXPECT_EQ(paintMethod->rowCount_, WEEKS_COUNT_SIX);
|
EXPECT_EQ(paintMethod->rowCount_, WEEKS_COUNT_SIX);
|
||||||
}
|
}
|
||||||
@ -606,7 +606,7 @@ HWTEST_F(CalendarTestNg, CalendarTest006, TestSize.Level1)
|
|||||||
calendarModelNG.SetCalendarDay(calendarDay);
|
calendarModelNG.SetCalendarDay(calendarDay);
|
||||||
|
|
||||||
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
paintMethod->DrawWeekAndDates(rsCanvas, Offset(0, 0));
|
paintMethod->DrawWeekAndDates(rsCanvas, Offset(0, 0));
|
||||||
EXPECT_EQ(paintMethod->rowCount_, WEEKS_COUNT_FIVE);
|
EXPECT_EQ(paintMethod->rowCount_, WEEKS_COUNT_FIVE);
|
||||||
}
|
}
|
||||||
@ -699,7 +699,7 @@ HWTEST_F(CalendarTestNg, CalendarTest007, TestSize.Level1)
|
|||||||
calendarModelNG.SetCalendarDay(calendarDay);
|
calendarModelNG.SetCalendarDay(calendarDay);
|
||||||
|
|
||||||
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
paintMethod->SetCalendarTheme(calendarPaintProperty);
|
paintMethod->SetCalendarTheme(calendarPaintProperty);
|
||||||
RSTextStyle dateTextStyle;
|
RSTextStyle dateTextStyle;
|
||||||
RSTextStyle lunarTextStyle;
|
RSTextStyle lunarTextStyle;
|
||||||
@ -1329,7 +1329,7 @@ HWTEST_F(CalendarTestNg, CalendarPaintMethodTest002, TestSize.Level1)
|
|||||||
ObtainedMonth obtainedMonth;
|
ObtainedMonth obtainedMonth;
|
||||||
CalendarDay calendarDay;
|
CalendarDay calendarDay;
|
||||||
CalendarPaintMethod calendarPaintMethod(obtainedMonth, calendarDay);
|
CalendarPaintMethod calendarPaintMethod(obtainedMonth, calendarDay);
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
calendarPaintMethod.PaintContent(rsCanvas, calendarPaintProperty);
|
calendarPaintMethod.PaintContent(rsCanvas, calendarPaintProperty);
|
||||||
EXPECT_TRUE(calendarPaintMethod.obtainedMonth_.days.empty());
|
EXPECT_TRUE(calendarPaintMethod.obtainedMonth_.days.empty());
|
||||||
EXPECT_TRUE(calendarPaintMethod.calendarDays_.empty());
|
EXPECT_TRUE(calendarPaintMethod.calendarDays_.empty());
|
||||||
@ -1349,7 +1349,7 @@ HWTEST_F(CalendarTestNg, CalendarPaintMethodTest003, TestSize.Level1)
|
|||||||
CalendarPaintMethod calendarPaintMethod(obtainedMonth, calendarDay);
|
CalendarPaintMethod calendarPaintMethod(obtainedMonth, calendarDay);
|
||||||
calendarPaintMethod.currentMonth_ = calendarMonth;
|
calendarPaintMethod.currentMonth_ = calendarMonth;
|
||||||
|
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
calendarDay.focused = true;
|
calendarDay.focused = true;
|
||||||
calendarPaintMethod.DrawCalendar(
|
calendarPaintMethod.DrawCalendar(
|
||||||
rsCanvas, Offset(OFFSET_X, OFFSET_Y), Offset(VALID_LENGTH, VALID_LENGTH), calendarDay);
|
rsCanvas, Offset(OFFSET_X, OFFSET_Y), Offset(VALID_LENGTH, VALID_LENGTH), calendarDay);
|
||||||
@ -1400,7 +1400,7 @@ HWTEST_F(CalendarTestNg, CalendarPaintMethodTest004, TestSize.Level1)
|
|||||||
CalendarPaintMethod calendarPaintMethod(obtainedMonth, calendarDay);
|
CalendarPaintMethod calendarPaintMethod(obtainedMonth, calendarDay);
|
||||||
calendarPaintMethod.currentMonth_ = calendarMonth;
|
calendarPaintMethod.currentMonth_ = calendarMonth;
|
||||||
|
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
RSTextStyle rsTextStyle;
|
RSTextStyle rsTextStyle;
|
||||||
calendarDay.dayMark.clear();
|
calendarDay.dayMark.clear();
|
||||||
calendarPaintMethod.showHoliday_ = false;
|
calendarPaintMethod.showHoliday_ = false;
|
||||||
@ -1525,7 +1525,7 @@ HWTEST_F(CalendarTestNg, CalendarPaintMethodTest005, TestSize.Level1)
|
|||||||
calendarModelNG.SetCalendarDay(calendarDay);
|
calendarModelNG.SetCalendarDay(calendarDay);
|
||||||
|
|
||||||
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
auto paintMethod = AceType::MakeRefPtr<CalendarPaintMethod>(obtainedMonth, calendarDay);
|
||||||
RSCanvas rsCanvas;
|
Testing::MockCanvas rsCanvas;
|
||||||
paintMethod->SetCalendarTheme(calendarPaintProperty);
|
paintMethod->SetCalendarTheme(calendarPaintProperty);
|
||||||
|
|
||||||
RSTextStyle workOffTextStyle;
|
RSTextStyle workOffTextStyle;
|
||||||
|
@ -836,7 +836,7 @@ HWTEST_F(ListLayoutTestNg, PaintMethod002, TestSize.Level1)
|
|||||||
RefPtr<NodePaintMethod> paint = pattern_->CreateNodePaintMethod();
|
RefPtr<NodePaintMethod> paint = pattern_->CreateNodePaintMethod();
|
||||||
RefPtr<ListPaintMethod> listPaint = AceType::DynamicCast<ListPaintMethod>(paint);
|
RefPtr<ListPaintMethod> listPaint = AceType::DynamicCast<ListPaintMethod>(paint);
|
||||||
auto paintWrapper = frameNode_->CreatePaintWrapper();
|
auto paintWrapper = frameNode_->CreatePaintWrapper();
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
listPaint->GetForegroundDrawFunction(AceType::RawPtr(paintWrapper));
|
listPaint->GetForegroundDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
listPaint->PaintEdgeEffect(AceType::RawPtr(paintWrapper), canvas);
|
listPaint->PaintEdgeEffect(AceType::RawPtr(paintWrapper), canvas);
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
@ -853,9 +853,7 @@ HWTEST_F(ListLayoutTestNg, PaintMethod003, TestSize.Level1)
|
|||||||
* @tc.steps: step1. Set DisplayMode ON
|
* @tc.steps: step1. Set DisplayMode ON
|
||||||
* @tc.expected: The displayMode is ON, has scrollbar and on the right
|
* @tc.expected: The displayMode is ON, has scrollbar and on the right
|
||||||
*/
|
*/
|
||||||
CreateWithItem([](ListModelNG model) {
|
CreateWithItem([](ListModelNG model) { model.SetScrollBar(DisplayMode::ON); });
|
||||||
model.SetScrollBar(DisplayMode::ON);
|
|
||||||
});
|
|
||||||
RefPtr<ListPaintMethod> paint = UpdateOverlayModifier();
|
RefPtr<ListPaintMethod> paint = UpdateOverlayModifier();
|
||||||
auto scrollBarOverlayModifier = paint->scrollBarOverlayModifier_.Upgrade();
|
auto scrollBarOverlayModifier = paint->scrollBarOverlayModifier_.Upgrade();
|
||||||
auto scrollBar = paint->scrollBar_.Upgrade();
|
auto scrollBar = paint->scrollBar_.Upgrade();
|
||||||
@ -904,9 +902,7 @@ HWTEST_F(ListLayoutTestNg, PaintMethod003, TestSize.Level1)
|
|||||||
* @tc.steps: step5. Has no item
|
* @tc.steps: step5. Has no item
|
||||||
* @tc.expected: UnScrollable, has no scrollbar
|
* @tc.expected: UnScrollable, has no scrollbar
|
||||||
*/
|
*/
|
||||||
Create([](ListModelNG model) {
|
Create([](ListModelNG model) { model.SetScrollBar(DisplayMode::ON); });
|
||||||
model.SetScrollBar(DisplayMode::ON);
|
|
||||||
});
|
|
||||||
paint = UpdateOverlayModifier();
|
paint = UpdateOverlayModifier();
|
||||||
scrollBarOverlayModifier = paint->scrollBarOverlayModifier_.Upgrade();
|
scrollBarOverlayModifier = paint->scrollBarOverlayModifier_.Upgrade();
|
||||||
scrollBar = paint->scrollBar_.Upgrade();
|
scrollBar = paint->scrollBar_.Upgrade();
|
||||||
@ -938,7 +934,7 @@ HWTEST_F(ListLayoutTestNg, PaintMethod003, TestSize.Level1)
|
|||||||
HWTEST_F(ListLayoutTestNg, PaintMethod004, TestSize.Level1)
|
HWTEST_F(ListLayoutTestNg, PaintMethod004, TestSize.Level1)
|
||||||
{
|
{
|
||||||
Testing::MockCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).Times(3);
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).Times(3);
|
||||||
EXPECT_CALL(canvas, AttachBrush(_)).WillRepeatedly(ReturnRef(canvas));
|
EXPECT_CALL(canvas, AttachBrush(_)).WillRepeatedly(ReturnRef(canvas));
|
||||||
EXPECT_CALL(canvas, AttachPen(_)).WillRepeatedly(ReturnRef(canvas));
|
EXPECT_CALL(canvas, AttachPen(_)).WillRepeatedly(ReturnRef(canvas));
|
||||||
EXPECT_CALL(canvas, DetachBrush()).WillRepeatedly(ReturnRef(canvas));
|
EXPECT_CALL(canvas, DetachBrush()).WillRepeatedly(ReturnRef(canvas));
|
||||||
|
@ -851,7 +851,7 @@ HWTEST_F(RatingTestNg, RatingPaintPropertyTest001, TestSize.Level1)
|
|||||||
EXPECT_CALL(mockCanvas, Save()).Times(AtLeast(RATING_SAVE_TIMES));
|
EXPECT_CALL(mockCanvas, Save()).Times(AtLeast(RATING_SAVE_TIMES));
|
||||||
EXPECT_CALL(mockCanvas, ClipRoundRectImpl(_, _, _)).Times(RATING_CLIP_ROUND_RECT_TIMES);
|
EXPECT_CALL(mockCanvas, ClipRoundRectImpl(_, _, _)).Times(RATING_CLIP_ROUND_RECT_TIMES);
|
||||||
EXPECT_CALL(mockCanvas, Restore()).Times(AtLeast(RATING_RESTORE_TIMES));
|
EXPECT_CALL(mockCanvas, Restore()).Times(AtLeast(RATING_RESTORE_TIMES));
|
||||||
EXPECT_CALL(mockCanvas, ClipRect(_, _)).Times(RATING_CLIP_CLIP_RECT_TIMES);
|
EXPECT_CALL(mockCanvas, ClipRect(_, _, _)).Times(RATING_CLIP_CLIP_RECT_TIMES);
|
||||||
ratingPaintMethod->ratingModifier_->onDraw(context);
|
ratingPaintMethod->ratingModifier_->onDraw(context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -870,7 +870,7 @@ HWTEST_F(RatingTestNg, RatingPaintPropertyTest001, TestSize.Level1)
|
|||||||
|
|
||||||
EXPECT_CALL(mockCanvas2, Save()).Times(AtLeast(RATING_SAVE_TIMES_1));
|
EXPECT_CALL(mockCanvas2, Save()).Times(AtLeast(RATING_SAVE_TIMES_1));
|
||||||
EXPECT_CALL(mockCanvas2, Restore()).Times(AtLeast(RATING_RESTORE_TIMES_1));
|
EXPECT_CALL(mockCanvas2, Restore()).Times(AtLeast(RATING_RESTORE_TIMES_1));
|
||||||
EXPECT_CALL(mockCanvas2, ClipRect(_, _)).Times(RATING_CLIP_CLIP_RECT_TIMES_1);
|
EXPECT_CALL(mockCanvas2, ClipRect(_, _, _)).Times(RATING_CLIP_CLIP_RECT_TIMES_1);
|
||||||
ratingPaintMethod->ratingModifier_->onDraw(context2);
|
ratingPaintMethod->ratingModifier_->onDraw(context2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -886,7 +886,7 @@ HWTEST_F(RatingTestNg, RatingPaintPropertyTest001, TestSize.Level1)
|
|||||||
DrawingContext context3 = { mockCanvas3, 10.0f, 10.0f };
|
DrawingContext context3 = { mockCanvas3, 10.0f, 10.0f };
|
||||||
EXPECT_CALL(mockCanvas3, Save()).Times(AtLeast(RATING_SAVE_TIMES_1));
|
EXPECT_CALL(mockCanvas3, Save()).Times(AtLeast(RATING_SAVE_TIMES_1));
|
||||||
EXPECT_CALL(mockCanvas3, Restore()).Times(AtLeast(RATING_RESTORE_TIMES_1));
|
EXPECT_CALL(mockCanvas3, Restore()).Times(AtLeast(RATING_RESTORE_TIMES_1));
|
||||||
EXPECT_CALL(mockCanvas3, ClipRect(_, _)).Times(RATING_CLIP_CLIP_RECT_TIMES_1);
|
EXPECT_CALL(mockCanvas3, ClipRect(_, _, _)).Times(RATING_CLIP_CLIP_RECT_TIMES_1);
|
||||||
ratingPaintMethod->ratingModifier_->onDraw(context3);
|
ratingPaintMethod->ratingModifier_->onDraw(context3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,7 +957,7 @@ HWTEST_F(ScrollTestNg, ScrollPositionControlle003, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
HWTEST_F(ScrollTestNg, ScrollBarAnimation001, TestSize.Level1)
|
HWTEST_F(ScrollTestNg, ScrollBarAnimation001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||||
PaintWrapper paintWrapper(nullptr, geometryNode, paintProperty_);
|
PaintWrapper paintWrapper(nullptr, geometryNode, paintProperty_);
|
||||||
|
|
||||||
@ -1024,7 +1024,7 @@ HWTEST_F(ScrollTestNg, ScrollBarAnimation001, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
HWTEST_F(ScrollTestNg, ScrollBarAnimation002, TestSize.Level1)
|
HWTEST_F(ScrollTestNg, ScrollBarAnimation002, TestSize.Level1)
|
||||||
{
|
{
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||||
PaintWrapper paintWrapper(nullptr, geometryNode, paintProperty_);
|
PaintWrapper paintWrapper(nullptr, geometryNode, paintProperty_);
|
||||||
|
|
||||||
@ -1081,7 +1081,7 @@ HWTEST_F(ScrollTestNg, ScrollBarAnimation002, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
HWTEST_F(ScrollTestNg, ScrollBarAnimation003, TestSize.Level1)
|
HWTEST_F(ScrollTestNg, ScrollBarAnimation003, TestSize.Level1)
|
||||||
{
|
{
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||||
PaintWrapper paintWrapper(nullptr, geometryNode, paintProperty_);
|
PaintWrapper paintWrapper(nullptr, geometryNode, paintProperty_);
|
||||||
|
|
||||||
|
@ -1291,7 +1291,7 @@ HWTEST_F(SelectOverlayTestNg, ContentModifierOnDraw001, TestSize.Level1)
|
|||||||
EXPECT_CALL(canvas, DrawCircle(_, _)).Times(AtLeast(1));
|
EXPECT_CALL(canvas, DrawCircle(_, _)).Times(AtLeast(1));
|
||||||
EXPECT_CALL(canvas, Translate(_, _)).Times(AtLeast(1));
|
EXPECT_CALL(canvas, Translate(_, _)).Times(AtLeast(1));
|
||||||
EXPECT_CALL(canvas, Restore()).Times(AtLeast(1));
|
EXPECT_CALL(canvas, Restore()).Times(AtLeast(1));
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).WillRepeatedly(Return());
|
||||||
EXPECT_CALL(canvas, DrawLine(_, _)).Times(AtLeast(1));
|
EXPECT_CALL(canvas, DrawLine(_, _)).Times(AtLeast(1));
|
||||||
DrawingContext context { canvas, 100, 100 };
|
DrawingContext context { canvas, 100, 100 };
|
||||||
/**
|
/**
|
||||||
@ -1421,7 +1421,7 @@ HWTEST_F(SelectOverlayTestNg, OverlayModifierOnDraw001, TestSize.Level1)
|
|||||||
EXPECT_CALL(canvas, DrawCircle(_, _)).Times(AnyNumber());
|
EXPECT_CALL(canvas, DrawCircle(_, _)).Times(AnyNumber());
|
||||||
EXPECT_CALL(canvas, Translate(_, _)).Times(AnyNumber());
|
EXPECT_CALL(canvas, Translate(_, _)).Times(AnyNumber());
|
||||||
EXPECT_CALL(canvas, Restore()).Times(AnyNumber());
|
EXPECT_CALL(canvas, Restore()).Times(AnyNumber());
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).WillRepeatedly(Return());
|
||||||
for (int32_t i = 0; i < 4; i++) {
|
for (int32_t i = 0; i < 4; i++) {
|
||||||
overlayModifier->circleOffset_[i] = AceType::MakeRefPtr<AnimatablePropertyOffsetF>(offset);
|
overlayModifier->circleOffset_[i] = AceType::MakeRefPtr<AnimatablePropertyOffsetF>(offset);
|
||||||
EXPECT_NE(overlayModifier->circleOffset_[i], nullptr);
|
EXPECT_NE(overlayModifier->circleOffset_[i], nullptr);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "base_shape_pattern_test_ng.h"
|
#include "base_shape_pattern_test_ng.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "include/core/SkCanvas.h"
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/geometry/dimension.h"
|
#include "base/geometry/dimension.h"
|
||||||
#include "base/memory/ace_type.h"
|
#include "base/memory/ace_type.h"
|
||||||
@ -70,7 +70,7 @@ class CirclePatternTestNg : public BaseShapePatternTestNg {
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "base_shape_pattern_test_ng.h"
|
#include "base_shape_pattern_test_ng.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "include/core/SkCanvas.h"
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/base/view_stack_processor.h"
|
#include "core/components_ng/base/view_stack_processor.h"
|
||||||
#include "core/components_ng/pattern/shape/ellipse_model_ng.h"
|
#include "core/components_ng/pattern/shape/ellipse_model_ng.h"
|
||||||
@ -64,7 +64,7 @@ public:
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "base_shape_pattern_test_ng.h"
|
#include "base_shape_pattern_test_ng.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/geometry/dimension.h"
|
#include "base/geometry/dimension.h"
|
||||||
#include "base/memory/referenced.h"
|
#include "base/memory/referenced.h"
|
||||||
@ -70,8 +71,7 @@ public:
|
|||||||
EXPECT_EQ(paintWrapper == nullptr, false);
|
EXPECT_EQ(paintWrapper == nullptr, false);
|
||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
Testing::MockCanvas rsCavas;
|
||||||
RSCanvas rsCavas(&canvas);
|
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "base_shape_pattern_test_ng.h"
|
#include "base_shape_pattern_test_ng.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/base/view_stack_processor.h"
|
#include "core/components_ng/base/view_stack_processor.h"
|
||||||
#include "core/components_ng/pattern/shape/path_model_ng.h"
|
#include "core/components_ng/pattern/shape/path_model_ng.h"
|
||||||
@ -74,7 +75,7 @@ public:
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base_polygon_pattern_test_ng.h"
|
#include "base_polygon_pattern_test_ng.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/base/view_stack_processor.h"
|
#include "core/components_ng/base/view_stack_processor.h"
|
||||||
#include "core/components_ng/pattern/shape/polygon_model_ng.h"
|
#include "core/components_ng/pattern/shape/polygon_model_ng.h"
|
||||||
@ -62,7 +63,7 @@ public:
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "base_polygon_pattern_test_ng.h"
|
#include "base_polygon_pattern_test_ng.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/base/view_stack_processor.h"
|
#include "core/components_ng/base/view_stack_processor.h"
|
||||||
#include "core/components_ng/pattern/shape/polygon_model_ng.h"
|
#include "core/components_ng/pattern/shape/polygon_model_ng.h"
|
||||||
@ -62,7 +63,7 @@ public:
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#define protected public
|
#define protected public
|
||||||
|
|
||||||
#include "base_shape_pattern_test_ng.h"
|
#include "base_shape_pattern_test_ng.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/geometry/dimension.h"
|
#include "base/geometry/dimension.h"
|
||||||
#include "base/geometry/ng/radius.h"
|
#include "base/geometry/ng/radius.h"
|
||||||
@ -79,7 +80,7 @@ public:
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define protected public
|
#define protected public
|
||||||
|
|
||||||
#include "base_shape_pattern_test_ng.h"
|
#include "base_shape_pattern_test_ng.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/geometry/axis.h"
|
#include "base/geometry/axis.h"
|
||||||
#include "base/geometry/dimension.h"
|
#include "base/geometry/dimension.h"
|
||||||
@ -230,7 +231,7 @@ HWTEST_F(ShapePatternTestNg, InheritedProperty001, TestSize.Level1)
|
|||||||
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
auto contentDraw = paintMethod->GetContentDrawFunction(AceType::RawPtr(paintWrapper));
|
||||||
EXPECT_EQ(contentDraw == nullptr, false);
|
EXPECT_EQ(contentDraw == nullptr, false);
|
||||||
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
std::shared_ptr<SkCanvas> canvas = std::make_shared<SkCanvas>();
|
||||||
RSCanvas rsCavas(&canvas);
|
Testing::MockCanvas rsCavas(&canvas);
|
||||||
contentDraw(rsCavas);
|
contentDraw(rsCavas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#define private public
|
#define private public
|
||||||
#define protected public
|
#define protected public
|
||||||
|
#include "test/mock/core/pipeline/mock_pipeline_context.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/geometry/dimension.h"
|
#include "base/geometry/dimension.h"
|
||||||
#include "base/geometry/ng/offset_t.h"
|
#include "base/geometry/ng/offset_t.h"
|
||||||
#include "core/components/common/layout/constants.h"
|
#include "core/components/common/layout/constants.h"
|
||||||
@ -29,15 +32,14 @@
|
|||||||
#include "core/components_ng/pattern/side_bar/side_bar_container_layout_algorithm.h"
|
#include "core/components_ng/pattern/side_bar/side_bar_container_layout_algorithm.h"
|
||||||
#include "core/components_ng/pattern/side_bar/side_bar_container_layout_property.h"
|
#include "core/components_ng/pattern/side_bar/side_bar_container_layout_property.h"
|
||||||
#include "core/components_ng/pattern/side_bar/side_bar_container_model_ng.h"
|
#include "core/components_ng/pattern/side_bar/side_bar_container_model_ng.h"
|
||||||
|
#include "core/components_ng/pattern/side_bar/side_bar_container_paint_method.h"
|
||||||
#include "core/components_ng/pattern/side_bar/side_bar_container_pattern.h"
|
#include "core/components_ng/pattern/side_bar/side_bar_container_pattern.h"
|
||||||
|
#include "core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_paint_property.h"
|
||||||
#include "core/components_ng/property/calc_length.h"
|
#include "core/components_ng/property/calc_length.h"
|
||||||
#include "core/components_ng/property/measure_utils.h"
|
#include "core/components_ng/property/measure_utils.h"
|
||||||
#include "core/components_v2/inspector/inspector_constants.h"
|
#include "core/components_v2/inspector/inspector_constants.h"
|
||||||
#include "test/mock/core/pipeline/mock_pipeline_context.h"
|
|
||||||
#include "frameworks/base/geometry/ng/size_t.h"
|
#include "frameworks/base/geometry/ng/size_t.h"
|
||||||
#include "frameworks/core/components_ng/property/property.h"
|
#include "frameworks/core/components_ng/property/property.h"
|
||||||
#include "core/components_ng/pattern/side_bar/side_bar_container_paint_method.h"
|
|
||||||
#include "core/components_ng/pattern/swiper_indicator/dot_indicator/dot_indicator_paint_property.h"
|
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace testing::ext;
|
using namespace testing::ext;
|
||||||
@ -1182,7 +1184,7 @@ HWTEST_F(SideBarLayoutTestNg, SideBarLayoutTestNg027, TestSize.Level1)
|
|||||||
auto renderContext = frameNode->GetRenderContext();
|
auto renderContext = frameNode->GetRenderContext();
|
||||||
ASSERT_NE(renderContext, nullptr);
|
ASSERT_NE(renderContext, nullptr);
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
SideBarContainerPaintMethodInstance.ClipPadding(&paintWrapper, canvas);
|
SideBarContainerPaintMethodInstance.ClipPadding(&paintWrapper, canvas);
|
||||||
EXPECT_EQ(SideBarContainerPaintMethodInstance.needClipPadding_, false);
|
EXPECT_EQ(SideBarContainerPaintMethodInstance.needClipPadding_, false);
|
||||||
SideBarContainerPaintMethodInstance.needClipPadding_ = true;
|
SideBarContainerPaintMethodInstance.needClipPadding_ = true;
|
||||||
|
@ -174,7 +174,7 @@ void SliderTestNg::MockCanvasFunction(Testing::MockCanvas& canvas)
|
|||||||
EXPECT_CALL(canvas, Scale(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, Scale(_, _)).WillRepeatedly(Return());
|
||||||
EXPECT_CALL(canvas, Translate(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, Translate(_, _)).WillRepeatedly(Return());
|
||||||
EXPECT_CALL(canvas, Restore()).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, Restore()).WillRepeatedly(Return());
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).WillRepeatedly(Return());
|
||||||
EXPECT_CALL(canvas, DrawPath(_)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, DrawPath(_)).WillRepeatedly(Return());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "swiper_test_ng.h"
|
#include "swiper_test_ng.h"
|
||||||
|
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
namespace OHOS::Ace::NG {
|
namespace OHOS::Ace::NG {
|
||||||
void SwiperTestNg::SetUpTestSuite()
|
void SwiperTestNg::SetUpTestSuite()
|
||||||
{
|
{
|
||||||
@ -209,7 +211,7 @@ void SwiperTestNg::CreateChildWrapperAppendToHostWrapper(
|
|||||||
auto childPattern = AceType::MakeRefPtr<Pattern>();
|
auto childPattern = AceType::MakeRefPtr<Pattern>();
|
||||||
auto childFrameNode = FrameNode::CreateFrameNode(BOX_NAME, index, childPattern);
|
auto childFrameNode = FrameNode::CreateFrameNode(BOX_NAME, index, childPattern);
|
||||||
auto host = hostWrapper->GetHostNode();
|
auto host = hostWrapper->GetHostNode();
|
||||||
frameNode_->AddChild(childFrameNode);
|
frameNode_->AddChild(childFrameNode);
|
||||||
RefPtr<GeometryNode> childGeometryNode = AceType::MakeRefPtr<GeometryNode>();
|
RefPtr<GeometryNode> childGeometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||||
RefPtr<LayoutProperty> childLayoutProperty = childFrameNode->GetLayoutProperty();
|
RefPtr<LayoutProperty> childLayoutProperty = childFrameNode->GetLayoutProperty();
|
||||||
childLayoutProperty->UpdateAspectRatio(1.0f);
|
childLayoutProperty->UpdateAspectRatio(1.0f);
|
||||||
@ -416,8 +418,7 @@ HWTEST_F(SwiperTestNg, SwiperUtilsTest001, TestSize.Level1)
|
|||||||
layoutConstraint.selfIdealSize = OptionalSize(SizeF(720.f, 1200.f));
|
layoutConstraint.selfIdealSize = OptionalSize(SizeF(720.f, 1200.f));
|
||||||
layoutProperty_->UpdateLayoutConstraint(layoutConstraint);
|
layoutProperty_->UpdateLayoutConstraint(layoutConstraint);
|
||||||
layoutProperty_->UpdateContentConstraint();
|
layoutProperty_->UpdateContentConstraint();
|
||||||
auto layoutWrapper =
|
auto layoutWrapper = AceType::MakeRefPtr<LayoutWrapperNode>(frameNode_, swiperGeometryNode, layoutProperty_);
|
||||||
AceType::MakeRefPtr<LayoutWrapperNode>(frameNode_, swiperGeometryNode, layoutProperty_);
|
|
||||||
int32_t displaycount = 3;
|
int32_t displaycount = 3;
|
||||||
layoutProperty_->UpdateItemSpace(Dimension(20));
|
layoutProperty_->UpdateItemSpace(Dimension(20));
|
||||||
layoutProperty_->UpdateCachedCount(1);
|
layoutProperty_->UpdateCachedCount(1);
|
||||||
@ -1232,7 +1233,7 @@ HWTEST_F(SwiperTestNg, SwiperAccessibilityPropertyGetAccessibilityValue001, Test
|
|||||||
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
}
|
}
|
||||||
pattern_->currentIndex_ = 10;
|
pattern_->currentIndex_ = 10;
|
||||||
|
|
||||||
@ -1257,7 +1258,7 @@ HWTEST_F(SwiperTestNg, SwiperAccessibilityPropertyIsScrollable001, TestSize.Leve
|
|||||||
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
}
|
}
|
||||||
pattern_->OnModifyDone();
|
pattern_->OnModifyDone();
|
||||||
EXPECT_TRUE(accessibilityProperty_->IsScrollable());
|
EXPECT_TRUE(accessibilityProperty_->IsScrollable());
|
||||||
@ -1276,7 +1277,7 @@ HWTEST_F(SwiperTestNg, SwiperAccessibilityPropertyGetCollectionItemCounts001, Te
|
|||||||
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
}
|
}
|
||||||
pattern_->OnModifyDone();
|
pattern_->OnModifyDone();
|
||||||
EXPECT_EQ(accessibilityProperty_->GetCollectionItemCounts(), 15);
|
EXPECT_EQ(accessibilityProperty_->GetCollectionItemCounts(), 15);
|
||||||
@ -1295,7 +1296,7 @@ HWTEST_F(SwiperTestNg, SwiperAccessibilityPropertyGetSupportAction001, TestSize.
|
|||||||
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
}
|
}
|
||||||
pattern_->currentIndex_ = 1;
|
pattern_->currentIndex_ = 1;
|
||||||
pattern_->OnModifyDone();
|
pattern_->OnModifyDone();
|
||||||
@ -1347,7 +1348,7 @@ HWTEST_F(SwiperTestNg, SwiperAccessibilityPropertySetSpecificSupportAction001, T
|
|||||||
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
}
|
}
|
||||||
accessibilityProperty_->SetSpecificSupportAction();
|
accessibilityProperty_->SetSpecificSupportAction();
|
||||||
pattern_->currentIndex_ = pattern_->TotalCount();
|
pattern_->currentIndex_ = pattern_->TotalCount();
|
||||||
@ -1689,7 +1690,6 @@ HWTEST_F(SwiperTestNg, SwiperIndicatorOnModifyDone001, TestSize.Level1)
|
|||||||
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
|
|
||||||
|
|
||||||
RefPtr<SwiperIndicatorPattern> indicatorPattern = indicatorNode->GetPattern<SwiperIndicatorPattern>();
|
RefPtr<SwiperIndicatorPattern> indicatorPattern = indicatorNode->GetPattern<SwiperIndicatorPattern>();
|
||||||
indicatorPattern->OnModifyDone();
|
indicatorPattern->OnModifyDone();
|
||||||
DirtySwapConfig config;
|
DirtySwapConfig config;
|
||||||
@ -3042,8 +3042,7 @@ HWTEST_F(SwiperTestNg, SwiperIndicatorPaintPressIndicator002, TestSize.Level1)
|
|||||||
* @tc.expected: itemHalfSizes_->Get()[1] is 6.65 .
|
* @tc.expected: itemHalfSizes_->Get()[1] is 6.65 .
|
||||||
*/
|
*/
|
||||||
paintMethod->PaintPressIndicator(&paintWrapper);
|
paintMethod->PaintPressIndicator(&paintWrapper);
|
||||||
EXPECT_TRUE(NearEqual(
|
EXPECT_TRUE(NearEqual(paintMethod->dotIndicatorModifier_->itemHalfSizes_->Get()[1], 10.f * 0.5 * 1.33f));
|
||||||
paintMethod->dotIndicatorModifier_->itemHalfSizes_->Get()[1], 10.f * 0.5 * 1.33f));
|
|
||||||
paintMethod->IsCustomSizeValue_ = true;
|
paintMethod->IsCustomSizeValue_ = true;
|
||||||
paintMethod->PaintPressIndicator(&paintWrapper);
|
paintMethod->PaintPressIndicator(&paintWrapper);
|
||||||
}
|
}
|
||||||
@ -3118,8 +3117,7 @@ HWTEST_F(SwiperTestNg, SwiperIndicatorPaintHoverIndicator002, TestSize.Level1)
|
|||||||
* @tc.expected: itemHalfSizes_->Get()[0] is 13.30 .
|
* @tc.expected: itemHalfSizes_->Get()[0] is 13.30 .
|
||||||
*/
|
*/
|
||||||
paintMethod->PaintHoverIndicator(&paintWrapper);
|
paintMethod->PaintHoverIndicator(&paintWrapper);
|
||||||
EXPECT_TRUE(NearEqual(
|
EXPECT_TRUE(NearEqual(paintMethod->dotIndicatorModifier_->itemHalfSizes_->Get()[0], 20.f * 0.5 * 1.33f));
|
||||||
paintMethod->dotIndicatorModifier_->itemHalfSizes_->Get()[0], 20.f * 0.5 * 1.33f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3741,8 +3739,8 @@ HWTEST_F(SwiperTestNg, ArrowOnModifyDone001, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::VERTICAL);
|
model.SetDirection(Axis::VERTICAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
auto leftSwiperArrowLayoutProperty =
|
auto leftSwiperArrowLayoutProperty =
|
||||||
@ -3776,8 +3774,8 @@ HWTEST_F(SwiperTestNg, ArrowOnModifyDone002, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::VERTICAL);
|
model.SetDirection(Axis::VERTICAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
auto leftSwiperArrowLayoutProperty =
|
auto leftSwiperArrowLayoutProperty =
|
||||||
@ -3823,8 +3821,8 @@ HWTEST_F(SwiperTestNg, UpdateArrowContent001, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::VERTICAL);
|
model.SetDirection(Axis::VERTICAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
auto leftSwiperArrowLayoutProperty =
|
auto leftSwiperArrowLayoutProperty =
|
||||||
@ -3868,8 +3866,8 @@ HWTEST_F(SwiperTestNg, UpdateArrowContent002, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::VERTICAL);
|
model.SetDirection(Axis::VERTICAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
model.SetIndicatorType(SwiperIndicatorType::DIGIT);
|
||||||
});
|
});
|
||||||
auto rightArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_RIGHT_ARROW_ETS_TAG,
|
auto rightArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_RIGHT_ARROW_ETS_TAG, pattern_->GetRightButtonId(),
|
||||||
pattern_->GetRightButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
EXPECT_NE(rightArrowNode, nullptr);
|
EXPECT_NE(rightArrowNode, nullptr);
|
||||||
frameNode_->AddChild(rightArrowNode);
|
frameNode_->AddChild(rightArrowNode);
|
||||||
auto rightArrowPattern = rightArrowNode->GetPattern<SwiperArrowPattern>();
|
auto rightArrowPattern = rightArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
@ -3918,8 +3916,8 @@ HWTEST_F(SwiperTestNg, SetButtonVisible001, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::HORIZONTAL);
|
model.SetDirection(Axis::HORIZONTAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
auto leftSwiperArrowLayoutProperty = leftArrowPattern->GetSwiperArrowLayoutProperty();
|
auto leftSwiperArrowLayoutProperty = leftArrowPattern->GetSwiperArrowLayoutProperty();
|
||||||
@ -3976,8 +3974,8 @@ HWTEST_F(SwiperTestNg, TotalCount001, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::HORIZONTAL);
|
model.SetDirection(Axis::HORIZONTAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
|
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
|
|
||||||
@ -3989,7 +3987,7 @@ HWTEST_F(SwiperTestNg, TotalCount001, TestSize.Level1)
|
|||||||
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
RefPtr<FrameNode> indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
}
|
}
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
|
|
||||||
@ -4012,8 +4010,8 @@ HWTEST_F(SwiperTestNg, ButtonOnHover001, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::HORIZONTAL);
|
model.SetDirection(Axis::HORIZONTAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
auto leftSwiperArrowLayoutProperty = leftArrowPattern->GetSwiperArrowLayoutProperty();
|
auto leftSwiperArrowLayoutProperty = leftArrowPattern->GetSwiperArrowLayoutProperty();
|
||||||
@ -4067,8 +4065,8 @@ HWTEST_F(SwiperTestNg, ButtonTouchEvent001, TestSize.Level1)
|
|||||||
model.SetDirection(Axis::HORIZONTAL);
|
model.SetDirection(Axis::HORIZONTAL);
|
||||||
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
model.SetIndicatorType(SwiperIndicatorType::DOT);
|
||||||
});
|
});
|
||||||
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG,
|
auto leftArrowNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_LEFT_ARROW_ETS_TAG, pattern_->GetLeftButtonId(),
|
||||||
pattern_->GetLeftButtonId(), []() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperArrowPattern>(); });
|
||||||
frameNode_->AddChild(leftArrowNode);
|
frameNode_->AddChild(leftArrowNode);
|
||||||
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
auto leftArrowPattern = leftArrowNode->GetPattern<SwiperArrowPattern>();
|
||||||
auto leftSwiperArrowLayoutProperty = leftArrowPattern->GetSwiperArrowLayoutProperty();
|
auto leftSwiperArrowLayoutProperty = leftArrowPattern->GetSwiperArrowLayoutProperty();
|
||||||
@ -4855,7 +4853,7 @@ HWTEST_F(SwiperTestNg, SwiperPatternFinishAnimation001, TestSize.Level1)
|
|||||||
pattern_->FinishAnimation();
|
pattern_->FinishAnimation();
|
||||||
pattern_->usePropertyAnimation_ = true;
|
pattern_->usePropertyAnimation_ = true;
|
||||||
pattern_->isUserFinish_ = true;
|
pattern_->isUserFinish_ = true;
|
||||||
}
|
}
|
||||||
pattern_->swiperController_->SetFinishCallback([]() {});
|
pattern_->swiperController_->SetFinishCallback([]() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5198,10 +5196,10 @@ HWTEST_F(SwiperTestNg, SwiperPatternPlayTranslateAnimation001, TestSize.Level1)
|
|||||||
for (int j = 0; j <= 1; j++) {
|
for (int j = 0; j <= 1; j++) {
|
||||||
for (int k = 0; k <= 1; k++) {
|
for (int k = 0; k <= 1; k++) {
|
||||||
pattern_->PlayTranslateAnimation(startPos, endPos, nextIndex, restartAutoPlay, velocity);
|
pattern_->PlayTranslateAnimation(startPos, endPos, nextIndex, restartAutoPlay, velocity);
|
||||||
Animation<double>::ValueCallback valueCallback = static_cast<CurveAnimation<double>*>(
|
Animation<double>::ValueCallback valueCallback =
|
||||||
AceType::RawPtr(pattern_->controller_->interpolators_.front()))
|
static_cast<CurveAnimation<double>*>(AceType::RawPtr(pattern_->controller_->interpolators_.front()))
|
||||||
->callbacks_.begin()
|
->callbacks_.begin()
|
||||||
->second;
|
->second;
|
||||||
valueCallback.callback_(value);
|
valueCallback.callback_(value);
|
||||||
value = 0;
|
value = 0;
|
||||||
startPos = 0.0f;
|
startPos = 0.0f;
|
||||||
@ -5542,12 +5540,10 @@ HWTEST_F(SwiperTestNg, SwiperPatternGetFirstItemInfoInVisibleArea001, TestSize.L
|
|||||||
pattern_->itemPosition_.emplace(std::make_pair(3, swiperItemInfo3));
|
pattern_->itemPosition_.emplace(std::make_pair(3, swiperItemInfo3));
|
||||||
pattern_->itemPosition_.emplace(std::make_pair(4, swiperItemInfo4));
|
pattern_->itemPosition_.emplace(std::make_pair(4, swiperItemInfo4));
|
||||||
layoutProperty_->UpdatePrevMargin(dimension);
|
layoutProperty_->UpdatePrevMargin(dimension);
|
||||||
layoutProperty_->layoutConstraint_->scaleProperty =
|
layoutProperty_->layoutConstraint_->scaleProperty = ScaleProperty { 1.0f, 1.0f, 1.0f };
|
||||||
ScaleProperty { 1.0f, 1.0f, 1.0f };
|
|
||||||
}
|
}
|
||||||
layoutProperty_->ResetPrevMargin();
|
layoutProperty_->ResetPrevMargin();
|
||||||
layoutProperty_->layoutConstraint_->scaleProperty =
|
layoutProperty_->layoutConstraint_->scaleProperty = ScaleProperty { 0.0f, 0.0f, 0.0f };
|
||||||
ScaleProperty { 0.0f, 0.0f, 0.0f };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5597,12 +5593,10 @@ HWTEST_F(SwiperTestNg, SwiperPatternGetSecondItemInfoInVisibleArea001, TestSize.
|
|||||||
pattern_->itemPosition_.emplace(std::make_pair(3, swiperItemInfo3));
|
pattern_->itemPosition_.emplace(std::make_pair(3, swiperItemInfo3));
|
||||||
pattern_->itemPosition_.emplace(std::make_pair(4, swiperItemInfo4));
|
pattern_->itemPosition_.emplace(std::make_pair(4, swiperItemInfo4));
|
||||||
layoutProperty_->UpdatePrevMargin(dimension);
|
layoutProperty_->UpdatePrevMargin(dimension);
|
||||||
layoutProperty_->layoutConstraint_->scaleProperty =
|
layoutProperty_->layoutConstraint_->scaleProperty = ScaleProperty { 1.0f, 1.0f, 1.0f };
|
||||||
ScaleProperty { 1.0f, 1.0f, 1.0f };
|
|
||||||
}
|
}
|
||||||
layoutProperty_->ResetPrevMargin();
|
layoutProperty_->ResetPrevMargin();
|
||||||
layoutProperty_->layoutConstraint_->scaleProperty =
|
layoutProperty_->layoutConstraint_->scaleProperty = ScaleProperty { 0.0f, 0.0f, 0.0f };
|
||||||
ScaleProperty { 0.0f, 0.0f, 0.0f };
|
|
||||||
}
|
}
|
||||||
pattern_->itemPosition_.erase(2);
|
pattern_->itemPosition_.erase(2);
|
||||||
pattern_->GetSecondItemInfoInVisibleArea();
|
pattern_->GetSecondItemInfoInVisibleArea();
|
||||||
@ -6320,7 +6314,7 @@ HWTEST_F(SwiperTestNg, SwiperLayoutAlgorithmLayoutBackward002, TestSize.Level1)
|
|||||||
auto indicatorNode_test =
|
auto indicatorNode_test =
|
||||||
FrameNode::GetOrCreateFrameNode(V2::SWIPER_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
FrameNode::GetOrCreateFrameNode(V2::SWIPER_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||||
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
[]() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
layoutWrapper.childrenMap_.emplace(
|
layoutWrapper.childrenMap_.emplace(
|
||||||
std::make_pair(1, AceType::MakeRefPtr<LayoutWrapperNode>(
|
std::make_pair(1, AceType::MakeRefPtr<LayoutWrapperNode>(
|
||||||
indicatorNode_test, geometryNode, indicatorNode->GetLayoutProperty())));
|
indicatorNode_test, geometryNode, indicatorNode->GetLayoutProperty())));
|
||||||
continue;
|
continue;
|
||||||
@ -7986,7 +7980,6 @@ HWTEST_F(SwiperTestNg, SwiperPatternOnModifyDone001, TestSize.Level1)
|
|||||||
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
|
|
||||||
|
|
||||||
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
||||||
indicatorPattern->panEvent_ =
|
indicatorPattern->panEvent_ =
|
||||||
AceType::MakeRefPtr<PanEvent>([](GestureEvent&) {}, [](GestureEvent&) {}, [](GestureEvent&) {}, [] {});
|
AceType::MakeRefPtr<PanEvent>([](GestureEvent&) {}, [](GestureEvent&) {}, [](GestureEvent&) {}, [] {});
|
||||||
@ -8301,7 +8294,6 @@ HWTEST_F(SwiperTestNg, SwiperPatternInitPanEvent001, TestSize.Level1)
|
|||||||
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. test InitPanEvent.
|
* @tc.steps: step2. test InitPanEvent.
|
||||||
* @tc.expected: Related function runs ok.
|
* @tc.expected: Related function runs ok.
|
||||||
@ -8351,7 +8343,6 @@ HWTEST_F(SwiperTestNg, SwiperPatternCheckMarkDirtyNodeForRenderIndicator001, Tes
|
|||||||
FrameNode::GetOrCreateFrameNode(V2::SWIPER_ETS_TAG, 1, []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
FrameNode::GetOrCreateFrameNode(V2::SWIPER_ETS_TAG, 1, []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
||||||
indicatorNode->AddChild(indicatorNode_test);
|
indicatorNode->AddChild(indicatorNode_test);
|
||||||
|
|
||||||
|
|
||||||
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8854,7 +8845,6 @@ HWTEST_F(SwiperTestNg, SwiperPatternCheckMarkDirtyNodeForRenderIndicator002, Tes
|
|||||||
V2::SWIPER_INDICATOR_ETS_TAG, 1, []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
V2::SWIPER_INDICATOR_ETS_TAG, 1, []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
||||||
indicatorNode->AddChild(indicatorNode_test);
|
indicatorNode->AddChild(indicatorNode_test);
|
||||||
|
|
||||||
|
|
||||||
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
||||||
float additionalOffset = -1.0f;
|
float additionalOffset = -1.0f;
|
||||||
indicatorPattern->itemPosition_.emplace(std::make_pair(0, SwiperItemInfo { 0.0f, 0.0f }));
|
indicatorPattern->itemPosition_.emplace(std::make_pair(0, SwiperItemInfo { 0.0f, 0.0f }));
|
||||||
@ -9298,8 +9288,8 @@ HWTEST_F(SwiperTestNg, SwiperPatternOnTranslateFinish002, TestSize.Level1)
|
|||||||
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateAutoPlay(true);
|
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateAutoPlay(true);
|
||||||
pattern_->isIndicatorLongPress_ = false;
|
pattern_->isIndicatorLongPress_ = false;
|
||||||
EXPECT_EQ(frameNode_->GetChildren().size(), 2);
|
EXPECT_EQ(frameNode_->GetChildren().size(), 2);
|
||||||
auto indicatorNode = AceType::DynamicCast<FrameNode>(frameNode_->GetChildAtIndex(
|
auto indicatorNode = AceType::DynamicCast<FrameNode>(
|
||||||
frameNode_->GetChildIndexById(indicatorNode1->GetId())));
|
frameNode_->GetChildAtIndex(frameNode_->GetChildIndexById(indicatorNode1->GetId())));
|
||||||
EXPECT_NE(indicatorNode, nullptr);
|
EXPECT_NE(indicatorNode, nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9443,7 +9433,6 @@ HWTEST_F(SwiperTestNg, SwiperPatternOnModifyDone002, TestSize.Level1)
|
|||||||
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperPattern>(); });
|
||||||
frameNode_->AddChild(indicatorNode);
|
frameNode_->AddChild(indicatorNode);
|
||||||
|
|
||||||
|
|
||||||
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
RefPtr<SwiperPattern> indicatorPattern = indicatorNode->GetPattern<SwiperPattern>();
|
||||||
indicatorPattern->panEvent_ =
|
indicatorPattern->panEvent_ =
|
||||||
AceType::MakeRefPtr<PanEvent>([](GestureEvent&) {}, [](GestureEvent&) {}, [](GestureEvent&) {}, [] {});
|
AceType::MakeRefPtr<PanEvent>([](GestureEvent&) {}, [](GestureEvent&) {}, [](GestureEvent&) {}, [] {});
|
||||||
@ -9474,7 +9463,7 @@ HWTEST_F(SwiperTestNg, SwiperPaintMethodClipPadding001, TestSize.Level1)
|
|||||||
paintProperty->UpdateColor(Color::RED);
|
paintProperty->UpdateColor(Color::RED);
|
||||||
auto renderContext = frameNode_->GetRenderContext();
|
auto renderContext = frameNode_->GetRenderContext();
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call ClipPadding.
|
* @tc.steps: step2. call ClipPadding.
|
||||||
@ -9509,7 +9498,7 @@ HWTEST_F(SwiperTestNg, SwiperPaintMethodPaintFade001, TestSize.Level1)
|
|||||||
paintProperty->UpdateColor(Color::RED);
|
paintProperty->UpdateColor(Color::RED);
|
||||||
auto renderContext = frameNode_->GetRenderContext();
|
auto renderContext = frameNode_->GetRenderContext();
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call PaintFade whith setting needPaintFade_ and renderContext.
|
* @tc.steps: step2. call PaintFade whith setting needPaintFade_ and renderContext.
|
||||||
@ -9546,7 +9535,7 @@ HWTEST_F(SwiperTestNg, SwiperPaintMethodPaintFade002, TestSize.Level1)
|
|||||||
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
||||||
auto renderContext = frameNode_->GetRenderContext();
|
auto renderContext = frameNode_->GetRenderContext();
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
paintWrapper.paintProperty_ = AceType::MakeRefPtr<SwiperPaintProperty>();
|
paintWrapper.paintProperty_ = AceType::MakeRefPtr<SwiperPaintProperty>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9629,7 +9618,7 @@ HWTEST_F(SwiperTestNg, SwiperPaintMethodGetForegroundDrawFunction001, TestSize.L
|
|||||||
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
||||||
auto renderContext = frameNode_->GetRenderContext();
|
auto renderContext = frameNode_->GetRenderContext();
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call PaintFade whith setting (GreatNotEqual(mainDelta_, 0.0)) .
|
* @tc.steps: step2. call PaintFade whith setting (GreatNotEqual(mainDelta_, 0.0)) .
|
||||||
@ -9656,7 +9645,7 @@ HWTEST_F(SwiperTestNg, SwiperPaintMethodPaintFade003, TestSize.Level1)
|
|||||||
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
||||||
auto renderContext = frameNode_->GetRenderContext();
|
auto renderContext = frameNode_->GetRenderContext();
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
paintWrapper.paintProperty_ = AceType::MakeRefPtr<SwiperPaintProperty>();
|
paintWrapper.paintProperty_ = AceType::MakeRefPtr<SwiperPaintProperty>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9690,7 +9679,7 @@ HWTEST_F(SwiperTestNg, SwiperPaintMethodPaintFade004, TestSize.Level1)
|
|||||||
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
auto paintProperty = AceType::MakeRefPtr<PaintProperty>();
|
||||||
auto renderContext = frameNode_->GetRenderContext();
|
auto renderContext = frameNode_->GetRenderContext();
|
||||||
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
PaintWrapper paintWrapper(renderContext, geometryNode, paintProperty);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
paintWrapper.paintProperty_ = AceType::MakeRefPtr<SwiperPaintProperty>();
|
paintWrapper.paintProperty_ = AceType::MakeRefPtr<SwiperPaintProperty>();
|
||||||
ASSERT_NE(paintWrapper.paintProperty_, nullptr);
|
ASSERT_NE(paintWrapper.paintProperty_, nullptr);
|
||||||
auto frameSize = paintWrapper.GetGeometryNode()->GetFrameSize();
|
auto frameSize = paintWrapper.GetGeometryNode()->GetFrameSize();
|
||||||
@ -10109,7 +10098,7 @@ HWTEST_F(SwiperTestNg, SwiperPatternHandleScroll003, TestSize.Level1)
|
|||||||
CreateWithItem([](SwiperModelNG model) {});
|
CreateWithItem([](SwiperModelNG model) {});
|
||||||
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
||||||
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateEdgeEffect(EdgeEffect::NONE);
|
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateEdgeEffect(EdgeEffect::NONE);
|
||||||
pattern_->itemPosition_.insert({ 0, SwiperItemInfo{ .startPos = -0.5 } });
|
pattern_->itemPosition_.insert({ 0, SwiperItemInfo { .startPos = -0.5 } });
|
||||||
|
|
||||||
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
||||||
EXPECT_CALL(*mockScroll, HandleScroll(5.0f, SCROLL_FROM_UPDATE, NestedState::CHILD_SCROLL))
|
EXPECT_CALL(*mockScroll, HandleScroll(5.0f, SCROLL_FROM_UPDATE, NestedState::CHILD_SCROLL))
|
||||||
@ -10136,7 +10125,7 @@ HWTEST_F(SwiperTestNg, SwiperPatternHandleScroll004, TestSize.Level1)
|
|||||||
CreateWithItem([](SwiperModelNG model) {});
|
CreateWithItem([](SwiperModelNG model) {});
|
||||||
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
||||||
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateEdgeEffect(EdgeEffect::SPRING);
|
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateEdgeEffect(EdgeEffect::SPRING);
|
||||||
pattern_->itemPosition_.insert({ 0, SwiperItemInfo{ .startPos = -0.5 } });
|
pattern_->itemPosition_.insert({ 0, SwiperItemInfo { .startPos = -0.5 } });
|
||||||
|
|
||||||
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
||||||
EXPECT_CALL(*mockScroll, HandleScroll(5.0f, SCROLL_FROM_UPDATE, NestedState::CHILD_SCROLL))
|
EXPECT_CALL(*mockScroll, HandleScroll(5.0f, SCROLL_FROM_UPDATE, NestedState::CHILD_SCROLL))
|
||||||
@ -10247,7 +10236,7 @@ HWTEST_F(SwiperTestNg, SwiperPatternHandleScrollVelocity002, TestSize.Level1)
|
|||||||
{
|
{
|
||||||
CreateWithItem([](SwiperModelNG model) {});
|
CreateWithItem([](SwiperModelNG model) {});
|
||||||
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
||||||
pattern_->itemPosition_.insert({ 0, SwiperItemInfo{ .startPos = 0.0f } });
|
pattern_->itemPosition_.insert({ 0, SwiperItemInfo { .startPos = 0.0f } });
|
||||||
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
||||||
EXPECT_CALL(*mockScroll, HandleScrollVelocity).Times(1).WillOnce(Return(true));
|
EXPECT_CALL(*mockScroll, HandleScrollVelocity).Times(1).WillOnce(Return(true));
|
||||||
pattern_->parent_ = mockScroll;
|
pattern_->parent_ = mockScroll;
|
||||||
@ -10267,7 +10256,7 @@ HWTEST_F(SwiperTestNg, SwiperPatternHandleScrollVelocity003, TestSize.Level1)
|
|||||||
CreateWithItem([](SwiperModelNG model) {});
|
CreateWithItem([](SwiperModelNG model) {});
|
||||||
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
pattern_->GetLayoutProperty<SwiperLayoutProperty>()->UpdateLoop(false);
|
||||||
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateEdgeEffect(EdgeEffect::NONE);
|
pattern_->GetPaintProperty<SwiperPaintProperty>()->UpdateEdgeEffect(EdgeEffect::NONE);
|
||||||
pattern_->itemPosition_.insert({ 0, SwiperItemInfo{ .startPos = 0.0f } });
|
pattern_->itemPosition_.insert({ 0, SwiperItemInfo { .startPos = 0.0f } });
|
||||||
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
auto mockScroll = AceType::MakeRefPtr<MockNestableScrollContainer>();
|
||||||
EXPECT_CALL(*mockScroll, HandleScrollVelocity).Times(2).WillRepeatedly(Return(false));
|
EXPECT_CALL(*mockScroll, HandleScrollVelocity).Times(2).WillRepeatedly(Return(false));
|
||||||
pattern_->parent_ = mockScroll;
|
pattern_->parent_ = mockScroll;
|
||||||
@ -10678,24 +10667,24 @@ HWTEST_F(SwiperTestNg, SwiperLayoutAlgorithmGetChildMaxSize002, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
CreateWithItem([](SwiperModelNG model) {});
|
CreateWithItem([](SwiperModelNG model) {});
|
||||||
auto swiperLayoutAlgorithm = AceType::DynamicCast<SwiperLayoutAlgorithm>(pattern_->CreateLayoutAlgorithm());
|
auto swiperLayoutAlgorithm = AceType::DynamicCast<SwiperLayoutAlgorithm>(pattern_->CreateLayoutAlgorithm());
|
||||||
|
|
||||||
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
auto indicatorNode = FrameNode::GetOrCreateFrameNode(V2::SWIPER_INDICATOR_ETS_TAG,
|
||||||
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
ElementRegister::GetInstance()->MakeUniqueId(), []() { return AceType::MakeRefPtr<SwiperIndicatorPattern>(); });
|
||||||
auto geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
auto geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||||
auto layoutWrapper = LayoutWrapperNode(indicatorNode, geometryNode, indicatorNode->GetLayoutProperty());
|
auto layoutWrapper = LayoutWrapperNode(indicatorNode, geometryNode, indicatorNode->GetLayoutProperty());
|
||||||
|
|
||||||
layoutWrapper.currentChildCount_ = 2;
|
layoutWrapper.currentChildCount_ = 2;
|
||||||
layoutWrapper.childrenMap_.emplace(std::make_pair(
|
layoutWrapper.childrenMap_.emplace(std::make_pair(
|
||||||
0, AceType::MakeRefPtr<LayoutWrapperNode>(indicatorNode, geometryNode, indicatorNode->GetLayoutProperty())));
|
0, AceType::MakeRefPtr<LayoutWrapperNode>(indicatorNode, geometryNode, indicatorNode->GetLayoutProperty())));
|
||||||
layoutWrapper.childrenMap_.emplace(std::make_pair(
|
layoutWrapper.childrenMap_.emplace(std::make_pair(
|
||||||
1, AceType::MakeRefPtr<LayoutWrapperNode>(indicatorNode, nullptr, indicatorNode->GetLayoutProperty())));
|
1, AceType::MakeRefPtr<LayoutWrapperNode>(indicatorNode, nullptr, indicatorNode->GetLayoutProperty())));
|
||||||
|
|
||||||
LayoutConstraintF layoutConstraint;
|
LayoutConstraintF layoutConstraint;
|
||||||
layoutConstraint.maxSize = SizeF(720.f, 1136.f);
|
layoutConstraint.maxSize = SizeF(720.f, 1136.f);
|
||||||
layoutConstraint.percentReference = SizeF(720.f, 1136.f);
|
layoutConstraint.percentReference = SizeF(720.f, 1136.f);
|
||||||
layoutConstraint.parentIdealSize.SetSize(SizeF(720.f, 1136.f));
|
layoutConstraint.parentIdealSize.SetSize(SizeF(720.f, 1136.f));
|
||||||
ASSERT_NE(layoutWrapper.layoutProperty_, nullptr);
|
ASSERT_NE(layoutWrapper.layoutProperty_, nullptr);
|
||||||
|
|
||||||
layoutWrapper.GetLayoutProperty()->UpdateLayoutConstraint(layoutConstraint);
|
layoutWrapper.GetLayoutProperty()->UpdateLayoutConstraint(layoutConstraint);
|
||||||
Axis axis = Axis::HORIZONTAL;
|
Axis axis = Axis::HORIZONTAL;
|
||||||
bool isMainAxis = true;
|
bool isMainAxis = true;
|
||||||
|
@ -154,10 +154,8 @@ constexpr int32_t AI_SPAN_START = 7;
|
|||||||
constexpr int32_t AI_SPAN_END = 18;
|
constexpr int32_t AI_SPAN_END = 18;
|
||||||
constexpr int32_t AI_SPAN_START_II = 24;
|
constexpr int32_t AI_SPAN_START_II = 24;
|
||||||
constexpr int32_t AI_SPAN_END_II = 37;
|
constexpr int32_t AI_SPAN_END_II = 37;
|
||||||
const struct TextDataDetectResult TEXT_DATA_DETECT_RESULT = {
|
const struct TextDataDetectResult TEXT_DATA_DETECT_RESULT = { 0,
|
||||||
0,
|
"{\"phoneNum\":[{\"charOffset\":7,\"number\":\"18888888888\",\"oriText\":\"18888888888\",\"type\":1}]}", "0",
|
||||||
"{\"phoneNum\":[{\"charOffset\":7,\"number\":\"18888888888\",\"oriText\":\"18888888888\",\"type\":1}]}",
|
|
||||||
"0",
|
|
||||||
"{\"phoneNum\":[{\"option\":\"呼叫\"},{\"option\":\"发送信息\"},\
|
"{\"phoneNum\":[{\"option\":\"呼叫\"},{\"option\":\"发送信息\"},\
|
||||||
{\"option\":\"新建联系人\"},{\"option\":\"复制\"},{\"option\":\"选择文本\"}],\
|
{\"option\":\"新建联系人\"},{\"option\":\"复制\"},{\"option\":\"选择文本\"}],\
|
||||||
\"url\":[{\"option\":\"打开\"},{\"option\":\"复制\"},{\"option\":\"选择文本\"}],\
|
\"url\":[{\"option\":\"打开\"},{\"option\":\"复制\"},{\"option\":\"选择文本\"}],\
|
||||||
@ -165,8 +163,7 @@ const struct TextDataDetectResult TEXT_DATA_DETECT_RESULT = {
|
|||||||
{\"option\":\"新建联系人\"},{\"option\":\"复制\"},{\"option\":\"选择文本\"}],\
|
{\"option\":\"新建联系人\"},{\"option\":\"复制\"},{\"option\":\"选择文本\"}],\
|
||||||
\"location\":[{\"option\":\"导航至该位置\"},{\"option\":\"在地图中打开\"},\
|
\"location\":[{\"option\":\"导航至该位置\"},{\"option\":\"在地图中打开\"},\
|
||||||
{\"option\":\"复制\"},{\"option\":\"选择文本\"}]}",
|
{\"option\":\"复制\"},{\"option\":\"选择文本\"}]}",
|
||||||
"{\"bundlename\":\"com.XXXXXX.hmsapp.hiai\",\"abilityname\":\"EntityMenuUIExtensionAbility\"}"
|
"{\"bundlename\":\"com.XXXXXX.hmsapp.hiai\",\"abilityname\":\"EntityMenuUIExtensionAbility\"}" };
|
||||||
};
|
|
||||||
|
|
||||||
using OnClickCallback = std::function<void(const BaseEventInfo* info)>;
|
using OnClickCallback = std::function<void(const BaseEventInfo* info)>;
|
||||||
using DragDropBaseCallback = std::function<DragDropBaseInfo(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)>;
|
using DragDropBaseCallback = std::function<DragDropBaseInfo(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)>;
|
||||||
@ -2074,7 +2071,7 @@ HWTEST_F(TextTestNg, TextContentModifier001, TestSize.Level1)
|
|||||||
textContentModifier.SetBaselineOffset(BASELINE_OFFSET_VALUE);
|
textContentModifier.SetBaselineOffset(BASELINE_OFFSET_VALUE);
|
||||||
MockPipelineContext::SetUp();
|
MockPipelineContext::SetUp();
|
||||||
Testing::MockCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).WillRepeatedly(Return());
|
||||||
DrawingContext context { canvas, CONTEXT_WIDTH_VALUE, CONTEXT_HEIGHT_VALUE };
|
DrawingContext context { canvas, CONTEXT_WIDTH_VALUE, CONTEXT_HEIGHT_VALUE };
|
||||||
textContentModifier.SetParagraph(paragraph);
|
textContentModifier.SetParagraph(paragraph);
|
||||||
// call onDraw function(textRacing_ = true)
|
// call onDraw function(textRacing_ = true)
|
||||||
@ -4032,7 +4029,7 @@ HWTEST_F(TextTestNg, TextContentModifier003, TestSize.Level1)
|
|||||||
* @tc.steps: step2. set context.
|
* @tc.steps: step2. set context.
|
||||||
*/
|
*/
|
||||||
Testing::MockCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).WillRepeatedly(Return());
|
||||||
DrawingContext context { canvas, CONTEXT_WIDTH_VALUE, CONTEXT_HEIGHT_VALUE };
|
DrawingContext context { canvas, CONTEXT_WIDTH_VALUE, CONTEXT_HEIGHT_VALUE };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4116,7 +4113,7 @@ HWTEST_F(TextTestNg, TextContentModifier004, TestSize.Level1)
|
|||||||
* push one rect to drawObscuredRects and set drawObscuredRects_ to drawObscuredRects.
|
* push one rect to drawObscuredRects and set drawObscuredRects_ to drawObscuredRects.
|
||||||
*/
|
*/
|
||||||
Testing::MockCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _)).WillRepeatedly(Return());
|
EXPECT_CALL(canvas, ClipRect(_, _, _)).WillRepeatedly(Return());
|
||||||
EXPECT_CALL(canvas, AttachBrush(_)).WillRepeatedly(ReturnRef(canvas));
|
EXPECT_CALL(canvas, AttachBrush(_)).WillRepeatedly(ReturnRef(canvas));
|
||||||
EXPECT_CALL(canvas, DetachBrush()).WillRepeatedly(ReturnRef(canvas));
|
EXPECT_CALL(canvas, DetachBrush()).WillRepeatedly(ReturnRef(canvas));
|
||||||
DrawingContext context { canvas, CONTEXT_WIDTH_VALUE, CONTEXT_HEIGHT_VALUE };
|
DrawingContext context { canvas, CONTEXT_WIDTH_VALUE, CONTEXT_HEIGHT_VALUE };
|
||||||
@ -5092,7 +5089,7 @@ HWTEST_F(TextTestNg, TextLayoutAlgorithmTest009, TestSize.Level1)
|
|||||||
.fontLocale = "zh-CN",
|
.fontLocale = "zh-CN",
|
||||||
.wordBreak = textStyle.GetWordBreak(),
|
.wordBreak = textStyle.GetWordBreak(),
|
||||||
.textOverflow = textStyle.GetTextOverflow() };
|
.textOverflow = textStyle.GetTextOverflow() };
|
||||||
auto paragraph= MockParagraph::GetOrCreateMockParagraph();
|
auto paragraph = MockParagraph::GetOrCreateMockParagraph();
|
||||||
|
|
||||||
AISpan aiSpan1;
|
AISpan aiSpan1;
|
||||||
aiSpan1.start = AI_SPAN_START;
|
aiSpan1.start = AI_SPAN_START;
|
||||||
@ -5134,7 +5131,7 @@ HWTEST_F(TextTestNg, ParseAIJson001, TestSize.Level1)
|
|||||||
ASSERT_NE(textFrameNode, nullptr);
|
ASSERT_NE(textFrameNode, nullptr);
|
||||||
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
||||||
ASSERT_NE(textPattern, nullptr);
|
ASSERT_NE(textPattern, nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. Parse to JsonObject.
|
* @tc.steps: step2. Parse to JsonObject.
|
||||||
* @tc.expected: parseSuccess phoneNum is not Empty.
|
* @tc.expected: parseSuccess phoneNum is not Empty.
|
||||||
@ -5156,7 +5153,7 @@ HWTEST_F(TextTestNg, ParseAIJson001, TestSize.Level1)
|
|||||||
EXPECT_FALSE(textPattern->aiSpanMap_.empty());
|
EXPECT_FALSE(textPattern->aiSpanMap_.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: ParseAIJson002
|
* @tc.name: ParseAIJson002
|
||||||
* @tc.desc: Test TextPattern: new method ParseAIJson for methodOption
|
* @tc.desc: Test TextPattern: new method ParseAIJson for methodOption
|
||||||
* @tc.type: FUNC
|
* @tc.type: FUNC
|
||||||
@ -5170,7 +5167,7 @@ HWTEST_F(TextTestNg, ParseAIJson002, TestSize.Level1)
|
|||||||
ASSERT_NE(textFrameNode, nullptr);
|
ASSERT_NE(textFrameNode, nullptr);
|
||||||
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
||||||
ASSERT_NE(textPattern, nullptr);
|
ASSERT_NE(textPattern, nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call ParseAIResult function.
|
* @tc.steps: step2. call ParseAIResult function.
|
||||||
* @tc.expected: parseSuccess any element is not Empty.
|
* @tc.expected: parseSuccess any element is not Empty.
|
||||||
@ -5210,7 +5207,7 @@ HWTEST_F(TextTestNg, ParseAIResult001, TestSize.Level1)
|
|||||||
ASSERT_NE(textFrameNode, nullptr);
|
ASSERT_NE(textFrameNode, nullptr);
|
||||||
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
||||||
ASSERT_NE(textPattern, nullptr);
|
ASSERT_NE(textPattern, nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call ParseAIResult function.
|
* @tc.steps: step2. call ParseAIResult function.
|
||||||
* @tc.expected: parseSuccess aiSpanMap_ is not Empty.
|
* @tc.expected: parseSuccess aiSpanMap_ is not Empty.
|
||||||
@ -5242,7 +5239,7 @@ HWTEST_F(TextTestNg, ParseAIResult002, TestSize.Level1)
|
|||||||
ASSERT_NE(textFrameNode, nullptr);
|
ASSERT_NE(textFrameNode, nullptr);
|
||||||
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
auto textPattern = textFrameNode->GetPattern<TextPattern>();
|
||||||
ASSERT_NE(textPattern, nullptr);
|
ASSERT_NE(textPattern, nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call ParseAIResult function.
|
* @tc.steps: step2. call ParseAIResult function.
|
||||||
* @tc.expected: parseSuccess aiSpanMap_ is not Empty.
|
* @tc.expected: parseSuccess aiSpanMap_ is not Empty.
|
||||||
@ -5265,7 +5262,7 @@ HWTEST_F(TextTestNg, ParseAIResult002, TestSize.Level1)
|
|||||||
EXPECT_FALSE(textPattern->aiSpanMap_.empty());
|
EXPECT_FALSE(textPattern->aiSpanMap_.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: HandleSpanSingleClickEvent
|
* @tc.name: HandleSpanSingleClickEvent
|
||||||
* @tc.desc: test test_pattern.h HandleSpanSingleClickEvent function with valid textSelector
|
* @tc.desc: test test_pattern.h HandleSpanSingleClickEvent function with valid textSelector
|
||||||
* @tc.type: FUNC
|
* @tc.type: FUNC
|
||||||
@ -5286,7 +5283,7 @@ HWTEST_F(TextTestNg, HandleSpanSingleClickEvent, TestSize.Level1)
|
|||||||
spanItemChild->position = StringUtils::ToWstring(spanItemChild->content).length();
|
spanItemChild->position = StringUtils::ToWstring(spanItemChild->content).length();
|
||||||
pattern->spans_.emplace_back(spanItemChild);
|
pattern->spans_.emplace_back(spanItemChild);
|
||||||
|
|
||||||
auto paragraph= MockParagraph::GetOrCreateMockParagraph();
|
auto paragraph = MockParagraph::GetOrCreateMockParagraph();
|
||||||
std::vector<RectF> rects { RectF(0, 0, 20, 20) };
|
std::vector<RectF> rects { RectF(0, 0, 20, 20) };
|
||||||
EXPECT_CALL(*paragraph, GetRectsForRange(_, _, _)).WillRepeatedly(SetArgReferee<2>(rects));
|
EXPECT_CALL(*paragraph, GetRectsForRange(_, _, _)).WillRepeatedly(SetArgReferee<2>(rects));
|
||||||
pattern->paragraph_ = paragraph;
|
pattern->paragraph_ = paragraph;
|
||||||
@ -5329,7 +5326,7 @@ HWTEST_F(TextTestNg, HandleSpanSingleClickEvent, TestSize.Level1)
|
|||||||
info.localLocation_ = Offset(3.0f, 3.0f);
|
info.localLocation_ = Offset(3.0f, 3.0f);
|
||||||
|
|
||||||
PointF textOffset = { info.GetLocalLocation().GetX() - textContentRect.GetX(),
|
PointF textOffset = { info.GetLocalLocation().GetX() - textContentRect.GetX(),
|
||||||
info.GetLocalLocation().GetY() - textContentRect.GetY() };
|
info.GetLocalLocation().GetY() - textContentRect.GetY() };
|
||||||
|
|
||||||
bool isClickOnSpan = false;
|
bool isClickOnSpan = false;
|
||||||
bool isClickOnAISpan = false;
|
bool isClickOnAISpan = false;
|
||||||
@ -5376,7 +5373,6 @@ HWTEST_F(TextTestNg, ShowUIExtensionMenu, TestSize.Level1)
|
|||||||
menuOptionsMap["location"] = menuOptionsLocation;
|
menuOptionsMap["location"] = menuOptionsLocation;
|
||||||
pattern->aiMenuOptionsMap_ = menuOptionsMap;
|
pattern->aiMenuOptionsMap_ = menuOptionsMap;
|
||||||
|
|
||||||
|
|
||||||
EXPECT_TRUE(pattern->ShowUIExtensionMenu(aiSpan, nullptr, nullptr));
|
EXPECT_TRUE(pattern->ShowUIExtensionMenu(aiSpan, nullptr, nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components/scroll/scroll_controller_base.h"
|
#include "core/components/scroll/scroll_controller_base.h"
|
||||||
|
|
||||||
#define protected public
|
#define protected public
|
||||||
@ -36,13 +38,13 @@
|
|||||||
#include "base/utils/utils.h"
|
#include "base/utils/utils.h"
|
||||||
#include "core/components/button/button_theme.h"
|
#include "core/components/button/button_theme.h"
|
||||||
#include "core/components/common/layout/constants.h"
|
#include "core/components/common/layout/constants.h"
|
||||||
#include "core/components_ng/pattern/scrollable/scrollable.h"
|
|
||||||
#include "core/components_ng/base/view_stack_processor.h"
|
#include "core/components_ng/base/view_stack_processor.h"
|
||||||
#include "core/components_ng/pattern/button/button_layout_property.h"
|
#include "core/components_ng/pattern/button/button_layout_property.h"
|
||||||
#include "core/components_ng/pattern/button/button_model_ng.h"
|
#include "core/components_ng/pattern/button/button_model_ng.h"
|
||||||
#include "core/components_ng/pattern/button/button_pattern.h"
|
#include "core/components_ng/pattern/button/button_pattern.h"
|
||||||
#include "core/components_ng/pattern/linear_layout/row_model_ng.h"
|
#include "core/components_ng/pattern/linear_layout/row_model_ng.h"
|
||||||
#include "core/components_ng/pattern/pattern.h"
|
#include "core/components_ng/pattern/pattern.h"
|
||||||
|
#include "core/components_ng/pattern/scrollable/scrollable.h"
|
||||||
#include "core/components_ng/pattern/waterflow/water_flow_accessibility_property.h"
|
#include "core/components_ng/pattern/waterflow/water_flow_accessibility_property.h"
|
||||||
#include "core/components_ng/pattern/waterflow/water_flow_event_hub.h"
|
#include "core/components_ng/pattern/waterflow/water_flow_event_hub.h"
|
||||||
#include "core/components_ng/pattern/waterflow/water_flow_item_model_ng.h"
|
#include "core/components_ng/pattern/waterflow/water_flow_item_model_ng.h"
|
||||||
@ -1234,7 +1236,7 @@ HWTEST_F(WaterFlowTestNg, WaterFlowContentModifier_onDraw001, TestSize.Level1)
|
|||||||
pattern_->CreateNodePaintMethod();
|
pattern_->CreateNodePaintMethod();
|
||||||
auto contentModifier = pattern_->contentModifier_;
|
auto contentModifier = pattern_->contentModifier_;
|
||||||
ASSERT_NE(contentModifier, nullptr);
|
ASSERT_NE(contentModifier, nullptr);
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
DrawingContext context = { canvas, 1, 1 };
|
DrawingContext context = { canvas, 1, 1 };
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. test function.
|
* @tc.steps: step2. test function.
|
||||||
@ -1473,7 +1475,7 @@ HWTEST_F(WaterFlowTestNg, WaterFlowGetItemRectTest001, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
HWTEST_F(WaterFlowTestNg, MeasureForAnimation001, TestSize.Level1)
|
HWTEST_F(WaterFlowTestNg, MeasureForAnimation001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step1. Create WithItem to test MeaseForAnimation for node creation .
|
* @tc.steps: step1. Create WithItem to test MeaseForAnimation for node creation .
|
||||||
* @tc.expected: pattern_->layoutInfo_ There is corresponding index information in it.
|
* @tc.expected: pattern_->layoutInfo_ There is corresponding index information in it.
|
||||||
*/
|
*/
|
||||||
@ -1482,7 +1484,7 @@ HWTEST_F(WaterFlowTestNg, MeasureForAnimation001, TestSize.Level1)
|
|||||||
CreateItem(TOTAL_LINE_NUMBER * 2);
|
CreateItem(TOTAL_LINE_NUMBER * 2);
|
||||||
});
|
});
|
||||||
pattern_->ScrollToIndex(15, true);
|
pattern_->ScrollToIndex(15, true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. Get value from pattern_ -> LayoutInfo_ .
|
* @tc.steps: step2. Get value from pattern_ -> LayoutInfo_ .
|
||||||
* @tc.expected: return value(crossIndex) is not -1.
|
* @tc.expected: return value(crossIndex) is not -1.
|
||||||
|
@ -41,7 +41,6 @@ template("web_pattern_unit_source_set") {
|
|||||||
"web_pattern_test_ng.cpp",
|
"web_pattern_test_ng.cpp",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"$ace_root/build:ace_ohos_unittest_base",
|
|
||||||
"$ace_root/frameworks/core/components/theme:build_theme_code",
|
"$ace_root/frameworks/core/components/theme:build_theme_code",
|
||||||
"$ace_root/frameworks/core/components_ng/base:ace_core_components_base_ng_ohos",
|
"$ace_root/frameworks/core/components_ng/base:ace_core_components_base_ng_ohos",
|
||||||
"//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
|
"//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client",
|
||||||
|
@ -12,12 +12,14 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "base/utils/utils.h"
|
#include "base/utils/utils.h"
|
||||||
#define protected public
|
#define protected public
|
||||||
#define private public
|
#define private public
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/render/border_image_painter.h"
|
#include "core/components_ng/render/border_image_painter.h"
|
||||||
|
|
||||||
#undef private
|
#undef private
|
||||||
@ -29,46 +31,46 @@ using namespace testing::ext;
|
|||||||
namespace OHOS::Ace {
|
namespace OHOS::Ace {
|
||||||
namespace {
|
namespace {
|
||||||
const NG::BorderWidthProperty BORDER_WIDTH_TEST = { 1.0_vp, 1.0_vp, 1.0_vp, 1.0_vp };
|
const NG::BorderWidthProperty BORDER_WIDTH_TEST = { 1.0_vp, 1.0_vp, 1.0_vp, 1.0_vp };
|
||||||
const NG::SizeF PAINTSIZE = {5.0, 10.0};
|
const NG::SizeF PAINTSIZE = { 5.0, 10.0 };
|
||||||
const NG::SizeF TEST_SIZE = {100.0, 200.0};
|
const NG::SizeF TEST_SIZE = { 100.0, 200.0 };
|
||||||
const NG::OffsetF OFFSET_F = {1.0, 2.0};
|
const NG::OffsetF OFFSET_F = { 1.0, 2.0 };
|
||||||
|
|
||||||
const double DIPSCALE = 10.0;
|
const double DIPSCALE = 10.0;
|
||||||
const double FIVE = 5.0;
|
const double FIVE = 5.0;
|
||||||
const double TWO = 2.0;
|
const double TWO = 2.0;
|
||||||
const double ONE = 1.0;
|
const double ONE = 1.0;
|
||||||
const double ZERO_TEST = 0.0;
|
const double ZERO_TEST = 0.0;
|
||||||
const std::string SRC_IMAGES = "images/mmm.jpg";
|
const std::string SRC_IMAGES = "images/mmm.jpg";
|
||||||
|
|
||||||
const Dimension DIMENSION_SLICE = 10.0_vp;
|
const Dimension DIMENSION_SLICE = 10.0_vp;
|
||||||
const Dimension DIMENSION_WIDTH = 30.0_vp;
|
const Dimension DIMENSION_WIDTH = 30.0_vp;
|
||||||
const Dimension DIMENSION_OUTSET = 100.0_vp;
|
const Dimension DIMENSION_OUTSET = 100.0_vp;
|
||||||
|
|
||||||
const BorderImageDirection DIRECTION_LEFT = BorderImageDirection::LEFT;
|
const BorderImageDirection DIRECTION_LEFT = BorderImageDirection::LEFT;
|
||||||
const BorderImageDirection DIRECTION_RIGHT = BorderImageDirection::RIGHT;
|
const BorderImageDirection DIRECTION_RIGHT = BorderImageDirection::RIGHT;
|
||||||
const BorderImageDirection DIRECTION_TOP = BorderImageDirection::TOP;
|
const BorderImageDirection DIRECTION_TOP = BorderImageDirection::TOP;
|
||||||
const BorderImageDirection DIRECTION_BOTTOM = BorderImageDirection::BOTTOM;
|
const BorderImageDirection DIRECTION_BOTTOM = BorderImageDirection::BOTTOM;
|
||||||
|
|
||||||
BorderImage* MakeBorderImage()
|
BorderImage* MakeBorderImage()
|
||||||
{
|
{
|
||||||
BorderImage* testImage = new BorderImage(SRC_IMAGES);
|
BorderImage* testImage = new BorderImage(SRC_IMAGES);
|
||||||
testImage->SetEdgeSlice(DIRECTION_LEFT, DIMENSION_SLICE);
|
testImage->SetEdgeSlice(DIRECTION_LEFT, DIMENSION_SLICE);
|
||||||
testImage->SetEdgeSlice(DIRECTION_RIGHT, DIMENSION_SLICE);
|
testImage->SetEdgeSlice(DIRECTION_RIGHT, DIMENSION_SLICE);
|
||||||
testImage->SetEdgeSlice(DIRECTION_TOP, DIMENSION_SLICE);
|
testImage->SetEdgeSlice(DIRECTION_TOP, DIMENSION_SLICE);
|
||||||
testImage->SetEdgeSlice(DIRECTION_BOTTOM, DIMENSION_SLICE);
|
testImage->SetEdgeSlice(DIRECTION_BOTTOM, DIMENSION_SLICE);
|
||||||
|
|
||||||
testImage->SetEdgeWidth(DIRECTION_LEFT, DIMENSION_WIDTH);
|
testImage->SetEdgeWidth(DIRECTION_LEFT, DIMENSION_WIDTH);
|
||||||
testImage->SetEdgeWidth(DIRECTION_RIGHT, DIMENSION_WIDTH);
|
testImage->SetEdgeWidth(DIRECTION_RIGHT, DIMENSION_WIDTH);
|
||||||
testImage->SetEdgeWidth(DIRECTION_TOP, DIMENSION_WIDTH);
|
testImage->SetEdgeWidth(DIRECTION_TOP, DIMENSION_WIDTH);
|
||||||
testImage->SetEdgeWidth(DIRECTION_BOTTOM, DIMENSION_WIDTH);
|
testImage->SetEdgeWidth(DIRECTION_BOTTOM, DIMENSION_WIDTH);
|
||||||
|
|
||||||
testImage->SetEdgeOutset(DIRECTION_LEFT, DIMENSION_OUTSET);
|
testImage->SetEdgeOutset(DIRECTION_LEFT, DIMENSION_OUTSET);
|
||||||
testImage->SetEdgeOutset(DIRECTION_RIGHT, DIMENSION_OUTSET);
|
testImage->SetEdgeOutset(DIRECTION_RIGHT, DIMENSION_OUTSET);
|
||||||
testImage->SetEdgeOutset(DIRECTION_TOP, DIMENSION_OUTSET);
|
testImage->SetEdgeOutset(DIRECTION_TOP, DIMENSION_OUTSET);
|
||||||
testImage->SetEdgeOutset(DIRECTION_BOTTOM, DIMENSION_OUTSET);
|
testImage->SetEdgeOutset(DIRECTION_BOTTOM, DIMENSION_OUTSET);
|
||||||
return testImage;
|
return testImage;
|
||||||
};
|
};
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
class BorderImagePainterTestNg : public testing::Test {};
|
class BorderImagePainterTestNg : public testing::Test {};
|
||||||
|
|
||||||
@ -83,34 +85,34 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter001, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImagePainter.borderImageProperty_ is not null.
|
* @tc.steps: step2. push borderImagePainter.borderImageProperty_ is not null.
|
||||||
* @tc.steps: step2. call InitPainter.
|
* @tc.steps: step2. call InitPainter.
|
||||||
*/
|
*/
|
||||||
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.hasWidthProp_ = true;
|
borderImagePainter.hasWidthProp_ = true;
|
||||||
borderImagePainter.imageWidth_ = 720.0;
|
borderImagePainter.imageWidth_ = 720.0;
|
||||||
borderImagePainter.imageHeight_ = 1080.0;
|
borderImagePainter.imageHeight_ = 1080.0;
|
||||||
borderImagePainter.paintSize_ = TEST_SIZE;
|
borderImagePainter.paintSize_ = TEST_SIZE;
|
||||||
borderImagePainter.InitPainter();
|
borderImagePainter.InitPainter();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.expected: the borderImagePainter.borderCenterWidth_ is expected results.
|
* @tc.expected: the borderImagePainter.borderCenterWidth_ is expected results.
|
||||||
* @tc.expected: the borderImagePainter.imageCenterWidth_ is expected results.
|
* @tc.expected: the borderImagePainter.imageCenterWidth_ is expected results.
|
||||||
*/
|
*/
|
||||||
EXPECT_EQ(borderImagePainter.borderCenterWidth_, 100);
|
EXPECT_EQ(borderImagePainter.borderCenterWidth_, 100);
|
||||||
EXPECT_EQ(borderImagePainter.borderCenterHeight_, 200);
|
EXPECT_EQ(borderImagePainter.borderCenterHeight_, 200);
|
||||||
EXPECT_EQ(borderImagePainter.imageCenterWidth_, -720);
|
EXPECT_EQ(borderImagePainter.imageCenterWidth_, -720);
|
||||||
EXPECT_EQ(borderImagePainter.imageCenterHeight_, -1080);
|
EXPECT_EQ(borderImagePainter.imageCenterHeight_, -1080);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter002
|
* @tc.name: BorderImagePainter002
|
||||||
* @tc.desc: Test cast to BorderImagePainterTestNg
|
* @tc.desc: Test cast to BorderImagePainterTestNg
|
||||||
@ -122,37 +124,37 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter002, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp = nullptr.
|
* @tc.steps: step1. push widthProp = nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp;
|
std::unique_ptr<NG::BorderWidthProperty> widthProp;
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImageProperty.propBorderImage is null.
|
* @tc.steps: step2. push borderImageProperty.propBorderImage is null.
|
||||||
* @tc.steps: step2. push borderImagePainter.leftSlice_ < imageWidth_.
|
* @tc.steps: step2. push borderImagePainter.leftSlice_ < imageWidth_.
|
||||||
* @tc.steps: step2. call InitPainter.
|
* @tc.steps: step2. call InitPainter.
|
||||||
*/
|
*/
|
||||||
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
||||||
borderImageProperty.propHasBorderImageSlice = true;
|
borderImageProperty.propHasBorderImageSlice = true;
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.leftSlice_ = 10.0;
|
borderImagePainter.leftSlice_ = 10.0;
|
||||||
borderImagePainter.rightSlice_ = 20.0;
|
borderImagePainter.rightSlice_ = 20.0;
|
||||||
borderImagePainter.topSlice_ = 40.0;
|
borderImagePainter.topSlice_ = 40.0;
|
||||||
borderImagePainter.bottomSlice_ = 80.0;
|
borderImagePainter.bottomSlice_ = 80.0;
|
||||||
borderImagePainter.InitBorderImageSlice();
|
borderImagePainter.InitBorderImageSlice();
|
||||||
borderImagePainter.InitBorderImageWidth();
|
borderImagePainter.InitBorderImageWidth();
|
||||||
borderImagePainter.InitBorderImageOutset();
|
borderImagePainter.InitBorderImageOutset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.expected: the borderImagePainter.leftSlice_ is expected results.
|
* @tc.expected: the borderImagePainter.leftSlice_ is expected results.
|
||||||
* @tc.expected: the borderImagePainter.rightSlice_ is expected results.
|
* @tc.expected: the borderImagePainter.rightSlice_ is expected results.
|
||||||
*/
|
*/
|
||||||
EXPECT_EQ(borderImagePainter.leftSlice_, 10);
|
EXPECT_EQ(borderImagePainter.leftSlice_, 10);
|
||||||
EXPECT_EQ(borderImagePainter.rightSlice_, 20);
|
EXPECT_EQ(borderImagePainter.rightSlice_, 20);
|
||||||
EXPECT_EQ(borderImagePainter.topSlice_, 40);
|
EXPECT_EQ(borderImagePainter.topSlice_, 40);
|
||||||
EXPECT_EQ(borderImagePainter.bottomSlice_, 80);
|
EXPECT_EQ(borderImagePainter.bottomSlice_, 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter003
|
* @tc.name: BorderImagePainter003
|
||||||
@ -165,41 +167,41 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter003, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImageProperty.propBorderImage is not null.
|
* @tc.steps: step2. push borderImageProperty.propBorderImage is not null.
|
||||||
* @tc.steps: step2. push borderImagePainter.leftSlice_ > imageWidth_.
|
* @tc.steps: step2. push borderImagePainter.leftSlice_ > imageWidth_.
|
||||||
* @tc.steps: step2. call InitBorderImageSlice.
|
* @tc.steps: step2. call InitBorderImageSlice.
|
||||||
*/
|
*/
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
testBorderImage->needFillCenter_ = true;
|
testBorderImage->needFillCenter_ = true;
|
||||||
|
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
||||||
borderImageProperty.propHasBorderImageSlice = true;
|
borderImageProperty.propHasBorderImageSlice = true;
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.leftSlice_ = 120.0;
|
borderImagePainter.leftSlice_ = 120.0;
|
||||||
borderImagePainter.rightSlice_ = 240.0;
|
borderImagePainter.rightSlice_ = 240.0;
|
||||||
borderImagePainter.topSlice_ = 120.0;
|
borderImagePainter.topSlice_ = 120.0;
|
||||||
borderImagePainter.bottomSlice_ = 240.0;
|
borderImagePainter.bottomSlice_ = 240.0;
|
||||||
borderImagePainter.InitBorderImageSlice();
|
borderImagePainter.InitBorderImageSlice();
|
||||||
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.expected: the borderImagePainter.leftSlice_ is expected results.
|
* @tc.expected: the borderImagePainter.leftSlice_ is expected results.
|
||||||
* @tc.expected: the borderImagePainter.rightSlice_ is expected results.
|
* @tc.expected: the borderImagePainter.rightSlice_ is expected results.
|
||||||
*/
|
*/
|
||||||
EXPECT_EQ(borderImagePainter.leftSlice_, 100);
|
EXPECT_EQ(borderImagePainter.leftSlice_, 100);
|
||||||
EXPECT_EQ(borderImagePainter.rightSlice_, 100);
|
EXPECT_EQ(borderImagePainter.rightSlice_, 100);
|
||||||
EXPECT_EQ(borderImagePainter.topSlice_, 100);
|
EXPECT_EQ(borderImagePainter.topSlice_, 100);
|
||||||
EXPECT_EQ(borderImagePainter.bottomSlice_, 100);
|
EXPECT_EQ(borderImagePainter.bottomSlice_, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter004
|
* @tc.name: BorderImagePainter004
|
||||||
@ -212,39 +214,39 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter004, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImageProperty.propBorderImage is not null.
|
* @tc.steps: step2. push borderImageProperty.propBorderImage is not null.
|
||||||
* @tc.steps: step2. call InitBorderImageWidth.
|
* @tc.steps: step2. call InitBorderImageWidth.
|
||||||
*/
|
*/
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
|
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
||||||
borderImageProperty.propHasBorderImageWidth = true;
|
borderImageProperty.propHasBorderImageWidth = true;
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.InitBorderImageWidth();
|
borderImagePainter.InitBorderImageWidth();
|
||||||
|
|
||||||
auto borderImage = borderImagePainter.borderImageProperty_.GetBorderImageValue();
|
auto borderImage = borderImagePainter.borderImageProperty_.GetBorderImageValue();
|
||||||
BorderImageEdge imageLeft = borderImage->GetBorderImageEdge(DIRECTION_LEFT);
|
BorderImageEdge imageLeft = borderImage->GetBorderImageEdge(DIRECTION_LEFT);
|
||||||
BorderImageEdge imageTop = borderImage->GetBorderImageEdge(DIRECTION_RIGHT);
|
BorderImageEdge imageTop = borderImage->GetBorderImageEdge(DIRECTION_RIGHT);
|
||||||
BorderImageEdge imageRight = borderImage->GetBorderImageEdge(DIRECTION_TOP);
|
BorderImageEdge imageRight = borderImage->GetBorderImageEdge(DIRECTION_TOP);
|
||||||
BorderImageEdge imageBottom = borderImage->GetBorderImageEdge(DIRECTION_BOTTOM);
|
BorderImageEdge imageBottom = borderImage->GetBorderImageEdge(DIRECTION_BOTTOM);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.expected: the imageLeft.GetBorderImageWidth() is expected results.
|
* @tc.expected: the imageLeft.GetBorderImageWidth() is expected results.
|
||||||
* @tc.expected: the imageTop.GetBorderImageWidth() is expected results.
|
* @tc.expected: the imageTop.GetBorderImageWidth() is expected results.
|
||||||
*/
|
*/
|
||||||
EXPECT_EQ(imageLeft.GetBorderImageWidth(), DIMENSION_WIDTH);
|
EXPECT_EQ(imageLeft.GetBorderImageWidth(), DIMENSION_WIDTH);
|
||||||
EXPECT_EQ(imageTop.GetBorderImageWidth(), DIMENSION_WIDTH);
|
EXPECT_EQ(imageTop.GetBorderImageWidth(), DIMENSION_WIDTH);
|
||||||
EXPECT_EQ(imageRight.GetBorderImageWidth(), DIMENSION_WIDTH);
|
EXPECT_EQ(imageRight.GetBorderImageWidth(), DIMENSION_WIDTH);
|
||||||
EXPECT_EQ(imageBottom.GetBorderImageWidth(), DIMENSION_WIDTH);
|
EXPECT_EQ(imageBottom.GetBorderImageWidth(), DIMENSION_WIDTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter005
|
* @tc.name: BorderImagePainter005
|
||||||
@ -257,39 +259,39 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter005, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImageProperty.propBorderImage is not null.
|
* @tc.steps: step2. push borderImageProperty.propBorderImage is not null.
|
||||||
* @tc.steps: step2. call InitBorderImageOutset.
|
* @tc.steps: step2. call InitBorderImageOutset.
|
||||||
*/
|
*/
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
|
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
||||||
borderImageProperty.propHasBorderImageOutset = true;
|
borderImageProperty.propHasBorderImageOutset = true;
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.InitBorderImageOutset();
|
borderImagePainter.InitBorderImageOutset();
|
||||||
|
|
||||||
auto borderImage = borderImagePainter.borderImageProperty_.GetBorderImageValue();
|
auto borderImage = borderImagePainter.borderImageProperty_.GetBorderImageValue();
|
||||||
BorderImageEdge imageLeft = borderImage->GetBorderImageEdge(DIRECTION_LEFT);
|
BorderImageEdge imageLeft = borderImage->GetBorderImageEdge(DIRECTION_LEFT);
|
||||||
BorderImageEdge imageTop = borderImage->GetBorderImageEdge(DIRECTION_RIGHT);
|
BorderImageEdge imageTop = borderImage->GetBorderImageEdge(DIRECTION_RIGHT);
|
||||||
BorderImageEdge imageRight = borderImage->GetBorderImageEdge(DIRECTION_TOP);
|
BorderImageEdge imageRight = borderImage->GetBorderImageEdge(DIRECTION_TOP);
|
||||||
BorderImageEdge imageBottom = borderImage->GetBorderImageEdge(DIRECTION_BOTTOM);
|
BorderImageEdge imageBottom = borderImage->GetBorderImageEdge(DIRECTION_BOTTOM);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.expected: the imageLeft.GetBorderImageOutset() is expected results.
|
* @tc.expected: the imageLeft.GetBorderImageOutset() is expected results.
|
||||||
* @tc.expected: the imageTop.GetBorderImageOutset() is expected results.
|
* @tc.expected: the imageTop.GetBorderImageOutset() is expected results.
|
||||||
*/
|
*/
|
||||||
EXPECT_EQ(imageLeft.GetBorderImageOutset(), DIMENSION_OUTSET);
|
EXPECT_EQ(imageLeft.GetBorderImageOutset(), DIMENSION_OUTSET);
|
||||||
EXPECT_EQ(imageTop.GetBorderImageOutset(), DIMENSION_OUTSET);
|
EXPECT_EQ(imageTop.GetBorderImageOutset(), DIMENSION_OUTSET);
|
||||||
EXPECT_EQ(imageRight.GetBorderImageOutset(), DIMENSION_OUTSET);
|
EXPECT_EQ(imageRight.GetBorderImageOutset(), DIMENSION_OUTSET);
|
||||||
EXPECT_EQ(imageBottom.GetBorderImageOutset(), DIMENSION_OUTSET);
|
EXPECT_EQ(imageBottom.GetBorderImageOutset(), DIMENSION_OUTSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter006
|
* @tc.name: BorderImagePainter006
|
||||||
@ -302,35 +304,35 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter006, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp = nullptr.
|
* @tc.steps: step1. push widthProp = nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp;
|
std::unique_ptr<NG::BorderWidthProperty> widthProp;
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImageProperty.propBorderImage is null.
|
* @tc.steps: step2. push borderImageProperty.propBorderImage is null.
|
||||||
* @tc.steps: step2. push propHasBorderImageWidth and propHasBorderImageOutset is true.
|
* @tc.steps: step2. push propHasBorderImageWidth and propHasBorderImageOutset is true.
|
||||||
* @tc.steps: step2. call InitBorderImageWidth and InitBorderImageOutset.
|
* @tc.steps: step2. call InitBorderImageWidth and InitBorderImageOutset.
|
||||||
*/
|
*/
|
||||||
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
||||||
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
borderImageProperty.propBorderImageSource = ImageSourceInfo(SRC_IMAGES);
|
||||||
borderImageProperty.propHasBorderImageWidth = true;
|
borderImageProperty.propHasBorderImageWidth = true;
|
||||||
borderImageProperty.propHasBorderImageOutset = true;
|
borderImageProperty.propHasBorderImageOutset = true;
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.InitBorderImageWidth();
|
borderImagePainter.InitBorderImageWidth();
|
||||||
borderImagePainter.InitBorderImageOutset();
|
borderImagePainter.InitBorderImageOutset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.expected: the borderImagePainter.borderCenterWidth_ is expected results.
|
* @tc.expected: the borderImagePainter.borderCenterWidth_ is expected results.
|
||||||
* @tc.expected: the borderImagePainter.imageCenterWidth_ is expected results.
|
* @tc.expected: the borderImagePainter.imageCenterWidth_ is expected results.
|
||||||
*/
|
*/
|
||||||
auto result = borderImagePainter.widthProp_;
|
auto result = borderImagePainter.widthProp_;
|
||||||
EXPECT_EQ(result.leftDimen, std::nullopt);
|
EXPECT_EQ(result.leftDimen, std::nullopt);
|
||||||
EXPECT_EQ(result.topDimen, std::nullopt);
|
EXPECT_EQ(result.topDimen, std::nullopt);
|
||||||
EXPECT_EQ(result.rightDimen, std::nullopt);
|
EXPECT_EQ(result.rightDimen, std::nullopt);
|
||||||
EXPECT_EQ(result.bottomDimen, std::nullopt);
|
EXPECT_EQ(result.bottomDimen, std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter007
|
* @tc.name: BorderImagePainter007
|
||||||
@ -343,31 +345,31 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter007, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp = nullptr.
|
* @tc.steps: step1. push widthProp = nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp;
|
std::unique_ptr<NG::BorderWidthProperty> widthProp;
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. call PaintBorderImage .
|
* @tc.steps: step2. call PaintBorderImage .
|
||||||
* @tc.expected: the borderImagePainter.imageWidth_ is 100.
|
* @tc.expected: the borderImagePainter.imageWidth_ is 100.
|
||||||
*/
|
*/
|
||||||
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
||||||
EXPECT_EQ(borderImagePainter.imageWidth_, 100);
|
EXPECT_EQ(borderImagePainter.imageWidth_, 100);
|
||||||
EXPECT_EQ(borderImagePainter.imageHeight_, 100);
|
EXPECT_EQ(borderImagePainter.imageHeight_, 100);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step3. push borderImageProperty.propBorderImage is default value.
|
* @tc.steps: step3. push borderImageProperty.propBorderImage is default value.
|
||||||
* @tc.steps: step3. push paintCornersOnly_ is true, call PaintBorderImage.
|
* @tc.steps: step3. push paintCornersOnly_ is true, call PaintBorderImage.
|
||||||
* @tc.expected: the borderImagePainter.hasWidthProp_ is false.
|
* @tc.expected: the borderImagePainter.hasWidthProp_ is false.
|
||||||
*/
|
*/
|
||||||
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
borderImageProperty.propBorderImage = AceType::MakeRefPtr<BorderImage>();
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.paintCornersOnly_ = true;
|
borderImagePainter.paintCornersOnly_ = true;
|
||||||
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
||||||
EXPECT_EQ(borderImagePainter.hasWidthProp_, false);
|
EXPECT_EQ(borderImagePainter.hasWidthProp_, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter008
|
* @tc.name: BorderImagePainter008
|
||||||
@ -380,26 +382,26 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter008, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step3. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
* @tc.steps: step3. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
||||||
* @tc.steps: step3. push paintCornersOnly_ is true, call PaintBorderImage.
|
* @tc.steps: step3. push paintCornersOnly_ is true, call PaintBorderImage.
|
||||||
* @tc.expected: Return expected results.
|
* @tc.expected: Return expected results.
|
||||||
*/
|
*/
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
|
|
||||||
for (int32_t id = 0; id < 5; id++) {
|
for (int32_t id = 0; id < 5; id++) {
|
||||||
auto state = static_cast<BorderImageRepeat>(id);
|
auto state = static_cast<BorderImageRepeat>(id);
|
||||||
testBorderImage->repeatMode_ = state;
|
testBorderImage->repeatMode_ = state;
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImage(OFFSET_F, canvas);
|
||||||
|
|
||||||
switch (borderImagePainter.borderImageProperty_.GetBorderImageValue()->GetRepeatMode()) {
|
switch (borderImagePainter.borderImageProperty_.GetBorderImageValue()->GetRepeatMode()) {
|
||||||
case BorderImageRepeat::STRETCH:
|
case BorderImageRepeat::STRETCH:
|
||||||
case BorderImageRepeat::SPACE:
|
case BorderImageRepeat::SPACE:
|
||||||
@ -411,8 +413,8 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter008, TestSize.Level1)
|
|||||||
default:
|
default:
|
||||||
LOGE("Unsupported Border Image repeat mode");
|
LOGE("Unsupported Border Image repeat mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter009
|
* @tc.name: BorderImagePainter009
|
||||||
@ -425,37 +427,37 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter009, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
* @tc.steps: step2. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
||||||
* @tc.steps: step2. push borderCenterWidth_ is FIVE, imageCenterWidth_ is ONE.
|
* @tc.steps: step2. push borderCenterWidth_ is FIVE, imageCenterWidth_ is ONE.
|
||||||
*/
|
*/
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.borderCenterWidth_ = FIVE;
|
borderImagePainter.borderCenterWidth_ = FIVE;
|
||||||
borderImagePainter.borderCenterHeight_ = FIVE;
|
borderImagePainter.borderCenterHeight_ = FIVE;
|
||||||
borderImagePainter.imageCenterWidth_ = ONE;
|
borderImagePainter.imageCenterWidth_ = ONE;
|
||||||
borderImagePainter.imageCenterHeight_ = ONE;
|
borderImagePainter.imageCenterHeight_ = ONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step3. call PaintBorderImageRound PaintBorderImageSpace and PaintBorderImageRepeat.
|
* @tc.steps: step3. call PaintBorderImageRound PaintBorderImageSpace and PaintBorderImageRepeat.
|
||||||
* @tc.expected: expected the widthCount and heightCount is 0.
|
* @tc.expected: expected the widthCount and heightCount is 0.
|
||||||
*/
|
*/
|
||||||
borderImagePainter.PaintBorderImageRound(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImageRound(OFFSET_F, canvas);
|
||||||
borderImagePainter.PaintBorderImageSpace(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImageSpace(OFFSET_F, canvas);
|
||||||
borderImagePainter.PaintBorderImageRepeat(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImageRepeat(OFFSET_F, canvas);
|
||||||
auto widthCount = fmod(borderImagePainter.borderCenterWidth_, borderImagePainter.imageCenterWidth_);
|
auto widthCount = fmod(borderImagePainter.borderCenterWidth_, borderImagePainter.imageCenterWidth_);
|
||||||
auto heightCount = fmod(borderImagePainter.borderCenterHeight_, borderImagePainter.imageCenterHeight_);
|
auto heightCount = fmod(borderImagePainter.borderCenterHeight_, borderImagePainter.imageCenterHeight_);
|
||||||
EXPECT_EQ(widthCount, 0);
|
EXPECT_EQ(widthCount, 0);
|
||||||
EXPECT_EQ(heightCount, 0);
|
EXPECT_EQ(heightCount, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter010
|
* @tc.name: BorderImagePainter010
|
||||||
@ -468,35 +470,35 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter010, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
* @tc.steps: step2. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
||||||
* @tc.steps: step2. push borderCenterWidth_ is TWO, imageCenterWidth_ is FIVE.
|
* @tc.steps: step2. push borderCenterWidth_ is TWO, imageCenterWidth_ is FIVE.
|
||||||
*/
|
*/
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.borderCenterWidth_ = TWO;
|
borderImagePainter.borderCenterWidth_ = TWO;
|
||||||
borderImagePainter.borderCenterHeight_ = TWO;
|
borderImagePainter.borderCenterHeight_ = TWO;
|
||||||
borderImagePainter.imageCenterWidth_ = FIVE;
|
borderImagePainter.imageCenterWidth_ = FIVE;
|
||||||
borderImagePainter.imageCenterHeight_ = FIVE;
|
borderImagePainter.imageCenterHeight_ = FIVE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step3. call PaintBorderImageRound PaintBorderImageSpace and PaintBorderImageRepeat.
|
* @tc.steps: step3. call PaintBorderImageRound PaintBorderImageSpace and PaintBorderImageRepeat.
|
||||||
* @tc.expected: expected the widthCount and heightCount is 2.
|
* @tc.expected: expected the widthCount and heightCount is 2.
|
||||||
*/
|
*/
|
||||||
borderImagePainter.PaintBorderImageRepeat(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImageRepeat(OFFSET_F, canvas);
|
||||||
auto widthCount = fmod(borderImagePainter.borderCenterWidth_, borderImagePainter.imageCenterWidth_);
|
auto widthCount = fmod(borderImagePainter.borderCenterWidth_, borderImagePainter.imageCenterWidth_);
|
||||||
auto heightCount = fmod(borderImagePainter.borderCenterHeight_, borderImagePainter.imageCenterHeight_);
|
auto heightCount = fmod(borderImagePainter.borderCenterHeight_, borderImagePainter.imageCenterHeight_);
|
||||||
EXPECT_EQ(widthCount, 2);
|
EXPECT_EQ(widthCount, 2);
|
||||||
EXPECT_EQ(heightCount, 2);
|
EXPECT_EQ(heightCount, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: BorderImagePainter011
|
* @tc.name: BorderImagePainter011
|
||||||
@ -509,41 +511,41 @@ HWTEST_F(BorderImagePainterTestNg, BorderImagePainter011, TestSize.Level1)
|
|||||||
* @tc.steps: step1. push widthProp != nullptr.
|
* @tc.steps: step1. push widthProp != nullptr.
|
||||||
* @tc.steps: step1. Build a object borderImagePainter.
|
* @tc.steps: step1. Build a object borderImagePainter.
|
||||||
*/
|
*/
|
||||||
NG::BorderImageProperty borderImageProperty;
|
NG::BorderImageProperty borderImageProperty;
|
||||||
RSImage image;
|
RSImage image;
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
std::unique_ptr<NG::BorderWidthProperty> widthProp {std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST)};
|
std::unique_ptr<NG::BorderWidthProperty> widthProp { std::make_unique<NG::BorderWidthProperty>(BORDER_WIDTH_TEST) };
|
||||||
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
NG::BorderImagePainter borderImagePainter(borderImageProperty, widthProp, PAINTSIZE, image, DIPSCALE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step2. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
* @tc.steps: step2. push borderImagePainter.borderImageProperty_.GetBorderImageValue() is new value.
|
||||||
* @tc.steps: step2. push borderCenterWidth_ is minus, imageCenterWidth_ is TWO.
|
* @tc.steps: step2. push borderCenterWidth_ is minus, imageCenterWidth_ is TWO.
|
||||||
*/
|
*/
|
||||||
double minus = -1.0;
|
double minus = -1.0;
|
||||||
auto testBorderImage = MakeBorderImage();
|
auto testBorderImage = MakeBorderImage();
|
||||||
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
borderImageProperty.propBorderImage = std::move(testBorderImage);
|
||||||
|
|
||||||
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
borderImagePainter.borderImageProperty_ = std::move(borderImageProperty);
|
||||||
borderImagePainter.borderCenterWidth_ = minus;
|
borderImagePainter.borderCenterWidth_ = minus;
|
||||||
borderImagePainter.borderCenterHeight_ = minus;
|
borderImagePainter.borderCenterHeight_ = minus;
|
||||||
borderImagePainter.imageCenterWidth_ = TWO;
|
borderImagePainter.imageCenterWidth_ = TWO;
|
||||||
borderImagePainter.imageCenterHeight_ = TWO;
|
borderImagePainter.imageCenterHeight_ = TWO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step3. call PaintBorderImageRepeat.
|
* @tc.steps: step3. call PaintBorderImageRepeat.
|
||||||
* @tc.expected: expected the widthCount and heightCount is minus.
|
* @tc.expected: expected the widthCount and heightCount is minus.
|
||||||
*/
|
*/
|
||||||
borderImagePainter.PaintBorderImageRepeat(OFFSET_F, canvas);
|
borderImagePainter.PaintBorderImageRepeat(OFFSET_F, canvas);
|
||||||
auto widthCount = fmod(borderImagePainter.borderCenterWidth_, borderImagePainter.imageCenterWidth_);
|
auto widthCount = fmod(borderImagePainter.borderCenterWidth_, borderImagePainter.imageCenterWidth_);
|
||||||
auto heightCount = fmod(borderImagePainter.borderCenterHeight_, borderImagePainter.imageCenterHeight_);
|
auto heightCount = fmod(borderImagePainter.borderCenterHeight_, borderImagePainter.imageCenterHeight_);
|
||||||
EXPECT_EQ(widthCount, minus);
|
EXPECT_EQ(widthCount, minus);
|
||||||
EXPECT_EQ(heightCount, minus);
|
EXPECT_EQ(heightCount, minus);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.steps: step4. push value is minus, call ParseNegativeNumberToZeroOrCeil.
|
* @tc.steps: step4. push value is minus, call ParseNegativeNumberToZeroOrCeil.
|
||||||
* @tc.expected: expected the minus = ZERO_TEST.
|
* @tc.expected: expected the minus = ZERO_TEST.
|
||||||
*/
|
*/
|
||||||
borderImagePainter.ParseNegativeNumberToZeroOrCeil(minus);
|
borderImagePainter.ParseNegativeNumberToZeroOrCeil(minus);
|
||||||
EXPECT_EQ(minus, ZERO_TEST);
|
EXPECT_EQ(minus, ZERO_TEST);
|
||||||
}
|
}
|
||||||
} // namespace OHOS::Ace
|
} // namespace OHOS::Ace
|
||||||
|
@ -12,14 +12,16 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "base/utils/utils.h"
|
#include "base/utils/utils.h"
|
||||||
#define protected public
|
#define protected public
|
||||||
#define private public
|
#define private public
|
||||||
#include "core/components_ng/render/circle_painter.h"
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/pattern/shape/shape_paint_property.h"
|
#include "core/components_ng/pattern/shape/shape_paint_property.h"
|
||||||
|
#include "core/components_ng/render/circle_painter.h"
|
||||||
#include "core/components_ng/render/drawing.h"
|
#include "core/components_ng/render/drawing.h"
|
||||||
#include "core/components_ng/render/drawing_prop_convertor.h"
|
#include "core/components_ng/render/drawing_prop_convertor.h"
|
||||||
#include "core/components_ng/render/shape_painter.h"
|
#include "core/components_ng/render/shape_painter.h"
|
||||||
@ -32,20 +34,19 @@ using namespace testing::ext;
|
|||||||
|
|
||||||
namespace OHOS::Ace {
|
namespace OHOS::Ace {
|
||||||
namespace {
|
namespace {
|
||||||
Dimension test {0, DimensionUnit::PX};
|
Dimension test { 0, DimensionUnit::PX };
|
||||||
|
|
||||||
float radius = 1;
|
float radius = 1;
|
||||||
|
|
||||||
Testing::TestingCanvas testingCanvas;
|
Testing::MockCanvas testingCanvas;
|
||||||
Testing::TestingPen pen;
|
Testing::TestingPen pen;
|
||||||
|
|
||||||
const NG::OffsetF& DRAWOFFSET {1, 1};
|
const NG::OffsetF& DRAWOFFSET { 1, 1 };
|
||||||
|
|
||||||
NG::ShapePaintProperty shapePaintProperty;
|
NG::ShapePaintProperty shapePaintProperty;
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
class CirclePainterTestNg : public testing::Test {
|
class CirclePainterTestNg : public testing::Test {};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: CirclePainterTestNg001
|
* @tc.name: CirclePainterTestNg001
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
#define protected public
|
#define protected public
|
||||||
#define private public
|
#define private public
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
#include "core/components_ng/render/ellipse_painter.h"
|
|
||||||
|
|
||||||
#include "base/geometry/ng/rect_t.h"
|
#include "base/geometry/ng/rect_t.h"
|
||||||
#include "core/components_ng/render/canvas_image.h"
|
#include "core/components_ng/render/canvas_image.h"
|
||||||
#include "core/components_ng/render/drawing.h"
|
#include "core/components_ng/render/drawing.h"
|
||||||
|
#include "core/components_ng/render/ellipse_painter.h"
|
||||||
#include "core/components_ng/render/shape_painter.h"
|
#include "core/components_ng/render/shape_painter.h"
|
||||||
|
|
||||||
#undef private
|
#undef private
|
||||||
@ -35,9 +35,9 @@ using namespace testing::ext;
|
|||||||
|
|
||||||
namespace OHOS::Ace {
|
namespace OHOS::Ace {
|
||||||
namespace {
|
namespace {
|
||||||
const Dimension STROKE_WIDTH {0.0, DimensionUnit::PX};
|
const Dimension STROKE_WIDTH { 0.0, DimensionUnit::PX };
|
||||||
const NG::RectF TEST_RECT {10.0f, 20.0f, 15.0f, 15.0f};
|
const NG::RectF TEST_RECT { 10.0f, 20.0f, 15.0f, 15.0f };
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
class EllipsePainterTestNg : public testing::Test {};
|
class EllipsePainterTestNg : public testing::Test {};
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ HWTEST_F(EllipsePainterTestNg, EllipsePainterTestNg001, TestSize.Level1)
|
|||||||
/**
|
/**
|
||||||
* @tc.steps1: create canvas and shapePaintProperty object.
|
* @tc.steps1: create canvas and shapePaintProperty object.
|
||||||
*/
|
*/
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
NG::ShapePaintProperty shapePaintProperty;
|
NG::ShapePaintProperty shapePaintProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
#include "base/utils/utils.h"
|
#include "base/utils/utils.h"
|
||||||
#define protected public
|
#define protected public
|
||||||
#define private public
|
#define private public
|
||||||
|
#include "test/mock/core/render/mock_canvas_image.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/geometry/ng/point_t.h"
|
#include "base/geometry/ng/point_t.h"
|
||||||
#include "core/components/common/properties/paint_state.h"
|
#include "core/components/common/properties/paint_state.h"
|
||||||
#include "core/components_ng/pattern/image/image_paint_method.h"
|
#include "core/components_ng/pattern/image/image_paint_method.h"
|
||||||
@ -26,7 +29,6 @@
|
|||||||
#include "core/components_ng/render/canvas_image.h"
|
#include "core/components_ng/render/canvas_image.h"
|
||||||
#include "core/components_ng/render/drawing_prop_convertor.h"
|
#include "core/components_ng/render/drawing_prop_convertor.h"
|
||||||
#include "core/components_ng/render/image_painter.h"
|
#include "core/components_ng/render/image_painter.h"
|
||||||
#include "test/mock/core/render/mock_canvas_image.h"
|
|
||||||
#include "core/pipeline_ng/pipeline_context.h"
|
#include "core/pipeline_ng/pipeline_context.h"
|
||||||
|
|
||||||
#undef private
|
#undef private
|
||||||
@ -37,7 +39,7 @@ using namespace testing::ext;
|
|||||||
|
|
||||||
namespace OHOS::Ace {
|
namespace OHOS::Ace {
|
||||||
namespace {
|
namespace {
|
||||||
Testing::TestingCanvas testingCanvas;
|
Testing::MockCanvas testingCanvas;
|
||||||
|
|
||||||
const NG::OffsetF& OFFSETF { 1, 1 };
|
const NG::OffsetF& OFFSETF { 1, 1 };
|
||||||
const NG::SizeF& SIZE { 10, 10 };
|
const NG::SizeF& SIZE { 10, 10 };
|
||||||
|
@ -13,15 +13,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "base/utils/utils.h"
|
#include "base/utils/utils.h"
|
||||||
#define protected public
|
#define protected public
|
||||||
#define private public
|
#define private public
|
||||||
#include "core/components_ng/render/line_painter.h"
|
|
||||||
#include "core/components/common/properties/color.h"
|
#include "core/components/common/properties/color.h"
|
||||||
#include "core/components_ng/pattern/pattern.h"
|
#include "core/components_ng/pattern/pattern.h"
|
||||||
#include "core/components_ng/pattern/shape/line_paint_property.h"
|
#include "core/components_ng/pattern/shape/line_paint_property.h"
|
||||||
#include "core/components_ng/render/drawing_prop_convertor.h"
|
#include "core/components_ng/render/drawing_prop_convertor.h"
|
||||||
|
#include "core/components_ng/render/line_painter.h"
|
||||||
#include "core/components_ng/render/shape_painter.h"
|
#include "core/components_ng/render/shape_painter.h"
|
||||||
|
|
||||||
#undef private
|
#undef private
|
||||||
@ -34,11 +35,11 @@ namespace OHOS::Ace {
|
|||||||
namespace {
|
namespace {
|
||||||
const double START_VALUE = 10.0;
|
const double START_VALUE = 10.0;
|
||||||
const double END_VALUE = 30.0;
|
const double END_VALUE = 30.0;
|
||||||
const Dimension TEST {0.0, DimensionUnit::PX};
|
const Dimension TEST { 0.0, DimensionUnit::PX };
|
||||||
const NG::OffsetF OFFSET_TEST {1, 1};
|
const NG::OffsetF OFFSET_TEST { 1, 1 };
|
||||||
static constexpr NG::ShapePoint START_POINT = ShapePoint(10.0, 10.0);
|
static constexpr NG::ShapePoint START_POINT = ShapePoint(10.0, 10.0);
|
||||||
static constexpr NG::ShapePoint END_POINT = ShapePoint(30.0, 30.0);
|
static constexpr NG::ShapePoint END_POINT = ShapePoint(30.0, 30.0);
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
class LinePainterTestNg : public testing::Test {};
|
class LinePainterTestNg : public testing::Test {};
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ HWTEST_F(LinePainterTestNg, LinePainterTestNg001, TestSize.Level1)
|
|||||||
/**
|
/**
|
||||||
* @tc.steps1: create canvas pen and linePaintProperty object.
|
* @tc.steps1: create canvas pen and linePaintProperty object.
|
||||||
*/
|
*/
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
RSPen pen;
|
RSPen pen;
|
||||||
NG::LinePaintProperty linePaintProperty;
|
NG::LinePaintProperty linePaintProperty;
|
||||||
|
|
||||||
|
@ -17,12 +17,13 @@
|
|||||||
#include "base/utils/utils.h"
|
#include "base/utils/utils.h"
|
||||||
#define protected public
|
#define protected public
|
||||||
#define private public
|
#define private public
|
||||||
#include "core/components_ng/render/polygon_painter.h"
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
|
|
||||||
#include "core/components_ng/pattern/shape/polygon_paint_property.h"
|
#include "core/components_ng/pattern/shape/polygon_paint_property.h"
|
||||||
#include "core/components_ng/pattern/shape/shape_paint_property.h"
|
#include "core/components_ng/pattern/shape/shape_paint_property.h"
|
||||||
#include "core/components_ng/render/drawing.h"
|
#include "core/components_ng/render/drawing.h"
|
||||||
#include "core/components_ng/render/drawing_prop_convertor.h"
|
#include "core/components_ng/render/drawing_prop_convertor.h"
|
||||||
|
#include "core/components_ng/render/polygon_painter.h"
|
||||||
#include "core/components_ng/render/shape_painter.h"
|
#include "core/components_ng/render/shape_painter.h"
|
||||||
|
|
||||||
#undef private
|
#undef private
|
||||||
@ -33,12 +34,12 @@ using namespace testing::ext;
|
|||||||
|
|
||||||
namespace OHOS::Ace {
|
namespace OHOS::Ace {
|
||||||
namespace {
|
namespace {
|
||||||
const Dimension TEST {0.0, DimensionUnit::PX};
|
const Dimension TEST { 0.0, DimensionUnit::PX };
|
||||||
const std::pair<Dimension, Dimension> START_POINT = {10.0_vp, 10.0_vp};
|
const std::pair<Dimension, Dimension> START_POINT = { 10.0_vp, 10.0_vp };
|
||||||
const std::pair<Dimension, Dimension> END_POINT = {30.0_vp, 30.0_vp};
|
const std::pair<Dimension, Dimension> END_POINT = { 30.0_vp, 30.0_vp };
|
||||||
|
|
||||||
std::vector<ShapePoint> shape_Point;
|
std::vector<ShapePoint> shape_Point;
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
class PolygonPainterTestNg : public testing::Test {};
|
class PolygonPainterTestNg : public testing::Test {};
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ HWTEST_F(PolygonPainterTestNg, PolygonPainterTestNg001, TestSize.Level1)
|
|||||||
/**
|
/**
|
||||||
* @tc.steps1: create canvas and polygonPaintProperty object.
|
* @tc.steps1: create canvas and polygonPaintProperty object.
|
||||||
*/
|
*/
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
NG::PolygonPaintProperty polygonPaintProperty;
|
NG::PolygonPaintProperty polygonPaintProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +83,7 @@ HWTEST_F(PolygonPainterTestNg, PolygonPainterTestNg002, TestSize.Level1)
|
|||||||
/**
|
/**
|
||||||
* @tc.steps1: create canvas and polygonPaintProperty object.
|
* @tc.steps1: create canvas and polygonPaintProperty object.
|
||||||
*/
|
*/
|
||||||
RSCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
NG::PolygonPaintProperty polygonPaintProperty;
|
NG::PolygonPaintProperty polygonPaintProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
# Copyright (c) 2022-2024 Huawei Device Co., Ltd.
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# You may obtain a copy of the License at
|
||||||
@ -30,6 +30,7 @@ config("config_svg_parse_test") {
|
|||||||
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/include",
|
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/include",
|
||||||
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src",
|
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src",
|
||||||
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src/drawing/engine_adapter",
|
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src/drawing/engine_adapter",
|
||||||
|
"//foundation/graphic/graphic_2d/rosen/modules/render_service_base/include",
|
||||||
"//third_party/skia",
|
"//third_party/skia",
|
||||||
"$ace_root",
|
"$ace_root",
|
||||||
"$ace_root/frameworks",
|
"$ace_root/frameworks",
|
||||||
@ -44,30 +45,107 @@ config("config_svg_parse_test") {
|
|||||||
|
|
||||||
ohos_unittest("parse_test_ng") {
|
ohos_unittest("parse_test_ng") {
|
||||||
module_out_path = svg_test_output_path
|
module_out_path = svg_test_output_path
|
||||||
|
sources = [
|
||||||
sources = [ "parse_test_ng.cpp" ]
|
"$ace_root/frameworks/bridge/common/dom/dom_type.cpp",
|
||||||
|
"$ace_root/frameworks/bridge/common/utils/utils.cpp",
|
||||||
|
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
|
||||||
|
"$ace_root/frameworks/core/animation/svg_animate.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/common/declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/common/declaration_constants.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/common/event.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_animate_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_base_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_circle_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_ellipse_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_colormatrix_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_component_transfer_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_composite_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_flood_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_func_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_gaussianblur_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_merge_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_offset_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_filter_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_gradient_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_line_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_mask_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_path_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_pattern_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_polygon_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_rect_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_stop_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_text_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_text_path_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/svg/svg_transform.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_animation.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_circle.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_clip_path.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_ellipse.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_color_matrix.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_composite.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_gaussian_blur.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_offset.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_filter.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_g.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_gradient.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_graphic.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_line.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_mask.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_node.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_path.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_pattern.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_polygon.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_rect.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_stop.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_style.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_svg.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_use.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/svg_context.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/svg_dom.cpp",
|
||||||
|
"$ace_root/test/mock/core/svg/mock_image_painter_utils.cpp",
|
||||||
|
"$ace_root/test/mock/core/svg/mock_rosen_svg_painter.cpp",
|
||||||
|
"$ace_root/test/mock/core/svg/mock_shared_transition_effect.cpp",
|
||||||
|
"parse_test_ng.cpp",
|
||||||
|
]
|
||||||
|
defines = [ "USE_ROSEN_DRAWING" ]
|
||||||
if (ace_use_rosen_drawing) {
|
if (ace_use_rosen_drawing) {
|
||||||
defines = [
|
defines += [
|
||||||
"ACE_ENABLE_GPU",
|
"ACE_ENABLE_GPU",
|
||||||
"NEW_SKIA",
|
"NEW_SKIA",
|
||||||
]
|
]
|
||||||
include_dirs = [ "//third_party/skia" ]
|
include_dirs = [ "//third_party/skia" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configs = [
|
||||||
|
":config_svg_parse_test",
|
||||||
|
"$ace_root/test/unittest:ace_unittest_config",
|
||||||
|
]
|
||||||
|
|
||||||
|
external_deps = [
|
||||||
|
"eventhandler:libeventhandler",
|
||||||
|
"graphic_2d:librender_service_base",
|
||||||
|
"graphic_2d:librender_service_client",
|
||||||
|
"graphic_2d:rosen_text",
|
||||||
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"$ace_root/build:ace_ohos_unittest_base",
|
"$ace_root/test/unittest:ace_base",
|
||||||
"$ace_root/frameworks/core/components_ng/base:ace_core_components_base_ng_ohos",
|
"$ace_root/test/unittest:ace_components_base",
|
||||||
|
"$ace_root/test/unittest:ace_components_mock",
|
||||||
|
"$ace_root/test/unittest:ace_components_render",
|
||||||
|
"$ace_root/test/unittest:ace_core_animation",
|
||||||
|
"$ace_root/test/unittest:ace_core_extra",
|
||||||
|
"$skia_root_new:skia_ohos",
|
||||||
|
"//third_party/bounds_checking_function:libsec_static",
|
||||||
|
"//third_party/googletest:gmock",
|
||||||
"//third_party/googletest:gtest_main",
|
"//third_party/googletest:gtest_main",
|
||||||
]
|
]
|
||||||
|
|
||||||
configs = [
|
|
||||||
":config_svg_parse_test",
|
|
||||||
"$ace_root:ace_config",
|
|
||||||
]
|
|
||||||
|
|
||||||
if (ability_runtime_graphics) {
|
if (ability_runtime_graphics) {
|
||||||
external_deps = [
|
external_deps += [
|
||||||
"ability_runtime:runtime",
|
"ability_runtime:runtime",
|
||||||
"image_framework:image_native",
|
"image_framework:image_native",
|
||||||
"window_manager:libdm",
|
"window_manager:libdm",
|
||||||
@ -79,25 +157,96 @@ ohos_unittest("svg_dom_test_ng") {
|
|||||||
module_out_path = svg_test_output_path
|
module_out_path = svg_test_output_path
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"$ace_root/frameworks/core/common/container_scope.cpp",
|
"$ace_root/frameworks/bridge/common/dom/dom_type.cpp",
|
||||||
"$ace_root/frameworks/core/components_ng/render/adapter/image_painter_utils.cpp",
|
"$ace_root/frameworks/bridge/common/utils/utils.cpp",
|
||||||
|
"$ace_root/frameworks/bridge/js_frontend/engine/common/js_constants.cpp",
|
||||||
|
"$ace_root/frameworks/core/animation/svg_animate.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/common/declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/common/declaration_constants.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/common/event.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_animate_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_base_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_circle_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_ellipse_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_colormatrix_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_component_transfer_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_composite_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_flood_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_func_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_gaussianblur_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_merge_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_fe_offset_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_filter_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_gradient_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_line_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_mask_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_path_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_pattern_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_polygon_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_rect_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_stop_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_text_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/declaration/svg/svg_text_path_declaration.cpp",
|
||||||
|
"$ace_root/frameworks/core/components/svg/svg_transform.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_animation.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_circle.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_clip_path.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_ellipse.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_color_matrix.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_composite.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_gaussian_blur.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_fe_offset.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_filter.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_g.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_gradient.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_graphic.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_line.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_mask.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_node.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_path.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_pattern.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_polygon.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_rect.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_stop.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_style.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_svg.cpp",
|
||||||
|
"$ace_root/frameworks/core/components_ng/svg/parse/svg_use.cpp",
|
||||||
"$ace_root/frameworks/core/components_ng/svg/svg_context.cpp",
|
"$ace_root/frameworks/core/components_ng/svg/svg_context.cpp",
|
||||||
"$ace_root/frameworks/core/components_ng/svg/svg_dom.cpp",
|
"$ace_root/frameworks/core/components_ng/svg/svg_dom.cpp",
|
||||||
"$ace_root/test/mock/core/animation/mock_animator.cpp",
|
"$ace_root/test/mock/core/svg/mock_image_painter_utils.cpp",
|
||||||
|
"$ace_root/test/mock/core/svg/mock_rosen_svg_painter.cpp",
|
||||||
|
"$ace_root/test/mock/core/svg/mock_shared_transition_effect.cpp",
|
||||||
"svg_dom_test_ng.cpp",
|
"svg_dom_test_ng.cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
defines = [ "USE_ROSEN_DRAWING" ]
|
||||||
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
|
|
||||||
"$ace_root/test/unittest:ace_unittest_log",
|
|
||||||
"$ace_root/test/unittest:ace_unittest_trace",
|
|
||||||
"$cjson_root:cjson_static",
|
|
||||||
"//third_party/googletest:gmock_main",
|
|
||||||
]
|
|
||||||
|
|
||||||
configs = [
|
configs = [
|
||||||
"$ace_root/test/unittest:ace_unittest_config",
|
|
||||||
":config_svg_parse_test",
|
":config_svg_parse_test",
|
||||||
|
"$ace_root/test/unittest:ace_unittest_config",
|
||||||
|
]
|
||||||
|
|
||||||
|
external_deps = [
|
||||||
|
"eventhandler:libeventhandler",
|
||||||
|
"graphic_2d:librender_service_base",
|
||||||
|
"graphic_2d:librender_service_client",
|
||||||
|
"graphic_2d:rosen_text",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"$ace_root/test/unittest:ace_base",
|
||||||
|
"$ace_root/test/unittest:ace_components_base",
|
||||||
|
"$ace_root/test/unittest:ace_components_mock",
|
||||||
|
"$ace_root/test/unittest:ace_components_render",
|
||||||
|
"$ace_root/test/unittest:ace_core_animation",
|
||||||
|
"$ace_root/test/unittest:ace_core_extra",
|
||||||
|
"$skia_root_new:skia_ohos",
|
||||||
|
"//third_party/bounds_checking_function:libsec_static",
|
||||||
|
"//third_party/googletest:gmock",
|
||||||
|
"//third_party/googletest:gtest_main",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#define private public
|
#define private public
|
||||||
#define protected public
|
#define protected public
|
||||||
|
|
||||||
|
#include "include/core/SkStream.h"
|
||||||
|
|
||||||
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
#include "base/memory/ace_type.h"
|
#include "base/memory/ace_type.h"
|
||||||
#include "core/components/common/layout/constants.h"
|
#include "core/components/common/layout/constants.h"
|
||||||
#include "core/components/common/properties/color.h"
|
#include "core/components/common/properties/color.h"
|
||||||
@ -65,7 +68,6 @@
|
|||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace testing::ext;
|
using namespace testing::ext;
|
||||||
|
|
||||||
namespace OHOS::Ace::NG {
|
namespace OHOS::Ace::NG {
|
||||||
namespace {
|
namespace {
|
||||||
const std::string CIRCLE_SVG_LABEL =
|
const std::string CIRCLE_SVG_LABEL =
|
||||||
@ -382,7 +384,7 @@ HWTEST_F(ParseTestNg, ParseCircleTest001, TestSize.Level1)
|
|||||||
EXPECT_FLOAT_EQ(circleDeclaration->GetCx().ConvertToPx(), Cx);
|
EXPECT_FLOAT_EQ(circleDeclaration->GetCx().ConvertToPx(), Cx);
|
||||||
EXPECT_FLOAT_EQ(circleDeclaration->GetCy().ConvertToPx(), Cy);
|
EXPECT_FLOAT_EQ(circleDeclaration->GetCy().ConvertToPx(), Cy);
|
||||||
EXPECT_FLOAT_EQ(circleDeclaration->GetR().ConvertToPx(), R);
|
EXPECT_FLOAT_EQ(circleDeclaration->GetR().ConvertToPx(), R);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -427,7 +429,7 @@ HWTEST_F(ParseTestNg, ParseClipPathTest001, TestSize.Level1)
|
|||||||
auto svgClipPath = AceType::DynamicCast<SvgClipPath>(svgDefs->children_.at(0));
|
auto svgClipPath = AceType::DynamicCast<SvgClipPath>(svgDefs->children_.at(0));
|
||||||
EXPECT_NE(svgClipPath, nullptr);
|
EXPECT_NE(svgClipPath, nullptr);
|
||||||
EXPECT_STREQ(svgClipPath->nodeId_.c_str(), ID.c_str());
|
EXPECT_STREQ(svgClipPath->nodeId_.c_str(), ID.c_str());
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -476,7 +478,7 @@ HWTEST_F(ParseTestNg, ParseUseTest001, TestSize.Level1)
|
|||||||
EXPECT_EQ(stroke.HasStroke(), true);
|
EXPECT_EQ(stroke.HasStroke(), true);
|
||||||
EXPECT_STREQ(stroke.GetColor().ColorToString().c_str(), Color(STROKE).ColorToString().c_str());
|
EXPECT_STREQ(stroke.GetColor().ColorToString().c_str(), Color(STROKE).ColorToString().c_str());
|
||||||
EXPECT_STREQ(svgUseDeclaration->GetHref().c_str(), HREF.c_str());
|
EXPECT_STREQ(svgUseDeclaration->GetHref().c_str(), HREF.c_str());
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -507,7 +509,7 @@ HWTEST_F(ParseTestNg, ParseStyleTest001, TestSize.Level1)
|
|||||||
auto svgStyle = AceType::DynamicCast<SvgStyle>(svg->children_.at(0));
|
auto svgStyle = AceType::DynamicCast<SvgStyle>(svg->children_.at(0));
|
||||||
EXPECT_NE(svgStyle, nullptr);
|
EXPECT_NE(svgStyle, nullptr);
|
||||||
// todo parse style attr
|
// todo parse style attr
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
||||||
@ -538,7 +540,7 @@ HWTEST_F(ParseTestNg, ParseStopTest001, TestSize.Level1)
|
|||||||
auto gradientColor = svgStopDeclaration->GetGradientColor();
|
auto gradientColor = svgStopDeclaration->GetGradientColor();
|
||||||
EXPECT_FLOAT_EQ(gradientColor.GetOpacity(), STOP_OPACITY);
|
EXPECT_FLOAT_EQ(gradientColor.GetOpacity(), STOP_OPACITY);
|
||||||
EXPECT_STREQ(gradientColor.GetColor().ColorToString().c_str(), Color::FromRGB(255, 255, 0).ColorToString().c_str());
|
EXPECT_STREQ(gradientColor.GetColor().ColorToString().c_str(), Color::FromRGB(255, 255, 0).ColorToString().c_str());
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -553,7 +555,7 @@ HWTEST_F(ParseTestNg, ParseStopTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseRectTest001, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseRectTest001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseRect(RECT_SVG_LABEL);
|
auto svgDom = ParseRect(RECT_SVG_LABEL);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -568,7 +570,7 @@ HWTEST_F(ParseTestNg, ParseRectTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseRectTest002, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseRectTest002, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseRect(RECT_SVG_LABEL);
|
auto svgDom = ParseRect(RECT_SVG_LABEL);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->svgContext_ = nullptr;
|
svgDom->svgContext_ = nullptr;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
@ -584,7 +586,7 @@ HWTEST_F(ParseTestNg, ParseRectTest002, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseRectTest003, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseRectTest003, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseRect(RECT_SVG_LABEL2);
|
auto svgDom = ParseRect(RECT_SVG_LABEL2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->viewBox_.IsValid(), false);
|
EXPECT_EQ(svgDom->viewBox_.IsValid(), false);
|
||||||
@ -598,7 +600,7 @@ HWTEST_F(ParseTestNg, ParseRectTest003, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePolygonTest001, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePolygonTest001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = parsePolygon(POLYGON_SVG_LABEL1);
|
auto svgDom = parsePolygon(POLYGON_SVG_LABEL1);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -613,7 +615,7 @@ HWTEST_F(ParseTestNg, ParsePolygonTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePolygonTest002, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePolygonTest002, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = parsePolygon(POLYGON_SVG_LABEL2);
|
auto svgDom = parsePolygon(POLYGON_SVG_LABEL2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -644,7 +646,7 @@ HWTEST_F(ParseTestNg, ParsePatternTest001, TestSize.Level1)
|
|||||||
EXPECT_FLOAT_EQ(patternDeclaration->GetViewBox().GetOffset().GetY(), PATTERN_VIEWBOX_Y);
|
EXPECT_FLOAT_EQ(patternDeclaration->GetViewBox().GetOffset().GetY(), PATTERN_VIEWBOX_Y);
|
||||||
EXPECT_FLOAT_EQ(patternDeclaration->GetViewBox().GetSize().Width(), PATTERN_VIEWBOX_WIDTH);
|
EXPECT_FLOAT_EQ(patternDeclaration->GetViewBox().GetSize().Width(), PATTERN_VIEWBOX_WIDTH);
|
||||||
EXPECT_FLOAT_EQ(patternDeclaration->GetViewBox().GetSize().Height(), PATTERN_VIEWBOX_HEIGHT);
|
EXPECT_FLOAT_EQ(patternDeclaration->GetViewBox().GetSize().Height(), PATTERN_VIEWBOX_HEIGHT);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
||||||
@ -668,7 +670,7 @@ HWTEST_F(ParseTestNg, ParsePatternTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePathTest001, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePathTest001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParsePath(PATH_SVG_LABEL1);
|
auto svgDom = ParsePath(PATH_SVG_LABEL1);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size());
|
svgDom->FitViewPort(Size());
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -684,7 +686,7 @@ HWTEST_F(ParseTestNg, ParsePathTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePathTest002, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePathTest002, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParsePath(PATH_SVG_LABEL2);
|
auto svgDom = ParsePath(PATH_SVG_LABEL2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
||||||
@ -700,7 +702,7 @@ HWTEST_F(ParseTestNg, ParsePathTest002, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePathTest003, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePathTest003, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParsePath(PATH_SVG_LABEL4);
|
auto svgDom = ParsePath(PATH_SVG_LABEL4);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -716,7 +718,7 @@ HWTEST_F(ParseTestNg, ParsePathTest003, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePathTest004, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePathTest004, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParsePath(PATH_SVG_LABEL3);
|
auto svgDom = ParsePath(PATH_SVG_LABEL3);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size());
|
svgDom->FitViewPort(Size());
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
||||||
@ -736,7 +738,7 @@ HWTEST_F(ParseTestNg, ParsePathTest004, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParsePathTest005, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParsePathTest005, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParsePath(PATH_SVG_LABEL5);
|
auto svgDom = ParsePath(PATH_SVG_LABEL5);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size());
|
svgDom->FitViewPort(Size());
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -762,16 +764,13 @@ HWTEST_F(ParseTestNg, ParseMaskTest001, TestSize.Level1)
|
|||||||
auto svgMask = AceType::DynamicCast<SvgMask>(svgGChild->children_.at(INDEX_ZEARO));
|
auto svgMask = AceType::DynamicCast<SvgMask>(svgGChild->children_.at(INDEX_ZEARO));
|
||||||
EXPECT_NE(svgMask, nullptr);
|
EXPECT_NE(svgMask, nullptr);
|
||||||
EXPECT_STREQ(svgMask->nodeId_.c_str(), MASK_ID.c_str());
|
EXPECT_STREQ(svgMask->nodeId_.c_str(), MASK_ID.c_str());
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
// test canvas layer save and restore
|
// test canvas layer save and restore
|
||||||
// all saved layers need to be restored
|
// all saved layers need to be restored
|
||||||
auto skCanvas = rSCanvas.GetImpl<RSSkCanvas>()->ExportSkCanvas();
|
|
||||||
auto layerCount = skCanvas->getSaveCount();
|
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
EXPECT_EQ(svgDom->viewBox_.IsValid(), true);
|
EXPECT_EQ(svgDom->viewBox_.IsValid(), true);
|
||||||
EXPECT_EQ(skCanvas->getSaveCount(), layerCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -793,7 +792,7 @@ HWTEST_F(ParseTestNg, ParseLineTest001, TestSize.Level1)
|
|||||||
EXPECT_FLOAT_EQ(lineDeclaration->GetY1().ConvertToPx(), Y1);
|
EXPECT_FLOAT_EQ(lineDeclaration->GetY1().ConvertToPx(), Y1);
|
||||||
EXPECT_FLOAT_EQ(lineDeclaration->GetX2().ConvertToPx(), X2);
|
EXPECT_FLOAT_EQ(lineDeclaration->GetX2().ConvertToPx(), X2);
|
||||||
EXPECT_FLOAT_EQ(lineDeclaration->GetY2().ConvertToPx(), Y2);
|
EXPECT_FLOAT_EQ(lineDeclaration->GetY2().ConvertToPx(), Y2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -828,7 +827,7 @@ HWTEST_F(ParseTestNg, ParseLinearGradientTest001, TestSize.Level1)
|
|||||||
EXPECT_FLOAT_EQ(gradient.GetLinearGradient().y1->ConvertToPx(), ZERO);
|
EXPECT_FLOAT_EQ(gradient.GetLinearGradient().y1->ConvertToPx(), ZERO);
|
||||||
EXPECT_EQ(gradient.GetLinearGradient().y2.has_value(), true);
|
EXPECT_EQ(gradient.GetLinearGradient().y2.has_value(), true);
|
||||||
EXPECT_FLOAT_EQ(gradient.GetLinearGradient().y2->ConvertToPx(), ZERO);
|
EXPECT_FLOAT_EQ(gradient.GetLinearGradient().y2->ConvertToPx(), ZERO);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -870,7 +869,7 @@ HWTEST_F(ParseTestNg, ParseRadialGradientTest001, TestSize.Level1)
|
|||||||
EXPECT_FLOAT_EQ(radialGradient.radialVerticalSize->ConvertToPx(), ZERO);
|
EXPECT_FLOAT_EQ(radialGradient.radialVerticalSize->ConvertToPx(), ZERO);
|
||||||
EXPECT_EQ(radialGradient.radialShape.has_value(), false);
|
EXPECT_EQ(radialGradient.radialShape.has_value(), false);
|
||||||
EXPECT_EQ(radialGradient.radialSizeType.has_value(), false);
|
EXPECT_EQ(radialGradient.radialSizeType.has_value(), false);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -891,7 +890,7 @@ HWTEST_F(ParseTestNg, ParseGTest001, TestSize.Level1)
|
|||||||
EXPECT_GT(svg->children_.size(), 0);
|
EXPECT_GT(svg->children_.size(), 0);
|
||||||
auto g = AceType::DynamicCast<SvgG>(svg->children_.at(0));
|
auto g = AceType::DynamicCast<SvgG>(svg->children_.at(0));
|
||||||
ASSERT_STREQ(g->nodeId_.c_str(), G_ID.c_str());
|
ASSERT_STREQ(g->nodeId_.c_str(), G_ID.c_str());
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -918,7 +917,7 @@ HWTEST_F(ParseTestNg, ParseFilterTest001, TestSize.Level1)
|
|||||||
EXPECT_FLOAT_EQ(filterDeclaration->GetWidth().ConvertToPx(), FILTER_WIDTH);
|
EXPECT_FLOAT_EQ(filterDeclaration->GetWidth().ConvertToPx(), FILTER_WIDTH);
|
||||||
EXPECT_FLOAT_EQ(filterDeclaration->GetX().ConvertToPx(), ZERO);
|
EXPECT_FLOAT_EQ(filterDeclaration->GetX().ConvertToPx(), ZERO);
|
||||||
EXPECT_FLOAT_EQ(filterDeclaration->GetY().ConvertToPx(), ZERO);
|
EXPECT_FLOAT_EQ(filterDeclaration->GetY().ConvertToPx(), ZERO);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -933,7 +932,7 @@ HWTEST_F(ParseTestNg, ParseFilterTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseFeGaussianblurTest001, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseFeGaussianblurTest001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseFeGaussianblur(FEGAUSS_SVG_LABEL);
|
auto svgDom = ParseFeGaussianblur(FEGAUSS_SVG_LABEL);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -948,7 +947,7 @@ HWTEST_F(ParseTestNg, ParseFeGaussianblurTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseFeGaussianblurTest002, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseFeGaussianblurTest002, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseFeGaussianblur(FEGAUSS_SVG_LABEL2);
|
auto svgDom = ParseFeGaussianblur(FEGAUSS_SVG_LABEL2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), false);
|
||||||
@ -973,7 +972,7 @@ HWTEST_F(ParseTestNg, ParseFeCompositeTest001, TestSize.Level1)
|
|||||||
EXPECT_NE(svgFeComposite, nullptr);
|
EXPECT_NE(svgFeComposite, nullptr);
|
||||||
auto feCompositsDeclaration = AceType::DynamicCast<SvgFeCompositeDeclaration>(svgFeComposite->declaration_);
|
auto feCompositsDeclaration = AceType::DynamicCast<SvgFeCompositeDeclaration>(svgFeComposite->declaration_);
|
||||||
EXPECT_NE(feCompositsDeclaration, nullptr);
|
EXPECT_NE(feCompositsDeclaration, nullptr);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -1048,7 +1047,7 @@ HWTEST_F(ParseTestNg, ParseFeColorMatrixTest001, TestSize.Level1)
|
|||||||
EXPECT_NE(feColorDeclaration, nullptr);
|
EXPECT_NE(feColorDeclaration, nullptr);
|
||||||
EXPECT_STREQ(feColorDeclaration->GetType().c_str(), TYPE.c_str());
|
EXPECT_STREQ(feColorDeclaration->GetType().c_str(), TYPE.c_str());
|
||||||
EXPECT_STREQ(feColorDeclaration->GetValues().c_str(), VALUE.c_str());
|
EXPECT_STREQ(feColorDeclaration->GetValues().c_str(), VALUE.c_str());
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -1063,7 +1062,7 @@ HWTEST_F(ParseTestNg, ParseFeColorMatrixTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseEllipseTest001, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseEllipseTest001, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseEllipse(ELLIPSE_SVG_LABEL1);
|
auto svgDom = ParseEllipse(ELLIPSE_SVG_LABEL1);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -1078,7 +1077,7 @@ HWTEST_F(ParseTestNg, ParseEllipseTest001, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseEllipseTest002, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseEllipseTest002, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseEllipse(ELLIPSE_SVG_LABEL2);
|
auto svgDom = ParseEllipse(ELLIPSE_SVG_LABEL2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgDom->root_->Draw(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -1093,7 +1092,7 @@ HWTEST_F(ParseTestNg, ParseEllipseTest002, TestSize.Level1)
|
|||||||
HWTEST_F(ParseTestNg, ParseEllipseTest003, TestSize.Level1)
|
HWTEST_F(ParseTestNg, ParseEllipseTest003, TestSize.Level1)
|
||||||
{
|
{
|
||||||
auto svgDom = ParseEllipse(ELLIPSE_SVG_LABEL2);
|
auto svgDom = ParseEllipse(ELLIPSE_SVG_LABEL2);
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->root_ = nullptr;
|
svgDom->root_ = nullptr;
|
||||||
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
svgDom->FitViewPort(Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT));
|
||||||
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
EXPECT_EQ(svgDom->svgSize_.IsValid(), true);
|
||||||
@ -1338,7 +1337,7 @@ HWTEST_F(ParseTestNg, ParseNodeTest002, TestSize.Level1)
|
|||||||
svgDom->root_->svgContext_.Upgrade()->Push("href", SvgGradient::CreateLinearGradient());
|
svgDom->root_->svgContext_.Upgrade()->Push("href", SvgGradient::CreateLinearGradient());
|
||||||
svgDom->root_->InitStyle(nullptr);
|
svgDom->root_->InitStyle(nullptr);
|
||||||
EXPECT_EQ(svgDom->root_->declaration_->GetHref(), "href");
|
EXPECT_EQ(svgDom->root_->declaration_->GetHref(), "href");
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgDom->root_->hrefRender_ = false;
|
svgDom->root_->hrefRender_ = false;
|
||||||
|
|
||||||
// 1 = SmoothEdge
|
// 1 = SmoothEdge
|
||||||
@ -1545,7 +1544,7 @@ HWTEST_F(ParseTestNg, ParseNodeTest007, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
RefPtr<SvgNode> ptr;
|
RefPtr<SvgNode> ptr;
|
||||||
svgAnimation->children_ = { ptr, svgAnimation };
|
svgAnimation->children_ = { ptr, svgAnimation };
|
||||||
RSCanvas rSCanvas;
|
Testing::MockCanvas rSCanvas;
|
||||||
svgAnimation->OnDrawTraversed(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgAnimation->OnDrawTraversed(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
svgAnimation->InitNoneFlag();
|
svgAnimation->InitNoneFlag();
|
||||||
svgAnimation->OnDrawTraversed(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
svgAnimation->OnDrawTraversed(rSCanvas, Size(IMAGE_COMPONENT_WIDTH, IMAGE_COMPONENT_HEIGHT), Color::BLACK);
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include "test/mock/core/rosen/mock_canvas.h"
|
#include "test/mock/core/rosen/mock_canvas.h"
|
||||||
#include "test/mock/core/rosen/testing_rect.h"
|
#include "test/mock/core/rosen/testing_rect.h"
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ HWTEST_F(SvgDomTestNg, SvgDom001, TestSize.Level1)
|
|||||||
Testing::MockCanvas canvas;
|
Testing::MockCanvas canvas;
|
||||||
float layoutScale = LAYOUT.Width() / SVG_SIZE.Width();
|
float layoutScale = LAYOUT.Width() / SVG_SIZE.Width();
|
||||||
float viewBoxScale = SVG_SIZE.Width() / VIEW_BOX.Width();
|
float viewBoxScale = SVG_SIZE.Width() / VIEW_BOX.Width();
|
||||||
float tx = 4.0f * viewBoxScale * layoutScale ;
|
float tx = 4.0f * viewBoxScale * layoutScale;
|
||||||
float ty = 10.0f * viewBoxScale * layoutScale;
|
float ty = 10.0f * viewBoxScale * layoutScale;
|
||||||
|
|
||||||
ty += (LAYOUT.Height() - SVG_SIZE.Height() * layoutScale) / 2;
|
ty += (LAYOUT.Height() - SVG_SIZE.Height() * layoutScale) / 2;
|
||||||
@ -59,7 +58,7 @@ HWTEST_F(SvgDomTestNg, SvgDom001, TestSize.Level1)
|
|||||||
EXPECT_CALL(canvas, Translate(FloatNear(tx, EPSILON), FloatNear(ty, EPSILON)));
|
EXPECT_CALL(canvas, Translate(FloatNear(tx, EPSILON), FloatNear(ty, EPSILON)));
|
||||||
EXPECT_CALL(canvas, Scale(layoutScale * viewBoxScale, layoutScale * viewBoxScale));
|
EXPECT_CALL(canvas, Scale(layoutScale * viewBoxScale, layoutScale * viewBoxScale));
|
||||||
auto clipRect = Testing::TestingRect(0, 0, LAYOUT.Width(), LAYOUT.Height());
|
auto clipRect = Testing::TestingRect(0, 0, LAYOUT.Width(), LAYOUT.Height());
|
||||||
EXPECT_CALL(canvas, ClipRect(_, _));
|
EXPECT_CALL(canvas, ClipRect(_, _, _));
|
||||||
svgDom->FitImage(canvas, ImageFit::CONTAIN, LAYOUT);
|
svgDom->FitImage(canvas, ImageFit::CONTAIN, LAYOUT);
|
||||||
}
|
}
|
||||||
} // namespace OHOS::Ace::NG
|
} // namespace OHOS::Ace::NG
|
||||||
|
Loading…
Reference in New Issue
Block a user