Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ComboBox.GetAllItems fails on non-English Windows OS #31

@brian-mcmaster

Description

@brian-mcmaster

Specifically, because it hard-codes English strings when looking for sub-controls and control types, such as "Open" and "list_item". These captions are localized on other OS's... i.e. on Spanish these captions are "Abrir" and "elemento de listo," respectively. Here is the diff of how I fixed it. Replaced "Open" with "*" since there should only be one button-type control as a child of a combobox. Also replaced "list_item" with the ControlType.ListItem property. I had to add the element's control type to the propertyHT in Utils.cs at the bottom.

This is just the first issue I encountered running one of our tests in localized OS. I imagine there are many other hard-coded strings in LDTP.

==== cobra-master\Ldtpd\Combobox.cs ====
168c168,169

< elementItem = utils.GetObjectHandle(childHandle, "Open", type, true);

            // find the Open button, but use '*' as the caption since it gets localized on different OS's
            elementItem = utils.GetObjectHandle(childHandle, "*", type, true);

207,208c208,210
< case "Verify":

< elementItem = utils.GetObjectHandle(childHandle, "Open",

                        case "Verify":
                            // find the Open button, but use '*' as the caption since it gets localized on different OS's
                            elementItem = utils.GetObjectHandle(childHandle, "*",

238,239c240,242
< LogMessage("GetComboValue");

< elementItem = utils.GetObjectHandle(childHandle, "Open",

                            LogMessage("GetComboValue");
                            // find the Open button, but use '*' as the caption since it gets localized on different OS's
                            elementItem = utils.GetObjectHandle(childHandle, "*",

298,299c301,303
< InternalTreeWalker w = new InternalTreeWalker();

< elementItem = utils.GetObjectHandle(childHandle, "Open",

                            InternalTreeWalker w = new InternalTreeWalker();
                            // find the Open button, but use '*' as the caption since it gets localized on different OS's
                            elementItem = utils.GetObjectHandle(childHandle, "*",

330c334

< className.Contains("list_item"))

                                    propertyHT["control_type"] == ControlType.ListItem)

==== cobra-master/Ldtpd/Utils.cs#1 - d:\dev\experience-dev\product-tests\third-party\LDTP\cobra-master\Ldtpd\Utils.cs ====
894a895
propertyHT.Add("control_type", element.Current.ControlType);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions