Creating sunburst segment accessors, instance creation method and tests.

This commit is contained in:
ruidajo 2022-09-21 17:15:28 -05:00
parent 950da1e35e
commit 07af684d34
4 changed files with 76 additions and 3 deletions

View File

@ -8,7 +8,7 @@ Class {
}
{ #category : #accessing }
EcSunburst >> segments: aEcSunburstSegment [
segments := aEcSunburstSegment
EcSunburst >> segments [
^ segments ifNil: [ segments := OrderedCollection new ].
]

View File

@ -10,24 +10,59 @@ Class {
#category : #'EchartsPharo-EchartsPharo'
}
{ #category : #'instace creation' }
EcSunburstSegment class >> name: aName value: aNumber color: aColor children: anEcSunburstSegment [
^ self new
name: aName;
value: aNumber;
color: aColor;
children: anEcSunburstSegment;
yourself
]
{ #category : #accessing }
EcSunburstSegment >> children [
^ children
]
{ #category : #accessing }
EcSunburstSegment >> children: anEcSunburstSegment [
children := anEcSunburstSegment
]
{ #category : #accessing }
EcSunburstSegment >> color [
^ color
]
{ #category : #accessing }
EcSunburstSegment >> color: aColor [
color := aColor
]
{ #category : #accessing }
EcSunburstSegment >> name [
^ name
]
{ #category : #accessing }
EcSunburstSegment >> name: string [
name := string
]
{ #category : #accessing }
EcSunburstSegment >> value [
^ value
]
{ #category : #accessing }
EcSunburstSegment >> value: number [

View File

@ -0,0 +1,24 @@
Class {
#name : #EcSunburstSegmentTest,
#superclass : #TestCase,
#category : #'EchartsPharo-EchartsPharo'
}
{ #category : #accessing }
EcSunburstSegmentTest >> testSunbusrtSegmentInstanceCreation [
| sunburstSegment children|
children := EcSunburstSegment new.
sunburstSegment := EcSunburstSegment
name: '@profile'
value: 2
color: Color red
children: children.
self
assert: { sunburstSegment name.
sunburstSegment value.
sunburstSegment color.
sunburstSegment children }
equals: { '@profile'. 2. Color red. children}
]

View File

@ -0,0 +1,14 @@
Class {
#name : #EcSunburstTest,
#superclass : #TestCase,
#category : #'EchartsPharo-EchartsPharo'
}
{ #category : #accessing }
EcSunburstTest >> testSegmentsIsCollection [
| sunburst |
sunburst := EcSunburst new.
self assert: sunburst segments equals: OrderedCollection new
]