-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
156 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...es/TabletopUI-Core.package/TTMap.class/instance/convertPixelPositionToTileCoordinates..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
converting | ||
convertPixelPositionToTileCoordinates: aPoint | ||
|
||
^ ((aPoint - self position) / TTTile defaultSize) rounded + (1 @ 1) | ||
^ ((aPoint - self position) / TTTile defaultSize) floor + (1 @ 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
5 changes: 5 additions & 0 deletions
5
packages/TabletopUI-Tests.package/TTMockActionLog.class/instance/initialize.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
initialize-release | ||
initialize | ||
|
||
super initialize. | ||
self outputs: OrderedCollection new. |
4 changes: 4 additions & 0 deletions
4
packages/TabletopUI-Tests.package/TTMockActionLog.class/instance/logInput..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
actions | ||
logInput: aString | ||
|
||
self outputs add: aString |
4 changes: 4 additions & 0 deletions
4
packages/TabletopUI-Tests.package/TTMockActionLog.class/instance/logOutput..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
actions | ||
logOutput: aString | ||
|
||
self outputs add: aString |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTMockActionLog.class/instance/outputs..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
outputs: anObject | ||
outputs := anObject |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTMockActionLog.class/instance/outputs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
outputs | ||
^ outputs |
9 changes: 9 additions & 0 deletions
9
packages/TabletopUI-Tests.package/TTMockActionLog.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"initialize" : "ML 6/27/2022 16:09", | ||
"logInput:" : "ML 6/27/2022 16:10", | ||
"logOutput:" : "ML 6/27/2022 16:10", | ||
"outputs" : "ML 6/27/2022 16:09", | ||
"outputs:" : "ML 6/27/2022 16:09" } } |
14 changes: 14 additions & 0 deletions
14
packages/TabletopUI-Tests.package/TTMockActionLog.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"category" : "TabletopUI-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"outputs" ], | ||
"name" : "TTMockActionLog", | ||
"pools" : [ | ||
], | ||
"super" : "Object", | ||
"type" : "normal" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTMockInputField.class/instance/log..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
log: anObject | ||
log := anObject |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTMockInputField.class/instance/log.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
log | ||
^ log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/inputField..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
inputField: anObject | ||
inputField := anObject |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/inputField.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
inputField | ||
^ inputField |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/map..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
map: anObject | ||
map := anObject |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/map.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
map | ||
^ map |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/rulerTool..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
rulerTool: anObject | ||
rulerTool := anObject |
3 changes: 3 additions & 0 deletions
3
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/rulerTool.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
rulerTool | ||
^ rulerTool |
6 changes: 6 additions & 0 deletions
6
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/setUp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
testing | ||
setUp | ||
|
||
self inputField: TTMockInputField new. | ||
self map: (TTMap newWith: OrderedCollection new). | ||
self rulerTool: (TTRulerTool newWithMap: self map inputField: self inputField) |
20 changes: 20 additions & 0 deletions
20
...TabletopUI-Tests.package/TTRulerToolTest.class/instance/test01CalculateDistanceWithEnd.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
testing | ||
test01CalculateDistanceWithEnd | ||
|
||
| result | | ||
self rulerTool startPosition: (self map convertTileCoordinatesToPixelPosition: 1 @ 1). | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: 1 @ 1). | ||
self assert: result equals: 0. | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: 2 @ 1). | ||
self assert: result equals: 5. | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: 1 @ 2). | ||
self assert: result equals: 5. | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: 2 @ 2). | ||
self assert: result equals: 5. | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: 4 @ 2). | ||
self assert: result equals: 15. | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: -9 @ 2). | ||
self assert: result equals: 50. | ||
"this is expected, as long as the conversion is only math based and does not check whether tiles actually exist" | ||
result := self rulerTool calculateDistanceWithEnd: (self map convertTileCoordinatesToPixelPosition: 9 @ 10). | ||
self assert: result equals: 45. |
14 changes: 14 additions & 0 deletions
14
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/test02CalculateDistance.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
testing | ||
test02CalculateDistance | ||
|
||
| result | | ||
self rulerTool startPosition: (self map convertTileCoordinatesToPixelPosition: 1 @ 1). | ||
self rulerTool endPosition: (self map convertTileCoordinatesToPixelPosition: 1 @ 1). | ||
result := self rulerTool calculateDistance. | ||
self assert: result equals: 0. | ||
self rulerTool endPosition: (self map convertTileCoordinatesToPixelPosition: 10 @ 1). | ||
result := self rulerTool calculateDistance. | ||
self assert: result equals: 45. | ||
self rulerTool endPosition: (self map convertTileCoordinatesToPixelPosition: 2 @ 2). | ||
result := self rulerTool calculateDistance. | ||
self assert: result equals: 5. |
9 changes: 9 additions & 0 deletions
9
packages/TabletopUI-Tests.package/TTRulerToolTest.class/instance/test03MouseDownMouseUp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
testing | ||
test03MouseDownMouseUp | ||
|
||
| result | | ||
self rulerTool inputMouseDown: (self map convertTileCoordinatesToPixelPosition: 1 @ 1). | ||
self rulerTool inputMouseUp: (self map convertTileCoordinatesToPixelPosition: 1 @ 1). | ||
result := self inputField log outputs first. | ||
self inputField log outputs removeFirst. | ||
self assert: result equals: 'Distance measured: 0ft'. |
14 changes: 14 additions & 0 deletions
14
packages/TabletopUI-Tests.package/TTRulerToolTest.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"inputField" : "ML 6/27/2022 15:38", | ||
"inputField:" : "ML 6/27/2022 15:38", | ||
"map" : "ML 6/27/2022 15:38", | ||
"map:" : "ML 6/27/2022 15:38", | ||
"rulerTool" : "ML 6/27/2022 15:36", | ||
"rulerTool:" : "ML 6/27/2022 15:36", | ||
"setUp" : "ML 6/27/2022 15:40", | ||
"test01CalculateDistanceWithEnd" : "ML 6/27/2022 15:51", | ||
"test02CalculateDistance" : "ML 6/27/2022 15:54", | ||
"test03MouseDownMouseUp" : "ML 6/27/2022 16:13" } } |
16 changes: 16 additions & 0 deletions
16
packages/TabletopUI-Tests.package/TTRulerToolTest.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"category" : "TabletopUI-Tests", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
"rulerTool", | ||
"map", | ||
"inputField" ], | ||
"name" : "TTRulerToolTest", | ||
"pools" : [ | ||
], | ||
"super" : "TestCase", | ||
"type" : "normal" } |