From d475287b8e1feec8af850f29958d3237f7d54c77 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Tue, 31 Jan 2017 13:33:01 +0000 Subject: [PATCH] Starting test on the core funcitonality for the model... finally! ;-). --- .../GrafoscopioDocumentation.class.st | 4 ++-- .../Grafoscopio/GrafoscopioGUI.class.st | 5 ++-- .../Grafoscopio/GrafoscopioNode.class.st | 23 +++++++++++++++++++ .../Grafoscopio/GrafoscopioNodeTest.class.st | 23 +++++++++++++++++++ .../Grafoscopio/GrafoscopioNotebook.class.st | 6 +++++ .../Grafoscopio/ManifestGrafoscopio.class.st | 5 ++++ 6 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 repository/Grafoscopio/GrafoscopioNodeTest.class.st diff --git a/repository/Grafoscopio/GrafoscopioDocumentation.class.st b/repository/Grafoscopio/GrafoscopioDocumentation.class.st index eaa9576..d470249 100644 --- a/repository/Grafoscopio/GrafoscopioDocumentation.class.st +++ b/repository/Grafoscopio/GrafoscopioDocumentation.class.st @@ -82,9 +82,9 @@ GrafoscopioDocumentation class >> update [ ] -{ #category : #'as yet unclassified' } +{ #category : #updating } GrafoscopioDocumentation class >> updateDocsPlaceUI [ - self current localPlace: (UIManager default chooseDirectory: 'Path to the documents Folder') + self current localPlace: (UIManager default chooseDirectory: 'Path to the documentation folder') ] { #category : #accessing } diff --git a/repository/Grafoscopio/GrafoscopioGUI.class.st b/repository/Grafoscopio/GrafoscopioGUI.class.st index 14b70e5..712c328 100644 --- a/repository/Grafoscopio/GrafoscopioGUI.class.st +++ b/repository/Grafoscopio/GrafoscopioGUI.class.st @@ -443,7 +443,7 @@ GrafoscopioGUI class >> startDockingBar [ add: 'Grafoscopio' target: self selector: #updateGrafoscopioUI; add: 'Documentation' target: self selector: #updateDocumentationUI; add: 'DataViz package' target: self selector: #updateDatavizUI; - add: 'Documents place' target: GrafoscopioDocumentation selector: #updateDocsPlaceUI; + add: 'Notebooks places' target: GrafoscopioDocumentation selector: #updateDocsPlaceUI; "add: 'Database engine' target: ExternalApp selector: #installSQLite32BitsUI; add: 'Pandoc path' target: ExternalApp selector: #configurePandoc; add: 'Fossil path' target: ExternalApp selector: #configureFossil;" @@ -451,8 +451,9 @@ GrafoscopioGUI class >> startDockingBar [ helpMenu := MenuMorph new. helpMenu - add: 'Tutorial' target: (GrafoscopioNotebook new) selector: #openTutorial; + add: 'Tutorial (Spanish)' target: (GrafoscopioNotebook new) selector: #openTutorial; add: 'Manual' target: (self new) selector: #openManual; + add: 'Manual (PDF)' target: (self new) selector: #openPDFManual; add: 'About Grafoscopio' target: self selector: #messageAbout. dockingBar := DockingBarMorph new. diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 9789f8b..7dad173 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -134,6 +134,21 @@ GrafoscopioNode >> ancestors [ ^ ancestors ] +{ #category : #accessing } +GrafoscopioNode >> ancestorsAll [ + "I return a collection of all the nodes wich are ancestors of the receiver node" + | currentNode ancestors | + + currentNode := self. + ancestors := OrderedCollection new. + [ currentNode parent notNil and: [ currentNode level > 0 ] ] + whileTrue: [ + ancestors add: currentNode parent. + currentNode := currentNode parent]. + ancestors := ancestors reversed. + ^ ancestors +] + { #category : #accessing } GrafoscopioNode >> ancestorsHeaders [ "Returns the headers of all the ancestors of the node. @@ -657,6 +672,14 @@ GrafoscopioNode >> removeNode: aNode [ ] +{ #category : #accessing } +GrafoscopioNode >> root [ + "I return the node of the Grafoscopio tree that contains the receiver" + self level = 0 + ifTrue: [ ^ self ] + ifFalse: [ ^ self ancestors first. ] +] + { #category : #accessing } GrafoscopioNode >> saveContent: anObject [ "Sets the receivers body to the given object" diff --git a/repository/Grafoscopio/GrafoscopioNodeTest.class.st b/repository/Grafoscopio/GrafoscopioNodeTest.class.st new file mode 100644 index 0000000..bc33944 --- /dev/null +++ b/repository/Grafoscopio/GrafoscopioNodeTest.class.st @@ -0,0 +1,23 @@ +" +I test the main functionality of the GrafoscopioNode class. +" +Class { + #name : #GrafoscopioNodeTest, + #superclass : #TestCase, + #category : #'Grafoscopio-Model' +} + +{ #category : #tests } +GrafoscopioNodeTest >> testAddingChildren [ + | tree nnode orig modif | + tree := GrafoscopioNode new becomeDefaultTestTree. + nnode := GrafoscopioNode new. + orig := tree children size. + tree addNode: nnode. + +] + +{ #category : #tests } +GrafoscopioNodeTest >> testInitializeIsOk [ + self shouldnt: [ GrafoscopioNode new ] raise: Error +] diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index 49cd2a5..e349345 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -178,6 +178,7 @@ GrafoscopioNotebook >> initializeWidgets [ add: header; add: body; add: links. + self askOkToClose: true. ] { #category : #accessing } @@ -382,6 +383,11 @@ GrafoscopioNotebook >> notebookSubMenu [ action: [ self inform: 'To be implemented...' ] ] ] ] +{ #category : #private } +GrafoscopioNotebook >> okToChange [ + ^ true +] + { #category : #persistence } GrafoscopioNotebook >> openDefault [ "I open a new default notebook" diff --git a/repository/Grafoscopio/ManifestGrafoscopio.class.st b/repository/Grafoscopio/ManifestGrafoscopio.class.st index f578248..787bd53 100644 --- a/repository/Grafoscopio/ManifestGrafoscopio.class.st +++ b/repository/Grafoscopio/ManifestGrafoscopio.class.st @@ -27,6 +27,11 @@ ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [ ^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #newWindowMainMenu #false)) #'2016-12-17T18:51:40.617924-05:00') ) ] +{ #category : #'code-critics' } +ManifestGrafoscopio class >> ruleRBShouldntRaiseErrorRuleV1FalsePositive [ + ^ #(#(#(#RGMethodDefinition #(#GrafoscopioNodeTest #testInitializeIsOk #false)) #'2017-01-31T12:49:28.199769-05:00') ) +] + { #category : #'code-critics' } ManifestGrafoscopio class >> ruleRBStringConcatenationRuleV1FalsePositive [ ^ #(#(#(#RGMethodDefinition #(#'FileUtils class' #createFilesNamed:endingWith:intoFolder: #true)) #'2017-01-01T21:48:26.712639-05:00') )