Skip to content

Commit

Permalink
Merge ad0dadb
Browse files Browse the repository at this point in the history
  • Loading branch information
plantec committed Feb 6, 2025
2 parents 5eccc9e + ad0dadb commit bca40db
Show file tree
Hide file tree
Showing 16 changed files with 336 additions and 314 deletions.
7 changes: 1 addition & 6 deletions .ci.ston
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,5 @@ SmalltalkCISpec {
#directory : 'src',
#platforms : [ #pharo ]
}
],
#testing : {
#exclude : {
#packages : [ 'Bloc-Examples.*', 'Bloc-Layout-Examples.*', 'Bloc-Text-Examples.*' ]
}
}
]
}
6 changes: 5 additions & 1 deletion doc/4-History.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ Then, Sparta-Skia was introduced by feencom and it became the first backend opti
In 2021, we started to work on a Bloc version that to be included in the future in Pharo.
This codebase started to retrofit a part of the development made at feenkcom, to focus on core features and stability.

In 2022, we introduced Alexandrie, a replacement of Sparta that uses Cairo much more efficiently and doesn't need the complexity of the bindings to Skia.
In 2022, we introduced Alexandrie as a replacement for Sparta, leveraging Cairo for improved efficiency while eliminating the need for Skia bindings' complexity. That same year, Bloc was showcased at [ESUG](https://esug.org/2022-Conference/conf2022.html): [Watch here](https://youtu.be/HvJTDYuXkMU?si=FgcqK9qKFrfWOH74).

The following year, in 2023, Bloc was featured at [Smalltalks Argentina](https://smalltalks2023.fast.org.ar/): [Watch here](https://youtu.be/CG8i2R4CbX0?si=0t7U_fE3N1DOYlFb).

Most recently, in 2024, Bloc made another appearance at [ESUG](https://esug.org/2024-Conference/conf2024.html): [Watch here](https://youtu.be/R_yNWTUF7l0?si=oMQJR9Lh-UtMR6-3).
1 change: 1 addition & 0 deletions src/Bloc-Examples/BlElementBoundsByScripterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ BlElementBoundsByScripterTest >> testBoundsInSpace2 [

{ #category : #tests }
BlElementBoundsByScripterTest >> testBoundsInSpace3 [
<expectedFailure>

| aScripter |
aScripter := self testBoundsInSpace2.
Expand Down
171 changes: 82 additions & 89 deletions src/Bloc-Examples/BlEventCountingElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -255,110 +255,103 @@ BlEventCountingElement >> initialize [
blurCount := 0.
positionInSpaceChangedCount := 0.

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlClickEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementClickCount ]).
do: [ :anEvent | anEvent currentTarget incrementClickCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseEnterEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseEnterCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseEnterCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseLeaveEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseLeaveCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseLeaveCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseMoveEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseMoveCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseMoveCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseOverEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseOverCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseOverCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseOutEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseOutCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseOutCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseDownEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseDownCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseDownCount ]).

self addEventHandler: (BlEventHandler
self addEventHandler:
(BlEventHandler
on: BlMouseUpEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementMouseUpCount ]).

self addEventHandler: (BlEventHandler
on: BlDragStartEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementDragStartCount ]).

self addEventHandler: (BlEventHandler
on: BlDragEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementDragCount ]).

self addEventHandler: (BlEventHandler
on: BlDragEndEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementDragEndCount ]).

self addEventHandler: (BlEventHandler
on: BlDragEnterEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementDragEnterCount ]).

self addEventHandler: (BlEventHandler
on: BlDragLeaveEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementDragLeaveCount ]).

self addEventHandler: (BlEventHandler
on: BlDropEvent
do: [ :anEvent |
anEvent consume.
anEvent currentTarget incrementDropCount ]).

self addEventHandler: (BlEventHandler
on: BlFocusInEvent
do: [ :anEvent | anEvent currentTarget incrementFocusInCount ]).

