Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stash Serializer #17

Closed
wants to merge 4 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ Class {
BaselineOfBlocSerialization >> baseline: spec [

<baseline>
spec for: #common do: [

"dependencies"
spec for: #common do: [ "dependencies"
spec
baseline: 'Ston'
with: [ spec repository: 'github://svenvc/ston/repository' ].

spec
baseline: 'StashSerialization'
with: [ spec repository: 'github://Nyan11/Stash/src' ].

spec
baseline: 'Bloc'
with: [ spec repository: 'github://pharo-graphics/Bloc:master/src' ].

"project packages"
spec package: 'Bloc-Serialization-STON'.
spec
package: 'Bloc-Serialization'
with: [ spec requires: #( 'Bloc' 'Bloc-Serialization-STON' 'Ston' ) ].
spec package: 'Bloc-Serialization' with: [
spec requires: #( 'Bloc' 'Bloc-Serialization-STON'
'Ston' ) ].
spec
package: 'Bloc-Serialization-Tests'
with: [ spec requires: #( 'Bloc-Serialization' ) ].

]
with: [ spec requires: #( 'Bloc-Serialization' ) ] ]
]
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
Class {
#name : #BlElementSerializationTests,
#superclass : #TestCase,
#category : #'Bloc-Serialization-Tests-Extensions'
#name : 'BlElementSerializationTests',
#superclass : 'TestCase',
#category : 'Bloc-Serialization-Tests-Extensions',
#package : 'Bloc-Serialization-Tests',
#tag : 'Extensions'
}

{ #category : #tests }
{ #category : 'tests' }
BlElementSerializationTests >> testSerialize [

| string |
string := BlElement new serialize.
self assert: string isString
]

{ #category : #tests }
{ #category : 'tests' }
BlElementSerializationTests >> testSerializeThenMaterialize [

| element newElement |
Expand All @@ -22,7 +24,7 @@ BlElementSerializationTests >> testSerializeThenMaterialize [
self assert: element class equals: newElement class.
]

{ #category : #tests }
{ #category : 'tests' }
BlElementSerializationTests >> testShouldSerializedChildren [

| element |
Expand Down
25 changes: 13 additions & 12 deletions src/Bloc-Serialization-Tests/BlSerializerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A BlSerializerTest is a test class for testing the behavior of BlSerializer
"
Class {
#name : #BlSerializerTest,
#superclass : #TestCase,
#category : #'Bloc-Serialization-Tests-Core'
#name : 'BlSerializerTest',
#superclass : 'TestCase',
#category : 'Bloc-Serialization-Tests-Core',
#package : 'Bloc-Serialization-Tests',
#tag : 'Core'
}

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testMaterializeEmptyString [

| error blElement |
Expand All @@ -19,7 +21,7 @@ BlSerializerTest >> testMaterializeEmptyString [
self assert: (error isKindOf: BlocMaterializationError)
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testMaterializeNilString [

| blElement error |
Expand All @@ -31,7 +33,7 @@ BlSerializerTest >> testMaterializeNilString [
self assert: (error isKindOf: BlocMaterializationError)
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testMaterializeNotSerializedString [

| blElement error |
Expand All @@ -43,23 +45,22 @@ BlSerializerTest >> testMaterializeNotSerializedString [
self assert: (error isKindOf: BlocMaterializationError)
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testSerialize [

| string |
string := BlSerializer serialize: BlElement new.
self assert: string isString
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testSerializeBlElementCollection [
| error result oc oc2 |

"Empty Collection"
error := nil. result := nil.
[ result := BlSerializer serialize: OrderedCollection new ] onErrorDo: [ :e | error := e ].
self deny: (error isKindOf: BlocSerializationError). "this test is ok because of a empty string is an empty collection"
self assert: result equals: 'OrderedCollection [ ]'.

error := nil. result := nil.
oc := OrderedCollection new.
Expand All @@ -71,7 +72,7 @@ BlSerializerTest >> testSerializeBlElementCollection [
self assert: (oc2 allSatisfy: [ :e | e class = BlElement ]).
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testSerializeNilObject [

| error blElement |
Expand All @@ -83,7 +84,7 @@ BlSerializerTest >> testSerializeNilObject [
self assert: (error isKindOf: BlocSerializationError)
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testSerializeNoBlElement [
| error result |

Expand All @@ -108,7 +109,7 @@ BlSerializerTest >> testSerializeNoBlElement [
self assert: (error isKindOf: BlocSerializationError). "this test is ok because of a empty string is an empty collection"
]

{ #category : #tests }
{ #category : 'tests' }
BlSerializerTest >> testSerializeThenMaterialize [

| string blElement |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
This BlELement is a used for testing the no serialization of children.
"
Class {
#name : #BlTestShouldNotSerializedChildrenElement,
#superclass : #BlElement,
#category : #'Bloc-Serialization-Tests-Core'
#name : 'BlTestShouldNotSerializedChildrenElement',
#superclass : 'BlElement',
#category : 'Bloc-Serialization-Tests-Core',
#package : 'Bloc-Serialization-Tests',
#tag : 'Core'
}

{ #category : #asserting }
{ #category : 'asserting' }
BlTestShouldNotSerializedChildrenElement >> shouldSerializedChildren [

^ false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #BlocSerializationBackgroundTests,
#superclass : #BlocSerializationTests,
#category : #'Bloc-Serialization-Tests-Core'
#name : 'BlocSerializationBackgroundTests',
#superclass : 'BlocSerializationTests',
#category : 'Bloc-Serialization-Tests-Core',
#package : 'Bloc-Serialization-Tests',
#tag : 'Core'
}

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testColor [

| origin |
Expand All @@ -17,7 +19,7 @@ BlocSerializationBackgroundTests >> testColor [
equals: (Color red alpha: 0.8) ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testImageBackground1 [

| origin |
Expand All @@ -32,7 +34,7 @@ BlocSerializationBackgroundTests >> testImageBackground1 [
equals: PolymorphSystemSettings pharoLogoForm bits ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testImageBackground2 [

| origin |
Expand All @@ -48,7 +50,7 @@ BlocSerializationBackgroundTests >> testImageBackground2 [
self assert: element background opacity equals: 0.5 ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testLinearGradient1 [

| origin |
Expand All @@ -69,7 +71,7 @@ BlocSerializationBackgroundTests >> testLinearGradient1 [
equals: 1 -> Color blue ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testLinearGradient2 [

| origin |
Expand All @@ -90,7 +92,7 @@ BlocSerializationBackgroundTests >> testLinearGradient2 [
equals: 1 -> Color blue ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testLinearGradient3 [

| origin |
Expand All @@ -112,7 +114,7 @@ BlocSerializationBackgroundTests >> testLinearGradient3 [
equals: 1 -> Color blue ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testLinearGradient4 [

| origin |
Expand Down Expand Up @@ -145,7 +147,7 @@ BlocSerializationBackgroundTests >> testLinearGradient4 [
equals: 1 -> Color black ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testPaintTransparent [

| origin |
Expand All @@ -157,7 +159,7 @@ BlocSerializationBackgroundTests >> testPaintTransparent [
self assert: element background isTransparent equals: true ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testRadailGradient1 [

| origin |
Expand All @@ -180,7 +182,7 @@ BlocSerializationBackgroundTests >> testRadailGradient1 [
equals: 1 -> Color blue ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBackgroundTests >> testRadialGradient2 [

| origin |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #BlocSerializationBlRopedTextTests,
#superclass : #BlocSerializationTests,
#category : #'Bloc-Serialization-Tests-Core'
#name : 'BlocSerializationBlRopedTextTests',
#superclass : 'BlocSerializationTests',
#category : 'Bloc-Serialization-Tests-Core',
#package : 'Bloc-Serialization-Tests',
#tag : 'Core'
}

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBlRopedTextTests >> testMultiplesAttributes [

| origin |
Expand All @@ -23,7 +25,7 @@ BlocSerializationBlRopedTextTests >> testMultiplesAttributes [
att class = BlTextForegroundAttribute and: [ att paint = Color red ] ]) ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBlRopedTextTests >> testNoAttributes [

| origin |
Expand All @@ -34,7 +36,7 @@ BlocSerializationBlRopedTextTests >> testNoAttributes [
on: [ :element | self assert: origin text rope asString equals: 'test' ]
]

{ #category : #tests }
{ #category : 'tests' }
BlocSerializationBlRopedTextTests >> testOneAttribute [

| origin |
Expand Down
Loading
Loading