mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 23:21:05 +00:00
补充swiper onKeyEvent TDD, 提升覆盖率
Change-Id: Iafdcd71f0976fad318b8f116f980880c0454fb4f Signed-off-by: wushengyu <wusy587@163.com>
This commit is contained in:
parent
593cfa28ce
commit
4f5a94a92c
@ -818,6 +818,60 @@ HWTEST_F(SwiperCommonTestNg, OnKeyEvent004, TestSize.Level1)
|
||||
EXPECT_TRUE(GetChildFocusHub(frameNode_, 0)->IsCurrentFocus());
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnKeyEvent005
|
||||
* @tc.desc: OnKeyEvent return false
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(SwiperCommonTestNg, OnKeyEvent005, TestSize.Level1)
|
||||
{
|
||||
/**
|
||||
* @tc.steps: step1. set axis default
|
||||
*/
|
||||
CreateWithItem([](SwiperModelNG model) {});
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. Call OnKeyEvent KEY_DPAD_LEFT
|
||||
* @tc.expected: false
|
||||
*/
|
||||
EXPECT_FALSE(pattern_->OnKeyEvent(KeyEvent(KeyCode::KEY_DPAD_LEFT, KeyAction::LONG_PRESS)));
|
||||
|
||||
/**
|
||||
* @tc.steps: step3. Call OnKeyEvent KEY_DPAD_RIGHT
|
||||
* @tc.expected: false
|
||||
*/
|
||||
EXPECT_FALSE(pattern_->OnKeyEvent(KeyEvent(KeyCode::KEY_DPAD_RIGHT, KeyAction::LONG_PRESS)));
|
||||
|
||||
/**
|
||||
* @tc.steps: step4. Call OnKeyEvent KEY_DPAD_UP
|
||||
* @tc.expected: false
|
||||
*/
|
||||
EXPECT_FALSE(pattern_->OnKeyEvent(KeyEvent(KeyCode::KEY_DPAD_UP, KeyAction::DOWN)));
|
||||
|
||||
/**
|
||||
* @tc.steps: step5. Call OnKeyEvent KEY_DPAD_DOWN
|
||||
* @tc.expected: false
|
||||
*/
|
||||
EXPECT_FALSE(pattern_->OnKeyEvent(KeyEvent(KeyCode::KEY_DPAD_DOWN, KeyAction::DOWN)));
|
||||
|
||||
/**
|
||||
* @tc.steps: step6. set axis vertical
|
||||
*/
|
||||
CreateWithItem([](SwiperModelNG model) { model.SetDirection(Axis::VERTICAL); });
|
||||
|
||||
/**
|
||||
* @tc.steps: step7. Call OnKeyEvent KEY_DPAD_LEFT
|
||||
* @tc.expected: false
|
||||
*/
|
||||
EXPECT_FALSE(pattern_->OnKeyEvent(KeyEvent(KeyCode::KEY_DPAD_LEFT, KeyAction::DOWN)));
|
||||
|
||||
/**
|
||||
* @tc.steps: step8. Call OnKeyEvent KEY_DPAD_RIGHT
|
||||
* @tc.expected: false
|
||||
*/
|
||||
EXPECT_FALSE(pattern_->OnKeyEvent(KeyEvent(KeyCode::KEY_DPAD_RIGHT, KeyAction::DOWN)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: MarginIgnoreBlankTest001
|
||||
* @tc.desc: Test Swiper PrevMargin IgnoreBlank
|
||||
|
Loading…
Reference in New Issue
Block a user