Bug 471757

Summary: Current value, Minimum value and maximum value do not seem correct
Product: [Mono] UI Automation Reporter: Brian Merrell <bgmerrell>
Component: Winforms - GeneralAssignee: E-mail List <mono-a11y-bugs>
Status: NEW --- QA Contact: E-mail List <mono-a11y-qa>
Severity: Normal    
Priority: P3 - Medium CC: mgorse
Version: Release 1.0   
Target Milestone: Release 1.1   
Hardware: All   
OS: Linux   
Whiteboard:
Found By: Integration Test Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: splitter1.py example referenced above
splitter1.py example referenced above

Description Brian Merrell 2009-02-02 23:10:53 UTC
PROBLEM STATEMENT

The minimum value has the same value in two different cases even though the splitter location is different in each case.  The same is true for the current value.

The maximum value changes in two different cases even though the window is the same size.  Since the window does not change sizes, I would not expect the maximum value to change.

REPRO

1.  Run Accerciser, open the "Interface Viewer" tab, and expand the "Value" expander
2.  Run the first attached sample (splitter1.py)
3.  Run the second attached sample (splitter2.py)
4.  Notice that the splitter control is located higher up on the window on splitter2.py (because some labels were removed). 
5.  Browse to and select the "split pane" accessible of splitter1.py in Accerciser's left pane.
6.  In the "Interface Viewer" tab, notice that the current value and minimum value are 25 and the maximum value is 176.
7.  Browse to and select the "split pane" accessible of splitter2.py in Accerciser's left pane.
8.  In the "Interface Viewer" tab, notice that the current value and minimum value are 25 and the maximum value is 245.

RESULTS

The current value and minimum value is the same (25) in each example application, even though the splitter is obviously in a different place.  The maximum value is different between the example applications even though the size of the window has not changed.

EXPECTED RESULTS

I would expect the maximum value to not change between the two example applications.

I would expect the current value to be different between the two example applications because the splitter starts in a different location for each example application.

I would expect the minimum value to be different between the two example applications because the splitter is limited to different heights when dragging it upward in the two example applications.

COMMENTS

This bug is likely related to Mono WinForms Bug 469569 and Mono WinForms Bug 471749.  So we might need to wait for those to be fixed first.
Comment 1 Brian Merrell 2009-02-02 23:11:36 UTC
Created attachment 269436 [details]
splitter1.py example referenced above
Comment 2 Brian Merrell 2009-02-02 23:12:02 UTC
Created attachment 269437 [details]
splitter1.py example referenced above
Comment 3 Rui Guo 2009-03-17 14:54:03 UTC
Brian, I think in this case there is no bug (or just one little bug) in the UIA module, and some incorrect behaviors are caused by bugs of SWF.

To be specific, I think these behavior are bugs:
a) We can drag a splitter up, and make its position value even less than the splitter's MinValue (Shall be a SWF bug).
b) In sample#1, We shall not allowed to drag the splitter too high (i.e. shall not drag it higher than the top of Label0), however while dragging, end-user can drag the splitter nearly up to the top of the form, though after the dragging action is released the result of the splitter's final position won't be violated since the topmost position for splitter will not exceed the top of Label0. This behavior could misleads the end-user (allow them drag the splitter to disallowed area while dragging). And this shall be a bug of SWF.

And I think as bugs are NOT bug:
c)The current value of the two samples are the same. I think it is correct. 

From MSDN (http://msdn.microsoft.com/en-us/library/aa983728(VS.71).aspx):
"The splitter control allows the user to resize the docked control that is immediately before it. Therefore, to enable the user to resize a docked control at run time, dock the control to be resized to an edge of a container, and then dock a splitter control to the same side of that container."

As we look into splitter1.py:
        self.Controls.Add(self.label4)
        self.Controls.Add(self.splitter)
        self.Controls.Add(self.label0)
        self.Controls.Add(self.label1)
        self.Controls.Add(self.label2)
        self.Controls.Add(self.label3)
So in this case, the splitter is just used to control the size of label0, and the splitter's value is calculated from the top position of label0, and that's why we get the initial value of 25 pixels. And similarly, in sample 2, the splitter controls the size of the upper lable.

So, why the minimal values are 25 in both samples? The reason is for a splitter, the default MinValue is 25, and the MinValue will not change until it is explicitly be assigned by other objects. However we can drag the position value to 0 in both samples even if the MinValues are 25, and even if we explicitly set the MinValue to 10, we can still drag the splitter's position to 0. (You may see it by using my test script which will be posted after this comment).  And that's exactly I mean when writing the "a)" section.
BTW, "splitter's postion equals to 0" means the height of the label on the top of the splitter is shrunk to 0.

And finally, for now I understand that the splitter will not fire an event (no UIA event, and therefore there is no ATK notification either) when its MinValue/MaxValue get changed. It's easy to handle the change of MinValue (fire an event in the MinValue property's setter, in SWF code base), however, the splitter's MaxValue property has no setter (see SWF_source_folder/Splitter.cs), and is dynamically calcuated when its getter is called. I havn't figured out how to handle this situation and achieve to make ATs be aware of the change of splitter's MaxValue.
Comment 4 Rui Guo 2009-03-17 14:58:58 UTC
My test sciprt is pasted as following. the script is modified from sample 1.  the diff are:a)the MinSize of the splitter is explicitly set to 10 b) Add a button to the UI, by clicking this button you can get the splitter's current position value and MinValue.
P.S. Add 1 additonal work hour, it cost me that much time to write these comments...
----
# imports
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Windows.Forms import Application, DockStyle, Form, Splitter, Label, BorderStyle, Button, MessageBox
from System.Drawing import Color
from System import *

