After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 519559 - gtk-demo/role_spin_button.py regression test #4 produces the wrong results.
gtk-demo/role_spin_button.py regression test #4 produces the wrong results.
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
2.21.x
Other Linux
: Normal normal
: ---
Assigned To: Rich Burridge
Orca Maintainers
Depends on:
Blocks: 519271
 
 
Reported: 2008-02-29 16:06 UTC by Rich Burridge
Modified: 2008-03-07 22:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Orca debug when running synchronously. (24.01 KB, text/plain)
2008-03-03 20:15 UTC, Rich Burridge
  Details
Orca debug when running asynchronously. (24.38 KB, text/plain)
2008-03-03 20:20 UTC, Rich Burridge
  Details
Patch that I thought should have fixed the problem. (836 bytes, patch)
2008-03-04 22:46 UTC, Rich Burridge
committed Details | Review
Fix up regression test #4 as KNOWN ISSUE. (721 bytes, patch)
2008-03-07 22:10 UTC, Rich Burridge
committed Details | Review

Description Rich Burridge 2008-02-29 16:06:45 UTC
This is on latest Ubuntu Hardy:

EXPECTED:
     "BUG? - Value should be 239",
     "BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
     "     VISIBLE:  'Hue: 240 $l', cursor=9",
     "BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
     "     VISIBLE:  'Hue: 240 $l', cursor=6",
     "BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
     "     VISIBLE:  'Hue: 240 $l', cursor=6",
     "SPEECH OUTPUT: '240'",
     "SPEECH OUTPUT: '240'",
ACTUAL:
     "BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
     "     VISIBLE:  'Hue: 240 $l', cursor=9",
     "BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
     "     VISIBLE:  'Hue: 240 $l', cursor=6",
     "BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'",
     "     VISIBLE:  'Hue: 240 $l', cursor=6",
     "SPEECH OUTPUT: '240'",
     "SPEECH OUTPUT: '240'",
[FAILURE WAS EXPECTED - LOOK FOR BUG? IN EXPECTED RESULTS]

We need to determine why the value isn't 239.
Comment 1 Rich Burridge 2008-03-03 20:15:02 UTC
Created attachment 106510 [details]
Orca debug when running synchronously.
Comment 2 Rich Burridge 2008-03-03 20:20:17 UTC
Created attachment 106511 [details]
Orca debug when running asynchronously.

When I press Down when focus is on the Hue spin button
with an initial value of 240:

Asynchronously it speaks:
SPEECH OUTPUT: '240'
because of an "object:text-changed:insert" event, followed by:
SPEECH OUTPUT: '239'
because of an "object:text-caret-moved" event.

Synchronously it speaks:
SPEECH OUTPUT: '240'
because of an "object:text-changed:insert" event, followed by:
SPEECH OUTPUT: '240'
because of an "object:text-caret-moved" event.

Need to determine why these are different.
Comment 3 Rich Burridge 2008-03-03 21:17:12 UTC
Well this is interesting. 

With the "object:text-changed:insert" event, the braille display 
gets the correct value:

BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 239 $l'
     VISIBLE:  'Hue: 239 $l', cursor=6

but the speech gets it wrong (240).

SPEECH OUTPUT: '240'

Braille.
--------
In onTextInserted() in default.py, to get the braille line we call

        self.updateBraille(event.source)

(at line 3336 in default.py). For the spin button we further call
_getBrailleRegionsForSpinButton() in braillegenerator.py
which in turn calls _getBrailleRegionsForText().

That method calls:

        textRegion = braille.Text(obj,
                                  self._script.getDisplayedLabel(obj),
                                  " $l")

(at line 801 in braillegenerator.py). In the Text class in braille.py,
the __init__() method calls:

            [string, self.caretOffset, self.lineOffset] = \
                 orca_state.activeScript.getTextLineAtCaret(self.accessible)

(at line 467 in braille.py). This returns a string of "239".

Speech.
-------
In onTextInserted() in default.py, to get the speech for the value
of the spin button, we call

        text = event.any_data

        # If this is a spin button, then speak the text and return.
        #
        if event.source.getRole() == pyatspi.ROLE_SPIN_BUTTON:
            speech.speak(text)
            return

(at line 3338 in default.py). The value of the text variable is "240".

