[orca] Fix for bgo#588910 - Orca should support the spellcheck as you go in mozilla applications



commit f6de282e63bc40980467cbaaade2f5afd8180bbc
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sat Jul 18 15:20:59 2009 -0400

    Fix for bgo#588910 - Orca should support the spellcheck as you go in mozilla applications

 src/orca/default.py                        |  102 +++++
 src/orca/orca_state.py                     |    4 +
 src/orca/scripts/toolkits/Gecko/script.py  |   30 ++-
 src/orca/text_attribute_names.py           |    2 +-
 test/keystrokes/firefox/spelling_errors.py |  556 ++++++++++++++++++++++++++++
 5 files changed, 691 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/default.py b/src/orca/default.py
index a9688a5..0362241 100644
--- a/src/orca/default.py
+++ b/src/orca/default.py
@@ -1044,6 +1044,8 @@ class Script(script.Script):
             self.onStateChanged
         listeners["object:state-changed:selected"]          = \
             self.onStateChanged
+        listeners["object:text-attributes-changed"]         = \
+            self.onTextAttributesChanged
         listeners["object:text-selection-changed"]          = \
             self.onTextSelectionChanged
         listeners["object:selection-changed"]               = \
@@ -2253,6 +2255,8 @@ class Script(script.Script):
         else:
             voice = self.voices[settings.DEFAULT_VOICE]
 
+        self.speakMisspelledIndicator(obj, startOffset)
+
         word = self.adjustForRepeats(word)
         orca_state.lastWord = word
         speech.speak(word, voice)
@@ -2518,6 +2522,7 @@ class Script(script.Script):
                     speech.speak(_("blank"), voice, False)
                 return
 
+        self.speakMisspelledIndicator(obj, offset)
         speech.speakCharacter(character, voice)
 
     def isFunctionalDialog(self, obj):
@@ -3994,6 +3999,45 @@ class Script(script.Script):
 
         return [startOffset, endOffset]
 
+    def onTextAttributesChanged(self, event):
+        """Called when an object's text attributes change. Right now this
+        method is only to handle the presentation of spelling errors on
+        the fly. Also note that right now, the Gecko toolkit is the only
+        one to present this information to us.
+
+        Arguments:
+        - event: the Event
+        """
+
+        if settings.speechVerbosityLevel == settings.VERBOSITY_LEVEL_VERBOSE \
+           and self.isSameObject(event.source, orca_state.locusOfFocus):
+            try:
+                text = event.source.queryText()
+            except:
+                return
+
+            # If the misspelled word indicator has just appeared, it's
+            # because the user typed a word boundary or navigated out
+            # of the word. We don't want to have to store a full set of
+            # each object's text attributes to compare, therefore, we'll
+            # check the previous word (most likely case) and the next
+            # word with respect to the current position.
+            #
+            prevWordAndOffsets = \
+                text.getTextAtOffset(text.caretOffset - 1,
+                                     pyatspi.TEXT_BOUNDARY_WORD_START)
+            nextWordAndOffsets = \
+                text.getTextAtOffset(text.caretOffset + 1,
+                                     pyatspi.TEXT_BOUNDARY_WORD_START)
+
+            if self.isWordMisspelled(event.source, prevWordAndOffsets[1] ) \
+               or self.isWordMisspelled(event.source, nextWordAndOffsets[1]):
+                # Translators: this is to inform the user of the presence
+                # of the red squiggly line which indicates that a given
+                # word is not spelled correctly.
+                #
+                speech.speak(_("misspelled"))
+
     def onTextSelectionChanged(self, event):
         """Called when an object's text selection changes.
 
@@ -8164,6 +8208,64 @@ class Script(script.Script):
         """
         return acc and acc.getState().contains(pyatspi.STATE_EDITABLE)
 
