problem with enter text and locale

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

problem with enter text and locale

Postby hyshyshys » Fri Oct 23, 2009 8:45 am

Hi,

Before integrating our tests on CI servers, I made some tests with different sets of locale settings. Unfortunately, the ui.enterText(...) function doesn't work correctly depending on the keyboards and languages settings.

1- When I run tests with US keyboard and English(Canada) language, everything works correctly.
2- When I run tests with Canadian french keyboard and English(Canada) language, the enterText function outputs wrong characters when characters are non alpha-numeric...

I tried two solutions without success:

a) The solution proposed by "3061" in the "Problem with enterText() and WT.setLocaleToCurrent" topic

Code: Select all
   private void enterTextWithDefaultLocal(String s)
   {
      WT.setLocaleToCurrent();
      ui.enterText(s); // enter the text in the ui
      WT.resetLocale();
   }


This solution doesn't make any change when I run tests.

b) The solution proposed by "3061" in the "Question mark ? in enterText" topic.
Code: Select all
   /**
    * Use this if ui.enterText(String s) does not enter some chars correctly.
    *
    * @param s
    *            The text to be entered
    * @param language
    *            examples: "en" for English, "de" for German
    * @param country
    *            examples: "US" for USA, "DE" for Germany
    */
   private void enterTextWithTempLocale(String s, String language, String country)
   {
      Locale defaultLocale = Locale.getDefault(); // remember previous Locale
      Locale.setDefault(new Locale(language, country));
      WT.setLocaleToCurrent();
      ui.enterText(s); // enter the text in the ui
      Locale.setDefault(defaultLocale); // reset to previous locale
      WT.setLocaleToCurrent();
   }


This solution doesn't work well because each machines that will start the tests have different configurations, so I need to automatically detect which language and country is currently used by the machine.

It is possible to set this settings automatically based on the machine configuration?

Any suggestions?

OS: Winows XP Pro SP3 in English, always with newest updates
Java: version jdk1.6.0_12
WindowTester: WindowTester SWT professional version 3.8.0.200904021341 for Eclipse 3.4
Eclipse: Version: 3.4.0 Build id: I20080617-2000
hyshyshys
 
Posts: 37
Joined: Thu Jul 03, 2008 12:27 pm

Re: problem with enter text and locale

Postby keertip » Mon Oct 26, 2009 7:07 am

Currently we do not have support for the Canadian French keyboard, you can help us to add support for it. Take a look at

http://downloads.instantiations.com/Win ... pport.html

on how to add support for your keyboard. Follow the instructions and send us the files and we will incorporate it into WindowTester.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am

Re: problem with enter text and locale

Postby hyshyshys » Mon Oct 26, 2009 12:12 pm

Thanks,

We will generate the map file soon.

Vincent
hyshyshys
 
Posts: 37
Joined: Thu Jul 03, 2008 12:27 pm

Re: problem with enter text and locale

Postby Phil Quitslund » Thu Oct 29, 2009 7:42 pm

Excellent. Thanks!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest