TS 610 JavaEditorEditing

(Difference between revisions)
(Test suite: Keyboard and Shortcuts)
(Test suite: Keyboard and Shortcuts)
Line 19: Line 19:
##Open some Java file and focus the editor
##Open some Java file and focus the editor
##Press arrow keys '''→''', '''↑''', '''←''' and '''↓'''
##Press arrow keys '''→''', '''↑''', '''←''' and '''↓'''
-
##Press arrow keys '''→''' and '''←''' in combination with Ctrl key ('''Ctrl+→''' and '''Ctrl+←''')
+
##Press arrow keys '''→''' and '''←''' in combination with Ctrl key (on Mac OS X use Alt key instead) ('''Ctrl+→''' and '''Ctrl+←''')
#* {{result|EXPECTED RESULT:<br>- Caret moves in editor as expected.<br>- While moving the caret right, caret jumps to the beginning of next row when it reaches EOL (it works backwards too)<br>- If the previous/next row is shorter than the current row, caret jumps to EOL when you press up/down.<br>- If caret is about to leave the current editor view, the view should be scrolled so that the caret is always visible.<br>- Left and right arrows in combination with Ctrl moves caret to next/previous word.}}   
#* {{result|EXPECTED RESULT:<br>- Caret moves in editor as expected.<br>- While moving the caret right, caret jumps to the beginning of next row when it reaches EOL (it works backwards too)<br>- If the previous/next row is shorter than the current row, caret jumps to EOL when you press up/down.<br>- If caret is about to leave the current editor view, the view should be scrolled so that the caret is always visible.<br>- Left and right arrows in combination with Ctrl moves caret to next/previous word.}}   
# {{testcase|Home key}}
# {{testcase|Home key}}

Revision as of 15:31, 13 January 2011

Test Specification: Editing File in Java editor

Author: Roman Strobl & Max Sauer & Petr Dvorak & Jiri Prox & Peter Pis
Version: 6.10
Introduction: This document serves as a test specification for editor module. The main purpose is to test features that are related to editing a file in editor, navigating in this file and also to the features of basic coding assistance.

Contents



Test suite: Keyboard and Shortcuts