class SplitterSample(Form):
    """Splitter control class"""

    def __init__(self):
        """SplitterSample class init function."""

        # setup title
        self.Text = "Splitter control 1"

        # setup labels
        self.label0 = Label()
        self.label0.Dock = DockStyle.Top
        self.label0.BackColor = Color.DarkCyan
        self.label0.Text = "label0 on one side against splitter"

        self.label1 = Label()
        self.label1.Dock = DockStyle.Top
        self.label1.BackColor = Color.DarkCyan
        self.label1.Text = "label1 on one side against splitter"

    self.label2 = Label()
        self.label2.Dock = DockStyle.Top
        self.label2.BackColor = Color.DarkCyan
        self.label2.Text = "label2 on one side against splitter"
   
    self.label3 = Label()
        self.label3.Dock = DockStyle.Top
        self.label3.BackColor = Color.DarkCyan
        self.label3.Text = "label3 on one side against splitter"

        self.label4 = Label()
        self.label4.Dock = DockStyle.Top
        self.label4.Text = "label4 on the other side against splitter"
        self.label4.BackColor = Color.Coral


        # setup splitter
        self.splitter = Splitter()
        self.splitter.Dock = DockStyle.Top
        self.splitter.BorderStyle = BorderStyle.Fixed3D
        self.splitter.MinSize = 10

        # add controls
        self.Controls.Add(self.label4)
        self.Controls.Add(self.splitter)
        self.Controls.Add(self.label0)
        self.Controls.Add(self.label1)
        self.Controls.Add(self.label2)
        self.Controls.Add(self.label3)

        self.button1 = Button()
        self.button1.Name = "button1"
        self.button1.Text = "button1"
        self.button1.BackColor = Color.Green
        self.button1.ForeColor = Color.Red
        self.button1.Width = 100
        self.button1.Height = 25
        self.button1.Dock = DockStyle.Fill
        self.button1.Click += self.button1_click

        self.Controls.Add(self.button1)

    def button1_click(self, sender, event):
        MessageBox.Show(String.Format("Value: {0}, {1}", self.splitter.SplitPosition, self.splitter.ToString()))

# run application
form = SplitterSample()
Application.EnableVisualStyles()
Application.Run(form)
Comment 5 Feng Xia Mu 2009-04-01 09:32:46 UTC
hi brian, I find the similar problem: the splitter control can reach it's maxvalue by being stetted in programme  but by hand  can't reach it's bottom line.

REPRO

1.  Run Accerciser, open the "Interface Viewer" tab, and expand the "Value"
expander
2.  Run the first attached sample (splitter1.py)
3.  Browse to and select the "split pane" accessible of splitter1.py in
Accerciser's left pane.
4.  in accerciser, under "interface viewer"->"value" shows:
    "Current  value  25
     Minimum  value  25.0
     Maximum  value  176.0
    "
5.   drag the splitter up to it's highest position, and this position is higher than the initial position.
     in accerciser,do "Refresh Node", under "interface viewer"->"value" shows:
    "Current  value  25
     Minimum  value  25.0
     Maximum  value  176.0
    "

for step 5, I would expect the "Current  value" should not "25" yet.
Comment 6 Feng Xia Mu 2009-04-01 09:48:12 UTC
for the problem:"the splitter control can reach it's maxvalue by being stetted in programme  but by hand  can't reach it's bottom line."

REPRO

1.  Run Accerciser, open the "Interface Viewer" tab, and expand the "Value"
expander
2.  Run the first attached sample (splitter1.py)
3.  Browse to and select the "split pane" accessible of splitter1.py in
Accerciser's left pane.
4.  in accerciser, under "interface viewer"->"value" shows:
    "Current  value  25
     Minimum  value  25.0
     Maximum  value  176.0
    "
5.   drag the splitter up to it's bottom position as low as possible, 
     in accerciser,do "Refresh Node", under "interface viewer"->"value" shows:
    "Current  value  107
     Minimum  value  25.0
     Maximum  value  176.0
    "
6.  in gnome-terminal : close splitter1.py and do "vim splitter1.py " 
    in line 71 of splitter1.py, add the codes "self.label0.Height = 176"

7.  Run the splitter1.py again

8.  in accerciser, under "interface viewer"->"value" shows:
    "Current  value  176
     Minimum  value  25.0
     Maximum  value  176.0

from the result of step 5, we can see that drag the splitter control by hand can't get the "Maximum   value  176"

from the result of step 8, we can see that actually if we set the label0's height to 176, the splitter control can reach the 176(Maximum  value)
Comment 7 Brad Taylor 2009-05-01 20:10:14 UTC
Unassigning from Matt, as he's working on other things at the moment.