morrislchg / flexlib

Automatically exported from code.google.com/p/flexlib
0 stars 0 forks source link

QTP does NOT recognize rawchildren of ButtonScrollingCanvas #218

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Launch Flex app with  ButtonScrollingCanvas 
2. Launch QTP and start recording
3. Click on a button within ButtonScrollingCanvas.

What is the expected output? What do you see instead?
QTP should record the button click with ButtonScrollingCanvas

Please use labels and text to provide additional information.
mouseChildren="true" 
mouseEnabled="false" 
tabChildren="true" 
tabEnabled="false"

Possible fix is at line 236
this.addChild(innerCanvas); 
instead of rawChildern.addChild(innerCanvas); 

Side-effect for the above change is an unwanted HorizonalScrollBar.
If i turn it off the ButtonScrollingCanvas Right/Left button are invisible.

Original issue reported on code.google.com by vam6...@gmail.com on 1 May 2009 at 3:07

GoogleCodeExporter commented 8 years ago
Following changes resolved it for me:
Step 1: Line 236
this.addChild(innerCanvas); 
instead of rawChildern.addChild(innerCanvas);

Step 2:  Turn off scrolling in the Constructor
public function ButtonScrollingCanvas1(){ 
        super();
        this.horizontalScrollPolicy = ScrollPolicy.OFF;
        this.verticalScrollPolicy = ScrollPolicy.OFF;
        this.mouseChildren = true;
        this.mouseEnabled = false;
        this.tabChildren = true;
    this.tabEnabled = false;     
}

Step 3 : Comment out the check for Scrollpolicy in method 
enableOrDisableButtons()

protected function enableOrDisableButtons():void {
//                 if(this.horizontalScrollPolicy == ScrollPolicy.OFF) {
//                         leftButton.visible = rightButton.visible = 
leftButton.includeInLayout = rightButton.includeInLayout = false;
//                 }
//                 else {
                         leftButton.visible = leftButton.enabled = 
innerCanvas.horizontalScrollPosition > 0;
                         rightButton.visible = rightButton.enabled = 
innerCanvas.horizontalScrollPosition < innerCanvas.maxHorizontalScrollPosition;
//                 }

//                 if(this.verticalScrollPolicy == ScrollPolicy.OFF) {
//                         upButton.visible = downButton.visible = 
upButton.includeInLayout = downButton.includeInLayout = false;
//                 }
//                 else {
                         upButton.visible = upButton.enabled = 
upButton.includeInLayout = innerCanvas.verticalScrollPosition > 0;
                         downButton.visible = downButton.enabled = 
downButton.includeInLayout = innerCanvas.verticalScrollPosition < 
innerCanvas.maxVerticalScrollPosition;
//                 }

                 positionButtons(this.width, this.height);
             }

Original comment by vam6...@gmail.com on 1 May 2009 at 3:47

GoogleCodeExporter commented 8 years ago
I add button to the Panel's title bar but it can't be recognized by QTP. Any 
idea?
Thanks.

Original comment by cht...@gmail.com on 3 Aug 2009 at 2:17

GoogleCodeExporter commented 8 years ago
The problem, specifically, is that rawChildren aren't recognized by the 
automation
framework--here are my (simpler, I feel) changes to make this work:

        override public function get numAutomationChildren():int
        {
            // Only the innerCanvas.
            return 1;
        }

        override public function getAutomationChildAt( index:int ):IAutomationObject
        {
            return innerCanvas;
        }

You'll have to import mx.automation.IAutomationObject, of course.

Original comment by salmanha...@gmail.com on 16 Nov 2009 at 3:47

GoogleCodeExporter commented 8 years ago
I haven't tried this, but you could probably do the exact same thing for the 
Panel's
buttons, also--just remember that you're responsible for returning ALL immediate
children that can be tested, so you should probably return the regular 
numChildren +
number of panel buttons as the numAutomationChildren and have 
getAutomationChildAt
return the usual getChildAt until the index is actually higher than 
numChildren, at
which point you should fall back to your new panel buttons.

Original comment by salmanha...@gmail.com on 16 Nov 2009 at 3:49