mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 23:21:05 +00:00
tdd
Signed-off-by: fengfeng <fengfeng18@huawei.com> Change-Id: I45d14dae4b88626a9b3c3744846db7e79b145ba5 Signed-off-by: fengfeng <fengfeng18@huawei.com>
This commit is contained in:
parent
e951c51888
commit
f4d9a21daa
@ -932,4 +932,55 @@ HWTEST_F(LazyForEachSyntaxTestNg, LazyForEachBuilder06, TestSize.Level1)
|
|||||||
lazyForEachBuilder->OnDataBulkDeleted(2, 5);
|
lazyForEachBuilder->OnDataBulkDeleted(2, 5);
|
||||||
EXPECT_NE(lazyForEachBuilder->nodeList_.size(), 0);
|
EXPECT_NE(lazyForEachBuilder->nodeList_.size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.name: LazyForEachBuilder07
|
||||||
|
* @tc.desc: LazyForEachBuilder::OnDataBulkDeleted
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
HWTEST_F(LazyForEachSyntaxTestNg, LazyForEachBuilder07, TestSize.Level1)
|
||||||
|
{
|
||||||
|
LazyForEachModelNG lazyForEach;
|
||||||
|
const RefPtr<LazyForEachActuator> mockLazyForEachActuator =
|
||||||
|
AceType::MakeRefPtr<OHOS::Ace::Framework::MockLazyForEachBuilder>();
|
||||||
|
lazyForEach.Create(mockLazyForEachActuator);
|
||||||
|
auto lazyForEachBuilder = AceType::DynamicCast<LazyForEachBuilder>(mockLazyForEachActuator);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.steps: step1. operation.index >= totalCountForDataset_;
|
||||||
|
*/
|
||||||
|
V2::Operation operation;
|
||||||
|
operation.index = 0;
|
||||||
|
int32_t initialIndex = 0;
|
||||||
|
std::map<int32_t, LazyForEachChild> cachedTemp;
|
||||||
|
std::map<int32_t, LazyForEachChild> expiringTemp;
|
||||||
|
lazyForEachBuilder->OperateChange(operation, initialIndex, cachedTemp, expiringTemp);
|
||||||
|
EXPECT_EQ(lazyForEachBuilder->operationList_.size(), 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.steps: step2. !indexExist == operationList_.end();
|
||||||
|
*/
|
||||||
|
lazyForEachBuilder->totalCountForDataset_ = 1;
|
||||||
|
OperationInfo operationinfo;
|
||||||
|
lazyForEachBuilder->operationList_[1] = operationinfo;
|
||||||
|
lazyForEachBuilder->OperateChange(operation, initialIndex, cachedTemp, expiringTemp);
|
||||||
|
EXPECT_EQ(lazyForEachBuilder->operationList_.size(), 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.steps: step3. !operation.key.empty();
|
||||||
|
*/
|
||||||
|
std::string str0 = "0";
|
||||||
|
expiringTemp[0] = LazyForEachChild(str0, nullptr);
|
||||||
|
cachedTemp[0] = LazyForEachChild(str0, nullptr);
|
||||||
|
operation.key = "0";
|
||||||
|
lazyForEachBuilder->OperateChange(operation, initialIndex, cachedTemp, expiringTemp);
|
||||||
|
EXPECT_EQ(lazyForEachBuilder->operationList_.size(), 2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.steps: step4. !indexExist == operationList_.end();
|
||||||
|
*/
|
||||||
|
lazyForEachBuilder->operationList_[0] = operationinfo;
|
||||||
|
lazyForEachBuilder->OperateChange(operation, initialIndex, cachedTemp, expiringTemp);
|
||||||
|
EXPECT_EQ(lazyForEachBuilder->operationList_.size(), 2);
|
||||||
|
}
|
||||||
} // namespace OHOS::Ace::NG
|
} // namespace OHOS::Ace::NG
|
||||||
|
Loading…
Reference in New Issue
Block a user