拖拽事件上报规则优化/allowDrop支持拖拽强校验及null类型 TDD

Signed-off-by: yangziyong <nsyangziyong@huawei.com>
This commit is contained in:
yangziyong 2024-05-31 18:21:18 +08:00
parent 7064b874a3
commit 51c2e48d76
2 changed files with 1048 additions and 12 deletions

View File

@ -1318,7 +1318,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg028, TestSize.Level1)
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_A);
const std::string allow_TAG(NODE_TAG_SPOT);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
@ -1330,7 +1330,6 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg028, TestSize.Level1)
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_SPOT);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
@ -1369,7 +1368,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg029, TestSize.Level1)
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_A);
const std::string allow_TAG(NODE_TAG_ONE);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
@ -1381,7 +1380,6 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg029, TestSize.Level1)
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_ONE);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
@ -1432,7 +1430,6 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg030, TestSize.Level1)
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_A);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
@ -2095,7 +2092,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg043, TestSize.Level1)
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_A);
const std::string allow_TAG(NODE_TAG_SPOT);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
@ -2107,7 +2104,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg043, TestSize.Level1)
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_SPOT);
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
@ -2146,7 +2143,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg044, TestSize.Level1)
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_A);
const std::string allow_TAG(NODE_TAG_ONE);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
@ -2158,7 +2155,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg044, TestSize.Level1)
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_ONE);
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
@ -2209,7 +2206,7 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg045, TestSize.Level1)
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_A);
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
@ -2229,4 +2226,515 @@ HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg045, TestSize.Level1)
*/
ASSERT_FALSE(dragDropManager->IsDropAllowed(frameNode));
}
} // namespace OHOS::Ace::NG
/**
* @tc.name: FrameNodeDropTestNg046
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg046, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_EMPTY);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
dragDropManager->summaryMap_.insert(make_pair(summary_TAG, frameNodeNullId));
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = false;
ASSERT_FALSE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_FALSE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_TRUE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg047
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg047, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_EMPTY);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = true;
ASSERT_TRUE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_TRUE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_FALSE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg048
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg048, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_SPOT);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = false;
ASSERT_FALSE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_FALSE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_TRUE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg049
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg049, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_ONE);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = false;
ASSERT_FALSE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_FALSE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_TRUE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg050
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg050, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_A);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = false;
ASSERT_FALSE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_FALSE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_TRUE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg051
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg051, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_EMPTY);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = false;
ASSERT_FALSE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_FALSE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_TRUE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg048
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg052, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_SPOT);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = true;
ASSERT_TRUE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_TRUE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_FALSE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg049
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg053, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_ONE);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = true;
ASSERT_TRUE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_TRUE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_FALSE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg050
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg054, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_A);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = true;
ASSERT_TRUE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_TRUE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_FALSE(dragDropManager->IsDropAllowed(frameNode));
}
/**
* @tc.name: FrameNodeDropTestNg051
* @tc.desc: Test frame node method
* @tc.type: FUNC
*/
HWTEST_F(FrameNodeDropTestNg, FrameNodeDropTestNg055, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. construct frameNode and update the properties.
* @tc.expected: frameNode is not null.
*/
const std::string allow_TAG(NODE_TAG_EMPTY);
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
auto frameNode = AceType::MakeRefPtr<FrameNode>(allow_TAG, frameNodeNullId, AceType::MakeRefPtr<Pattern>());
ASSERT_NE(frameNode, nullptr);
std::set<std::string> allowDrop = { allow_TAG };
frameNode->SetAllowDrop(allowDrop);
ASSERT_NE(frameNode, nullptr);
/**
* @tc.steps: step3. construct summaryMap for dragDropManager.
* @tc.expected: dragDropManager is not null.
*/
const std::string summary_TAG(NODE_TAG_EMPTY);
dragDropManager->summaryMap_.clear();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step4. Set an isDisallowDropForcedly in the frameNode and then get an isDisallowDropForcedly.
* @tc.expected: The set isDisallowDropForcedly is the same as the get isDisallowDropForcedly.
*/
bool isDisallowDrop = true;
ASSERT_TRUE(isDisallowDrop);
frameNode->SetDisallowDropForcedly(isDisallowDrop);
bool isDisallowDropForcedly = frameNode->GetDisallowDropForcedly();
ASSERT_TRUE(isDisallowDropForcedly);
/**
* @tc.steps: step5. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
ASSERT_FALSE(dragDropManager->IsDropAllowed(frameNode));
}
} // namespace OHOS::Ace::NG

View File

@ -1930,4 +1930,532 @@ HWTEST_F(DragDropReportTestNg, DragDropReportTest028, TestSize.Level1)
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
} // namespace OHOS::Ace::NG
/**
* @tc.name: DragDropReportTest029
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest029, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_1, GLOBAL_1 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_1, GLOBAL_1 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_1, GLOBAL_1 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest030
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest030, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_2, GLOBAL_1 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_2, GLOBAL_1 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_2, GLOBAL_1 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest031
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest031, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_2 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_2 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_2 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest032
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest032, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest033
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest033, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_2 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest034
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest034, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_1 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_1 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_2, GLOBAL_1 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest035
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest035, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_3, GLOBAL_1 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_3, GLOBAL_1 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_3, GLOBAL_1 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
/**
* @tc.name: DragDropReportTest036
* @tc.desc: Test DragEventStrictReportingEnabled
* @tc.type: FUNC
* @tc.author:
*/
HWTEST_F(DragDropReportTestNg, DragDropReportTest036, TestSize.Level1)
{
/**
* @tc.steps: step1. construct a DragDropManager.
* @tc.expected: dragDropManager is not null.
*/
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
ASSERT_NE(dragDropManager, nullptr);
/**
* @tc.steps: step2. ReportingEnable is not set.
* @tc.expected: reportingEnabledDefault is false.
*/
bool reportingEnabledDefault = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledDefault);
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
auto preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledDefault);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step3. ReportingSupported is set to true.
* @tc.expected: reportingEnabledTrue is true.
*/
bool variableTrue = true;
dragDropManager->SetEventStrictReportingEnabled(variableTrue);
bool reportingEnabledTrue = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_TRUE(reportingEnabledTrue);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_TRUE(reportingEnabledTrue);
preTargetNode.Reset();
frameNode.Reset();
/**
* @tc.steps: step4. ReportingSupported is set to false.
* @tc.expected: reportingEnabledFalse is false.
*/
bool variableFalse = false;
dragDropManager->SetEventStrictReportingEnabled(variableFalse);
bool reportingEnabledFalse = dragDropManager->IsEventStrictReportingEnabled();
ASSERT_FALSE(reportingEnabledFalse);
frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
dragDropManager->OnDragStart({ GLOBAL_3, GLOBAL_3 }, frameNode);
preTargetNode = dragDropManager->preTargetFrameNode_;
ASSERT_TRUE(preTargetNode);
dragDropManager->FireOnDragLeave(preTargetNode, { GLOBAL_1, GLOBAL_3 }, EXTRA_INFO);
ASSERT_TRUE(preTargetNode);
ASSERT_FALSE(reportingEnabledFalse);
}
} // namespace OHOS::Ace::NG