!34770 添加弧形SwiperPattern子类对应TDD

Merge pull request !34770 from zhangwt3652/arcswiper_tdd_0603
This commit is contained in:
openharmony_ci 2024-06-04 13:31:36 +00:00 committed by Gitee
commit 4a0a60405b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 33 additions and 6 deletions

View File

@ -20,6 +20,7 @@
namespace OHOS::Ace::NG {
class ArcSwiperPattern : public SwiperPattern {
DECLARE_ACE_TYPE(ArcSwiperPattern, SwiperPattern);
public:
void SaveCircleDotIndicatorProperty(const RefPtr<FrameNode>& indicatorNode) override;
void SetSwiperArcDotParameters(const SwiperArcDotParameters& swiperArcDotParameters) override;

View File

@ -1185,8 +1185,7 @@ HWTEST_F(SwiperAttrTestNg, SwiperPaintProperty001, TestSize.Level1)
HWTEST_F(SwiperAttrTestNg, ArcDotIndicator001, TestSize.Level1)
{
/**
* @tc.cases: Set indicator type to DIGIT
* @tc.expected: Show indicator, indicator type is DIGIT
* @tc.steps: step1. create swiper and set parameters.
*/
SwiperArcDotParameters swiperArcDotParameters;
swiperArcDotParameters.arcDirection = SwiperArcDirection::NINE_CLOCK_DIRECTION;
@ -1194,6 +1193,7 @@ HWTEST_F(SwiperAttrTestNg, ArcDotIndicator001, TestSize.Level1)
swiperArcDotParameters.selectedItemColor = Color::RED;
swiperArcDotParameters.containerColor = Color::BLUE;
CreateWithItem([=](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
model.SetArcDotIndicatorStyle(swiperArcDotParameters);
});
@ -1215,13 +1215,14 @@ HWTEST_F(SwiperAttrTestNg, ArcDotIndicator001, TestSize.Level1)
HWTEST_F(SwiperAttrTestNg, ArcDotIndicator002, TestSize.Level1)
{
/**
* @tc.cases: Set indicator type to DIGIT
* @tc.expected: Show indicator, indicator type is DIGIT
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([=](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
pattern_->GetSwiperArcDotParameters();
EXPECT_NE(pattern_->swiperArcDotParameters_, nullptr);
RefPtr<ArcSwiperPattern> indicatorPattern = frameNode_->GetPattern<ArcSwiperPattern>();
indicatorPattern->GetSwiperArcDotParameters();
EXPECT_NE(indicatorPattern->swiperArcDotParameters_, nullptr);
}
} // namespace OHOS::Ace::NG

View File

@ -403,9 +403,13 @@ HWTEST_F(SwiperIndicatorLayoutTestNg, CircleDotIndicatorLayoutAlgorithmMeasure00
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
ViewAbstract::SetWidth(AceType::RawPtr(frameNode_), CalcLength(SWIPER_WIDTH));
ViewAbstract::SetHeight(AceType::RawPtr(frameNode_), CalcLength(SWIPER_HEIGHT));
FlushLayoutTask(frameNode_);
auto indicatorPattern = indicatorNode_->GetPattern<SwiperIndicatorPattern>();
indicatorPattern->OnModifyDone();
auto algorithm = indicatorPattern->CreateLayoutAlgorithm();
@ -432,6 +436,7 @@ HWTEST_F(SwiperIndicatorLayoutTestNg, CircleDotIndicatorLayoutAlgorithmLayout001
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
auto indicatorPattern = indicatorNode_->GetPattern<SwiperIndicatorPattern>();
@ -458,8 +463,12 @@ HWTEST_F(SwiperIndicatorLayoutTestNg, CircleDotIndicatorFlushLayoutTask001, Test
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
ViewAbstract::SetWidth(AceType::RawPtr(frameNode_), CalcLength(SWIPER_WIDTH));
ViewAbstract::SetHeight(AceType::RawPtr(frameNode_), CalcLength(SWIPER_HEIGHT));
FlushLayoutTask(frameNode_);
/**
* @tc.steps: step2. call FlushLayoutTask.

View File

@ -1684,6 +1684,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotPlayIndicatorAnimation001, Test
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1714,6 +1715,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorUpdateContentModifier0
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
RefPtr<CircleDotIndicatorModifier> modifier = AceType::MakeRefPtr<CircleDotIndicatorModifier>();
@ -1758,6 +1760,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorPaintNormalIndicator00
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1801,6 +1804,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorPaintUnselectedIndicat
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1847,6 +1851,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorCalculatePointAngle001
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1879,6 +1884,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorGetHalfIndex001, TestS
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1911,6 +1917,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorGetLongPointAngle001,
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1944,6 +1951,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorGetBlackPointAngle001,
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -1983,6 +1991,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorGetIndex001, TestSize.
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -2016,6 +2025,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorGetStartAndEndIndex001
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -2062,6 +2072,7 @@ HWTEST_F(SwiperIndicatorModifierTestNg, CircleDotIndicatorSetFunctions001, TestS
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});

View File

@ -680,6 +680,7 @@ HWTEST_F(SwiperIndicatorTestNg, CircleSwiperIndicatorPatternCheckIsTouchBottom00
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -712,6 +713,7 @@ HWTEST_F(SwiperIndicatorTestNg, CircleSwiperIndicatorPatternCheckIsTouchBottom00
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
@ -737,6 +739,7 @@ HWTEST_F(SwiperIndicatorTestNg, CircleSwiperIndicatorPatternConvertAngleWithArcD
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});
auto indicatorPattern = indicatorNode_->GetPattern<SwiperIndicatorPattern>();

View File

@ -2055,6 +2055,7 @@ HWTEST_F(SwiperTestNg, WearableSwiperOnModifyDone001, TestSize.Level1)
* @tc.steps: step1. create swiper and set parameters.
*/
CreateWithItem([](SwiperModelNG model) {
model.Create(true);
model.SetDirection(Axis::VERTICAL);
model.SetIndicatorType(SwiperIndicatorType::ARC_DOT);
});

View File

@ -41,6 +41,7 @@
#include "core/components_ng/pattern/swiper/swiper_event_hub.h"
#include "core/components_ng/pattern/swiper/swiper_model_ng.h"
#include "core/components_ng/pattern/swiper/swiper_pattern.h"
#include "core/components_ng/pattern/swiper/arc_swiper_pattern.h"
#include "core/components_ng/pattern/swiper_indicator/circle_dot_indicator/circle_dot_indicator_layout_algorithm.h"
#include "core/components_ng/pattern/swiper_indicator/circle_dot_indicator/circle_dot_indicator_paint_method.h"
#include "core/components_ng/pattern/swiper_indicator/circle_dot_indicator/circle_dot_indicator_paint_property.h"