Skip to content

Commit

Permalink
moved
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Oct 15, 2024
1 parent d51b2be commit e035028
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 223 deletions.
55 changes: 0 additions & 55 deletions src/Spec2-Adapters-Morphic/SpMorphicBackend.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,6 @@ SpMorphicBackend >> dropListClass [
^ SpDropListPresenter
]

{ #category : 'private - dialogs' }
SpMorphicBackend >> executeOpenDirectoryDialog: aFileDialog [

^ StOpenDirectoryPresenter new
defaultFolder: (aFileDialog path ifNil: [ StFileSystemModel defaultDirectory ]);
title: (aFileDialog title ifNil: [ 'Choose Directory' translated ]);
openModal;
selectedEntry
]

{ #category : 'private - dialogs' }
SpMorphicBackend >> executeOpenFileDialog: aFileDialog [
| dialog |

dialog := self newFileDialogFor: aFileDialog.
^ dialog openModal answer
ifNotNil: [ :aString | aString asFileReference ]
]

{ #category : 'private - dialogs' }
SpMorphicBackend >> executeSaveFileDialog: aFileDialog [
| dialog |

dialog := self newFileDialogFor: aFileDialog.
dialog answerSaveFile.
^ dialog openModal answer
ifNotNil: [ :aString | aString asFileReference ]
]

{ #category : 'deferred message' }
SpMorphicBackend >> forceDefer: aBlock [

Expand All @@ -95,23 +66,6 @@ SpMorphicBackend >> listClass [
^ SpListPresenter
]

{ #category : 'private - dialogs' }
SpMorphicBackend >> newFileDialogFor: aFileDialog [
| dialog dialogClass |

dialogClass := aFileDialog isOpenFile
ifTrue: [ StOpenFilePresenter ]
ifFalse: [ StOpenDirectoryPresenter ].
dialog := dialogClass for: aFileDialog.

aFileDialog path ifNotNil: [ :folder | dialog openFolder: folder ].
aFileDialog filters ifNotEmpty: [ :filters |
dialog fileNavigationSystem
filter: (StCustomExtensionsFilter extensions: { filters }) ].

^ dialog
]

{ #category : 'private - notifying' }
SpMorphicBackend >> notifyError: aSpecNotification [

Expand All @@ -130,15 +84,6 @@ SpMorphicBackend >> notifyInfo: aSpecNotification [
contents: aSpecNotification message
]

{ #category : 'ui - dialogs' }
SpMorphicBackend >> openFileDialog: aFileDialog [

aFileDialog isOpenFile ifTrue: [ ^ self executeOpenFileDialog: aFileDialog ].
aFileDialog isOpenDirectory ifTrue: [ ^ self executeOpenDirectoryDialog: aFileDialog ].

^ self executeSaveFileDialog: aFileDialog
]

{ #category : 'display' }
SpMorphicBackend >> showWaitCursorWhile: aBlock inApplication: anApplication [

Expand Down
168 changes: 0 additions & 168 deletions src/Spec2-Backend-Tests/SpSliderAdapterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,171 +5,3 @@ Class {
#package : 'Spec2-Backend-Tests',
#tag : 'Base'
}

{ #category : 'accessing' }
SpSliderAdapterTest >> classToTest [
^ SpSliderPresenter
]

{ #category : 'tests' }
SpSliderAdapterTest >> testChangeInLabelUpdatesWidget [

self
assert: self adapter widgetLabel
closeTo: ''.

presenter label: 'test'.

self
assert: self adapter widgetLabel
equals: 'test'
]

{ #category : 'tests' }
SpSliderAdapterTest >> testChangeInMaxUpdatesWidget [

presenter value: 80.

"Default max is 100"
self
assert: self adapter widgetAbsoluteValue
closeTo: 0.8.
self
assert: self adapter widgetValue
equals: 80.

"Changing max updates the slider value"
presenter max: 1000.
self
assert: self adapter widgetAbsoluteValue
closeTo: 0.8.
self
assert: self adapter widgetValue
equals: 800
]

{ #category : 'tests' }
SpSliderAdapterTest >> testChangeInMinUpdatesWidget [

presenter value: 80.

"Default min is 0"
self
assert: self adapter widgetAbsoluteValue
closeTo: 0.8.
self
assert: self adapter widgetValue
equals: 80.

"Changing min updates the slider value"
presenter min: 50.
self
assert: self adapter widgetAbsoluteValue
closeTo: 0.8.
self
assert: self adapter widgetValue
equals: 90
]

{ #category : 'tests' }
SpSliderAdapterTest >> testChangeInQuantumUpdatesWidget [

presenter
min: -50;
max: 150.

"By default, quantum is 1, which means round Floats to Integer"
presenter value: 49.1.
self assert: self adapter widgetValue closeTo: 49.

presenter value: -49.1.
self assert: self adapter widgetValue closeTo: -49.

"Quantum is disabled when nil is set"
presenter quantum: nil.

presenter value: 49.1.
self assert: self adapter widgetValue closeTo: 49.1.

presenter value: -49.1.
self assert: self adapter widgetValue closeTo: -49.1.

"Set 50 as quantum"
presenter quantum: 10.

"Current value is automatically rounded acording to the new quamtum"
self assert: self adapter widgetValue equals: -50.

"It also works with new values"
presenter value: 49.
self assert: self adapter widgetValue equals: 50
]

{ #category : 'tests' }
SpSliderAdapterTest >> testChangeInValueUpdatesWidget [

presenter
min: -50;
max: 150.

presenter value: 50.
self assert: self adapter widgetValue equals: 50.

presenter value: -50.
self assert: self adapter widgetValue equals: -50
]

{ #category : 'tests' }
SpSliderAdapterTest >> testPresenterUpdatesWidget [

presenter
min: -50;
max: 150.

presenter value: 50.
self assert: self adapter widgetValue equals: 50.

presenter value: -50.
self assert: self adapter widgetValue equals: -50.

"By default, quantum is 1, which means round Floats to Integer"
presenter value: 49.1.
self assert: self adapter widgetValue closeTo: 49.

presenter value: -49.1.
self assert: self adapter widgetValue closeTo: -49.

"Quantum is disabled when nil is set"
presenter quantum: nil.

presenter value: 49.1.
self assert: self adapter widgetValue closeTo: 49.1.

presenter value: -49.1.
self assert: self adapter widgetValue closeTo: -49.1.

"Set 50 as quantum"
presenter quantum: 10.

"Current value is automatically rounded acording to the new quamtum"
self assert: self adapter widgetValue equals: -50.

"It also works with new values"
presenter value: 49.
self assert: self adapter widgetValue equals: 50
]

{ #category : 'tests' }
SpSliderAdapterTest >> testWidgetUpdatesPresenter [

presenter
min: -50;
max: 150;
quantum: 10.

"Emulate a change on the widget"
self adapter widgetValue: 54.

self assert: presenter value equals: 50.
self assert: presenter absoluteValue equals: 0.5
]

0 comments on commit e035028

Please sign in to comment.