Will, should we be doing something on the speech side equivalent to what we
are doing on the braille side?
Comment 4 Willie Walker 2008-03-04 17:04:21 UTC
(In reply to comment #3)
> Well this is interesting. 
> 
> With the "object:text-changed:insert" event, the braille display 
> gets the correct value:
...
> but the speech gets it wrong (240).
...
> Braille.
...
>                  orca_state.activeScript.getTextLineAtCaret(self.accessible)
...
> Speech.
>         text = event.any_data
...
> Will, should we be doing something on the speech side equivalent to what we
> are doing on the braille side?

OK, so the difference seems to be that braille makes a round trip to get the text and speech uses event.any_data.  The strange thing to me is why event.any_data seemingly seems to be different from the current state of the text.  Does this seem like a potential gail bug to you?  Can you dig more to verify that the event.any_data of the text inserted event seems to be the old value rather than the new value?

In addition, I guess a perfectly reasonable workaround would be to use getTextLineAtCaret for speech.


Comment 5 Rich Burridge 2008-03-04 18:23:14 UTC
> Does this seem like a potential gail bug to you?

I'm not sure. :-(

> Can you dig more to verify that the event.any_data of the 
> text inserted event seems to be the old value rather than 
> the new value?

Yes, it's the old value.

> In addition, I guess a perfectly reasonable workaround would be to use
> getTextLineAtCaret for speech.

Okay, I'll try to generate a patch that does that.

Thanks.


Comment 6 Joanmarie Diggs (IRC: joanie) 2008-03-04 19:35:22 UTC
(In reply to comment #5)
> > Does this seem like a potential gail bug to you?
> 
> I'm not sure. :-(

It's never been clear to me what's a gail bug versus a gtk+ bug, but fwiw you can reproduce the problem in Accerciser's event monitor.  :-) Seems that if text is selected when you Up/Down Arrow, the any_data is wrong for the object:text-changed:insert event.  If text isn't selected, the any_data seems to be correct.


Comment 7 Rich Burridge 2008-03-04 22:18:03 UTC
Thanks Joanie. Accerciser just hangs the desktop for me when I try to
Control-Alt-A to expand the component for the Hue spin button.

I've open gtk+/gail bug #520395 for this problem. I won't block it yet as
we can probably work around it using the equivalent of:

orca_state.activeScript.getTextLineAtCaret(self.accessible)
Comment 8 Rich Burridge 2008-03-04 22:46:40 UTC
Created attachment 106576 [details] [review]
Patch that I thought should have fixed the problem.

This patch works in asynchronous mode, i.e. speaks:

SPEECH OUTPUT: '239'
because of an "object:text-changed:insert" event, but doesn't
work in synchronous mode: still speaks:
SPEECH OUTPUT: '240'.

I double checked the braille output for the "object:text-changed:insert" event
when running synchronously and it was wrong (without the patch) and is still
wrong (with the patch):

BRAILLE LINE:  'gtk-demo Application Changing color ColorChooser ColorChooser Hue: 240 $l'
     VISIBLE:  'Hue: 240 $l', cursor=6

So the above patch will fix up the speech when Orca is running
asynchronously for the "object:text-changed:insert" event and the
"object:text-caret-moved" event ("239" each time),  but not
give the correct result in the regression test when running
synchronously. Better to have the right value twice then the
incorrect value twice.

So we have a few choices here:
1/ Apply this patch to improve the asynchronous (normal Orca)
   experience.
2/ Wait until the under lying gtk+/gail bug is fixed and block this
   bug against.
3/ Adjust the regression test to output "KNOWN ISSUE:".
4/ All of the above.
5/ Some of the above.

Thoughts?
Comment 9 Joanmarie Diggs (IRC: joanie) 2008-03-04 23:19:25 UTC
With or without the patch, I seem to get double-speech:

1. object:text-changed:delete
2. object:text-changed:insert

Without the patch I hear the old value and then the correct value; with the patch I hear the correct value (but twice).
Comment 10 Joanmarie Diggs (IRC: joanie) 2008-03-05 02:52:31 UTC
(In reply to comment #8)
> synchronously. Better to have the right value twice then the
> incorrect value twice.

Oops, I guess I should read more closely.  You already knew about the double speech.... Sorry Rich.

Still, I'm wondering if we can detect the condition in the object:text-changed:delete event as something we don't want to speak? 
Comment 11 Rich Burridge 2008-03-07 22:10:15 UTC
Created attachment 106813 [details] [review]
Fix up regression test #4 as KNOWN ISSUE.
Comment 12 Rich Burridge 2008-03-07 22:12:48 UTC
Two patches committed to SVN trunk. Closing as FIXED.

This means that it speaks the correct result (twice!)
when running asynchronously, and the incorrect result (twice!)
when running synchronously.

This also means that regression test #4 is now considered a
KNOWN ISSUE.