Purpose: Tests key shortcuts, basic manipulations with caret and modifying editor's content

  1. Typing characters in editor
    1. Open some Java file and focus the editor
    2. Try to type some text in the editor
    3. Press Insert to switch from insertion to overwrite mode (on mac first map the Toggle Typing Mode keymap in NetBeans Preferences)
    4. Type some characters when overwrite mode is on
    • EXPECTED RESULT:
      - Text you typed is correctly displayed in editor, caret's position is synchronized with typed text, typing is fast enough not to cause troubles/slowdown for a developer.
      - Insert/overwrite modes work as expected - when in overwrite mode, old characters are overwritten by the new ones while typing.
  2. Arrow keys
    1. Open some Java file and focus the editor
    2. Press arrow keys , , and
    3. Press arrow keys and in combination with Ctrl key (on Mac OS X use Alt key instead) (Ctrl+→ and Ctrl+←)
    • EXPECTED RESULT:
      - Caret moves in editor as expected.
      - While moving the caret right, caret jumps to the beginning of next row when it reaches EOL (it works backwards too)
      - If the previous/next row is shorter than the current row, caret jumps to EOL when you press up/down.
      - If caret is about to leave the current editor view, the view should be scrolled so that the caret is always visible.
      - Left and right arrows in combination with Ctrl moves caret to next/previous word.
  3. Home key
    1. Open some Java file and focus the editor, place caret to some line with indented text
    2. Press Home key several times
    • EXPECTED RESULT: Caret position changes from the position before first letter to the position on column 0 and the other way around as you are pressing a Home key.
  4. End key
    1. Open some Java file and focus the editor, place caret to some line with text
    2. Press End key
    • EXPECTED RESULT: Caret position changes to the EOL position (after the last character on the line). If you now press Up/Down keys, caret is still in the EOL position on previous/next line.
  5. Scrolling
    1. Press Ctrl-Up/Down several times
    2. Press PageUp/PageDown for a few times
    3. Press Ctrl+Home/End a few times
    • EXPECTED RESULT:
      - The caret stay on the same row and page is scrolled when you press Ctrl+Up/Down
      - Caret moves one page up/down when you press PageUp/PageDown, the editor's content is scrolled too (if possible)
      - Ctrl+Home/End moves caret to the beginning/end of the file, editor's content is scrolled to the right position
      Note: Small files have no scrollbar(s) and it is not possible to scroll them (but caret should still move as described). Big files with more lines or/and more columns have scrollbar(s).
  6. General keyboard shortcuts
    1. If you have changed some settings concerning key bindings, start IDE with a fresh userdir, open the some project and open some files in editor
    2. Try shortcuts for clipboard actions: Ctrl+C (Copy), Ctrl+X (Cut), Ctrl+V (Paste), Delete (Delete).
    3. Try shortcuts for other actions: Ctrl+F (find), Ctrl+G (Go to line), Ctrl+H (Replace) and Ctrl+F4 (Close).
    • EXPECTED RESULT: Shortcuts work, actions must be performed successfully.
  7. Shortcuts for Undo/Redo actions
    1. Open some file that has not been opened yet in the editor (from the any Java application)
    2. Try to use Undo/Redo shortcuts Ctrl-Z/Ctrl-Y, it should not be possible to do it because no changes were done previously
    3. Check if menu items for Undo/Redo (Edit|Undo and Edit|Redo) are disabled
    4. Perform any changes__ in the file
    5. Use the Undo action once (Ctrl+Z or a toolbar icon)
    6. Use the Redo action once (Ctrl+Y or a toolbar icon)
    7. Type__ another characters
    8. Use Undo as long as possible (vary between shortcut/toolbar action/main menu action), so that opened file has the same content as previously saved version
    • EXPECTED RESULT: Flag suggesting file is modified (small star next to the name of file in editor's tab) disappeared after the last step and undo properly cleared all typed changes (characters).
  8. Other keybindings
    1. Try some of the key shortcuts defined in Tools|Options|Keymap
    2. Set a new shortcut for some action and then invoke it in editor
    3. Try to change existing shortcut to something different
    • EXPECTED RESULT: The proper action is always called. In step 3, the old shortcut does not work any more.
  9. Text selection
    1. Open some longer file in editor
    2. Press Shift+Left/Right several times to (de)select individual characters
    3. Press Ctrl+Shift+Left/Right to (de)select next/previous words
    4. Press Shift+Up/Down to (de)select portion of text between current and previous caret position
    5. Press Ctrl+Shift+Home/End to (de)select portion of text between previous caret position and beginning/end of file
    6. Press Shift+Home/End to (de)select portion of text between previous caret position and beginning/end of line
    7. Press Shift+PageUp/PageDown to (de)select one page up/down
    8. Press Ctrl+A to select all contents of the files
    9. Try to select some text using above mentioned methods and press Delete (delete selection)
    • EXPECTED RESULT: Text selection works as expected. Whole selection can be deleted.
  10. Remove line
    1. Open some file in the editor
    2. Place caret to some non-empty line
    3. Press Shift+Delete (or Ctrl+E)
    4. Undo the last action
    • EXPECTED RESULT: Whole line is removed when you press Shift+Delete. Line deletion can be undone.
  11. Remove next/prevoius word
    1. Open some file in the editor
    2. Place caret in the middle of some non-empty line
    3. Press Ctrl+Delete to delete next word
    4. Press Ctrl+Backspace to delete previous word
    5. OPTIONAL: Try to use these shortcuts in front of/behind the guarded blocks → it mustn't be possible to delete guarded blocks using these shortcuts
    • EXPECTED RESULT: Ctrl+Delete deletes the word just behind caret, Ctrl+Backspace deletes word just in front of caret.


Test suite: Using Clipboard

Purpose: To test Copy/Cut/Paste actions and interoperability with external/native editors.
Setup: You will need two java files opened in editor.

  1. Copy/Cut data inside a single Java file
    1. Switch to a java file in editor.
    2. Select a portion of text and copy it to the clipboard (Edit|Copy or Ctrl+C)
    3. Move blinking caret to another place of editor and paste data from clipboard to the source file (Edit|Paste or Ctrl+V)
    4. Select another portion of text and cut it to the clipboard (Edit|Cut or Ctrl+X)
    5. Move blinking caret to another place of editor and paste data from clipboard to the source file (Edit|Paste or Ctrl+V)
    • EXPECTED RESULT: Copied text is duplicated in editor, cut text is removed, texts are placed in caret position. Caret should be behind pasted data.
  1. Copy/Cut data between two edited files
    1. Switch to the first file.
    2. Select any portion of text and copy (or cut) it to the clipboard
    3. Switch to the second file.
    4. Paste the data from clipboard to the second file
    • EXPECTED RESULT: Selected text is copied (cut) from the first file to the second file.
  1. Copy/Cut data To cloned view
    1. Switch to a java file.
    2. Select any portion of text and copy (or cut) it to the clipboard
    3. Clone view (display popup menu over editor's tab and invoke "Clone Document").
    4. There should be auto focus on the cloned view, if no then get focus to the cloned view (click to cloned view).
    5. Paste data from clipboard to source file in cloned view
    • EXPECTED RESULT: Text is correctly pasted in caret's position and both editor windows (cloned and original) contain the same data.
  1. Copy/Cut data from OS to Netbeans
    1. Open any file in native editor which uses system clipboard
    2. Select some text and copy (or cut) it to the system clipboard (depends on native editor)
    3. Focus some Netbeans Java editor tab
    4. Paste text from clipboard to the edited file
    • EXPECTED RESULT: Selected text is copied from native editor and correctly pasted to Netbeans editor.
  1. Copy/Cut data from Netbeans to OS
    1. Switch to a file in IDE's editor
    2. Select some text in and copy (or cut) it to clipboard
    3. Open any file in native editor which use system clipboard
    4. Paste text from clipboard to a text file in native editor (depends on native editor)
    • EXPECTED RESULT: Selected text is copied from Netbeans to native editor
  1. Formatted vs. non-formatted paste
    1. Open some java class in IDE
    2. Copy following code to the clipboard: for(i= 0; i<10;i++ ) {System.out.println("i="+i);}
    3. Invoke Paste action using Ctrl+V inside some method
    4. Press Ctrl+Z to undo previous Paste action
    5. Invoke "Paste Formatted" using Ctrl+Shift+V
    • EXPECTED RESULT:
      - When you press Ctrl+V, code is pasted in the Editor "as it is", without any shifting or reformatting.
      - Code is pasted re-formatted and properly indented when you press Ctrl+Shift+V.




Test suite: Internationalization

Purpose: Checks editor's support for national characters.
Setup: You must have national support in OS set up (fonts, keyboard, etc.) and some file opened in editor. You can find information about your locale in Help|About

  1. National keyboards
    1. Create a new Java file (File|New File...)
    2. Switch to a keyboard layout that is different from English (e.g. to Czech or German)
    3. Type some non-English characters in the editor
    • EXPECTED RESULT: All characters in chosen language should be displayed properly.
  1. I18N undo action
    1. Select part of the text with national characters and invoke Cut action (Ctrl+X).
    2. Try to invoke the Undo action (Ctrl+Z).
    • EXPECTED RESULT: All changes should be correctly undone.
  1. Clipboard with localized characters
    1. Copy any localized string from other application.
    2. Paste this string into IDE's editor.
    3. Copy the localized string in the IDE.
    4. Paste it back to the other application.
    • EXPECTED RESULT: Text should be properly copied and displayed.




Test suite: Erroneous Code

  1. Show tooltip
    1. Paste this incorrect field declaration inside a class body: public private int a0;
    2. Hover with mouse cursor over error annotation mark in gutter for a while (wait for tooltip to appear).
    3. Place caret on marked line and press Alt+Enter
    • EXPECTED RESULT:
      - Erroneous code should be underlined
      - A red annotation mark shows up in the gutter
      - A tooltip should be displayed after you hover above the annotation mark and after you press Alt+Enter, tooltip contains error "Illegal combination of modifiers: private and public"
  1. Cycling through annotations
    1. Use the incorrect field declaration public private int a0; from the previous test case
    2. Place caret on the line with the incorrect code and press Ctrl+F8 (toggle breakpoint→breakpoint is inserted)
    3. Press Ctrl+Shift+M (toggle bookmark→bookmark is inserted)
    4. You should see a little arrow by the annotation in the gutter - click it a few times
    5. Press Ctrl+F8 (toggle breakpoint→breakpoint is removed)
    6. Press Ctrl+Shift+M (toggle bookmark→bookmark is removed)
    • EXPECTED RESULT: The arrow is used for cycling among multiple annotations, so that you can see all annotations. In this case there should be 3 annotations: the bookmark, the breakpoint and error annotation.



Test suite: Smart Brackets

Note: Settings in Tools>Options>Editor>General must be enabled - run IDE with a fresh userdir.

  1. Smart pairs
    1. Type private String[[ in body of class
    2. Push Backspace key
    3. Type private String S = new String( in body of class
    4. Push Backspace key
    • EXPECTED RESULT:
      - Closing bracket is inserted when opening bracket is inserted
      - Closing bracket should be deleted when opening bracket is deleted.
  2. Smart pairs - bracket balancing
    1. Type if((11=11) & (2==3|) in an empty body of a method (place caret as suggested by '|')
    2. Press ')' key twice
    • EXPECTED RESULT:
      - When you press ')' for the first time, a new bracket is inserted after '3', so that brackets are correctly balanced. When you press ')' for the second time, the bracket is skipped (again - in order to keep number of closing/opening brackets balanced).
  3. Enter after opening curly bracket
    1. Move caret inside a method.
    2. Type if (true) {
    3. Push Enter key
    • EXPECTED RESULT: The closing bracket should be added automatically and indented properly
  4. Undo with bracket completion
    1. Try to Undo actions from previous test cases.
    • EXPECTED RESULT: Undo is working exactly in the opposite direction for all of these actions.
  5. Brackets highlighting
    1. Type in editor: if(true) {

      }
    2. Put caret just behind the some of the closing bracket - '}', ')' or ']'
    3. Press Ctrl+'[['
    4. Repeat with other types of brackets
    • {{result|EXPECTED RESULT: The matching bracket is highlighted, shortcut Ctrl-'[[' moves caret to matching bracket. }}


Test suite: Start New Line and Split Line

Setup: Type String str = "abcde 123456"; inside a method's body

  1. Smart Enter inside strings
    1. Move caret behind the "abcde"
    2. Press Enter
    • EXPECTED RESULT: If Enter is pressed inside of a string, the string is smartly divided using '+' operator above strings so that there are no errors in code
      Other info:
      - indentation works normally
      - all white characters are preserved
      - caret is moved behind the opening quote
  1. Undo,Redo and a smart Enter
    1. Follow previous testcase
    2. Invoke Undo and Redo several times
    • EXPECTED RESULT: Undo and Redo is working properly.
  1. Start new line
    1. Move the caret behind "abcde"
    2. Press Shift+Enter.
  1. Undo/Redo start new line
    1. Try to use Undo and Redo
    • EXPECTED RESULT: Undo/Redo works properly.
  1. Split line
    1. Move caret behind "abcde"
    2. Press Ctrl+Enter
  1. Undo/Redo split line
    1. Try to use Undo and Redo
    • EXPECTED RESULT: Undo/Redo works properly



Test suite: Word Matching

  1. Word matching
    1. Type some words inside an opened file
    2. Use a shortcut for word matching (Ctrl+K, Ctrl+Shift+K)
    3. Type some prefix and press mentioned shortcut
    4. Repeat this for various file types
    • EXPECTED RESULT:
      - It should be possible to use word matching between files of different type (on any place inside file)
      - Word matching provides only words starting with proper prefix




Test suite: Go To Line

  1. Go To Line
    1. Open some Java source file in editor and focus it (move mouse cursor to editor pane and click).
    2. Repeatedly invoke Go to line action (Ctrl+G), to invoked dialog write some line number and press Goto button.
    • EXPECTED RESULT: Editor window should have focus after each Go to line action invocation, negative numbers are not allowed as well as zero, you cannot type non-numerical characters to the line field.




Test suite: Jump List

  1. Basic Jump List functionality
    1. Open several java files and perform several searches.
    2. Try to jump through the jump list by pressing ALT+Left for previous entry and ALT+Right for next entry
    3. Try to jump through the jump list by selecting specific file from a popup window available in the right part of Go forward/Go backward buttons (editor toolbar)
    • EXPECTED RESULT: Editor should navigate through all positions in successful searches. Watch out for performance and for side effects.
  1. Last edited functionality
    1. Open several java files and perform several changes.
    2. Press Last Edit button several times
    • EXPECTED RESULT: Editor should navigate through all positions where code was edited




Test suite: Commenting code

  1. Toggle line comment
    1. Open any java file
    2. Try to comment and uncomment several lines by pressing CTRL+'/'
    • EXPECTED RESULT:
      - The selected lines should be commented by //.
      - If only commented lines are selected the action will uncomment them.
  1. Comment/Uncomment line
    1. Try to comment/uncomment lines using comment and uncomment buttons in editor toolbar
    • EXPECTED RESULT: Comment button should add '//' at the beginning of line, the uncomment button will remove it.




Test suite: Mouse Test

Purpose: Tests basic mouse functionality.
Setup: Opened some Java file in editor

  1. Mouse click
    1. Change focus to another window different from editor window.
    2. Click to editor window at any position.
    3. Try to click to different places in editor.
    • EXPECTED RESULT: Focus is changed to editor and cursor should be positioned at the clicked place or at end of line you have clicked.
  1. Mouse click after EOF
    1. Click on the first row in a file, caret should move to this place.
    2. Click behind the end of file to an empty area of editor.
    • EXPECTED RESULT: Caret must move to last line in editor. Caret is placed at EOL or at the column you have clicked (if it exists).
  1. Mouse double click
    1. Move mouse over any word in editor window.
    2. Double click quickly.
    3. Double click in front of the first character of the word.
    4. Double click behind last char of the word.
    • EXPECTED RESULT: Words must be selected (highlighted) and cursor positioned at end of selected words. If you double click between words and separator, the the first positioned (word or separator) will be selected.
  1. Mouse triple click
    1. Quickly triple click on any line in editor.
    • EXPECTED RESULT: Whole line you have clicked on should be selected.
  1. Mouse wheel
    1. Try to use the mouse wheel in editor.
    • EXPECTED RESULT: Document in editor should scroll up or down.
  1. Mouse selection
    1. Open class in editor
    2. Select text by clicking left mouse button and dragging
    3. Try to select more lines
    • EXPECTED RESULT: The proper part of text is selected
  1. Pop-up menu
    1. Open class in editor
    2. Right-click the editor and check the pop-up menu
    3. Left-click somewhere else in the editor to hide the pop-up menu
    4. Invoke pop-up menu using right-click again
    5. Right-click some other place in editor, pop-up menu should appear in that place
    6. Invoke the pop-up menu for the last time
    7. Press Esc key to hide the pop-up menu
    • EXPECTED RESULT: Pop-up menu is shown and hidden as expected.
  1. Support for URLs in editor
    1. Open class in editor.
    2. Enter some code that contains URL, e.g.:
URL url = new URL("http://www.netbeans.org");
    • EXPECTED RESULT: Entire URL specified in previous step should be underlined. Clicking the URL while holding CTRL (Cmd on Mac) should open this page in preferred browser.




Test suite: Drag & Drop

Purpose: Tests the drag & drop functionality inside NetBeans editor.
Setup: Opened any file in editor and focus should be in editor window.

  1. Basic test
    1. Select a block of code by mouse
    2. Drag the code and drop it to a different position in source code
    • EXPECTED RESULT: The code should be moved to the new position.
  1. Undo test
    1. Drag & Drop a piece of code
    2. Press Ctrl+Z
    • EXPECTED RESULT: The code should be moved and undo should return the code into it's original position.
  1. Interaction with guarded blocks
    1. Create a new form
    2. Try to invoke drag&drop action on guarded blocks
    • EXPECTED RESULT: Only the code outside guarded blocks should be moved. The code inside guarded blocks is copied.
  1. Cursor change
    1. Try to drag & drop the text inside editor and outside editor
    • EXPECTED RESULT: The cursor should change according to whether drag & drop action is available (inside editor) or not.




Test suite: Editor's Toolbar and Line numbers

  1. Show and hide line numbers (using gutter)
    1. Open a file in editor.
    2. Check if gutter is in its position (gutter = gray left edge of editor window).
    3. Invoke popup menu above gutter
    4. Try to check/uncheck Show Line Numbers
    • EXPECTED RESULT:
      - Gutter must be displayed on the left side of the Editor Window
      - Line numbers should be shown or hidden according to state of checkbox in gutter's context menu
  1. Show and hide editor's toolbar (using gutter)
    1. Open a file in editor
    2. Check if gutter is in its position (gutter = gray left edge of editor window).
    3. Invoke popup menu above gutter
    4. Try to check/uncheck Show Toolbar
    • EXPECTED RESULT:
      - Gutter must be displayed on the left side of the Editor Window
      - Editor's toolbar should be shown or hidden according to state of checkbox in gutter's context menu
  1. Show and hide line numbers (using main menu)
    1. Open Java file in editor
    2. Try to show/hide line numbers using main menu action View|Show Line Numbers
    • EXPECTED RESULT: Line numbers should be displayed and hidden according to state of checkbox state.
  1. Show and hide editor's toolbar (using main menu)
    1. Open Java file in editor
    2. Try to show/hide editor's toolbar using main menu action View|Show Editor Toolbar
    • EXPECTED RESULT: Toolbar should be displayed and hidden according to state of checkbox state.
  1. Editor's toolbar actions
    1. Check if all action icons in editor's toolbar have tooltip and if they are enabled
    2. Try to invoke actions from toolbar
    • EXPECTED RESULT: The tooltip is available for all icons in toolbar. Each icon invokes expected action.


Test suite: Other tests of minor features

  1. Selection to upper-case
    1. Open a java file in editor.
    2. Select some text with both lower and upper case
    3. Press Ctrl+U U (Ctrl+U followed by U)
    • EXPECTED RESULT:
      - Selection should be converted to upper-case.
  1. Selection to lower-case
    1. Open a java file in editor.
    2. Select some text with both lower and upper case
    3. Press Ctrl+U L (Ctrl+U followed by L)
    • EXPECTED RESULT:
      - Selection should be converted to lower-case.
  1. Switch case in selection
    1. Open a java file in editor.
    2. Select some text with both lower and upper case
    3. Press Ctrl+U S (Ctrl+U followed by S)
    • EXPECTED RESULT:
      - Selection should be converted so that letters that were originally in capitals are now in lower case and vice versa.
  1. Insert current date and time
    1. Open a java file in editor
    2. Open Tools>Options>Keymap
    3. Select node Other>Insert Current Date and Time
    4. Assign the action a shortcut (Ctrl+Alt+M should be unused)
    5. Confirm Options dialog and try to invoke the action Insert Current Date and Time in editor
    • EXPECTED RESULT: Current date and time should be inserted in the editor.


Test suite: Linewrap features

  1. Wrap after words
    1. Open Tools>Options>Formatting
    2. There should be Line Wrap combo box with options: Off, After words and Anywhere
    3. Choose After words option
    4. Close Options dialog (push OK button)
    5. Open a java file in editor
    6. Type long line to the method body, to the comments, long variable name. Make the editor tab as narrow as possible then return it back. While changing the width of editor tab, try to type line of code that doesn't fit to it.
    • EXPECTED RESULT: Make sure the lines are properly wrapped after words if possible (All wrapped lines end with wrap sign). Try to do line selection with the use of mouse and keyboard short cuts. Make sure that the selection view is correctly indicated.
  1. Wrap anywhere
    1. Open Tools>Options>Formatting
    2. Choose Anywhere option
    3. Close Options dialog (push OK button)
    4. Open a java file in editor
    5. Type long line of code to the method body, to the comments, long variable name. Make sure the editor tab as narrow as possible then return it back. While changing the width of editor tab, try to type line of code that doesn't fit to it.
    • EXPECTED RESULT: Make sure the lines are properly wrapped anywhere All wrapped lines end with wrap sign). Try to do line selection with the use of mouse and keyboard short cuts. Make sure that the selection view is correctly indicated.
  1. Wrap off
    1. Open Tools>Options>Formatting
    2. Choose Off option.
    • EXPECTED RESULT: Make sure the lines are no longer wrapped (No wrap sign is shown, lines fit the size editor pane area). Try to do line selection with the use of mouse and keyboard short cuts. Make sure that the selection view is correctly indicated.


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