Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions DebuggingSpy-Browser-Tests/DSTimerWindowTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,34 @@ DSTimerWindowTest >> testEmptyTimerMorph [
self assert: (Time readFrom: self timerMorph contents readStream) seconds equals: 0
]

{ #category : 'tests' }
DSTimerWindowTest >> testGetFormattedNameFrom [

| toolInfo |
toolInfo := DSToolInfo new toolClassName: 'DSTimerWindowTest'.

self assert: (timerWindow getFormattedNameFrom: DSBrowseRecord new) equals: 'Browse'.
self
assert: (timerWindow getFormattedNameFrom: (DSMouseEnterWindowRecord new toolInfo: toolInfo))
equals: 'Enter window (DSTimerWindowTest)'.
self assert: (timerWindow getFormattedNameFrom: DSBrowseRecord new) equals: 'Browse (DSTimerWindowTest)'
]

{ #category : 'tests' }
DSTimerWindowTest >> testGetToolInfoFor [

| toolInfo record |
self assert: (timerWindow getToolInfoFor: DSAbstractEventRecord new) isNil.

toolInfo := DSToolInfo new toolClassName: 'DSTimerWindowTest'.
record := DSMouseEnterWindowRecord new
toolInfo: toolInfo;
yourself.

self assert: (timerWindow getToolInfoFor: record) equals: toolInfo.
self assert: timerWindow lastToolInfo equals: toolInfo
]

{ #category : 'tests' }
DSTimerWindowTest >> testLastEventMorph [

Expand Down
5 changes: 2 additions & 3 deletions DebuggingSpy-Browser/DSRecordBrowserPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ DSRecordBrowserPresenter >> connectPresenters [
"Updates the records and the timeline whenever the selected file is changed."

fileListPresenter whenSelectionChangedDo: [ :presenter |
fileListPresenter selectedItem ifNotNil: [
self updateRecordsTable: presenter.
self updateTimelineChart ] ].
self updateRecordsTable: presenter.
self updateTimelineChart ].

recordsFilter whenChangedDo: [ fileListPresenter selectedItem ifNotNil: [ self updateRecordsTable: fileListPresenter ] ]
]
Expand Down
52 changes: 45 additions & 7 deletions DebuggingSpy-Browser/DSTimerWindow.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Class {
'timerMorph',
'startTime',
'currentTimeMorph',
'lastEventMorph'
'lastEventMorph',
'lastToolInfo'
],
#category : 'DebuggingSpy-Browser',
#package : 'DebuggingSpy-Browser'
Expand Down Expand Up @@ -42,7 +43,7 @@ DSTimerWindow >> currentTimeMorph [

^ StringMorph new
contents: Time now print24;
position: 175 @ 6
position: 325 @ 6
]

{ #category : 'timer' }
Expand All @@ -53,6 +54,31 @@ DSTimerWindow >> elapsedTime [
^ Time current asSeconds - startTime
]

{ #category : 'accessing' }
DSTimerWindow >> getFormattedNameFrom: aRecord [
"Returns the event name followed by the tool class (or the last one), if applicable."

| toolInfo formattedEventName |
formattedEventName := aRecord eventName.

toolInfo := self getToolInfoFor: aRecord.
toolInfo ifNotNil: [ formattedEventName := formattedEventName , ' (' , toolInfo toolClassName asString , ')' ].

^ formattedEventName
]

{ #category : 'accessing' }
DSTimerWindow >> getToolInfoFor: aRecord [
"Returns the record's toolInfo if possible, else returns the last used toolInfo (which can be nil)."

| toolInfo |
(aRecord class hasSlotNamed: 'toolInfo') ifFalse: [ ^ lastToolInfo ].

toolInfo := aRecord readSlotNamed: 'toolInfo'.
toolInfo ifNotNil: [ lastToolInfo := toolInfo ].
^ lastToolInfo
]

{ #category : 'initialization' }
DSTimerWindow >> initialize [

Expand Down Expand Up @@ -102,7 +128,19 @@ DSTimerWindow >> lastEventMorph [
DSTimerWindow >> lastRecord: aRecord [
"Updates the last record text on the window."

lastEventMorph contents: aRecord eventName
lastEventMorph contents: (self getFormattedNameFrom: aRecord)
]

{ #category : 'accessing' }
DSTimerWindow >> lastToolInfo [

^ lastToolInfo
]

{ #category : 'accessing' }
DSTimerWindow >> lastToolInfo: aToolInfo [

lastToolInfo := aToolInfo
]

{ #category : 'windows' }
Expand Down Expand Up @@ -134,14 +172,14 @@ DSTimerWindow >> recordingIcon [

^ ImageMorph new
image: (self iconNamed: #glamorousRedCircle);
position: 100 @ 7;
position: 250 @ 7;
yourself
]

{ #category : 'accessing' }
DSTimerWindow >> size [

^ 250 @ 30
^ 400 @ 30
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -172,7 +210,7 @@ DSTimerWindow >> stopButton [
label: (IconicListItemMorph new icon: (self iconNamed: #stop));
model: self;
actionSelector: #stopTimer;
position: 225 @ 4;
position: 375 @ 4;
yourself
]

Expand All @@ -189,7 +227,7 @@ DSTimerWindow >> timerMorph [

^ StringMorph new
contents: '00:00:00';
position: 115 @ 6
position: 265 @ 6
]

{ #category : 'private - layout' }
Expand Down