Skip to content
Open
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
125 changes: 88 additions & 37 deletions DebuggingSpy-Browser-Tests/DSRecordBrowserPresenterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -225,25 +225,21 @@ DSRecordBrowserPresenterTest >> testGetHistoryFrom [
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testGetRecordColorAssociationsFrom [
DSRecordBrowserPresenterTest >> testGetNumberOfEventsPerType [

| windows colorAssociations |
windows := { (DSWindowRecord new
toolInfo: (DSToolInfo new
toolClass: StPlaygroundPresenter;
yourself);
events: {
DSWindowOpenedRecord new.
DSDoItRecord new.
DSStepThroughRecord new }) } asOrderedCollection.
| dict |
browser selectedHistory: (DSRecordHistory on: {
(DSMouseEnterWindowRecord new windowId: 1).
(DSBrowseRecord new windowId: 1).
(DSBrowseRecord new windowId: 1).
(DSMouseLeaveWindowRecord new windowId: 1) }).

colorAssociations := browser getRecordColorAssociationsFrom: windows.

self assert: colorAssociations first key class equals: DSWindowOpenedRecord.
self assert: (colorAssociations at: 2) key class equals: DSDoItRecord.
self assert: colorAssociations last key class equals: DSStepThroughRecord.

colorAssociations do: [ :association | self assert: association value equals: (Color fromHexString: '#70B77E') ]
dict := browser getNumberOfEventsPerType.
self assert: dict keys size equals: DSAbstractEventRecord getLeafSubClasses size.
self assert: (dict at: DSMouseEnterWindowRecord) equals: 1.
self assert: (dict at: DSBrowseRecord) equals: 2.
self assert: (dict at: DSMouseLeaveWindowRecord) equals: 1.
self assert: (dict at: DSWindowOpenedRecord) equals: 0
]

{ #category : 'tests' }
Expand Down Expand Up @@ -385,6 +381,53 @@ DSRecordBrowserPresenterTest >> testStopRecording [
self assert: browser timerWindow isNil
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testUpdateActivityPresenter [

| presenter records jumps history |
presenter := browser presenterAt: #activityPresenter.
records := OrderedCollection new
add: (DSMouseEnterWindowRecord new
windowId: 1;
dateTime: (DateAndTime fromSeconds: 1));
add: (DSBrowseRecord new
windowId: 1;
dateTime: (DateAndTime fromSeconds: 6));
add: (DSMouseLeaveWindowRecord new
windowId: 1;
dateTime: (DateAndTime fromSeconds: 8));
add: (DSMouseEnterWindowRecord new
windowId: 2;
dateTime: (DateAndTime fromSeconds: 9));
add: (DSInspectItRecord new
windowId: 2;
dateTime: (DateAndTime fromSeconds: 10));
add: (DSMouseLeaveWindowRecord new
windowId: 2;
dateTime: (DateAndTime fromSeconds: 15));
yourself.

jumps := OrderedCollection new
add: (DSWindowActivityRecord start: records first stop: records third events: {
records first.
records second.
records third });
add: (DSWindowActivityRecord start: records fourth stop: records sixth events: {
records fourth.
records fifth.
records sixth });
yourself.

self assert: presenter roots isEmpty.
history := DSRecordHistory on: records.
history windowJumps: jumps.

browser selectedHistory: history.
browser updateActivityPresenter.

self assert: presenter roots equals: jumps
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testUpdateLastRecord [

Expand All @@ -402,28 +445,26 @@ DSRecordBrowserPresenterTest >> testUpdateLastRecord [
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testUpdateRecordsTable [
DSRecordBrowserPresenterTest >> testUpdateRecordTypesPresenter [

| fileRef |
fileRef := self generateRecordsFile.
browser selectedHistory: (browser getHistoryFrom: fileRef).
browser updateRecordsTable.
| presenter |
presenter := browser presenterAt: #recordTypesPresenter.
self assert: presenter roots isEmpty.
browser selectedHistory: (browser getHistoryFrom: self generateRecordsFile).
browser updateRecordTypesPresenter.

self assert: self recordsTablePresenter roots first key class equals: DSBrowseRecord.
self assert: (self recordsTablePresenter roots at: 2) key class equals: DSMouseEnterWindowRecord.
self assert: (self recordsTablePresenter roots at: 3) key class equals: DSMouseLeaveWindowRecord.
self assert: self recordsTablePresenter roots last key class equals: DSInspectItRecord
self assert: presenter roots equals: browser getNumberOfEventsPerType associations
Comment thread
nicolasp025 marked this conversation as resolved.
]

{ #category : 'tests' }
DSRecordBrowserPresenterTest >> testUpdateRecordsTableWhenAddingFile [
DSRecordBrowserPresenterTest >> testUpdateRecordsPresenterWith [

browser addFile: self generateRecordsFile.
| presenter records |
presenter := browser recordsPresenter.
records := self getRecordExamples.
browser updateRecordsPresenter: presenter with: (DSWindowRecord new events: records).

self assert: self recordsTablePresenter roots first key class equals: DSBrowseRecord.
self assert: (self recordsTablePresenter roots at: 2) key class equals: DSMouseEnterWindowRecord.
self assert: (self recordsTablePresenter roots at: 3) key class equals: DSMouseLeaveWindowRecord.
self assert: self recordsTablePresenter roots last key class equals: DSInspectItRecord
self assert: presenter roots equals: records
]

{ #category : 'tests' }
Expand All @@ -436,13 +477,23 @@ DSRecordBrowserPresenterTest >> testUpdateStatisticsPresenter [
browser updateStatisticsPresenter.

children := self statisticsPresenter children.
self assert: children size equals: 5.
self assert: children size equals: 15.

self assert: children keys first label equals: 'Number of events: 4'.
self assert: children keys second label equals: 'Number of windows: 4'.
self assert: children keys third label equals: 'Time taken: 00:00:03'.
self assert: children keys fourth label equals: 'Idle time: 00:00:00'.
self assert: children keys last label equals: 'Absolute time taken: 00:00:03'
self assert: (children keys at: 2) label equals: 'Number of windows: 4'.
self assert: (children keys at: 3) label equals: 'Time taken: 00:00:03'.
self assert: (children keys at: 4) label equals: 'Idle time: 00:00:00'.
self assert: (children keys at: 5) label equals: 'Absolute time taken: 00:00:03'.
self assert: (children keys at: 6) label equals: 'Number of debug actions: 1'.
self assert: (children keys at: 7) label equals: 'Date: ' , (DateAndTime fromSeconds: 1) asString.
self assert: (children keys at: 8) label equals: 'Debug points added: 0'.
self assert: (children keys at: 9) label equals: 'Debug points hit: 0'.
self assert: (children keys at: 10) label equals: 'Debug points removed: 0'.
self assert: (children keys at: 11) label equals: 'Methods added: 0'.
self assert: (children keys at: 12) label equals: 'Methods modified: 0'.
self assert: (children keys at: 13) label equals: 'Methods removed: 0'.
self assert: (children keys at: 14) label equals: 'Number of steps: 0'.
self assert: (children keys at: 15) label equals: 'Executed code: 1'
]

{ #category : 'tests' }
Expand Down
Loading