mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-01-08 09:53:20 +00:00
Fix:Radio组件增加覆盖率补充case
Signed-off-by: yangziyong <nsyangziyong@huawei.com> Change-Id: I20457fa92d2517ee4c0a74c583a44a01844c3096 Signed-off-by: yangziyong <nsyangziyong@huawei.com>
This commit is contained in:
parent
657ce11b7a
commit
8056c6d2b4
1695
test/unittest/core/pattern/radio/radio_pattern_test_ng.cpp
Normal file
1695
test/unittest/core/pattern/radio/radio_pattern_test_ng.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,7 @@
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "test/mock/core/common/mock_container.h"
|
||||
#include "test/mock/core/common/mock_theme_manager.h"
|
||||
#include "test/mock/core/pipeline/mock_pipeline_context.h"
|
||||
#include "test/mock/core/rosen/mock_canvas.h"
|
||||
@ -87,12 +88,14 @@ void RadioTestNg::SetUpTestSuite()
|
||||
return radioTheme;
|
||||
});
|
||||
MockPipelineContext::GetCurrent()->SetThemeManager(themeManager);
|
||||
MockContainer::SetUp();
|
||||
}
|
||||
|
||||
void RadioTestNg::TearDownTestSuite()
|
||||
{
|
||||
MockPipelineContext::GetCurrent()->themeManager_ = nullptr;
|
||||
MockPipelineContext::TearDown();
|
||||
MockContainer::TearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -209,8 +212,8 @@ HWTEST_F(RadioTestNg, RadioPaintPropertyTest004, TestSize.Level1)
|
||||
HWTEST_F(RadioTestNg, RadioPaintPropertyTest005, TestSize.Level1)
|
||||
{
|
||||
int32_t settingApiVersion = 12;
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(settingApiVersion);
|
||||
int32_t backupApiVersion = MockContainer::Current()->GetApiTargetVersion();
|
||||
MockContainer::Current()->SetApiTargetVersion(settingApiVersion);
|
||||
RadioModelNG radioModelNG;
|
||||
radioModelNG.Create(NAME, GROUP_NAME, INDICATOR_TYPE_TICK);
|
||||
radioModelNG.SetRadioIndicator(INDICATOR_TYPE_TICK.value());
|
||||
@ -219,7 +222,7 @@ HWTEST_F(RadioTestNg, RadioPaintPropertyTest005, TestSize.Level1)
|
||||
auto radioPaintProperty = frameNode->GetPaintProperty<RadioPaintProperty>();
|
||||
ASSERT_NE(radioPaintProperty, nullptr);
|
||||
EXPECT_EQ(radioPaintProperty->GetRadioIndicator(), INDICATOR_TYPE_TICK);
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(backupApiVersion);
|
||||
MockContainer::Current()->SetApiTargetVersion(backupApiVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -943,8 +946,8 @@ HWTEST_F(RadioTestNg, RadioPaintMethodTest007, TestSize.Level1)
|
||||
HWTEST_F(RadioTestNg, RadioPaintMethodTest008, TestSize.Level1)
|
||||
{
|
||||
int32_t settingApiVersion = 12;
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(settingApiVersion);
|
||||
int32_t backupApiVersion = MockContainer::Current()->GetApiTargetVersion();
|
||||
MockContainer::Current()->SetApiTargetVersion(settingApiVersion);
|
||||
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||
ASSERT_NE(geometryNode, nullptr);
|
||||
geometryNode->SetContentSize(CONTENT_SIZE);
|
||||
@ -964,7 +967,7 @@ HWTEST_F(RadioTestNg, RadioPaintMethodTest008, TestSize.Level1)
|
||||
radioPaintMethod.radioModifier_->uiStatus_ =
|
||||
AceType::MakeRefPtr<PropertyInt>(static_cast<int32_t>(UIStatus::SELECTED));
|
||||
radioPaintMethod.radioModifier_->PaintIndicator(canvas, false, CONTENT_SIZE, CONTENT_OFFSET);
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(backupApiVersion);
|
||||
MockContainer::Current()->SetApiTargetVersion(backupApiVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -975,8 +978,8 @@ HWTEST_F(RadioTestNg, RadioPaintMethodTest008, TestSize.Level1)
|
||||
HWTEST_F(RadioTestNg, RadioPaintMethodTest009, TestSize.Level1)
|
||||
{
|
||||
int32_t settingApiVersion = 12;
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(settingApiVersion);
|
||||
int32_t backupApiVersion = MockContainer::Current()->GetApiTargetVersion();
|
||||
MockContainer::Current()->SetApiTargetVersion(settingApiVersion);
|
||||
RefPtr<GeometryNode> geometryNode = AceType::MakeRefPtr<GeometryNode>();
|
||||
ASSERT_NE(geometryNode, nullptr);
|
||||
geometryNode->SetContentSize(CONTENT_SIZE);
|
||||
@ -996,7 +999,7 @@ HWTEST_F(RadioTestNg, RadioPaintMethodTest009, TestSize.Level1)
|
||||
radioPaintMethod.radioModifier_->uiStatus_ =
|
||||
AceType::MakeRefPtr<PropertyInt>(static_cast<int32_t>(UIStatus::UNSELECTED));
|
||||
radioPaintMethod.radioModifier_->PaintIndicator(canvas, false, CONTENT_SIZE, CONTENT_OFFSET);
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(backupApiVersion);
|
||||
MockContainer::Current()->SetApiTargetVersion(backupApiVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1007,8 +1010,8 @@ HWTEST_F(RadioTestNg, RadioPaintMethodTest009, TestSize.Level1)
|
||||
HWTEST_F(RadioTestNg, RadioPaintMethodTest010, TestSize.Level1)
|
||||
{
|
||||
int32_t settingApiVersion = 12;
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(settingApiVersion);
|
||||
int32_t backupApiVersion = MockContainer::Current()->GetApiTargetVersion();
|
||||
MockContainer::Current()->SetApiTargetVersion(settingApiVersion);
|
||||
auto radioModifier = AceType::MakeRefPtr<RadioModifier>();
|
||||
radioModifier->isOnAnimationFlag_->Set(true);
|
||||
radioModifier->UpdateIndicatorAnimation(true);
|
||||
@ -1018,7 +1021,7 @@ HWTEST_F(RadioTestNg, RadioPaintMethodTest010, TestSize.Level1)
|
||||
radioModifier->UpdateIndicatorAnimation(false);
|
||||
EXPECT_EQ(radioModifier->opacityScale_->Get(), 0);
|
||||
EXPECT_EQ(radioModifier->borderOpacityScale_->Get(), 1);
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(backupApiVersion);
|
||||
MockContainer::Current()->SetApiTargetVersion(backupApiVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1557,8 +1560,8 @@ RadioBuilderFunc RadioTestNg::RadioBuilder()
|
||||
HWTEST_F(RadioTestNg, RadioPatternTest030, TestSize.Level1)
|
||||
{
|
||||
int32_t settingApiVersion = 12;
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(settingApiVersion);
|
||||
int32_t backupApiVersion = MockContainer::Current()->GetApiTargetVersion();
|
||||
MockContainer::Current()->SetApiTargetVersion(settingApiVersion);
|
||||
RadioModelNG radioModelNG;
|
||||
radioModelNG.Create(NAME, GROUP_NAME, INDICATOR_TYPE_TICK);
|
||||
auto radioFunc = RadioBuilder();
|
||||
@ -1569,7 +1572,7 @@ HWTEST_F(RadioTestNg, RadioPatternTest030, TestSize.Level1)
|
||||
auto pattern = frameNode->GetPattern<RadioPattern>();
|
||||
ASSERT_NE(pattern, nullptr);
|
||||
ASSERT_NE(pattern->builder_, nullptr);
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(backupApiVersion);
|
||||
MockContainer::Current()->SetApiTargetVersion(backupApiVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1579,8 +1582,8 @@ HWTEST_F(RadioTestNg, RadioPatternTest030, TestSize.Level1)
|
||||
HWTEST_F(RadioTestNg, RadioPatternTest031, TestSize.Level1)
|
||||
{
|
||||
int32_t settingApiVersion = 12;
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(settingApiVersion);
|
||||
int32_t backupApiVersion = MockContainer::Current()->GetApiTargetVersion();
|
||||
MockContainer::Current()->SetApiTargetVersion(settingApiVersion);
|
||||
RadioModelNG radioModelNG;
|
||||
radioModelNG.Create(NAME, GROUP_NAME, INDICATOR_TYPE_TICK);
|
||||
radioModelNG.SetChecked(false);
|
||||
@ -1590,7 +1593,7 @@ HWTEST_F(RadioTestNg, RadioPatternTest031, TestSize.Level1)
|
||||
ASSERT_NE(pattern, nullptr);
|
||||
auto host = pattern->GetHost();
|
||||
pattern->OnModifyDone();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(backupApiVersion);
|
||||
MockContainer::Current()->SetApiTargetVersion(backupApiVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user