Skip to content

Commit

Permalink
Merge a78cf0d
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyan11 committed Jul 29, 2024
2 parents 9ae2317 + a78cf0d commit cd657d8
Show file tree
Hide file tree
Showing 122 changed files with 951 additions and 1,104 deletions.
45 changes: 25 additions & 20 deletions src/Pyramid-Bloc/PyramidBlocLayoutPlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,20 @@ PyramidBlocLayoutPlugin class >> constraintsPropV [
^ property
]

{ #category : #accessing }
PyramidBlocLayoutPlugin class >> constraintsWeight [

| property |
property := PyramidProperty new
name: 'Constraints - weight';
command: PyramidWeightConstraintsCommand new;
pyramidInputPresenterClass: PyramidNumberInputPresenter;
yourself.
property pyramidInputPresenterStrings help:
'Define the weight of the element to compute its size. The constraints must be "matchParent" to have an effect.'.
^ property
]

{ #category : #accessing }
PyramidBlocLayoutPlugin class >> flowLayoutOrientation [

Expand Down Expand Up @@ -296,30 +310,21 @@ PyramidBlocLayoutPlugin >> initialize [
propertiesManager addProperty: self class margin.

propertiesManager addProperty: self class layout.
propertiesManager addProperty:
self class flowLayoutOrientation.
propertiesManager addProperty:
self class linearLayoutOrientation.
propertiesManager addProperty: self class flowLayoutOrientation.
propertiesManager addProperty: self class linearLayoutOrientation.
propertiesManager addProperty: self class constraintsWeight.

"Constraints - horizontal"
propertiesManager addProperty:
self class constraintsFrameH.
propertiesManager addProperty:
self class constraintsPropH.
propertiesManager addProperty:
self class constraintsBasicH.
propertiesManager addProperty:
self class constraintsBasicHExact.
propertiesManager addProperty: self class constraintsFrameH.
propertiesManager addProperty: self class constraintsPropH.
propertiesManager addProperty: self class constraintsBasicH.
propertiesManager addProperty: self class constraintsBasicHExact.

"Constraints - vertical"
propertiesManager addProperty:
self class constraintsFrameV.
propertiesManager addProperty:
self class constraintsPropV.
propertiesManager addProperty:
self class constraintsBasicV.
propertiesManager addProperty:
self class constraintsBasicVExact.
propertiesManager addProperty: self class constraintsFrameV.
propertiesManager addProperty: self class constraintsPropV.
propertiesManager addProperty: self class constraintsBasicV.
propertiesManager addProperty: self class constraintsBasicVExact
]

{ #category : #adding }
Expand Down
26 changes: 26 additions & 0 deletions src/Pyramid-Bloc/PyramidWeightConstraintsCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Class {
#name : #PyramidWeightConstraintsCommand,
#superclass : #PyramidAbstractBlocCommand,
#category : #'Pyramid-Bloc-plugin-bloc-layout'
}

{ #category : #testing }
PyramidWeightConstraintsCommand >> canBeUsedFor: anObject [

^ (super canBeUsedFor: anObject) and: [
anObject hasParent and: [
{ BlFlowLayout . BlLinearLayout } includes: anObject parent layout class ] ]
]

{ #category : #'as yet unclassified' }
PyramidWeightConstraintsCommand >> getValueFor: anObject [

^ anObject constraints linear weight
]

{ #category : #'as yet unclassified' }
PyramidWeightConstraintsCommand >> setValueFor: anObject with: anArgument [

anObject constraints linear weight: anArgument.
anObject parent forceLayout
]
20 changes: 9 additions & 11 deletions src/Pyramid-Tests/PyramidAddChildCommandTest.class.st
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
Class {
#name : 'PyramidAddChildCommandTest',
#superclass : 'TestCase',
#name : #PyramidAddChildCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : 'Pyramid-Tests-cases-plugin-bloc',
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-bloc'
#category : 'Pyramid-Tests-cases-plugin-bloc'
}

{ #category : 'accessing' }
{ #category : #accessing }
PyramidAddChildCommandTest >> command [

^ PyramidAddChildCommand new
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidAddChildCommandTest >> targetsCanBeUsedFor [

^ { BlElement new . BlElement new addChild: BlElement new; yourself }
]

{ #category : 'accessing' }
{ #category : #accessing }
PyramidAddChildCommandTest >> targetsWithoutValuesAndValues [

^ self targetsCanBeUsedFor collect: [ :each | each -> (BlElement new background: Color random; yourself) ]
]

{ #category : 'tests' }
{ #category : #tests }
PyramidAddChildCommandTest >> testGetValueFor [
"ignore get return nothing"

self targetsCanBeUsedFor do: [ :each | self assert: (self command getValueFor: each) equals: nil ]

]

{ #category : 'tests' }
{ #category : #tests }
PyramidAddChildCommandTest >> testHistory [
"Do once.
undo
Expand Down Expand Up @@ -97,7 +95,7 @@ PyramidAddChildCommandTest >> testHistory [
self assert: (target children includes: argument) ] ]
]

{ #category : 'tests' }
{ #category : #tests }
PyramidAddChildCommandTest >> testSetValueForWith [

self targetsWithoutValuesAndValues do: [ :each |
Expand Down
12 changes: 5 additions & 7 deletions src/Pyramid-Tests/PyramidAddMockCommandTest.class.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
Class {
#name : 'PyramidAddMockCommandTest',
#superclass : 'TestCase',
#category : 'Pyramid-Tests-cases-command',
#package : 'Pyramid-Tests',
#tag : 'cases-command'
#name : #PyramidAddMockCommandTest,
#superclass : #TestCase,
#category : 'Pyramid-Tests-cases-command'
}

{ #category : 'tests' }
{ #category : #tests }
PyramidAddMockCommandTest >> testGetValueFor [

| mock |
Expand All @@ -17,7 +15,7 @@ PyramidAddMockCommandTest >> testGetValueFor [
self assert: (PyramidIncreaseMockCommand new getValueFor: mock) equals: nil.
]

{ #category : 'tests' }
{ #category : #tests }
PyramidAddMockCommandTest >> testSetValueForWith [

| mock |
Expand Down
14 changes: 6 additions & 8 deletions src/Pyramid-Tests/PyramidBackgroundImageCommandTest.class.st
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Class {
#name : 'PyramidBackgroundImageCommandTest',
#superclass : 'TestCase',
#name : #PyramidBackgroundImageCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals',
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-bloc-visuals'
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals'
}

{ #category : 'accessing' }
{ #category : #accessing }
PyramidBackgroundImageCommandTest >> command [

^ PyramidBackgroundImageCommand new
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundImageCommandTest >> targetContainers [

^ {
Expand All @@ -36,7 +34,7 @@ PyramidBackgroundImageCommandTest >> targetContainers [
prop: (Smalltalk ui icons iconNamed: #pharoBig)) }
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundImageCommandTest >> targetsCannotBeUsedFor [
"override if needed"

Expand Down
18 changes: 8 additions & 10 deletions src/Pyramid-Tests/PyramidBackgroundOpacityCommandTest.class.st
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Class {
#name : 'PyramidBackgroundOpacityCommandTest',
#superclass : 'TestCase',
#name : #PyramidBackgroundOpacityCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals',
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-bloc-visuals'
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals'
}

{ #category : 'accessing' }
{ #category : #accessing }
PyramidBackgroundOpacityCommandTest >> command [

^ PyramidBackgroundOpacityCommand new
]

{ #category : 'testing' }
{ #category : #testing }
PyramidBackgroundOpacityCommandTest >> isBlBackgroundEqualityFix [

| e b1 b2 |
Expand All @@ -28,7 +26,7 @@ PyramidBackgroundOpacityCommandTest >> isBlBackgroundEqualityFix [
^ e background == b2
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundOpacityCommandTest >> targetContainers [

^ {
Expand All @@ -53,7 +51,7 @@ PyramidBackgroundOpacityCommandTest >> targetContainers [
prop: 0.3) }
]

{ #category : 'tests' }
{ #category : #tests }
PyramidBackgroundOpacityCommandTest >> testHistory [
"Do once.
undo
Expand Down Expand Up @@ -100,7 +98,7 @@ PyramidBackgroundOpacityCommandTest >> testHistory [
self assert: (self command getValueFor: target) equals: argument ] ]
]

{ #category : 'tests' }
{ #category : #tests }
PyramidBackgroundOpacityCommandTest >> testSetValueForWith [

self isBlBackgroundEqualityFix ifFalse: [ ^ self skip. ].
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Class {
#name : 'PyramidBackgroundPaintColorCommandTest',
#superclass : 'TestCase',
#name : #PyramidBackgroundPaintColorCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals',
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-bloc-visuals'
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals'
}

{ #category : 'accessing' }
{ #category : #accessing }
PyramidBackgroundPaintColorCommandTest >> command [

^ PyramidBackgroundPaintColorCommand new
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundPaintColorCommandTest >> targetContainers [

^ {
Expand All @@ -37,7 +35,7 @@ PyramidBackgroundPaintColorCommandTest >> targetContainers [
}
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundPaintColorCommandTest >> targetsCannotBeUsedFor [
"override if needed"

Expand Down
18 changes: 8 additions & 10 deletions src/Pyramid-Tests/PyramidBackgroundPaintCommandTest.class.st
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Class {
#name : 'PyramidBackgroundPaintCommandTest',
#superclass : 'TestCase',
#name : #PyramidBackgroundPaintCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals',
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-bloc-visuals'
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals'
}

{ #category : 'accessing' }
{ #category : #accessing }
PyramidBackgroundPaintCommandTest >> command [

^ PyramidBackgroundPaintCommand new
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundPaintCommandTest >> targetContainers [

^ {(PyramidCommandTestContainer
Expand Down Expand Up @@ -59,14 +57,14 @@ PyramidBackgroundPaintCommandTest >> targetContainers [
yourself)) }
]

{ #category : 'tests' }
{ #category : #tests }
PyramidBackgroundPaintCommandTest >> testGetValueFor [

self targetsWithValuesAndValues do: [ :each |
self assert: (self command getValueFor: each key) class equals: each value value class ].
]

{ #category : 'tests' }
{ #category : #tests }
PyramidBackgroundPaintCommandTest >> testHistory [
"Do once.
undo
Expand Down Expand Up @@ -111,7 +109,7 @@ PyramidBackgroundPaintCommandTest >> testHistory [
self assert: (self command getValueFor: target) class equals: argument value class ] ]
]

{ #category : 'tests' }
{ #category : #tests }
PyramidBackgroundPaintCommandTest >> testSetValueForWith [

self targetsWithoutValuesAndValues do: [ :each |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
Class {
#name : 'PyramidBackgroundPaintLinearEndCommandTest',
#superclass : 'TestCase',
#name : #PyramidBackgroundPaintLinearEndCommandTest,
#superclass : #TestCase,
#traits : 'TPyramidCommandTest',
#classTraits : 'TPyramidCommandTest classTrait',
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals',
#package : 'Pyramid-Tests',
#tag : 'cases-plugin-bloc-visuals'
#category : 'Pyramid-Tests-cases-plugin-bloc-visuals'
}

{ #category : 'accessing' }
{ #category : #accessing }
PyramidBackgroundPaintLinearEndCommandTest >> command [

^ PyramidBackgroundPaintLinearEndCommand new
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundPaintLinearEndCommandTest >> targetContainers [

^ {
Expand Down Expand Up @@ -60,7 +58,7 @@ PyramidBackgroundPaintLinearEndCommandTest >> targetContainers [
prop: 0 @ 0) }
]

{ #category : 'as yet unclassified' }
{ #category : #'as yet unclassified' }
PyramidBackgroundPaintLinearEndCommandTest >> targetsCannotBeUsedFor [
"override if needed"

Expand Down
Loading

0 comments on commit cd657d8

Please sign in to comment.