From 2de662791ba1f3caf172e6f8d7ef4a79cb1a09e4 Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Sun, 10 Sep 2023 00:19:31 +0200 Subject: [PATCH 1/3] Fix various small issues - Fix #44 - Fix #46 - Fix #47 - Fix #48 --- .../ManifestArtefactCoreTests.class.st | 22 +++++++++++++++++++ src/Artefact-Core-Tests/PDFBasicTest.class.st | 3 ++- src/Artefact-Core-Tests/PDFColorTest.class.st | 2 +- .../PDFDataTypeTest.class.st | 4 +++- .../PDFDummyBasic.class.st | 11 ++++++++++ src/Artefact-Core-Tests/PDFFontTest.class.st | 5 +---- .../PDFGeneratorTest.class.st | 3 ++- .../PDFHorizontalLayoutTest.class.st | 1 + .../PDFLayoutTest.class.st | 1 + .../PDFParagraphTest.class.st | 5 +---- 10 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 src/Artefact-Core-Tests/ManifestArtefactCoreTests.class.st diff --git a/src/Artefact-Core-Tests/ManifestArtefactCoreTests.class.st b/src/Artefact-Core-Tests/ManifestArtefactCoreTests.class.st new file mode 100644 index 0000000..0da07ed --- /dev/null +++ b/src/Artefact-Core-Tests/ManifestArtefactCoreTests.class.st @@ -0,0 +1,22 @@ +" +Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser +" +Class { + #name : #ManifestArtefactCoreTests, + #superclass : #PackageManifest, + #category : #'Artefact-Core-Tests-Manifest' +} + +{ #category : #'code-critics' } +ManifestArtefactCoreTests class >> ruleCollectionProtocolRuleV1FalsePositive [ + + + ^ #(#(#(#RGMethodDefinition #(#PDFStreamPrinterTest #testGenerateGZipCompression #false)) #'2023-09-10T00:13:22.863+02:00') ) +] + +{ #category : #'code-critics' } +ManifestArtefactCoreTests class >> ruleLiteralArrayContainsSuspiciousTrueFalseOrNilRuleV1FalsePositive [ + + + ^ #(#(#(#RGMetaclassDefinition #(#'ManifestArtefactCoreTests class' #ManifestArtefactCoreTests)) #'2023-09-10T00:13:40.462+02:00') ) +] diff --git a/src/Artefact-Core-Tests/PDFBasicTest.class.st b/src/Artefact-Core-Tests/PDFBasicTest.class.st index 8f10bae..f4ee9f3 100644 --- a/src/Artefact-Core-Tests/PDFBasicTest.class.st +++ b/src/Artefact-Core-Tests/PDFBasicTest.class.st @@ -22,11 +22,12 @@ PDFBasicTest >> element: anObject [ { #category : #running } PDFBasicTest >> setUp [ + super setUp. self element: PDFDummyBasic new ] { #category : #tests } PDFBasicTest >> testSplitCoordinates [ - self assert: (self element splitCoordinates: 20@30) = '20 30' + self assert: (self element splitCoordinates: 20@30) equals: '20 30' ] diff --git a/src/Artefact-Core-Tests/PDFColorTest.class.st b/src/Artefact-Core-Tests/PDFColorTest.class.st index 0d184ba..6df4d9b 100644 --- a/src/Artefact-Core-Tests/PDFColorTest.class.st +++ b/src/Artefact-Core-Tests/PDFColorTest.class.st @@ -13,5 +13,5 @@ PDFColorTest >> testEqual [ { #category : #tests } PDFColorTest >> testEqualDifferents [ - self deny: (PDFColor r: 54 g: 98 b: 12) = (PDFColor r: 12 g: 48 b: 79) + self deny: (PDFColor r: 54 g: 98 b: 12) equals: (PDFColor r: 12 g: 48 b: 79) ] diff --git a/src/Artefact-Core-Tests/PDFDataTypeTest.class.st b/src/Artefact-Core-Tests/PDFDataTypeTest.class.st index 7c93cf5..f6aa43f 100644 --- a/src/Artefact-Core-Tests/PDFDataTypeTest.class.st +++ b/src/Artefact-Core-Tests/PDFDataTypeTest.class.st @@ -15,7 +15,9 @@ PDFDataTypeTest >> assert: aPDFDataType print: aString [ ] { #category : #running } -PDFDataTypeTest >> setUp [ +PDFDataTypeTest >> setUp [ + + super setUp. aStream := WriteStream on: '' ] diff --git a/src/Artefact-Core-Tests/PDFDummyBasic.class.st b/src/Artefact-Core-Tests/PDFDummyBasic.class.st index 36bfeeb..6846e2a 100644 --- a/src/Artefact-Core-Tests/PDFDummyBasic.class.st +++ b/src/Artefact-Core-Tests/PDFDummyBasic.class.st @@ -15,3 +15,14 @@ PDFDummyBasic >> defaultStyle [ ^ #default ] + +{ #category : #testing } +PDFDummyBasic >> isDrawElement [ + + ^ true +] + +{ #category : #render } +PDFDummyBasic >> producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet [ + "Do nothing here" +] diff --git a/src/Artefact-Core-Tests/PDFFontTest.class.st b/src/Artefact-Core-Tests/PDFFontTest.class.st index 929c364..880ca21 100644 --- a/src/Artefact-Core-Tests/PDFFontTest.class.st +++ b/src/Artefact-Core-Tests/PDFFontTest.class.st @@ -35,13 +35,10 @@ PDFFontTest >> page: anObject [ { #category : #running } PDFFontTest >> setUp [ + super setUp. self doc: PDFDocument new ] -{ #category : #running } -PDFFontTest >> tearDown [ -] - { #category : #'tests - fonts width' } PDFFontTest >> testCourierBIWidth [ diff --git a/src/Artefact-Core-Tests/PDFGeneratorTest.class.st b/src/Artefact-Core-Tests/PDFGeneratorTest.class.st index 355fede..27ab607 100644 --- a/src/Artefact-Core-Tests/PDFGeneratorTest.class.st +++ b/src/Artefact-Core-Tests/PDFGeneratorTest.class.st @@ -10,13 +10,14 @@ Class { { #category : #running } PDFGeneratorTest >> setUp [ + super setUp. generator := PDFGenerator new ] { #category : #tests } PDFGeneratorTest >> testGenerateEmptyPage [ - | page pageDataType contentDataType document | + | page pageDataType document | document := PDFDocument new uncompressed. page := PDFPage new format: PDFA4Format new. document add: page. diff --git a/src/Artefact-Core-Tests/PDFHorizontalLayoutTest.class.st b/src/Artefact-Core-Tests/PDFHorizontalLayoutTest.class.st index 8dc01b6..8d2befe 100644 --- a/src/Artefact-Core-Tests/PDFHorizontalLayoutTest.class.st +++ b/src/Artefact-Core-Tests/PDFHorizontalLayoutTest.class.st @@ -10,6 +10,7 @@ Class { { #category : #running } PDFHorizontalLayoutTest >> setUp [ + super setUp. testLayout := PDFHorizontalLayout new ] diff --git a/src/Artefact-Core-Tests/PDFLayoutTest.class.st b/src/Artefact-Core-Tests/PDFLayoutTest.class.st index e79399c..f708f7d 100644 --- a/src/Artefact-Core-Tests/PDFLayoutTest.class.st +++ b/src/Artefact-Core-Tests/PDFLayoutTest.class.st @@ -13,6 +13,7 @@ Class { { #category : #running } PDFLayoutTest >> setUp [ + super setUp. testLayout := PDFDummyLayout new. generator := PDFGenerator new. page := PDFPage new. diff --git a/src/Artefact-Core-Tests/PDFParagraphTest.class.st b/src/Artefact-Core-Tests/PDFParagraphTest.class.st index 0876f06..c0a224a 100644 --- a/src/Artefact-Core-Tests/PDFParagraphTest.class.st +++ b/src/Artefact-Core-Tests/PDFParagraphTest.class.st @@ -48,6 +48,7 @@ PDFParagraphTest >> paragraph: anObject [ { #category : #running } PDFParagraphTest >> setUp [ + super setUp. self doc: PDFDocument new. self page: PDFPage new. @@ -61,7 +62,3 @@ PDFParagraphTest >> setUp [ self doc generate ] - -{ #category : #running } -PDFParagraphTest >> tearDown [ -] From c83a1b4283b13ceb3c654edd73c63c010f8ba97c Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Sun, 10 Sep 2023 00:25:53 +0200 Subject: [PATCH 2/3] Rename PDFBasic>>#producePageElementCodeWith:StyleSheet: Fix #45 --- src/Artefact-Core/PDFBasic.class.st | 4 ++-- src/Artefact-Core/PDFBezierCurveElement.class.st | 2 +- src/Artefact-Core/PDFCircleElement.class.st | 2 +- src/Artefact-Core/PDFEllipseElement.class.st | 2 +- src/Artefact-Core/PDFImage.class.st | 2 +- src/Artefact-Core/PDFLineElement.class.st | 2 +- src/Artefact-Core/PDFPolygonElement.class.st | 2 +- src/Artefact-Core/PDFRectElement.class.st | 2 +- src/Artefact-Core/PDFTextElement.class.st | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Artefact-Core/PDFBasic.class.st b/src/Artefact-Core/PDFBasic.class.st index 6606fb2..6acc5ae 100644 --- a/src/Artefact-Core/PDFBasic.class.st +++ b/src/Artefact-Core/PDFBasic.class.st @@ -34,7 +34,7 @@ PDFBasic >> determinePosition: aPosition on: aPage [ PDFBasic >> generateCodeSegmentWith: aPDFGenerator styleSheet: aStyleSheet format: aFormat [ ^ self codeSegmentClass - code: (self producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet) + code: (self producePageElementCodeWith: aPDFGenerator styleSheet: aStyleSheet) styleSheet: aStyleSheet format: aFormat isDrawElement: self isDrawElement @@ -56,7 +56,7 @@ PDFBasic >> opacity: anOpacity [ ] { #category : #render } -PDFBasic >> producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet [ +PDFBasic >> producePageElementCodeWith: aPDFGenerator styleSheet: aStyleSheet [ self subclassResponsibility ] diff --git a/src/Artefact-Core/PDFBezierCurveElement.class.st b/src/Artefact-Core/PDFBezierCurveElement.class.st index 7d9cdea..89ae7a0 100644 --- a/src/Artefact-Core/PDFBezierCurveElement.class.st +++ b/src/Artefact-Core/PDFBezierCurveElement.class.st @@ -35,7 +35,7 @@ PDFBezierCurveElement >> points: anObject [ ] { #category : #render } -PDFBezierCurveElement >> producePageElementCodeWith: aPDFGenerator StyleSheet: anObject [ +PDFBezierCurveElement >> producePageElementCodeWith: aPDFGenerator styleSheet: anObject [ "Draw a Bezier curve from xy to destination (3 control points)" ^ String diff --git a/src/Artefact-Core/PDFCircleElement.class.st b/src/Artefact-Core/PDFCircleElement.class.st index e946992..7bbdce0 100644 --- a/src/Artefact-Core/PDFCircleElement.class.st +++ b/src/Artefact-Core/PDFCircleElement.class.st @@ -23,7 +23,7 @@ PDFCircleElement class >> center: aPoint radius: aRadius [ ] { #category : #render } -PDFCircleElement >> producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet [ +PDFCircleElement >> producePageElementCodeWith: aPDFGenerator styleSheet: aStyleSheet [ "Draw a line from xy to destination" | origin r | diff --git a/src/Artefact-Core/PDFEllipseElement.class.st b/src/Artefact-Core/PDFEllipseElement.class.st index dab9e80..306ebf9 100644 --- a/src/Artefact-Core/PDFEllipseElement.class.st +++ b/src/Artefact-Core/PDFEllipseElement.class.st @@ -16,7 +16,7 @@ PDFEllipseElement class >> center: aPoint radius: aRadius [ ] { #category : #render } -PDFEllipseElement >> producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet [ +PDFEllipseElement >> producePageElementCodeWith: aPDFGenerator styleSheet: aStyleSheet [ | hw hh magic cx cy lx rx ty by | diff --git a/src/Artefact-Core/PDFImage.class.st b/src/Artefact-Core/PDFImage.class.st index 89df2d3..2551095 100644 --- a/src/Artefact-Core/PDFImage.class.st +++ b/src/Artefact-Core/PDFImage.class.st @@ -77,7 +77,7 @@ PDFImage >> originalImageDimensions [ ] { #category : #render } -PDFImage >> producePageElementCodeWith: aPDFGenerator StyleSheet: anObject [ +PDFImage >> producePageElementCodeWith: aPDFGenerator styleSheet: anObject [ | origin imageId | "Determine the vertical position of the image" diff --git a/src/Artefact-Core/PDFLineElement.class.st b/src/Artefact-Core/PDFLineElement.class.st index c9a452c..8226207 100644 --- a/src/Artefact-Core/PDFLineElement.class.st +++ b/src/Artefact-Core/PDFLineElement.class.st @@ -21,7 +21,7 @@ PDFLineElement class >> from: from angle: angle length: aLength [ ] { #category : #render } -PDFLineElement >> producePageElementCodeWith: aPDFGenerator StyleSheet: anObject [ +PDFLineElement >> producePageElementCodeWith: aPDFGenerator styleSheet: anObject [ | dest | dest := aPDFGenerator determinePositionOnCurrentPage: self orientedTo . diff --git a/src/Artefact-Core/PDFPolygonElement.class.st b/src/Artefact-Core/PDFPolygonElement.class.st index c6f0664..96e85c6 100644 --- a/src/Artefact-Core/PDFPolygonElement.class.st +++ b/src/Artefact-Core/PDFPolygonElement.class.st @@ -32,7 +32,7 @@ PDFPolygonElement >> points: anObject [ ] { #category : #render } -PDFPolygonElement >> producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet [ +PDFPolygonElement >> producePageElementCodeWith: aPDFGenerator styleSheet: aStyleSheet [ "Draw a polygon from xy to destination (a array of positions)" ^ String diff --git a/src/Artefact-Core/PDFRectElement.class.st b/src/Artefact-Core/PDFRectElement.class.st index 16e5b67..802cfd5 100644 --- a/src/Artefact-Core/PDFRectElement.class.st +++ b/src/Artefact-Core/PDFRectElement.class.st @@ -11,7 +11,7 @@ Class { } { #category : #render } -PDFRectElement >> producePageElementCodeWith: aPDFGenerator StyleSheet: aStyleSheet [ +PDFRectElement >> producePageElementCodeWith: aPDFGenerator styleSheet: aStyleSheet [ "Draw a rectangle from xy with a specified dimension" | position | diff --git a/src/Artefact-Core/PDFTextElement.class.st b/src/Artefact-Core/PDFTextElement.class.st index 0afa84a..144bb30 100644 --- a/src/Artefact-Core/PDFTextElement.class.st +++ b/src/Artefact-Core/PDFTextElement.class.st @@ -17,7 +17,7 @@ PDFTextElement >> minimumDimensionWith: aPDFGenerator styleSheet: aStyleSheet [ ] { #category : #render } -PDFTextElement >> producePageElementCodeWith: aGenerator StyleSheet: aStyleSheet [ +PDFTextElement >> producePageElementCodeWith: aGenerator styleSheet: aStyleSheet [ "Draw a text at xy position" | position | From eb7a0af9337a57742d5f8d96cceac470eb5e3170 Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Sun, 10 Sep 2023 00:37:42 +0200 Subject: [PATCH 3/3] PDFParagraphTest has not test methods fix #51 --- src/Artefact-Core-Tests/PDFParagraphTest.class.st | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Artefact-Core-Tests/PDFParagraphTest.class.st b/src/Artefact-Core-Tests/PDFParagraphTest.class.st index c0a224a..0791a23 100644 --- a/src/Artefact-Core-Tests/PDFParagraphTest.class.st +++ b/src/Artefact-Core-Tests/PDFParagraphTest.class.st @@ -62,3 +62,15 @@ PDFParagraphTest >> setUp [ self doc generate ] + +{ #category : #tests } +PDFParagraphTest >> testDimensions [ + + self assert: paragraph dimension equals: 160mm@60mm +] + +{ #category : #tests } +PDFParagraphTest >> testOrigin [ + + self assert: paragraph from equals: 10 mm @ 10 mm +]