TS 61 Formi18n

Automatic Internationalization in Form Module

Author: Jana Maleckova
Version: 6.1
Last update: 2008/10/03
Introduction: This test specs tests the Internationalization in Form.
Comments:

Contents


Test suite: Installation of update for Internationalization of Form and testing basic functionality

Purpose: To test installation of update pack
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication) with container (e.g. JFrame named MyFrame) which is not in default package.

  1. Assure Internationalization is possible to turn On/Off
    1. Open your clear MyFrame container
    2. Select root node in Inspector
    3. Try to check/uncheck Automatic Internationalization property
    • EXPECTED RESULT: No exception should occurrs
  2. Assure ResourceBundle is created
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert e.g. Label into it
    3. Check Automatic Internationalization property
    • EXPECTED RESULT: ResourceBundle Bundle.properties should be automatically generated in the same package as MyFrame is
  3. Assure ResourceBundle is created
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Check Automatic Internationalization property
    3. Insert e.g. Label into it
    4. Change text by double click on Label in design and confirm it
    • EXPECTED RESULT: ResourceBundle Bundle.properties should be automatically generated in the same package as MyFrame is
  4. Assure ResourceBundle is created
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Check Automatic Internationalization property
    3. Insert e.g. Label into it
    4. Change text through pop-up menu - "Edit Text" invoked by right-mouse click on Label in design and confirm it
    • EXPECTED RESULT: ResourceBundle Bundle.properties should be automatically generated in the same package as MyFrame is
  5. Assure ResourceBundle is created
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Check Automatic Internationalization property
    3. Insert e.g. Label into it
    4. Change text on property card of Label and confirm it
    • EXPECTED RESULT: ResourceBundle Bundle.properties should be automatically generated in the same package as MyFrame is
  6. Assure ResourceBundle is not used if Automatic Internationalization is Off
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Check Automatic Internationalization property
    3. Insert e.g. Label into it
    4. Change text on property card of Label and confirm it (e.g. new text value of Label is Name)
    5. Check if string MyFrame.jLabel1.text=Name is generated in Bundle.properties
    6. UnCheck Automatic Internationalization property
    7. Change text on property card of Label again and confirm it (e.g. new text value of Label is Test)
    • EXPECTED RESULT: Bundle.properties is not deleted
      but it should be empty. In editor of source code for MyFrame there should be generated code
      jLabel1.setText("Test");
  7. Assure ResourceBundle is created
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Select root node in Inspector window and invoke custom editor at Properties Bundle File property
    3. Create new Properties file e.g. MyBundle in other location which is different from location of MyFrame and confirm it
    4. Check Automatic Internationalization property
    5. Insert e.g. Label into it
    6. Change text by double click on Label in design and confirm it
    • EXPECTED RESULT: ResourceBundle MyBundle.properties should be automatically generated in location which is set in Properties Bundle File property


Test suite: Automatic Internationalization of Form

Purpose: To test if Resource Bundle is generated correctly with appropriate strings
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication) with container (e.g. JFrame named MyFrame) which is not in default package.

  1. Automatic generation of keys and values in Resource Bundle
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert 3 Swing Components e.g. Label, TextField and Button
    3. Turn On Internationalization of MyFrame form
    4. Change text of Label and Button (jLabel1 => Name, jButton1 => Confirm)
    5. Switch from design to source editor
    6. Select Bundle.properties in Project Window and open it for editing by right mouse click -> Edit
    • EXPECTED RESULT: Form should generate code in source editor
      java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("newpackage/Bundle"); // NOI18N
jLabel1.setText(bundle.getString("MyFrame.jLabel1.text")); // NOI18N
jTextField1.setText(bundle.getString("MyFrame.jTextField1.text")); // NOI18N
jButton1.setText(bundle.getString("MyFrame.jButton1.text")); // NOI18N
In Bundle.properties there should be generated appropriate keys and values.
MyFrame.jLabel1.text=Name
MyFrame.jButton1.text=Confirm
MyFrame.jTextField1.text=jTextField1

  1. Automatic generation of keys and values in Resource Bundle
    1. Turn On Automatic Internationalization generally in Options (Tools -> Options -> Advanced Options -> GUI Builder -> Automatic Internationalization -> On)
    2. Create new JFrame e. g. MyFrame2 in new package, e. g. test_internationalization
    3. Insert new swing component e.g. Button
    4. Change text of Button (jButton1 => Confirm)
    • EXPECTED RESULT: Bundle.properties should be automatically generated with string
      MyFrame2.jButton1.text=Confirm
      in package test_internationalization

  2. Automatic generation of keys and values in Resource Bundle
    1. Turn Off Automatic Internationalization generally in Options (Tools -> Options -> Advanced Options -> GUI Builder -> Automatic Internationalization -> Off)
    2. Create new JFrame e. g. MyFrame3 in new package, e. g. test_internationalization2
    3. Insert new swing component e.g. Button
    4. Change text of Button (jButton1 => Confirm)
    • EXPECTED RESULT: Bundle.properties should not be generated in package test_internationalization2 and checkbox Automatic Internationalization in frame property should be unchecked


