Ticket #229: libtool_fix_1_of_1_rev_73f73118f3b8_Issue__229__Saving_workspace_into_a_file_renames_a_directory_which_should_not_be_renamed.patch
File libtool_fix_1_of_1_rev_73f73118f3b8_Issue__229__Saving_workspace_into_a_file_renames_a_directory_which_should_not_be_renamed.patch, 4.3 KB (added by , 5 years ago) |
---|
-
FileDialog.st
# HG changeset patch # User Patrik Svestka <patrik.svestka@gmail.com> # Date 1544526491 -3600 # Tue Dec 11 12:08:11 2018 +0100 # Branch jv # Node ID 73f73118f3b87d74c99cb8c119268ff3f5231ce2 # Parent 87d03e3567c41685d6daaec362b7b0e809c2540c Issue #229: Saving workspace into a file renames a directory which should not be renamed A patch which enables a user to switch to an directory when a directory path is entered Created a test which checks a situation when user pastes a path to directory - it should correctly to the pasted directory diff -r 87d03e3567c4 -r 73f73118f3b8 FileDialog.st
a b 2100 2100 treeBrowser browser closeEditor. 2101 2101 ^ self 2102 2102 ]. 2103 (viewFiles and:[self filenameHolder value asFilename isDirectory]) ifTrue:[ 2104 "/ directory opens instead of trying to save under such name 2105 ^ self 2106 ]. 2103 2107 appendWasPressed := false. 2104 2108 self commonAcceptAction. 2105 2109 ! -
tests/WorkspaceApplicationTests.st
diff -r 87d03e3567c4 -r 73f73118f3b8 tests/WorkspaceApplicationTests.st
a b 61 61 ! 62 62 63 63 tearDown 64 textView topView destroy. 64 textView topView destroy. 65 65 MessageTracer unmock: #current in: UserPreferences class 66 66 67 67 "Created: / 23-07-2014 / 07:17:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" 68 68 "Modified: / 12-10-2017 / 22:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" 69 "Modified: / 11-12-2018 / 10:48:58 / svestkap" 69 70 ! ! 70 71 71 72 !WorkspaceApplicationTests methodsFor:'tests'! 72 73 74 test_issue229 75 "Check that warning message is shown or simply changes to the destination directory if directory 76 77 Test saving file with same name as directory 78 1. Create a temporary directory 79 2. Write a random file into testing subdirectory 80 3. Pasting a String into a Workspace - to indicate what is going on 81 4. Trying to save Workspace with ctrl + s 82 5. Changing to the temporary directory 83 6. The file is found at the temporary directory 84 7. Checking if the created files exist 85 8. The whole randomDirectoryPath is removed 86 " 87 | randomDirectoryPath pathToTest testFileInSubdirectory | 88 89 randomDirectoryPath := Filename newTemporaryDirectory. 90 91 pathToTest := (randomDirectoryPath asString, '\', 'testing') asFilename. 92 pathToTest recursiveMakeDirectory. 93 "/ creating a temp directory with a text 94 testFileInSubdirectory := Filename newTemporaryIn: (pathToTest). 95 testFileInSubdirectory writingFileDo: [ :stream | stream nextPutLine: 'This file should not be lost!!' ]. 96 97 [ 98 textView contents: '''Testing directory vs. filename naming collision.'''. 99 "/ trying to save the Workspace 100 textViewInteractor type: #Ctrls. 101 "/ selecting the path at the dialog screen 102 textViewInteractor type: #ShiftHome. 103 "/ saving directory path into the clipboard 104 textView setClipboardText: pathToTest asString. 105 106 "/ pasting the directory path and trying to change into the directory 107 textViewInteractor type: #Paste. 108 textViewInteractor type: #Return. 109 110 self assert: pathToTest directoryContents notEmpty. 111 "/ saving the Workspace file 112 textViewInteractor type: '\'. 113 textViewInteractor type: 'WorkspaceFile.st'. 114 textViewInteractor type: #Return. 115 116 "/ temp file must exist 117 self assert: testFileInSubdirectory exists. 118 "/ the saved Workspace must too exist 119 self assert: (pathToTest asString,'\','WorkspaceFile.st') asFilename exists. 120 121 ] ensure: [ 122 randomDirectoryPath asFilename recursiveRemove. 123 self assert: randomDirectoryPath exists not 124 ] 125 126 "Created: / 15-10-2018 / 09:40:47 / svestkap" 127 "Modified (comment): / 11-12-2018 / 12:01:31 / svestkap" 128 ! 129 73 130 test_issue230_01a 74 131 " 75 132 Test paste over selection … … 149 206 "Modified: / 29-08-2018 / 21:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" 150 207 ! ! 151 208 209 !WorkspaceApplicationTests class methodsFor:'documentation'! 210 211 version_HG 212 213 ^ '$Changeset: <not expanded> $' 214 ! ! 215