+    def speakMisspelledIndicator(self, obj, offset):
+        """Speaks an announcement indicating that a given word is misspelled.
+
+        Arguments:
+        - obj: An accessible which implements the accessible text interface.
+        - offset: Offset in the accessible's text for which to retrieve the
+          attributes.
+        """
+
+        if settings.speechVerbosityLevel == settings.VERBOSITY_LEVEL_VERBOSE:
+            try:
+                text = obj.queryText()
+            except:
+                return
+            # If we're on whitespace, we cannot be on a misspelled word.
+            #
+            charAndOffsets = \
+                text.getTextAtOffset(offset, pyatspi.TEXT_BOUNDARY_CHAR)
+            if not charAndOffsets[0].strip() \
+               or self.isWordDelimiter(charAndOffsets[0]):
+                orca_state.lastWordCheckedForSpelling = charAndOffsets[0]
+                return
+
+            wordAndOffsets = \
+                text.getTextAtOffset(offset, pyatspi.TEXT_BOUNDARY_WORD_START)
+            if self.isWordMisspelled(obj, offset) \
+               and wordAndOffsets[0] != orca_state.lastWordCheckedForSpelling:
+                # Translators: this is to inform the user of the presence
+                # of the red squiggly line which indicates that a given
+                # word is not spelled correctly.
+                #
+                speech.speak(_("misspelled"))
+            # Store this word so that we do not continue to present the
+            # presence of the red squiggly as the user arrows amongst
+            # the characters.
+            #
+            orca_state.lastWordCheckedForSpelling = wordAndOffsets[0]
+
+    def isWordMisspelled(self, obj, offset):
+        """Identifies if the current word is flagged as misspelled by the
+        application.
+
+        Arguments:
+        - obj: An accessible which implements the accessible text interface.
+        - offset: Offset in the accessible's text for which to retrieve the
+          attributes.
+
+        Returns True if the word is flagged as misspelled.
+        """
+
+        # Right now, the Gecko toolkit is the only one to expose this
+        # information to us. As other appliations and toolkits do so,
+        # the scripts for those applications/toolkits can override this
+        # method and, theoretically, the presentation of misspelled words
+        # should JustWork(tm).
+        #
+        return False
+
     def getTextAttributes(self, acc, offset, get_defaults=False):
         """Get the text attributes run for a given offset in a given accessible
 
diff --git a/src/orca/orca_state.py b/src/orca/orca_state.py
index 7ea1111..ab4d68f 100644
--- a/src/orca/orca_state.py
+++ b/src/orca/orca_state.py
@@ -87,6 +87,10 @@ noFocusTimestamp = 0.0
 #
 lastWord = ""
 
+# The last word examined for the misspelled indicator.
+#
+lastWordCheckedForSpelling = ""
+
 # The last searchQuery
 #
 searchQuery = None
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index f498686..9310fa6 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -252,7 +252,8 @@ class Script(default.Script):
             "-moz-center"             : "center",
             "start"                   : "no justification",
             "underlinesolid"          : "single",
-            "line-throughsolid"       : "solid"}
+            "line-throughsolid"       : "solid",
+            "invalid"                 : "mistake"}
 
         # We need to save our special attributes so that we can revert to
         # the default text attributes when giving up focus to another app
@@ -2456,10 +2457,11 @@ class Script(default.Script):
         # with entries, we need to handle word navigation in entries here.
         #
         wordContents = self.getWordContentsAtOffset(obj, characterOffset)
+        [textObj, startOffset, endOffset, word] = wordContents[0]
+        self.speakMisspelledIndicator(textObj, startOffset)
         if obj.getRole() != pyatspi.ROLE_ENTRY:
             self.speakContents(wordContents)
         else:
-            [textObj, startOffset, endOffset, word] = wordContents[0]
             word = textObj.queryText().getText(startOffset, endOffset)
             speech.speak([word], self.getACSS(textObj, word))
 
@@ -5104,6 +5106,23 @@ class Script(default.Script):
         #print "getTextLineAtCaret failed"
         return default.Script.getTextLineAtCaret(self, obj, offset)
 
+    def isWordMisspelled(self, obj, offset):
+        """Identifies if the current word is flagged as misspelled by the
+        application.
+
+        Arguments:
+        - obj: An accessible which implements the accessible text interface.
+        - offset: Offset in the accessible's text for which to retrieve the
+          attributes.
+
+        Returns True if the word is flagged as misspelled.
+        """
+
+        attributes, start, end  = self.getTextAttributes(obj, offset, True)
+        error = attributes.get("invalid")
+
+        return error == "spelling"
+
     def getTextAttributes(self, acc, offset, get_defaults=False):
         """Get the text attributes run for a given offset in a given accessible
 
@@ -5642,6 +5661,7 @@ class Script(default.Script):
         """Speaks the character at the given characterOffset in the
         given object."""
         character = self.getCharacterAtOffset(obj, characterOffset)
+        self.speakMisspelledIndicator(obj, characterOffset)
         if obj:
             if character and character != self.EMBEDDED_OBJECT_CHARACTER:
                 speech.speakCharacter(character,
@@ -5843,6 +5863,7 @@ class Script(default.Script):
 
         self.setCaretPosition(obj, startOffset)
         self.updateBraille(obj)
+        self.speakMisspelledIndicator(obj, startOffset)
         self.speakContents(contents)
 
     def goNextWord(self, inputEvent):
@@ -5869,6 +5890,11 @@ class Script(default.Script):
         [obj, startOffset, endOffset, string] = contents[-1]
         self.setCaretPosition(obj, endOffset)
         self.updateBraille(obj)
+        # Because we're getting the word based on the WORD_END boundary
+        # rather than the WORD_START boundary, we need to increment our
+        # offset.
+        #
+        self.speakMisspelledIndicator(obj, startOffset + 1)
         self.speakContents(contents)
 
     def findPreviousLine(self, obj, characterOffset, updateCache=True):
diff --git a/src/orca/text_attribute_names.py b/src/orca/text_attribute_names.py
index 7b0af85..5e7e928 100644
--- a/src/orca/text_attribute_names.py
+++ b/src/orca/text_attribute_names.py
@@ -130,7 +130,7 @@ _textAttributeTable["indent"] = C_("textattr", "indent")
 # the text, such as it being a misspelled word. See:
 # https://developer.mozilla.org/en/Accessibility/AT-APIs/Gecko/TextAttrs
 #
-_textAttributeTable["invalid"] = C_("textattr", "invalid")
+_textAttributeTable["invalid"] = C_("textattr", "mistake")
 
 # Translators: this attribute specifies whether the text is invisible.
 # It will be a "true" or "false" value.
diff --git a/test/keystrokes/firefox/spelling_errors.py b/test/keystrokes/firefox/spelling_errors.py
new file mode 100644
index 0000000..0c2d547
--- /dev/null
+++ b/test/keystrokes/firefox/spelling_errors.py
@@ -0,0 +1,556 @@
+#!/usr/bin/python
+
+"""Test of line navigation output of Firefox on a page with a simple
+form.
+"""
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+########################################################################
+# We wait for the focus to be on a blank Firefox window.
+#
+sequence.append(WaitForWindowActivate(utils.firefoxFrameNames, None))
+
+########################################################################
+# Load the local "simple form" test case.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction(utils.htmlURLPrefix + "simpleform.html"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+
+sequence.append(WaitForFocus(utils.htmlURLPrefix + "simpleform.html",
+                             acc_role=pyatspi.ROLE_DOCUMENT_FRAME))
+
+########################################################################
+# Press Control+Home to move to the top.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+    "Top of file",
+    ["BRAILLE LINE:  'Type something here:  $l'",
+     "     VISIBLE:  'Type something here:  $l', cursor=1",
+     "SPEECH OUTPUT: 'Type something here: text'"]))
+
+########################################################################
+# Press Tab to reach the multi-line entry. Then select all the text and
+# delete it.
+#
+sequence.append(KeyComboAction("Tab"))
+sequence.append(KeyComboAction("Tab"))
+sequence.append(KeyComboAction("Tab"))
+sequence.append(KeyComboAction("Tab"))
+sequence.append(KeyComboAction("<Control>a"))
+sequence.append(KeyComboAction("Delete"))
+
+sequence.append(PauseAction(3000))
+
+########################################################################
+# Type some text with misspelled words.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(TypeAction("Thiss is a tesst. "))
+sequence.append(utils.AssertPresentationAction(
+    "Type a sentence with mistakes",
+    ["BUG? - For some reason, two characters into typing, the cursor remains at 0 from here on out",
+     "BRAILLE LINE:  'T $l'",
+     "     VISIBLE:  'T $l', cursor=2",
+     "BRAILLE LINE:  'T $l'",
+     "     VISIBLE:  'T $l', cursor=2",
+     "BRAILLE LINE:  'T $l'",
+     "     VISIBLE:  'T $l', cursor=2",
+     "BRAILLE LINE:  'Th $l'",
+     "     VISIBLE:  'Th $l', cursor=0",
+     "BRAILLE LINE:  'Th $l'",
+     "     VISIBLE:  'Th $l', cursor=0",
+     "BRAILLE LINE:  'Thi $l'",
+     "     VISIBLE:  'Thi $l', cursor=0",
+     "BRAILLE LINE:  'Thi $l'",
+     "     VISIBLE:  'Thi $l', cursor=0",
+     "BRAILLE LINE:  'This $l'",
+     "     VISIBLE:  'This $l', cursor=0",
+     "BRAILLE LINE:  'This $l'",
+     "     VISIBLE:  'This $l', cursor=0",
+     "BRAILLE LINE:  'Thiss $l'",
+     "     VISIBLE:  'Thiss $l', cursor=0",
+     "BRAILLE LINE:  'Thiss $l'",
+     "     VISIBLE:  'Thiss $l', cursor=0",
+     "BRAILLE LINE:  'Thiss  $l'",
+     "     VISIBLE:  'Thiss  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss  $l'",
+     "     VISIBLE:  'Thiss  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss i $l'",
+     "     VISIBLE:  'Thiss i $l', cursor=0",
+     "BRAILLE LINE:  'Thiss i $l'",
+     "     VISIBLE:  'Thiss i $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is $l'",
+     "     VISIBLE:  'Thiss is $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is $l'",
+     "     VISIBLE:  'Thiss is $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is  $l'",
+     "     VISIBLE:  'Thiss is  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is  $l'",
+     "     VISIBLE:  'Thiss is  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a $l'",
+     "     VISIBLE:  'Thiss is a $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a $l'",
+     "     VISIBLE:  'Thiss is a $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a  $l'",
+     "     VISIBLE:  'Thiss is a  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a  $l'",
+     "     VISIBLE:  'Thiss is a  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a t $l'",
+     "     VISIBLE:  'Thiss is a t $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a t $l'",
+     "     VISIBLE:  'Thiss is a t $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a te $l'",
+     "     VISIBLE:  'Thiss is a te $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a te $l'",
+     "     VISIBLE:  'Thiss is a te $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tes $l'",
+     "     VISIBLE:  'Thiss is a tes $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tes $l'",
+     "     VISIBLE:  'Thiss is a tes $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tess $l'",
+     "     VISIBLE:  'Thiss is a tess $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tess $l'",
+     "     VISIBLE:  'Thiss is a tess $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tesst $l'",
+     "     VISIBLE:  'Thiss is a tesst $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tesst $l'",
+     "     VISIBLE:  'Thiss is a tesst $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tesst. $l'",
+     "     VISIBLE:  'Thiss is a tesst. $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tesst. $l'",
+     "     VISIBLE:  'Thiss is a tesst. $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 'misspelled'"]))
+
+########################################################################
+# Left Arrow through the text.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'dot'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 't'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "5. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "6. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'e'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "7. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 't'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "8. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "9. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'a'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "10. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "11. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "12. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'i'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "13. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "14. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "15. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "16. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'i'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "17. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'h'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Left"))
+sequence.append(utils.AssertPresentationAction(
+    "18. Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'T'"]))
+
+########################################################################
+# Right Arrow through the text.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'h'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'i'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "5. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "6. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'i'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "7. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "8. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "9. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'a'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "10. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "11. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 't'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "12. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'e'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "13. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "14. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 's'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "15. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 't'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "16. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'dot'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "17. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'space'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Right"))
+sequence.append(utils.AssertPresentationAction(
+    "18. Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'newline'"]))
+
+########################################################################
+# Control+Left Arrow through the text.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Left"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Control Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 'tesst.",
+     "'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Left"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Control Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'a '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Left"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Control Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'is '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Left"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Control Left",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 'Thiss '"]))
+
+########################################################################
+# Get the formatting of this word (which is misspelled)
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyPressAction(0, None, "KP_Insert"))
+sequence.append(KeyComboAction("f"))
+sequence.append(KeyReleaseAction(0, None, "KP_Insert"))
+sequence.append(utils.AssertPresentationAction(
+    "Insert+f",
+    ["SPEECH OUTPUT: 'size 9pt'",
+     "SPEECH OUTPUT: 'family name monospace'",
+     "SPEECH OUTPUT: 'mistake spelling'"]))
+
+########################################################################
+# Control+Right Arrow through the text.
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Right"))
+sequence.append(utils.AssertPresentationAction(
+    "1. Control Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'Thiss '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Right"))
+sequence.append(utils.AssertPresentationAction(
+    "2. Control Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'is '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Right"))
+sequence.append(utils.AssertPresentationAction(
+    "3. Control Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'a '"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Right"))
+sequence.append(utils.AssertPresentationAction(
+    "4. Control Right",
+    ["BRAILLE LINE:  'Thiss is a tesst.  $l'",
+     "     VISIBLE:  'Thiss is a tesst.  $l', cursor=0",
+     "SPEECH OUTPUT: 'misspelled'",
+     "SPEECH OUTPUT: 'tesst.",
+     "'"]))
+
+########################################################################
+# Get the formatting of this word (which is not misspelled)
+#
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyPressAction(0, None, "KP_Insert"))
+sequence.append(KeyComboAction("f"))
+sequence.append(KeyReleaseAction(0, None, "KP_Insert"))
+sequence.append(utils.AssertPresentationAction(
+    "Insert+f",
+    ["SPEECH OUTPUT: 'size 9pt'",
+     "SPEECH OUTPUT: 'family name monospace'"]))
+
+########################################################################
+# Move to the location bar by pressing Control+L.  When it has focus
+# type "about:blank" and press Return to restore the browser to the
+# conditions at the test's start.
+#
+sequence.append(KeyComboAction("<Control>l"))
+sequence.append(WaitForFocus(acc_role=pyatspi.ROLE_ENTRY))
+
+sequence.append(TypeAction("about:blank"))
+sequence.append(KeyComboAction("Return"))
+
+sequence.append(WaitForDocLoad())
+
+# Just a little extra wait to let some events get through.
+#
+sequence.append(PauseAction(3000))
+
+sequence.append(utils.AssertionSummaryAction())
+
+sequence.start()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]