Skip to content

Commit

Permalink
more test for BlCompositeSelection (that exhibit issue #489 related m…
Browse files Browse the repository at this point in the history
…alfunction)
  • Loading branch information
plantec committed Apr 3, 2024
1 parent 798b00c commit 0199de3
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 2 deletions.
74 changes: 74 additions & 0 deletions src/Bloc-UnitedTests/BlCompositeSelectionTest.class.st
@@ -0,0 +1,74 @@
"
A BlCompositeSelectionTest is a test class for testing the behavior of BlCompositeSelection
"
Class {
#name : #BlCompositeSelectionTest,
#superclass : #TestCase,
#category : #'Bloc-UnitedTests-Selection'
}

{ #category : #tests }
BlCompositeSelectionTest >> deselectedIndexesIn: aCompositeSelection among: selectedIndexes [

^ selectedIndexes difference: aCompositeSelection indices
]

{ #category : #tests }
BlCompositeSelectionTest >> testDeselectADeselectedIndex [

| s |
s := BlCompositeSelection new.
s selectIndexes: #(1 5 8 12 16).
self assert: s indices equals: #(1 5 8 12 16).
s deselectIndex: 4.
s deselectIndex: 4.
self assert: s indices equals: #(1 5 8 12 16)
]

{ #category : #tests }
BlCompositeSelectionTest >> testDeselectADeselectedIndex2 [

| s |
s := BlCompositeSelection new.
s deselectAll.
s selectIndex: 1.
s selectIndex: 5.
s selectIndex: 8.
s selectIndex: 12.
s selectIndex: 16.
self assert: s indices equals: #(1 5 8 12 16).
s selectIndex: 1.
s deselectIndex: 4.
self assert: s indices equals: #(1 5 8 12 16)
]

{ #category : #tests }
BlCompositeSelectionTest >> testSelectAllThenDeselectOneByOne [

| s all |
s := BlCompositeSelection new.
all := (1 to: 48) asArray.
s selectIndexes: all.
s deselectIndex: 26.
self assert: (self deselectedIndexesIn: s among: all) equals: #(26).
s deselectIndex: 28.
self assert: (self deselectedIndexesIn: s among: all) equals: #(26 28).
s deselectIndex: 35.
self assert: (self deselectedIndexesIn: s among: all) equals: #(26 28 35).
s deselectIndex: 18.
self assert: (self deselectedIndexesIn: s among: all) equals: #(18 26 28 35).
s deselectIndex: 40.
self assert: (self deselectedIndexesIn: s among: all) equals: #(18 26 28 35 40).
s deselectIndex: 31.
self assert: (self deselectedIndexesIn: s among: all) equals: #(18 26 28 31 35 40).
s deselectIndex: 19.
self assert: (self deselectedIndexesIn: s among: all) equals: #(18 19 26 28 31 35 40).
s deselectIndex: 17.
self assert: (self deselectedIndexesIn: s among: all) equals: #(17 18 19 26 28 31 35 40).
s deselectIndex: 45.
self assert: (self deselectedIndexesIn: s among: all) equals: #(17 18 19 26 28 31 35 40 45).
s deselectIndex: 48.
self assert: (self deselectedIndexesIn: s among: all) equals: #(17 18 19 26 28 31 35 40 45 48).
s deselectIndex: 36.
self assert: (self deselectedIndexesIn: s among: all) equals: #(17 18 19 26 28 31 35 36 40 45 48)
]
3 changes: 1 addition & 2 deletions src/Bloc/BlSpace.class.st
Expand Up @@ -680,8 +680,7 @@ BlSpace >> doLayout [
self doUpdateLayout.
layoutCounter := layoutCounter + 1.
layoutCounter = 50 ifTrue: [
self class name trace.
': Warning: Layout was performed 50 times per frame!' traceCr ] ].
'Warning: Layout was performed 50 times per frame!' traceCr ] ].

self root dispatchLayoutDone

Expand Down

0 comments on commit 0199de3

Please sign in to comment.