self addEventHandler: (BlEventHandler
on: BlFocusOutEvent
do: [ :anEvent | anEvent currentTarget incrementFocusOutCount ]).

self addEventHandler: (BlEventHandler
on: BlFocusEvent
do: [ :anEvent | anEvent currentTarget incrementFocusCount ]).

self addEventHandler: (BlEventHandler
on: BlBlurEvent
do: [ :anEvent | anEvent currentTarget incrementBlurCount ]).

self addEventHandler: (BlEventHandler
on: BlElementPositionInSpaceChangedEvent
do: [ :anEvent |
anEvent currentTarget incrementPositionInSpaceChangedCount ]).
do: [ :anEvent | anEvent currentTarget incrementMouseUpCount ]).

self addEventHandler:
(BlEventHandler
on: BlDragStartEvent
do: [ :anEvent |
anEvent consume. "Need to consume this event to proceed"
anEvent currentTarget incrementDragStartCount ]).

self addEventHandler:
(BlEventHandler
on: BlDragEvent
do: [ :anEvent | anEvent currentTarget incrementDragCount ]).

self addEventHandler:
(BlEventHandler
on: BlDragEndEvent
do: [ :anEvent | anEvent currentTarget incrementDragEndCount ]).

self addEventHandler:
(BlEventHandler
on: BlDragEnterEvent
do: [ :anEvent | anEvent currentTarget incrementDragEnterCount ]).

self addEventHandler:
(BlEventHandler
on: BlDragLeaveEvent
do: [ :anEvent | anEvent currentTarget incrementDragLeaveCount ]).

self addEventHandler:
(BlEventHandler
on: BlDropEvent
do: [ :anEvent | anEvent currentTarget incrementDropCount ]).

self addEventHandler:
(BlEventHandler
on: BlFocusInEvent
do: [ :anEvent | anEvent currentTarget incrementFocusInCount ]).

self addEventHandler:
(BlEventHandler
on: BlFocusOutEvent
do: [ :anEvent | anEvent currentTarget incrementFocusOutCount ]).

self addEventHandler:
(BlEventHandler
on: BlFocusEvent
do: [ :anEvent | anEvent currentTarget incrementFocusCount ]).

self addEventHandler:
(BlEventHandler
on: BlBlurEvent
do: [ :anEvent | anEvent currentTarget incrementBlurCount ]).

self addEventHandler:
(BlEventHandler
on: BlElementPositionInSpaceChangedEvent
do: [ :anEvent |
anEvent currentTarget incrementPositionInSpaceChangedCount ]).

self background: Color veryVeryLightGray
]
Expand Down
31 changes: 26 additions & 5 deletions src/Bloc-Examples/BlFileCollectionRopeExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,36 @@ Class {
#category : #'Bloc-Examples-Rope'
}

{ #category : #'instance creation' }
BlFileCollectionRopeExamples >> testBufferedIndexes [
"Test that buffering + index calculations work"

| rope result file |
file := FileSystem memory / 'test.txt'.
file writeStreamDo: [ :stream | stream << 'foobarbaz' ].
rope :=
BlRopeableCollectionFile new
bufferSize: 3;
fileReference: file.

"The following test uses an explicit whileTrue: loop instead of to:do: since `rope size` can be different every time"
result :=
String streamContents: [ :str |
| i |
i := 1.
[ i <= rope size ] whileTrue: [
str nextPut: (rope at: i).
i := i + 1 ] ].

self assert: result equals: 'foobarbaz'
]

{ #category : #'instance creation' }
BlFileCollectionRopeExamples >> testSmall [
"Creates an instance of the rope of size smaller than combineLength"
"Test a rope of size smaller than combineLength"

<sampleInstance>
| aRope file |
file := FileReference
newTempFilePrefix: 'BlFileCollectionRopeExamples-'
suffix: '-small'.
file := FileSystem memory / 'test.txt'.
file writeStreamDo: [ :stream | stream << 'Hello' ].
aRope := BlCollectionRope collection:
(BlRopeableCollectionFile new fileReference: file).
Expand Down
60 changes: 30 additions & 30 deletions src/Bloc-Examples/BlMouseProcessorClickTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Class {
#name : #BlMouseProcessorClickTest,
#superclass : #TestCase,
#instVars : [
'scripter'
],
#category : #'Bloc-Examples-Event-Scripter'
}

Expand All @@ -13,13 +16,20 @@ BlMouseProcessorClickTest >> newScripterElement [
yourself
]

{ #category : #running }
BlMouseProcessorClickTest >> setUp [

super setUp.

scripter := BlDevScripter new.
scripter element: self newScripterElement
]

{ #category : #tests }
BlMouseProcessorClickTest >> testClick [

| aScripter |
aScripter := self testMouseEnter.

aScripter substeps: 'Click' do: [ :aStep |
scripter substeps: 'Click' do: [ :aStep |
aStep mouseMove by: 70 @ 60. "enter"
aStep mouseDown.
aStep mouseUp.

Expand All @@ -38,80 +48,70 @@ BlMouseProcessorClickTest >> testClick [
aStep check
label: 'Check last click event has correct target';
satisfies: [ :aMouseProcessor |
aMouseProcessor lastClickEvent target = aScripter element ];
aMouseProcessor lastClickEvent target = scripter element ];
onMouseProcessor.

aStep check
label: 'Check element was clicked';
satisfies: [ :anElement | anElement clickCount = 1 ];
onSelf ].
aScripter syncContinue.

^ aScripter
scripter syncPlay
]

{ #category : #tests }
BlMouseProcessorClickTest >> testMouseDown [

| aScripter |
aScripter := self testMouseEnter.

aScripter substeps: 'Click' do: [ :aStep |
scripter substeps: 'Click' do: [ :aStep |
aStep mouseMove by: 70 @ 60. "enter"
aStep mouseDown.

aStep check
label: 'Check previous mouse down event';
value: [ :aMouseProcessor |
aMouseProcessor lastMouseDownEvent target ]
equals: [ aScripter element ];
equals: [ scripter element ];
onMouseProcessor.

aStep check
label: 'Check last over target is the element';
value: [ :aMouseProcessor | aMouseProcessor lastOverTarget ]
equals: [ aScripter element ];
equals: [ scripter element ];
onMouseProcessor.

aStep check
label: 'Check entered targets';
value: [ :aMouseProcessor | aMouseProcessor enteredTargets ]
equals: [
{
aScripter element.
aScripter root } ];
scripter element.
scripter root } ];
onMouseProcessor ].

^ aScripter syncContinue
scripter syncPlay
]

{ #category : #tests }
BlMouseProcessorClickTest >> testMouseEnter [

| aScripter |
aScripter := BlDevScripter new.
aScripter element: self newScripterElement.

aScripter substeps: 'Mouse Enter' do: [ :aStep |
aStep mouseMove by: 30 @ 30.

aStep mouseMove by: 70 @ 60.
scripter substeps: 'Mouse Enter' do: [ :aStep |
aStep mouseMove by: 30 @ 30. "outside"
aStep mouseMove by: 70 @ 60. "inside"

aStep check
label: 'Check last over target is the element';
value: [ :aMouseProcessor | aMouseProcessor lastOverTarget ]
equals: [ aScripter element ];
equals: [ scripter element ];
onMouseProcessor.

aStep check
label: 'Check entered targets';
value: [ :aMouseProcessor | aMouseProcessor enteredTargets ]
equals: [
{
aScripter element.
aScripter root } ];
scripter element.
scripter root } ];
onMouseProcessor ].

aScripter syncContinue.

^ aScripter
scripter syncPlay
]
Loading

0 comments on commit bca40db

Please sign in to comment.