Abstract:
Displayed inconsistencies and errors within a visual resource (e.g., dialog, menu) and between two visual resources are automatically detected without requiring the execution of an application having either of the visual resources. When a source application is localized, its visual resources are extracted and translated into the target language. This translation of the visual resources often causes errors in the visual display. The visual resource analyzer of the invention identifies these errors without requiring execution of either the source or localized versions of the application, which enables the errors to be easily corrected. Furthermore, the elements of a visual resource are analyzed for display anomalies, such as alignment errors and overlapping other elements.

Description:
FIELD OF THE INVENTION 
     This invention relates to computer programming, and more particularly, to a framework and method for analyzing properties of visual resources to detect inconsistencies within a visual resource, or anomalies created during the localization process. 
     BACKGROUND OF THE INVENTION 
     The user interface of a software application distributed internationally requires several versions of its user interface to conform to local languages. The process of creating these different versions from a source version, which is typically an English language version, is called &#34;localization.&#34; It is a rather involved process to translate the local language of an application into a different local or target language, especially while maintaining the same &#34;look and feel&#34; of the application. For example, it is desirable that visual resource elements maintain their same relative positions and sizes. 
     Localization requires more than a mere substitution of character strings in the visual resources (menus, dialog boxes, titles, toolbars, and the like) to convert from the source to a target language. For example, translated visual resources must be modified to account for varying lengths of the character strings representing a word or phrase which can change substantially between two languages. For instance, the length of text in a visual resource of an application often grows when it is translated from English to a different language. For example, the English word &#34;Edit&#34; becomes &#34;Bearbeiten&#34; in German, and &#34;Sort Ascending&#34; becomes &#34;Lajittele nousevassa jarjestyksessa&#34; in Finnish. Deviation in lengths substantially complicates the localization process. 
     A vast majority of the problems associated with localized products are attributed to &#34;visual bugs.&#34; These visual bugs include such things as overlapped controls, truncated text on a control, and alignment errors. To manually check each visual resource of an application converted to a target language requires extensive resources and is costly and time consuming. Current localization tools do not currently provide for immediate testing as individual visual resources are localized. Rather, the localized application must be executed, and then a user or a testing tool manipulates the menus and commands to display the visual resources for a human tester to visually inspect each visual resource and attempt to spot the errors. Even if all visual resources are viewed, slight alignment errors are difficult to detect. Furthermore, only the localized visual resources are displayed by a localized application so a direct comparison between the source and localized visual resources is not available. In addition, truncation bugs are particularly difficult to spot because the application&#39;s tester is quite often not fluent in the target language, and therefore, may not know if a few characters are not displayed. 
     SUMMARY OF THE INVENTION 
     According to the invention, an automated method and framework are provided for detecting visual anomalies between a source application and its corresponding localized application without requiring the localized or source application to be compiled or executed. In addition, this method and framework compares localized and source visual resources to determine any changes, especially those that deviate from the &#34;look and feel&#34; of the source visual resources. Hereinafter, the word &#34;static&#34; will be used to describe a state of an application in which it is not executing. The checking of visual resources in a static condition provides an easy means for exhaustively testing each localized visual resource. Conventional testing methods require extensive knowledge of the application and painstaking manipulation of the localized application at run time in order to display and scrutinize each and every visual resource. Moreover, by combining the invention disclosed herein with a program that performs the localization of a source application, immediate testing results can be provided as each translation is made. This provides a substantial time and cost savings as errors are immediately detected and corrected. 
     A visual resource analyzer having the foregoing features statically tests the properties and characteristics of the localized visual resources incorporating the target language, and reports errors and discrepancies. The visual resource analyzer receives as its inputs the visual resources of the source and localized applications and the tests to be performed on these visual resources. Examples of tests that may be performed by the visual resource analyzer include checking for alignment, overlap, dialog initialization and fit errors. Additionally, by comparing the display properties of the source and localized visual resources, the analyzer identifies elements of the visual resources whose positions or sizes have changed as a result of the localization process. 
     Alignment errors in a localized visual resource occur when one or more of the elements of the resource are not properly horizontally or vertically aligned with respect to other elements of the localized visual resource. By comparing the position of each resource element with the positions of other resource elements, those elements that are not in the same position but are within some small delta (e.g., a few pixel positions) can be identified as potential alignment errors. 
     Errors in a localized visual resource may also result from overlapping elements within the localized visual resource or other visual resources. By comparing the position and size of each element with that of the other elements of the localized visual resource, the overlapping visual resource elements can be identified by the visual resource analyzer. 
     Dialog initialization errors sometimes occur in a localized visual resource when a text string is provided to the visual resource at runtime. While the dynamic elements of a visual resource are not available before runtime, the visual resource analyzer can detect errors by performing a series of tests on the dialog initialization data of the visual resources. For example, the visual resource analyzer tests controls and list boxes to ensure the number of initialization strings are the same. 
     Fit errors occur, for instance, when a text string displayed in a localized visual resource does not fit within the allocated space on the user interface. The visual resource analyzer employs a standard function supplied by the operating system to determine the space needed to display the string based on the desired font type and size. The visual resource analyzer identifies fit errors by comparing the space required with the space available in the localized visual resource. 
     Using the disclosed methods and framework to perform tests where the visual resource analyzer has access to the source and localized visual resources, the localized visual resource can be readily analyzed for inconsistencies and errors with respect to both the localized visual resources and source visual resources from which the localized version is based. Furthermore, the visual resource analyzer may be configured to communicate with localization software to test changes immediately after they are made. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The appended claims set forth the features of the present invention with particularity. The invention, together with its advantages, may be best understood from the following detailed description taken in conjunction with the accompanying drawings of which: 
     FIG. 1 is a block diagram of an exemplary operating environment in which the invention may be practiced, including a computer system for executing a visual resource analyzer in accordance with the invention; 
     FIG. 2A is a block diagram of one embodiment of the visual analysis framework using the visual resource analyzer to test visual resources; 
     FIG. 2B is a block diagram of the visual resource analyzer incorporated into a software localization system; 
     FIG. 3 illustrates exemplary English and Japanese versions of a &#34;Save As&#34; dialog box; 
     FIG. 4 is a high-level flow diagram describing the steps performed by the visual resource analyzer to analyze visual resources in accordance with one embodiment of the present invention described herein; 
     FIG. 5 is a flow diagram illustrating the framework for executing various tests to be performed on the localized visual resource elements; and 
     FIGS. 6A-6E present pseudo code for performing the visual analyzer tests illustrated in the flow diagram of FIG. 5. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 1 and the following discussion are intended to provide a brief, general description of a suitable computing environment in which the invention may be implemented. Although not required, the invention will be described in the general context of computer-executable instructions, such as program modules, being executed by a personal computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices. 
     With reference to FIG. 1, an exemplary system for implementing the invention includes a general purpose computing device in the form of a conventional personal computer 20, including a processing unit 21, a system memory 22, and a system bus 23 that couples various system components including the system memory to the processing unit 21. The system bus 23 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The system memory includes read only memory (ROM) 24 and random access memory (RAM) 25. A basic input/output system 26 (BIOS) containing the basic routines that helps to transfer information between elements within the personal computer 20, such as during start-up, is stored in ROM 24. The visual resource analyzer, stored in system memory 22, will be executed by processing unit 21. The personal computer 20 further includes a hard disk drive 27 for reading from and writing to a hard disk, not shown, a magnetic disk drive 28 for reading from or writing to a removable magnetic disk 29, and an optical disk drive 30 for reading from or writing to a removable optical disk 31 such as a CD ROM or other optical media. The hard disk drive 27, magnetic disk drive 28, and optical disk drive 30 are connected to the system bus 23 by a hard disk drive interface 32, a magnetic disk drive interface 33, and an optical drive interface 34, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer readable instructions, data structures, program modules and other data for the personal computer 20. Although the exemplary environment described herein employs a hard disk, a removable magnetic disk 29 and a removable optical disk 31, it should be appreciated by those skilled in the art that other types of computer readable media which can store data that is accessible by a computer, such as magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories (RAMs), read only memories (ROM), and the like, may also be used in the exemplary operating environment. 
     A number of program modules may be stored on the hard disk, magnetic disk 29, optical disk 31, ROM 24 or RAM 25, including an operating system 35, one or more application programs 36, other program modules 37, and program data 38. A user may enter commands and information into the personal computer 20 through input devices such as a keyboard 40 and pointing device 42. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 21 through a serial port interface 46 that is coupled to the system bus, but may be collected by other interfaces, such as a parallel port, game port or a universal serial bus (USB). A monitor 47 or other type of display device is also connected to the system bus 23 via an interface, such as a video adapter 48. In addition to the monitor, personal computers typically include other peripheral output devices (not shown), such as speakers and printers. 
     The personal computer 20 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 49. The remote computer 49 may be another personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the personal computer 20, although only a memory storage device 50 has been illustrated in FIG. 1. The logical connections depicted in FIG. 1 include a local area network (LAN) 51 and a wide area network (WAN) 52. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet. 
     When used in a LAN networking environment, the personal computer 20 is connected to the local network 51 through a network interface or adapter 53. When used in a WAN networking environment, the personal computer 20 typically includes a modem 54 or other means for establishing communications over the wide area network 52, such as the Internet. The modem 54, which may be internal or external, is connected to the system bus 23 via the serial port interface 46. In a networked environment, program modules depicted relative to the personal computer 20, or portions thereof, may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used. 
     Before describing the block diagrams of FIGS. 2A and 2B and to aid in the understanding of the testing performed by the visual resource analyzer 130, FIG. 3 presents an exemplary English &#34;Save As&#34; dialog box (the source visual resource) 300, and a Japanese &#34;Save As&#34; dialog box (the target visual resource) 350. The sizes of dialog boxes 300 and 350 are different, partly due to the larger system font used for Japanese Windows NT 3.x. Elements 310, 320, and 330 of the English dialog box 300 correspond with elements 360, 370, and 380 of the Japanese dialog box 350. Due to the difference in size of the font and text strings, many of the elements of the target visual resource 350 need to be expanded and shifted, which can result in non-alignment, overlapping of elements, and text truncations. For instance, the left and right sides of elements 360, 370, and 380 are correctly vertically aligned. Should one of these elements be shifted slightly left or right, the visual resource analyzer 130 would detect an alignment error. 
     Turning now to FIG. 2A, shown is a block diagram of the visual resource analyzer framework 100 for testing visual resources by the visual resource analyzer 130. As indicated, the visual resource analyzer 130 receives as its inputs localized or &#34;target&#34; visual resources 120, the source visual resources 110, and commands 115. The commands 115 correspond to a set of tests to be performed on the target visual resources 120. The diagnostic output 140, produced by the visual resource analyzer 130, indicates the results of the operations performed in response to commands 115. The diagnostic output 140 could be in many different forms, including messages displayed on a monitor 47 (FIG. 1), sent to the program performing the localization translations, or written to a file stored on a hard disk drive 27, magnetic disk drive 28, and optical disk drive 30. 
     Source visual resources 110 and target visual resources 120 are presented to visual resources analyzer 130 which are converted to internal data structures 135 which the visual resource analyzer 130 can manipulate. In one embodiment of the present invention in the Windows environment, the source and target visual resources (110, 120) are presented in the standard Win32 binary resource format, which is described in &#34;Win32 Binary Resource Formats&#34;, Microsoft MSDN CD 10, Microsoft Corporation (January 1995), which is hereby incorporated by reference. The source and target visual resources are then internally converted by the visual resource analyzer 130 and stored in C++ Microsoft Foundation Class (MFC) objects. MFC classes are described in Microsoft Visual C++ Version 5.0, Microsoft Corporation (1997), and in &#34;MFC 4.2&#34;, Microsoft Developer Network Library Edition--October 1997, Microsoft Corporation (1997). Each of these references are hereby incorporated by reference. For instance, if the visual resource is a dialog, then a CDialogTemplateEx object, derived from the MFC CDialogTemplate object would be used. The CDialogTemplateEx object contains multiple CDialogItemTemplates, one to represent each control element in the dialog. The CDialogItemTemplate contains zero or one CDialogInitTemplates which contain control specific dialog initialization data. Included in this embodiment, the internal data structure 135 includes a data structure element identifying the type of visual resource (e.g., dialog, menu, control) for visual resources represented therein. 
     As the present invention is not limited to the Windows environment, the source and target visual resources (110, 120) could be presented in other formats, such as those native to other operating environments (e.g., Unix, Macintosh). Similarly, a multitude of formats could be used for internal data structures 135. 
     In another configuration which is shown in FIG. 2B, the visual resource analyzer 130 is incorporated into a software localization system 200. The software localization system 200 comprises an editor subsystem 210 and a parser subsystem 220. The editor subsystem 210 provides the localization editing functions and a graphical user interface which allow the user to localize a source application into a target application. The parser subsystem 220 parses the native file format (e.g., source or object code, or executable image) of the source and target application files 235 to extract the visual resources and to populate the application visual resource database 230 with the extracted visual resources (110, 120). The parser subsystem 220 can also insert the target visual resources stored in the application visual resource database 230 into the target application stored in the target and source application files 235 after the visual resources have been localized by the editor subsystem 210. In one embodiment of the present invention in the Windows environment, the parser subsystem 220 uses Win32 APIs (application programming interfaces) to extract visual resources from executable application files. These APIs are described in &#34;Win32 APIs to Update and Extract Resources From PE Format Files&#34;, Microsoft Win32 SDK, Microsoft Corporation (1992), which is hereby incorporated by reference. 
     In the Windows environment, the editor subsystem 210 initiates a test by communicating via a Microsoft Component Object Model (COM) object. Commands 115, target visual resources 120, and source visual resources 110 are communicated via these COM objects to the visual resource analyzer 130. The visual resource analyzer 130 then performs the desired tests indicated by the commands 115, and sends the results 145 via COM objects to the editor subsystem 210 which displays the results to the user. COM objects and interfaces are described in &#34;COM&#34;, Microsoft Developer Network Library Edition--October 1997, Microsoft Corporation (1997), which is hereby incorporated by reference. In other embodiments, message passing or other communication mechanisms could be used instead of COM objects. In addition, all or some of the functions of software localization system 200 (i.e., the visual resource analyzer 130, editor subsystem 210, and parser subsystem 220) could be placed within a single application which would possibly eliminate the need for such a communications mechanism. 
     Turning now to FIG. 4, shown is a high-level flow diagram describing the process performed by the visual resource analyzer. First, in steps 410 and 420, the tests to be performed and the visual resources to be tested are identified. Next, while there are visual resources remaining to be tested as determined in step 430, a target visual resource is acquired in step 450 and a source visual resource is acquired in step 460. Next, in step 470, the specified tests are performed by the visual resource analyzer 130, with the diagnostic output 140 being reported in step 480. 
     FIG. 5 provides a flow diagram for performing the visual resource analyzer tests of step 470 in FIG. 4. This flow diagram illustrates a conventional case statement, with one entry for each possible test. Illustrated are five tests which could be performed: alignment test (step 515), overlap test (step 525), dialog initialization test (step 535), fit test (step 545), and visual resource element consistency test (step 555). These five tests are described in FIGS. 6A-E, where exemplary pseudo code is presented. As evident to one skilled in the art, these five tests are only an illustrative subset of tests which could be performed by the visual resource analyzer 130 within the visual resource analyzer framework 100 in accordance with the invention. 
     The alignment test of step 515 is described in FIG. 6A in which the horizontal (X) and vertical (Y) position of each visual resource element VRE 1  of the target visual resource is compared with the other visual resource elements VRE 2 . If the relative horizontal positions of VRE 1  and VRE 2  are not equal but are within some small predetermined delta amount (Δx), then a potential alignment error has been detected. Similarly, the relative vertical positions of VRE 1  and VRE 2  are compared, and if they are not equal but within some small predetermined delta amount (Δy), then a potential alignment error has been detected. 
     The overlap test of step 525 is described in FIG. 6B, in which the size and position of each visual resource element VRE 1  of the target visual resource is compared with those of the other visual resource elements VRE 2  of the target visual resource. If any VRE 1  and VRE 2  overlap, an overlap error has been detected. 
     The dialog initialization test of step 535 is described in FIG. 6C. Certain dynamic visual resources such as dialogs do not acquire the text of strings to be displayed until runtime. Therefore, exhaustive testing is not available without executing the target application. However, listbox controls and combo box controls may contain lists of strings to be initially viewed in the control. These strings are stored in a dialog initialization resource. It is possible to compare the number of elements in the source initialization resource with that of the target initialization resource. If they are not the same, then an error has been detected. 
     The fit test of step 545 is described in FIG. 6D, in which text strings are tested to ensure they will be fully displayed in the allotted display space available in the target visual resource. As described, the display size of the text string is determined by a function call to the operating system, which provides the required display space requirements based on the font type, font size and text of the string. If the returned display size exceeds the space allotted in the target visual resource, then a fit error has been detected. 
     Finally, the visual resource element consistency test of step 555 is described in FIG. 6E, in which each visual resource element in the target visual resource is compared with the corresponding visual resource element in the source visual resource. Any differences in display characteristics (e.g., size, position) are determined and recorded. For example, each control in a target dialog (CDialogItemTemplates object) is compared with the corresponding control in the source dialog. 
     After the visual resource analysis has been performed as indicated in steps 510-555 of FIG. 5 (corresponding to step 470 of FIG. 4), processing continues in step 480 of FIG. 4 whereby the Results 145 of the Visual Resource Analyzer 130 are sent to a diagnostic output device 140 or a calling routine or process, such as the editor subsystem 210 of the software localization system 200. Next, returning to step 430, if there are no more visual resources to be tested, then the visual resource analyzer is done as indicated in step 440, else more visual resources are tested as described herein. 
     In view of the many possible embodiments to which the principles of our invention may be applied, it should be recognized that the embodiment described herein with respect to the drawing figures is only illustrative and should not be taken as limiting the scope of the invention. To the contrary, the invention as described herein contemplates all such embodiments as may come within the scope of the following claims and equivalents thereof.