Merge branch 'master' of http://git.zhenyangtang.com.cn/ZYT/zyt
This commit is contained in:
@@ -295,6 +295,48 @@ def test_real_demo_login_reaches_success_without_widget_adapter(
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_login_password_group_keeps_focus_when_reveal_is_keyboard_focused(tmp_path: Any) -> None:
|
||||
application = QApplication.instance() or QApplication([])
|
||||
apply_theme(application)
|
||||
window = LoginWindow(
|
||||
object(), settings=QSettings(str(tmp_path / "focus.ini"), QSettings.Format.IniFormat),
|
||||
)
|
||||
window.show()
|
||||
application.processEvents()
|
||||
group = window.password_edit.parentWidget()
|
||||
geometry = group.geometry()
|
||||
try:
|
||||
for control in (window.password_edit, window.reveal_button):
|
||||
control.setFocus()
|
||||
application.processEvents()
|
||||
assert group.property("focused") is True
|
||||
assert group.geometry() == geometry
|
||||
window.login_button.setFocus()
|
||||
application.processEvents()
|
||||
assert group.property("focused") is False
|
||||
assert group.geometry() == geometry
|
||||
finally:
|
||||
window.close()
|
||||
|
||||
|
||||
def test_compact_login_keeps_the_whole_form_visible(tmp_path: Any) -> None:
|
||||
application = QApplication.instance() or QApplication([])
|
||||
apply_theme(application)
|
||||
window = LoginWindow(
|
||||
object(), settings=QSettings(str(tmp_path / "compact.ini"), QSettings.Format.IniFormat),
|
||||
)
|
||||
window.resize(860, 640)
|
||||
window.show()
|
||||
application.processEvents()
|
||||
try:
|
||||
assert not window.brand_panel.isVisible()
|
||||
assert window.login_scroll.verticalScrollBar().maximum() == 0
|
||||
assert window.card.height() >= window.card.minimumSizeHint().height()
|
||||
assert window.login_button.isVisibleTo(window)
|
||||
finally:
|
||||
window.close()
|
||||
|
||||
|
||||
def test_remembered_password_survives_a_new_login_window(tmp_path: Any) -> None:
|
||||
application = QApplication.instance() or QApplication([])
|
||||
settings_path = tmp_path / "remember-password.ini"
|
||||
|
||||
Reference in New Issue
Block a user