Test suite: Editing of already created Resource Bundle

Purpose: To test if all changes made in design are updated in Resource Bundle
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication) with container (e.g. JFrame named MyFrame) which is not in default package.

  1. Editing text directly in MyFrame
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert 3 Swing Components e.g. Label, TextField and Button
    3. Turn On Internationalization of MyFrame form
    4. Change text of Label and Button (jLabel1 => Name, jButton2 => Confirm) and check if keys with appropriate values for Label and Button are generated in Resource Bundle
    5. Switch to design of MyFrame and change text of Label by mouse double click to "Test Label"
    • EXPECTED RESULT: In Bundle.properties there the value of key
      MyFrame.jLabel1.text=Name
      should be changed to
      MyFrame.jLabel1.text=Test Label
  2. Changing components Variable Name
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert 3 Swing Components e.g. Label, TextField and Button
    3. Turn On Internationalization of MyFrame form
    4. Select Button in design mode and change Variable Name from jButton1 to Confirm which is in properties - code card.
    • EXPECTED RESULT: In Bundle.properties there the value of key
      MyFrame.jButton1.text=jButton1
      should be changed to
      MyFrame.Confirm.text=jButton1
  3. Change both, text and Variable Name of component
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert 3 Swing Components e.g. Label, TextField and Button
    3. Turn On Internationalization of MyFrame form
    4. Select Button in design mode and change Variable Name from jButton1 to Confirm which is in properties - code card.
    5. Change text of Button (jButton2 => Confirm)
    • EXPECTED RESULT: In Bundle.properties there the value of key
      MyFrame.jButton1.text=jButton1
      should be changed to
      MyFrame.Confirm.text=Confirm


Test suite: Editing of Resource Bundle directly

Purpose: Test if changes in Resource Bundle are updated in form file in design
Setup: Start IDE with clear userdir. Create new project, Java Application (e.g. MyApplication) with container (e.g. JFrame named MyFrame) which is not in default package.

  1. Editing of Key Value directly in Resource Bundle
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert Swing Component e.g. Label
    3. Turn On Internationalization of MyFrame
    4. Do right-mouse click on generated file Bundle.properties in Project Window and invoke action Edit
    5. Change string from
      MyJFrame.jLabel1.text=jLabel1
      to
      NewJFrame.jLabel1.text=Name
    6. Go back in design of MyFrame and do action Reload Form which is invoked by right mouse click on root node in Inspector Window
    • EXPECTED RESULT: IDE should ask whether this Form should be saved and if user confirms it, the text of Label should be changed on "Name" in design
  1. Adding comments in Resource Bundle
    1. Open your clear MyFrame container which hasn't been internationalized yet
    2. Insert Swing Component e.g. Label
    3. Turn On Internationalization of MyFrame
    4. Do right-mouse click on generated file Bundle.properties in Project Window and invoke action Edit
    5. Add comment
      #test
      above string
      MyJFrame.jLabel1.text=jLabel1
    • EXPECTED RESULT: No exception occurrred and Project is possible to build without any problem.


Test suite: Test automatic i18n in Project with Dependencies

Purpose: To test if Resource Bundle can be used from different Project
Setup: Start IDE with clear userdir. Create two j2se projects. One should contain clear jFrame

  1. Create dependencies between projects
    1. Select library package of project with jFrame and invoke popup menu
    2. Choose Add Project...
    3. Choose the second project and confirm it
    • EXPECTED RESULT: Library dir should contain a link to jar of the second project
  2. Switch auto i18n on
    1. Open jFrame from the first project
    2. Select root node in Inspector
    3. Invoke Custom Editor for Properties Bundle Location
    4. Select Source Package of project which is in dependency
    5. Create new Resource Bundle
    6. Select it and press OK
    • EXPECTED RESULT: File browser should display source package of dependent project. Properties Bundle File property should be set.
  3. All test cases written above should be done with this configuration
    1. Go through the steps describe in Test suite: Automatic Internationalization of Form
    • EXPECTED RESULT: All should pass as describe


Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo