Fixed a regression in table navigation.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
import gi
|
||||
|
||||
os.environ.setdefault("GSETTINGS_BACKEND", "memory")
|
||||
|
||||
gi.require_version("Atspi", "2.0")
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
|
||||
|
||||
from cthulhu import messages
|
||||
from cthulhu import structural_navigation
|
||||
|
||||
|
||||
class StructuralNavigationTableRegressionTests(unittest.TestCase):
|
||||
def test_table_cell_coordinates_do_not_interrupt_cell_contents(self):
|
||||
navigator = structural_navigation.StructuralNavigation.__new__(
|
||||
structural_navigation.StructuralNavigation
|
||||
)
|
||||
navigator._script = mock.Mock()
|
||||
navigator._script.utilities.rowAndColumnSpan.return_value = (1, 1)
|
||||
navigator._getCaretPosition = mock.Mock(return_value=("cell", 0))
|
||||
navigator._setCaretPosition = mock.Mock(return_value=("cell", 0))
|
||||
navigator._isBlankCell = mock.Mock(return_value=False)
|
||||
navigator._presentObject = mock.Mock()
|
||||
navigator.getCellCoordinates = mock.Mock(return_value=(1, 2))
|
||||
|
||||
with (
|
||||
mock.patch.object(structural_navigation.settings, "speakCellHeaders", False),
|
||||
mock.patch.object(structural_navigation.settings, "speakCellCoordinates", True),
|
||||
mock.patch.object(structural_navigation.settings, "speakCellSpan", False),
|
||||
):
|
||||
navigator._tableCellPresentation("cell", None)
|
||||
|
||||
navigator._presentObject.assert_called_once_with("cell", 0)
|
||||
navigator._script.presentMessage.assert_called_once_with(
|
||||
messages.TABLE_CELL_COORDINATES % {"row": 2, "column": 3},
|
||||
interrupt=False,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user