Faculty of Information Technology
Software Engineering Group

Ticket #255: WorkspaceApplicationTests-test_issue255.st

File WorkspaceApplicationTests-test_issue255.st, 2.0 KB (added by Patrik Svestka, 4 years ago)

Test as fileOut

Line 
1"{ Encoding: utf8 }" !
2!WorkspaceApplicationTests methodsFor:'tests'!
3
4test_issue255
5    "Check if the file is stored in the correct directory after changing the default directory path
6
7     Test saving file with same name as directory
8        1. Create a temporary directory
9        2. Pasting a String into a Workspace - to indicate what is going on
10        3. Trying to save Workspace with ctrl + s
11        4. Changing to the temporary directory       
12        5. Trying to save the file into the changed directory
13        6. Check if it was saved into correct place
14        7. Check if the directory was correctly deleted
15    "
16    | randomDirectoryPath pathToTest |
17
18    randomDirectoryPath := Filename newTemporaryDirectory.
19
20    pathToTest := (randomDirectoryPath asString, '\', 'testing') asFilename. 
21    pathToTest recursiveMakeDirectory.   
22    [
23        textView contents: '''Testing directory vs. filename naming collision.'''.
24        "/ trying to save the Workspace
25        textViewInteractor type: #Ctrls.
26        "/ selecting the path at the dialog screen
27        textViewInteractor type: #ShiftHome.
28        "/ saving directory path into the clipboard
29        textView setClipboardText: pathToTest asString.
30
31        "/ pasting the directory path and trying to change into the directory
32        textViewInteractor type: #Paste.
33        textViewInteractor type: #Return.
34
35        "/ selecting the path back again
36        textViewInteractor type: #ShiftHome.
37        "/ typing a file names
38        textViewInteractor type: 'WorkspaceFile.st'.
39        "/ saving it
40        textViewInteractor type: #Return.
41
42        "/ the saved Workspace must exist at the changed path
43        self assert: (pathToTest asString,'\','WorkspaceFile.st') asFilename exists.
44
45    ] ensure: [
46        randomDirectoryPath asFilename recursiveRemove.       
47        self assert: randomDirectoryPath exists not
48    ]
49
50    "Created: / 12-12-2018 / 10:20:14 / svestkap"
51! !
52