diff --git a/src/Bloc-UnitedTests/BlCompositeSelectionTest.class.st b/src/Bloc-UnitedTests/BlCompositeSelectionTest.class.st new file mode 100644 index 000000000..fcb3fbb20 --- /dev/null +++ b/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) +] diff --git a/src/Bloc/BlSpace.class.st b/src/Bloc/BlSpace.class.st index 9412cf998..ba904f0dc 100644 --- a/src/Bloc/BlSpace.class.st +++ b/src/Bloc/BlSpace.class.st @@ -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