mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-01-06 00:35:29 +00:00
增加text_picker覆盖率TDD用例
Signed-off-by: Zhang Jinyu <zhangjinyu101@huawei.com> Change-Id: I4c1214825e355ef6ac7d4496f0f24a227404884b
This commit is contained in:
parent
cef88eabf9
commit
ee78832a46
@ -18,6 +18,8 @@
|
||||
#include "core/common/font_manager.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
std::string FontManager::appCustomFont_ = "";
|
||||
const std::vector<std::string>& FontManager::GetFontNames() const
|
||||
{
|
||||
return {};
|
||||
@ -59,7 +61,6 @@ bool FontManager::IsUseAppCustomFont() const
|
||||
|
||||
const std::string& FontManager::GetAppCustomFont() const
|
||||
{
|
||||
const static std::string empty;
|
||||
return empty;
|
||||
return appCustomFont_;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "test/mock/core/pipeline/mock_pipeline_context.h"
|
||||
#include "test/mock/base/mock_task_executor.h"
|
||||
#include "test/mock/core/common/mock_container.h"
|
||||
#include "test/mock/core/common/mock_font_manager.h"
|
||||
#include "test/mock/core/rosen/mock_canvas.h"
|
||||
|
||||
#include "base/geometry/dimension.h"
|
||||
@ -36,6 +37,7 @@
|
||||
#include "core/components/picker/picker_theme.h"
|
||||
#include "core/components/theme/icon_theme.h"
|
||||
#include "core/components_ng/base/frame_node.h"
|
||||
#include "core/components_ng/base/modifier.h"
|
||||
#include "core/components_ng/base/view_stack_processor.h"
|
||||
#include "core/components_ng/layout/layout_algorithm.h"
|
||||
#include "core/components_ng/layout/layout_property.h"
|
||||
@ -82,6 +84,8 @@ constexpr double DISTANCE = 20.0;
|
||||
const OffsetF CHILD_OFFSET(0.0f, 10.0f);
|
||||
const SizeF TEST_TEXT_FRAME_SIZE { 100.0f, 10.0f };
|
||||
const SizeF COLUMN_SIZE { 100.0f, 200.0f };
|
||||
const std::vector<std::string> DEFAULT_VALUE = { "1", "2", "3" };
|
||||
const std::vector<std::string> CUSTOM_VALUE = { "appCustomFont" };
|
||||
} // namespace
|
||||
|
||||
class TextPickerColumnTestNg : public testing::Test {
|
||||
@ -187,6 +191,7 @@ void TextPickerColumnTestNg::TearDownTestSuite()
|
||||
void TextPickerColumnTestNg::SetUp()
|
||||
{
|
||||
auto themeManager = AceType::MakeRefPtr<MockThemeManager>();
|
||||
auto fontManager = AceType::MakeRefPtr<MockFontManager>();
|
||||
EXPECT_CALL(*themeManager, GetTheme(_)).WillRepeatedly([](ThemeType type) -> RefPtr<Theme> {
|
||||
if (type == IconTheme::TypeId()) {
|
||||
return AceType::MakeRefPtr<IconTheme>();
|
||||
@ -1867,4 +1872,110 @@ HWTEST_F(TextPickerColumnTestNg, TextPickerColumnPatternTest012, TestSize.Level1
|
||||
EXPECT_EQ(textPickerColumnPattern->algorithmOffset_.emplace_back(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerColumnPatternInitTextFontFamily001
|
||||
* @tc.desc: Test InitTextFontFamily.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerColumnTestNg, TextPickerColumnPatternInitTextFontFamily001, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerColumnTestNg();
|
||||
auto pipeline = PipelineContext::GetCurrentContext();
|
||||
ASSERT_NE(pipeline, nullptr);
|
||||
pipeline->fontManager_ = AceType::MakeRefPtr<MockFontManager>();
|
||||
auto textPickerPattern = frameNode_->GetPattern<TextPickerPattern>();
|
||||
ASSERT_NE(textPickerPattern, nullptr);
|
||||
auto textPickerLayoutProperty = frameNode_->GetLayoutProperty<TextPickerLayoutProperty>();
|
||||
ASSERT_NE(textPickerLayoutProperty, nullptr);
|
||||
/**
|
||||
* @tc.cases: case. cover hasAppCustomFont_ == false && ALL FontFamily_ == false.
|
||||
*/
|
||||
textPickerColumnPattern_->InitTextFontFamily();
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetDisappearFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetSelectedFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
/**
|
||||
* @tc.cases: case. cover hasAppCustomFont_ == false && ALL FontFamily_ == true.
|
||||
*/
|
||||
textPickerPattern->HasUserDefinedDisappearFontFamily(true);
|
||||
textPickerPattern->HasUserDefinedNormalFontFamily(true);
|
||||
textPickerPattern->HasUserDefinedSelectedFontFamily(true);
|
||||
textPickerColumnPattern_->InitTextFontFamily();
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetDisappearFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetSelectedFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerColumnPatternInitTextFontFamily002
|
||||
* @tc.desc: Test InitTextFontFamily.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerColumnTestNg, TextPickerColumnPatternInitTextFontFamily002, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerColumnTestNg();
|
||||
auto pipeline = PipelineContext::GetCurrentContext();
|
||||
ASSERT_NE(pipeline, nullptr);
|
||||
pipeline->fontManager_ = AceType::MakeRefPtr<MockFontManager>();
|
||||
pipeline->fontManager_->appCustomFont_ = "appCustomFont";
|
||||
auto textPickerPattern = frameNode_->GetPattern<TextPickerPattern>();
|
||||
ASSERT_NE(textPickerPattern, nullptr);
|
||||
auto textPickerLayoutProperty = frameNode_->GetLayoutProperty<TextPickerLayoutProperty>();
|
||||
ASSERT_NE(textPickerLayoutProperty, nullptr);
|
||||
/**
|
||||
* @tc.cases: case. cover hasAppCustomFont_ == true && ALL FontFamily_ == true.
|
||||
*/
|
||||
textPickerPattern->HasUserDefinedDisappearFontFamily(true);
|
||||
textPickerPattern->HasUserDefinedNormalFontFamily(true);
|
||||
textPickerPattern->HasUserDefinedSelectedFontFamily(true);
|
||||
textPickerColumnPattern_->InitTextFontFamily();
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetDisappearFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetSelectedFontFamilyValue(DEFAULT_VALUE), DEFAULT_VALUE);
|
||||
/**
|
||||
* @tc.cases: case. cover hasAppCustomFont_ == true && ALL FontFamily_ == false.
|
||||
*/
|
||||
textPickerPattern->HasUserDefinedDisappearFontFamily(false);
|
||||
textPickerPattern->HasUserDefinedNormalFontFamily(false);
|
||||
textPickerPattern->HasUserDefinedSelectedFontFamily(false);
|
||||
textPickerColumnPattern_->InitTextFontFamily();
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetDisappearFontFamilyValue(DEFAULT_VALUE), CUSTOM_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetFontFamilyValue(DEFAULT_VALUE), CUSTOM_VALUE);
|
||||
EXPECT_EQ(textPickerLayoutProperty->GetSelectedFontFamilyValue(DEFAULT_VALUE), CUSTOM_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerColumnPatternSetCanLoop001
|
||||
* @tc.desc: Test SetCanLoop.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerColumnTestNg, TextPickerColumnPatternSetCanLoop001, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerColumnTestNg();
|
||||
/**
|
||||
* @tc.cases: case. cover isLoop_ == isLoop.
|
||||
*/
|
||||
textPickerColumnPattern_->SetCanLoop(true);
|
||||
EXPECT_TRUE(textPickerColumnPattern_->isLoop_);
|
||||
|
||||
textPickerColumnPattern_->SetCanLoop(false);
|
||||
EXPECT_EQ(textPickerColumnPattern_->overscroller_.loopTossOffset_, 0.0);
|
||||
/**
|
||||
* @tc.cases: case. cover isLoop_ != isLoop.
|
||||
*/
|
||||
textPickerColumnPattern_->isLoop_ = false;
|
||||
textPickerColumnPattern_->SetCanLoop(true);
|
||||
EXPECT_EQ(textPickerColumnPattern_->overscroller_.loopTossOffset_, 0.0);
|
||||
|
||||
textPickerColumnPattern_->isLoop_ = false;
|
||||
textPickerColumnPattern_->SetTossStatus(true);
|
||||
textPickerColumnPattern_->SetCanLoop(true);
|
||||
EXPECT_EQ(textPickerColumnPattern_->overscroller_.loopTossOffset_, 0.0);
|
||||
|
||||
textPickerColumnPattern_->isLoop_ = true;
|
||||
textPickerColumnPattern_->SetTossStatus(true);
|
||||
textPickerColumnPattern_->SetCanLoop(false);
|
||||
EXPECT_EQ(textPickerColumnPattern_->overscroller_.loopTossOffset_, 0.0);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -1509,4 +1509,235 @@ HWTEST_F(TextPickerPatternTestNg, TextPickerColumnPatternOnClickEventTest012, Te
|
||||
textPickerColumnPattern_->HandleMouseEvent(false);
|
||||
textPickerColumnPattern_->HandleMouseEvent(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerPatternHandleDirectionKey001
|
||||
* @tc.desc: Test HandleDirectionKey
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerPatternTestNg, TextPickerPatternHandleDirectionKey001, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerPatternTestNg();
|
||||
std::vector<NG::RangeContent> range = { { "", "1" }, { "", "2" }, { "", "3" }, { "", "4" }, { "", "5" } };
|
||||
textPickerColumnPattern_->SetOptions(range);
|
||||
/**
|
||||
* @tc.cases: case. cover KeyCode == KEY_DPAD_UP.
|
||||
*/
|
||||
EXPECT_TRUE(textPickerPattern_->HandleDirectionKey(KeyCode::KEY_DPAD_UP));
|
||||
/**
|
||||
* @tc.cases: case. cover KeyCode == KEY_DPAD_DOWN.
|
||||
*/
|
||||
EXPECT_TRUE(textPickerPattern_->HandleDirectionKey(KeyCode::KEY_DPAD_DOWN));
|
||||
/**
|
||||
* @tc.cases: case. cover KeyCode == KEY_ENTER.
|
||||
*/
|
||||
EXPECT_TRUE(textPickerPattern_->HandleDirectionKey(KeyCode::KEY_ENTER));
|
||||
/**
|
||||
* @tc.cases: case. cover KeyCode == KEY_DPAD_LEFT.
|
||||
*/
|
||||
textPickerPattern_->focusKeyID_ = 0;
|
||||
EXPECT_TRUE(textPickerPattern_->HandleDirectionKey(KeyCode::KEY_DPAD_LEFT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerPatternHandleDirectionKey002
|
||||
* @tc.desc: Test HandleDirectionKey
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerPatternTestNg, TextPickerPatternHandleDirectionKey002, TestSize.Level1)
|
||||
{
|
||||
/**
|
||||
* @tc.step: step1. create textpicker pattern.
|
||||
*/
|
||||
auto frameNode = FrameNode::GetOrCreateFrameNode(V2::TEXT_PICKER_ETS_TAG,
|
||||
ViewStackProcessor::GetInstance()->ClaimNodeId(), []() { return AceType::MakeRefPtr<TextPickerPattern>(); });
|
||||
ASSERT_NE(frameNode, nullptr);
|
||||
auto textPickerPattern = frameNode->GetPattern<TextPickerPattern>();
|
||||
ASSERT_NE(textPickerPattern, nullptr);
|
||||
auto stackNode1 = FrameNode::GetOrCreateFrameNode(V2::STACK_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
[]() { return AceType::MakeRefPtr<StackPattern>(); });
|
||||
ASSERT_NE(stackNode1, nullptr);
|
||||
auto stackNode2 = FrameNode::GetOrCreateFrameNode(V2::STACK_ETS_TAG, ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
[]() { return AceType::MakeRefPtr<StackPattern>(); });
|
||||
ASSERT_NE(stackNode2, nullptr);
|
||||
auto blendNode1 = FrameNode::GetOrCreateFrameNode(V2::COLUMN_ETS_TAG,
|
||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
[]() { return AceType::MakeRefPtr<LinearLayoutPattern>(true); });
|
||||
ASSERT_NE(blendNode1, nullptr);
|
||||
auto blendNode2 = FrameNode::GetOrCreateFrameNode(V2::COLUMN_ETS_TAG,
|
||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
[]() { return AceType::MakeRefPtr<LinearLayoutPattern>(true); });
|
||||
ASSERT_NE(blendNode2, nullptr);
|
||||
auto columnNode1 = FrameNode::GetOrCreateFrameNode(V2::COLUMN_ETS_TAG,
|
||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
[]() { return AceType::MakeRefPtr<TextPickerColumnPattern>(); });
|
||||
ASSERT_NE(columnNode1, nullptr);
|
||||
auto columnNode2 = FrameNode::GetOrCreateFrameNode(V2::COLUMN_ETS_TAG,
|
||||
ElementRegister::GetInstance()->MakeUniqueId(),
|
||||
[]() { return AceType::MakeRefPtr<TextPickerColumnPattern>(); });
|
||||
ASSERT_NE(columnNode2, nullptr);
|
||||
columnNode1->MountToParent(blendNode1);
|
||||
blendNode1->MountToParent(stackNode1);
|
||||
stackNode1->MountToParent(frameNode);
|
||||
columnNode2->MountToParent(blendNode2);
|
||||
blendNode2->MountToParent(stackNode2);
|
||||
stackNode2->MountToParent(frameNode);
|
||||
auto textPickerColumnPattern2 = columnNode2->GetPattern<TextPickerColumnPattern>();
|
||||
ASSERT_NE(textPickerColumnPattern2, nullptr);
|
||||
/**
|
||||
* @tc.step: step2. SetOptions and call HandleDirectionKey.
|
||||
*/
|
||||
std::vector<NG::RangeContent> range = { { "", "1" }, { "", "2" }, { "", "3" }, { "", "4" }, { "", "5" } };
|
||||
textPickerColumnPattern2->SetOptions(range);
|
||||
textPickerPattern->focusKeyID_ = 1;
|
||||
bool result = textPickerPattern->HandleDirectionKey(KeyCode::KEY_DPAD_LEFT);
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerPatternPlayResetAnimation001
|
||||
* @tc.desc: Test PlayResetAnimation
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerPatternTestNg, TextPickerPatternPlayResetAnimation001, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerPatternTestNg();
|
||||
TextPickerOptionProperty prop;
|
||||
prop.height = 4.0f;
|
||||
prop.fontheight = 3.0f;
|
||||
prop.prevDistance = 5.0f;
|
||||
prop.nextDistance = 7.0f;
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
/**
|
||||
* @tc.cases: case. cover isDownScroll_ == false
|
||||
*/
|
||||
textPickerColumnPattern_->PlayResetAnimation();
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 0.0f);
|
||||
|
||||
textPickerColumnPattern_->scrollDelta_ = 10.0f;
|
||||
textPickerColumnPattern_->PlayResetAnimation();
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 15.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerPatternPlayResetAnimation002
|
||||
* @tc.desc: Test PlayResetAnimation
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerPatternTestNg, TextPickerPatternPlayResetAnimation002, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerPatternTestNg();
|
||||
TextPickerOptionProperty prop;
|
||||
prop.height = 4.0f;
|
||||
prop.fontheight = 3.0f;
|
||||
prop.prevDistance = 5.0f;
|
||||
prop.nextDistance = 7.0f;
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
/**
|
||||
* @tc.cases: case. cover isDownScroll_ == true
|
||||
*/
|
||||
textPickerColumnPattern_->SetScrollDirection(true);
|
||||
textPickerColumnPattern_->PlayResetAnimation();
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 0.0f);
|
||||
|
||||
textPickerColumnPattern_->SetScrollDirection(true);
|
||||
textPickerColumnPattern_->scrollDelta_ = 10.0f;
|
||||
textPickerColumnPattern_->PlayResetAnimation();
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 3.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerPatternUpdateColumnChildPosition001
|
||||
* @tc.desc: Test UpdateColumnChildPosition
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerPatternTestNg, TextPickerPatternUpdateColumnChildPosition001, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerPatternTestNg();
|
||||
TextPickerOptionProperty prop;
|
||||
prop.height = 4.0f;
|
||||
prop.fontheight = 3.0f;
|
||||
prop.prevDistance = 5.0f;
|
||||
prop.nextDistance = 7.0f;
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
/**
|
||||
* @tc.cases: case. cover isReboundInProgress_ == true && canLoop_ == true
|
||||
*/
|
||||
textPickerColumnPattern_->isReboundInProgress_ = true;
|
||||
textPickerColumnPattern_->SetYLast(1.0);
|
||||
textPickerColumnPattern_->UpdateColumnChildPosition(2.0);
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 1.0f);
|
||||
/**
|
||||
* @tc.cases: case. cover isReboundInProgress_ == true && canLoop_ == false
|
||||
*/
|
||||
auto property = frameNode_->GetLayoutProperty<TextPickerLayoutProperty>();
|
||||
ASSERT_NE(property, nullptr);
|
||||
property->UpdateCanLoop(false);
|
||||
textPickerColumnPattern_->isReboundInProgress_ = true;
|
||||
textPickerColumnPattern_->SetYLast(1.0);
|
||||
textPickerColumnPattern_->UpdateColumnChildPosition(2.0);
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 2.0f);
|
||||
/**
|
||||
* @tc.cases: case. cover isReboundInProgress_ == false && canLoop_ == false
|
||||
*/
|
||||
property->UpdateCanLoop(false);
|
||||
textPickerColumnPattern_->isReboundInProgress_ = false;
|
||||
textPickerColumnPattern_->SetYLast(1.0);
|
||||
textPickerColumnPattern_->UpdateColumnChildPosition(2.0);
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: TextPickerPatternUpdateColumnChildPosition002
|
||||
* @tc.desc: Test UpdateColumnChildPosition
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(TextPickerPatternTestNg, TextPickerPatternUpdateColumnChildPosition002, TestSize.Level1)
|
||||
{
|
||||
InitTextPickerPatternTestNg();
|
||||
TextPickerOptionProperty prop;
|
||||
prop.height = 4.0f;
|
||||
prop.fontheight = 3.0f;
|
||||
prop.prevDistance = 5.0f;
|
||||
prop.nextDistance = 7.0f;
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
textPickerColumnPattern_->optionProperties_.emplace_back(prop);
|
||||
/**
|
||||
* @tc.cases: case. covering the false branch
|
||||
*/
|
||||
textPickerColumnPattern_->pressed_ = true;
|
||||
textPickerColumnPattern_->SetTossStatus(true);
|
||||
textPickerColumnPattern_->overscroller_.SetOverScroll(1.0);
|
||||
textPickerColumnPattern_->SetYLast(1.0);
|
||||
textPickerColumnPattern_->UpdateColumnChildPosition(2.0);
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 1.0f);
|
||||
/**
|
||||
* @tc.cases: case. covering the true branch
|
||||
*/
|
||||
auto property = frameNode_->GetLayoutProperty<TextPickerLayoutProperty>();
|
||||
ASSERT_NE(property, nullptr);
|
||||
property->UpdateCanLoop(false);
|
||||
textPickerColumnPattern_->pressed_ = false;
|
||||
textPickerColumnPattern_->SetTossStatus(true);
|
||||
textPickerColumnPattern_->overscroller_.SetOverScroll(10.0);
|
||||
textPickerColumnPattern_->SetYLast(1.0);
|
||||
textPickerColumnPattern_->UpdateColumnChildPosition(2.0);
|
||||
EXPECT_EQ(textPickerColumnPattern_->scrollDelta_, 0.0f);
|
||||
/**
|
||||
* @tc.cases: case. covering the return branch
|
||||
*/
|
||||
textPickerColumnPattern_->SetYLast(1.0);
|
||||
textPickerColumnPattern_->UpdateColumnChildPosition(1.0);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
Loading…
Reference in New Issue
Block a user