Hi,

I have a custom panel  which extends panel.
Added one button to the titlebar of the custom panel, But in QTP i am
not able to detect the button which present in titlebar of custom
panel.

Can anyone tell or suggest me how will i get the instance on QTP?

Below is the code that i wrote for customdelegate & class definition
file(TEAFlexCustom.xml)

Delegate:----------


[Mixin]
        public class ResizablePanelDelegate extends PanelAutomationImpl
        {
                private var resizablePanel:ResizablePanel;

                public function ResizablePanelDelegate( resize:ResizablePanel )
                {
                        super( resize );
                        resizablePanel = resize;
                        
resizablePanel.MinMaxBtn.addEventListener(MouseEvent.CLICK,
clickHandler);
        
resizablePanel.MinMaxBtn.addEventListener(AutomationRecordEvent.RECORD,
labelRecordHandler);
                }


                public static function init(obj:DisplayObject):void
                {
                        AutomationManager.registerDelegateClass(ResizablePanel,
ResizablePanelDelegate);
                }


                private function clickHandler(event:MouseEvent):void
                {
                        
resizablePanel.MinMaxBtn.addEventListener(CustomEvent.PANEL_RESIZE,
resizeHandler);
                }


                private function resizeHandler(event:CustomEvent):void
                {
                        recordAutomatableEvent(event);
                }


                public function
labelRecordHandler(event:AutomationRecordEvent):void
                {
                        // if the event is not from the owning component reject 
it.
                        if(event.replayableEvent.target != uiComponent)
                                //event.preventDefault(); can also be used.
                                event.stopImmediatePropagation();
                }


                override public function get numAutomationChildren():int
                {
                        /*var numChildren:int = 0;
                        var renderers:Array = resize.getItemRenderers();
                        for(var i:int = 0;i< renderers.length;i++)
                        {
                        numChildren += renderers[i].length;
                        }
                        return numChildren;*/
                        var result:int = super.numAutomationChildren;
                        var controlBar:Object = resizablePanel.getControlBar();

                        if (controlBar && (controlBar is IAutomationObject))
                                ++result;

                        if ( resizablePanel.MinMaxBtn )
                                ++result;

                        return result;

                }


                override public function
getAutomationChildAt(index:int):IAutomationObject
                {
                        /*var numChildren:int = 0;
                        var renderers:Array = resize.getItemRenderers();
                        for(var i:int = 0;i < renderers.length;i++)
                        {
                        if(index >= numChildren)
                        {
                        if(i+1 < renderers.length && (numChildren + 
renderers[i].length) <=
index)
                        {
                        numChildren += renderers[i].length;
                        continue;
                        }

                        var subIndex:int = index - numChildren;
                        var instances:Array = renderers[i];
                        return (instances[subIndex] as IAutomationObject);
                        }
                        }
                        return null;*/
                        var result:int = super.numAutomationChildren;
                        var controlBar:Object = resizablePanel.getControlBar();
                        if (index < result)
                        {
                                return super.getAutomationChildAt(index);
                        }

                        if (controlBar)
                        {
                                if(index == result)
                                        return (controlBar as 
IAutomationObject);
                                ++result;
                        }

                        if (resizablePanel.MinMaxBtn && index == result)
                                return (resizablePanel.MinMaxBtn as 
IAutomationObject);

                        return null;

                }


                override public function
createAutomationIDPart(child:IAutomationObject):Object
                {
                        var help:IAutomationObjectHelper =
Automation.automationObjectHelper;
                        return help.helpCreateIDPart(this, child);
                }


                override public function
resolveAutomationIDPart(part:Object):Array
                {
                        var help:IAutomationObjectHelper =
Automation.automationObjectHelper;
                        return help.helpResolveIDPart(this, part as 
AutomationIDPart);
                }


                override public function
replayAutomatableEvent(event:Event):Boolean
                {
                        var help:IAutomationObjectHelper =
Automation.automationObjectHelper;
                        if (event is CustomEvent)
                        {
                                var rEvent:CustomEvent = event as CustomEvent;
                                help.replayClick(rEvent.itemRenderer);
                                (uiComponent as IInvalidating).validateNow();
                                return true;
                        }
                        else
                                return super.replayAutomatableEvent(event);
                }



Classdefinition:---

<TypeInformation xsi:noNamespaceSchemaLocation="ClassesDefintions.xsd"
Priority="0" PackageName="TEA" Load="true" id="Flex" xmlns:xsi="http:/
/www.w3.org/2001/XMLSchema-instance">

        <ClassInfo Name="ResizePanel" GenericTypeID="resizePanel"
Extends="FlexPanel" SupportsTabularData="false">
                <Description>ResizePanel</Description>
                <Implementation Class="containers::ResizablePanel"/>
                <TypeInfo>
                        <Operation Name="Click" PropertyType="Method"
ExposureLevel="CommonUsed">
                                <Implementation 
Class="flash.events::MouseEvent" Type="click"/>
                                <Argument Name="inputType" IsMandatory="false"
                                        DefaultValue="mouse">
                                        <Type VariantType="String"/>
                                </Argument>
                        </Operation>
                        <Operation Name="MinmaxButton" PropertyType="Method"
ExposureLevel="CommonUsed">
                                <Implementation 
Class="framework.panel.events::CustomEvent"
Type="panel_resize"/>
                                <Argument Name="MinMaxButton" 
IsMandatory="true" >
                                        <Type VariantType="String" 
Codec="automationObject"/>
                                        <Description>User clicked 
MaxMinButton</Description>
                                </Argument>
                        </Operation>
                </TypeInfo>
                <Properties>
                        <Property Name="automationClassName" 
ForDescription="true">
                                <Type VariantType="String"/>
                                <Description>To be written.</Description>
                        </Property>
                        <Property Name="automationName" ForDescription="true">
                                <Type VariantType="String"/>
                                <Description>The name used by the automation 
system to identify an
object.</Description>
                        </Property>
                        <Property Name="className" ForDescription="true">
                                <Type VariantType="String"/>
                                <Description>To be written.</Description>
                        </Property>
                        <Property Name="id" ForDescription="true" 
ForVerification="true">
                                <Type VariantType="String"/>
                                <Description>Developer-assigned 
ID.</Description>
                        </Property>
                        <Property Name="automationIndex" ForDescription="true">
                                <Type VariantType="String"/>
                                <Description>The object's index relative to its 
parent.</
Description>
                        </Property>
                        <Property Name="openChildrenCount" 
ForVerification="true"
ForDefaultVerification="true">
                                <Type VariantType="Integer"/>
                                <Description>Number of children open 
currently</Description>
                        </Property>
                </Properties>
        </ClassInfo>

</TypeInformation>



Thanks
Sushil

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to