示例#1
0
def _ensureRestartWithCrashDump(crashFunction: _Callable[[], None]):
	startTime = _datetime.utcnow()
	spy = _nvdaLib.getSpyLib()
	spy.wait_for_specific_speech("Welcome to NVDA")  # ensure the dialog is present
	spy.emulateKeyPress("enter")  # close the dialog so we can check for it after the crash
	oldMsgWindowHandle = _getNvdaMessageWindowhandle()

	crashFunction()
	_blockUntilConditionMet(
		getValue=lambda: windowWithHandleExists(oldMsgWindowHandle) is False,
		giveUpAfterSeconds=3,
		errorMessage="Old NVDA is still running"
	)
	_builtIn.should_not_be_true(
		windowWithHandleExists(oldMsgWindowHandle),
		msg="Old NVDA process is stil running"
	)
	crashOccurred, crashPath = _blockUntilConditionMet(
		getValue=lambda: _nvdaRobot.check_for_crash_dump(startTime),
		giveUpAfterSeconds=3,
	)
	if not crashOccurred:
		raise AssertionError("A crash.dmp file has not been generated after a crash")
	waitUntilWindowFocused("Welcome to NVDA")
	# prevent test failure by removing the crash dump file
	crashFileDeleted, _crashFileExists = _blockUntilConditionMet(
		getValue=lambda: _attemptFileRemove(crashPath),
		giveUpAfterSeconds=3,
	)
	_opSys.wait_until_removed(crashPath)
	if not crashFileDeleted:
		raise AssertionError("crash.dmp file could not be deleted")
示例#2
0
def _ensureRestartWithCrashDump(crashFunction: _Callable[[], None]):
    startTime = _datetime.utcnow()
    spy = _nvdaLib.getSpyLib()
    spy.wait_for_specific_speech(
        "Welcome to NVDA")  # ensure the dialog is present
    spy.emulateKeyPress(
        "enter")  # close the dialog so we can check for it after the crash
    crashFunction()
    _process.wait_for_process(_nvdaProcessAlias, timeout="3 sec")
    _process.process_should_be_stopped(_nvdaProcessAlias)
    crashOccurred, crashPath = _blockUntilConditionMet(
        getValue=lambda: _nvdaRobot.check_for_crash_dump(startTime),
        giveUpAfterSeconds=3,
    )
    if not crashOccurred:
        raise AssertionError(
            "A crash.dmp file has not been generated after a crash")
    waitUntilWindowFocused("Welcome to NVDA")
    # prevent test failure by removing the crash dump file
    crashFileDeleted, _crashFileExists = _blockUntilConditionMet(
        getValue=lambda: _attemptFileRemove(crashPath),
        giveUpAfterSeconds=3,
    )
    _opSys.wait_until_removed(crashPath)
    if not crashFileDeleted:
        raise AssertionError("crash.dmp file could not be deleted")
示例#3
0
def NVDA_restarts():
	"""Ensure NVDA can be restarted from keyboard."""
	spy = _nvdaLib.getSpyLib()
	spy.wait_for_specific_speech("Welcome to NVDA")  # ensure the dialog is present.
	spy.wait_for_speech_to_finish()

	spy.emulateKeyPress("NVDA+q")
	spy.wait_for_specific_speech("Exit NVDA")

	_builtIn.sleep(0.5)  # the dialog is not always receiving the enter keypress, wait a little longer for it
	spy.emulateKeyPress("downArrow")
	spy.wait_for_specific_speech("Restart")
	spy.emulateKeyPress("enter", blockUntilProcessed=False)  # don't block so NVDA can exit
	_process.wait_for_process(_nvdaProcessAlias, timeout="10 sec")
	_process.process_should_be_stopped(_nvdaProcessAlias)
	waitUntilWindowFocused("Welcome to NVDA")
示例#4
0
def NVDA_restarts():
	"""Ensure NVDA can be restarted from keyboard."""
	spy = _nvdaLib.getSpyLib()
	spy.wait_for_specific_speech("Welcome to NVDA")  # ensure the dialog is present.
	spy.wait_for_speech_to_finish()
	# Get handle of the message window for the currently running NVDA
	oldMsgWindowHandle = _getNvdaMessageWindowhandle()
	spy.emulateKeyPress("NVDA+q")
	spy.wait_for_specific_speech("Exit NVDA")

	_builtIn.sleep(0.5)  # the dialog is not always receiving the enter keypress, wait a little longer for it
	spy.emulateKeyPress("downArrow")
	spy.wait_for_specific_speech("Restart")
	spy.emulateKeyPress("enter", blockUntilProcessed=False)  # don't block so NVDA can exit
	_blockUntilConditionMet(
		getValue=lambda: windowWithHandleExists(oldMsgWindowHandle) is False,
		giveUpAfterSeconds=10,
		errorMessage="Old NVDA is still running"
	)
	_builtIn.should_not_be_true(
		windowWithHandleExists(oldMsgWindowHandle),
		msg="Old NVDA process is stil running"
	)
	waitUntilWindowFocused("Welcome to NVDA")
示例#5
0
def test_desktop_shortcut():
    spy = _nvdaLib.getSpyLib()
    spy.emulateKeyPress("control+alt+n")
    # Takes some time to exit a running process and start a new one
    waitUntilWindowFocused("Welcome to NVDA", timeoutSecs=7)