TS 68 JavaEditorFiles
Test Specification: Working with documents in Java editor
Author: Roman Strobl & Max Sauer & Petr Dvorak & Jiri Prox
Version: 6.8
Introduction: This document serves as a test specification for editor module. It covers main editor features concerning creating/opening/closing files and general subjects concerning the way editor handles documents (r/o, line-endings, tabs, cloning...). This specification does NOT cover editing files and operations concerning working with individual file in editor and features concerning a single editor's tab. Please use a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project to perform some steps of this test specification.
Contents |
Test suite: Creating a New File
Purpose: Tests if it is possible to create a new file in a project and if editor's tabs are correctly focused.
Setup: Open a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project.
- New file
- Invoke File|New File... from the main menu
- Select Java category and Java Class file type
- Click Next, fill in some class name and click Finish
- Create a few more Java classes (repeat these steps a few more times)
- EXPECTED RESULT: Whenever a new file is created it is opened in editor and focused.
Test suite: Opening Files in Editor
Purpose: This suite checks if is possible open files in Editor. There are more possibilities how to open file - they are described below.
Setup: Close all opened projects. Use files from File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project in following test cases.
- Open external file
- Open external file (file that is not a part of any NB project) from main menu action File|Open File...
- EXPECTED RESULT:
- File must be opened in editor.
- There is a lot of limitations, because the file is not part of any project. (no classpath is set)
- These features must work: Syntax coloring, Code Completion for JDK classes, Code Folding
- These features won't work: Code Completion for non JDK classes, Compile/run the class
- Open file from project that is not opened
- Open OpenFileBasic.java with File|Open File... menu. This class can be found in sample project archive under sampleEdirorFiles/src/test/opening directory
- EXPECTED RESULT:
- File must be opened in editor and all java-related stuff must work: Code Completion, Code Folding, compilation, running, etc.
- This action does not open the project where the class belongs to.
- Open a file in Projects view and close it
- Open a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project
- Expand test.opening package under Source Packages node in Project view and double click the OpenFile.java source file
- Don't modify this file in editor
- Invoke popup menu above editor's tab and choose Close All Documents item
- EXPECTED RESULT: The selected file should be opened in editor and then closed without any dialogs.
- Open a file in Files view and close it
- Open a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project if it is not opened yet
- Expand nodes in Files view and double click on the OpenFile.java source file
- Don't modify this file in editor
- Invoke popup menu above editor's tab and choose Close All Documents item
- EXPECTED RESULT: The selected file should be opened in editor and then closed without any dialogs.
- Open a file from main menu and close it
- Select File|Open File from the main menu and find OpenFile.java file used in previous case
- Open it
- Don't modify the opened file
- Invoke popup menu above editor's tab and choose Close All Documents item
- EXPECTED RESULT: The selected file should be opened in editor and then closed without any dialogs.
- Opening a file that is already opened in editor
- Expand nodes in Projects view and double click OpenFile.java source file
- Double click OpenFileBasic.java source file in Projects view
- Double click OpenFile.java source file in Projects view
- Invoke popup menu above editor's tab and choose Close All Documents item
- EXPECTED RESULT:
- The document that was just opened (double-clicked) must be opened and focused in editor
- All opened documents must be closed after you perform the last step
- Clone opened document ("Fake Editor Split")
- Open a java class (for example OpenFile.java from the sample project)
- Right click on editor's tab and choose Clone Document
- Move the cloned document to the bottom of the screen
- Try to open more files (use files under test.dummy package, for example)
- Move opened files from the top window to the bottom one and vice versa (move files between fake splits)
- Try to close all documents one by one
- EXPECTED RESULT:
- Editor should split into two views
- It should be possible to drag & drop editor tabs from top editor to the bottom one
- When closing the documents, the split should disappear when all documents are in the top or bottom part
Test suite: Line Endings
Setup: Use a File:SampleEditorFiles TS 68 JavaEditorFiles.zip sample project
Note: Default line endings:
- Upon creation of a new file, EOL's from your OS are used by default.
- Upon opening of an existing file, then the default EOL is read from the first line of this file.
Note: The Unix line ending is \n (CR - 0x0D), the Windows uses \r\n (CR/LF - 0x0D 0x0A) and the Mac uses \r (CR - 0x0A).
- Line endings - new files
- Create new Java file
- EXPECTED RESULT: Check line endings of the new file in any binary editor (for example "mc" in Linux, press F3 to view the file and then F4 to switch to HEX mode).
- Line endings - existing Java files
- Open a file with Unix EOL's (NewCanvasActionUnix.java under test.eols package)
- Type some new lines
- Open a file with windows EOL's (NewCanvasActionWin.java under test.eols package)
- Type some new lines
- Open a file with Mac EOL's (NewCanvasActionMac.java under test.eols package)
- Type some new lines
- Save files
- EXPECTED RESULT: Check line endings in any binary editor for all files. The type of line endings must be preserved
- Manipulating file with not native EOL
- Open java file with non native EOL (example: If you use Windows, then open file with Unix line endings)
- Try to manipulate this file - move from package to package, copy, use hints and code templates to generate code
- EXPECTED RESULT: Line endings are not changed, the code is not corrupted by any action.
Test suite: Read-Only Files
- Open read-only file
- Open a read-only file in editor
- Try to type some characters inside
- EXPECTED RESULT:
- It is not possible to make any changes in read-only file
- Read-only status is indicated by italics font in the editor's tab
- Make file read only
- Open any read/write file in editor
- Make some changes inside
- Make file read only (outside IDE)
- Save file
- EXPECTED RESULT: Saving should not be possible, a warning should be displayed, telling the user that the file has become read only.
- Read only file from JDK
- Open JDK class (you can use "Go To Type" dialog)
- EXPECTED RESULT: JDK class is read-only and no change can be done in the file
Test suite: Closing Modified Files
Purpose: This suite checks if a dialog shows up when user attempts to close a modified file.
Setup: Close all opened projects except for the sample project and close all opened files.
- Close a modified file (Save)
- Open OpenFile.java and modify it
- Modify flag (bold font) must by used in editor tab
- Close file with the X on editor's tab
- Confirm your changes by clicking Save
- EXPECTED RESULT:
- Modify flag must show up after you modify a file.
- A dialog asking for confirmation must show up after the fourth step.
- The file must be saved (check it on hard disk) and editor tab must be closed.
- Close a modified file (Discard)
- Open OpenFile.java and modify it
- Close the sample file using Ctrl+W shortcut
- Choose Discard in the dialog to discard your changes
- EXPECTED RESULT:
- Editor tab should be closed.
- All changes are lost (check the file on hard disk)
- Close a modified file (Cancel)
- Open OpenFile.java and modify it
- Close the sample file using main menu action Window|Close Window
- Choose Cancel
- EXPECTED RESULT:
- Nothing happens - a file remains opened and it is not saved
- A star next to file name must remain in editor tab
- Persistence of opened files
- Open several classes from the project
- Try to remember which files are opened
- Close IDE
- Start IDE
- EXPECTED RESULT:
- Files that were opened before closing IDE are opened in the editor after IDE restart
- The projects that were opened are reopened as well, but their nodes are collapsed (because of performance)
Test suite: Tab Focus
- Switching editor tabs
- Open two Java source files in editor and focus one of them (move mouse cursor to editor pane and click)
- Repeatedly switch to next file and return to previous one by clicking on editor tabs
- Use next tab action (Ctrl+PgUp/PgDown) to switch to next file
- Use Ctrl+Tab to switch to next file
- EXPECTED RESULT: Tabs should be switched intuitively and focus should remain in editor window.
- Closing editor tabs
- Open at least two java files in the Editor Window
- Close one of them (using Ctrl+F4)
- EXPECTED RESULT: Focus should be moved to another opened Editor tab.
Test suite: Select Document Node in Project/Files/Favorites
- Menu "Navigate"
- Verify functionality for every Navigate|Select in ... main menu item:
- Have a document focused in the IDE
- Use Select in Projects command or use shortcut Ctrl+Shift+1
→ the file is selected in Projects - Use Select in Files command or use shortcut Ctrl+Shift+2
→ the file is selected in Files - Use Select in Favorites command or use shortcut Ctrl+Shift+3
→ the file is selected in Favorites
- EXPECTED RESULT: Node corresponding to opened editor is selected in Project/Files/Favorites view
- Verify functionality for every Navigate|Select in ... main menu item:
- Same name test - Projects view
- Close all projects and create a new project
- Create files Main.java and Main.html in one package
- Open Main.java and call Select in Project
- Open Main.html and call Select in Project
- Try to repeat previous steps
- EXPECTED RESULT: The right node is always selected in Projects view
- Same name test - Files view
- Close all projects and create a new project
- Create files Main.java and Main.html in one package
- Open Main.java and call Select in Files
- Open Main.html and call Select in Files
- Try to repeat previous steps
- EXPECTED RESULT: The right node is always selected in Files view
- Same name test - Favorites view
- Close all projects and create a new project
- Create files Main.java and Main.html in one package
- Open Main.java and call Select in Favorites
- Open Main.html and call Select in Favorites
- Try to repeat previous steps
- EXPECTED RESULT: The right node is always selected in Favorites view