Support for detaching embedded test runner to separate, top level tool-like window.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 22 Sep 2014 15:03:41 +0200
changeset 14727 3c8f4e917e89
parent 14726 a52ba98c8627
child 14728 1c798d251860
Support for detaching embedded test runner to separate, top level tool-like window. Should (and will be) refactored.
Tools__TestRunnerEmbedded.st
--- a/Tools__TestRunnerEmbedded.st	Fri Sep 19 13:52:34 2014 +0200
+++ b/Tools__TestRunnerEmbedded.st	Mon Sep 22 15:03:41 2014 +0200
@@ -118,6 +118,28 @@
     "Created: / 04-06-2012 / 19:27:47 / cg"
 ! !
 
+!TestRunnerEmbedded class methodsFor:'image specs'!
+
+pinIcon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self pinIcon inspect
+     ImageEditor openOnClass:self andSelector:#pinIcon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'Tools::TestRunnerEmbedded pinIcon'
+        ifAbsentPut:[(Depth1Image new) width:8; height:8; bits:(ByteArray fromPackedString:'@G8@_''9>_ @b') ; colorMapFromArray:#[0 0 0 255 255 255]; yourself]
+! !
+
 !TestRunnerEmbedded class methodsFor:'interface specs'!
 
 windowSpec
@@ -136,145 +158,198 @@
     <resource: #canvas>
 
     ^ 
-     #(FullSpec
-        name: windowSpec
-        window: 
-       (WindowSpec
-          label: 'Test Runner Embedded'
-          name: 'Test Runner Embedded'
-          min: (Point 10 10)
-          bounds: (Rectangle 0 0 595 50)
-        )
-        component: 
-       (SpecCollection
-          collection: (
-           (ViewSpec
-              name: 'Runner'
-              layout: (LayoutFrame 5 0 0 0 -5 1 0 1)
-              backgroundChannel: resultBackgroundColorAspect
-              component: 
-             (SpecCollection
-                collection: (
-                 (HorizontalPanelViewSpec
-                    name: 'RunnerInnerBox'
-                    layout: (LayoutFrame 5 0 0 0 -5 1 0 1)
-                    backgroundChannel: resultBackgroundColorAspect
-                    horizontalLayout: rightSpaceFit
-                    verticalLayout: center
-                    horizontalSpace: 0
-                    elementsChangeSize: true
-                    component: 
-                   (SpecCollection
-                      collection: (
-                       (ViewSpec
-                          name: 'RunnerInfoBox'
-                          backgroundChannel: resultBackgroundColorAspect
-                          component: 
-                         (SpecCollection
-                            collection: (
-                             (LabelSpec
-                                label: 'Run tests first!!'
-                                name: 'ResultName'
-                                layout: (LayoutFrame 0 0 0 0 0 1 -10 1)
-                                backgroundChannel: resultBackgroundColorAspect
-                                foregroundColor: (Color 100.0 100.0 100.0)
-                                translateLabel: true
-                                labelChannel: resultNameAspect
-                                adjust: left
-                              )
-                             (LabelSpec
-                                name: 'ResultInfo'
-                                layout: (LayoutFrame 0 0 -10 1 0 1 0 1)
-                                style: (FontDescription helvetica medium roman 8 #'iso10646-1')
-                                backgroundChannel: resultBackgroundColorAspect
-                                foregroundColor: (Color 100.0 100.0 100.0)
-                                translateLabel: true
-                                labelChannel: resultInfoAspect
-                                adjust: left
-                              )
-                             (ViewSpec
-                                name: 'ProgressPanel'
-                                layout: (LayoutFrame 0 0 0 0 0 1 0 1)
-                                visibilityChannel: progressIndicatorShownHolder
-                                backgroundChannel: resultBackgroundColorAspect
-                                component: 
-                               (SpecCollection
-                                  collection: (
-                                   (ProgressIndicatorSpec
-                                      name: 'RunningProgress'
-                                      layout: (LayoutFrame 5 0 -10 0.5 -5 1 10 0.5)
-                                      model: progressHolder
-                                      postBuildCallback: postBuildProgressIndicator:
-                                    )
-                                   )
-                                 
-                                )
-                              )
+    #(FullSpec
+       name: windowSpec
+       window: 
+      (WindowSpec
+         label: 'Test Runner Embedded'
+         name: 'Test Runner Embedded'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 600 50)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (ViewSpec
+             name: 'Runner'
+             layout: (LayoutFrame 5 0 0 0 -5 1 0 1)
+             backgroundChannel: resultBackgroundColorAspect
+             component: 
+            (SpecCollection
+               collection: (
+                (UISubSpecification
+                   name: 'RunnerInnerBox'
+                   layout: (LayoutFrame 5 0 0 0 -5 1 0 1)
+                   minorKey: windowSpecNoPadding
+                 )
+                )
+              
+             )
+           )
+          )
+        
+       )
+     )
+
+    "Modified: / 22-09-2014 / 14:03:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+windowSpecNoPadding
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::TestRunnerEmbedded andSelector:#windowSpecNoPadding
+     Tools::TestRunnerEmbedded new openInterface:#windowSpecNoPadding
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: windowSpecNoPadding
+       window: 
+      (WindowSpec
+         label: 'Test Runner Embedded'
+         name: 'Test Runner Embedded'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 600 50)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (HorizontalPanelViewSpec
+             name: 'RunnerInnerBox'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             backgroundChannel: resultBackgroundColorAspect
+             horizontalLayout: rightSpaceFit
+             verticalLayout: center
+             horizontalSpace: 0
+             elementsChangeSize: true
+             component: 
+            (SpecCollection
+               collection: (
+                (ViewSpec
+                   name: 'RunnerInfoBox'
+                   backgroundChannel: resultBackgroundColorAspect
+                   component: 
+                  (SpecCollection
+                     collection: (
+                      (ViewSpec
+                         name: 'ProgressPanel'
+                         layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+                         initiallyInvisible: true
+                         visibilityChannel: progressIndicatorShownHolder
+                         backgroundChannel: resultBackgroundColorAspect
+                         component: 
+                        (SpecCollection
+                           collection: (
+                            (ProgressIndicatorSpec
+                               name: 'RunningProgress'
+                               layout: (LayoutFrame 5 0 -10 0.5 -5 1 10 0.5)
+                               model: progressHolder
+                               postBuildCallback: postBuildProgressIndicator:
                              )
-                           
-                          )
-                          extent: (Point 276 30)
-                        )
-                       (ActionButtonSpec
-                          label: 'Debug'
-                          name: 'DebugButton'
-                          activeHelpKey: debugSelected
-                          translateLabel: true
-                          model: debug
-                          enableChannel: runEnabledHolder
-                          extent: (Point 60 25)
-                        )
-                       (ActionButtonSpec
-                          label: 'Stop'
-                          name: 'Button2'
-                          activeHelpKey: stopRun
-                          visibilityChannel: runningHolder
-                          translateLabel: true
-                          model: stop
-                          extent: (Point 60 25)
-                        )
-                       (ActionButtonSpec
-                          label: 'Run'
-                          name: 'Run'
-                          activeHelpKey: runSelected
-                          visibilityChannel: notRunningHolder
-                          translateLabel: true
-                          model: run
-                          enableChannel: runEnabledHolder
-                          extent: (Point 60 25)
-                        )
-                       (ActionButtonSpec
-                          label: ' Failed'
-                          name: 'Button1'
-                          activeHelpKey: runFailed
-                          translateLabel: true
-                          model: runFailed
-                          enableChannel: runFailedEnabledHolder
-                          extent: (Point 60 25)
-                        )
-                       (ActionButtonSpec
-                          label: 'Run all'
-                          name: 'RunAll'
-                          activeHelpKey: runAll
-                          translateLabel: true
-                          model: runAll
-                          enableChannel: runAllEnabledHolder
-                          extent: (Point 60 25)
-                        )
+                            )
+                          
+                         )
+                       )
+                      (LabelSpec
+                         label: 'Run tests first!!'
+                         name: 'ResultName'
+                         layout: (LayoutFrame 0 0 0 0 0 1 -10 1)
+                         backgroundChannel: resultBackgroundColorAspect
+                         foregroundColor: (Color 100.0 100.0 100.0)
+                         translateLabel: true
+                         labelChannel: resultNameAspect
+                         adjust: left
+                       )
+                      (ActionButtonSpec
+                         name: 'Button3'
+                         layout: (LayoutFrame -20 1 3 0 -3 1 -10 1)
+                         level: 0
+                         backgroundChannel: resultBackgroundColorAspect
+                         hasCharacterOrientedLabel: false
+                         translateLabel: true
+                         foregroundChannel: resultBackgroundColorAspect
+                         labelChannel: pinIcon
+                         model: pin
+                       )
+                      (LabelSpec
+                         name: 'ResultInfo'
+                         layout: (LayoutFrame 0 0 -10 1 0 1 0 1)
+                         style: (FontDescription helvetica medium roman 8 #'iso10646-1')
+                         backgroundChannel: resultBackgroundColorAspect
+                         foregroundColor: (Color 100.0 100.0 100.0)
+                         translateLabel: true
+                         labelChannel: resultInfoAspect
+                         adjust: left
                        )
-                     
-                    )
-                    postBuildCallback: postBuildRunnerPanel:
-                  )
+                      )
+                    
+                   )
+                   extent: (Point 296 30)
+                 )
+                (ActionButtonSpec
+                   label: 'Debug'
+                   name: 'DebugButton'
+                   activeHelpKey: debugSelected
+                   translateLabel: true
+                   model: debug
+                   enableChannel: runEnabledHolder
+                   extent: (Point 60 25)
+                 )
+                (ActionButtonSpec
+                   label: 'Stop'
+                   name: 'Button2'
+                   activeHelpKey: stopRun
+                   visibilityChannel: runningHolder
+                   translateLabel: true
+                   model: stop
+                   extent: (Point 60 25)
                  )
-               
-              )
-            )
+                (ActionButtonSpec
+                   label: 'Run'
+                   name: 'Run'
+                   activeHelpKey: runSelected
+                   visibilityChannel: notRunningHolder
+                   translateLabel: true
+                   model: run
+                   enableChannel: runEnabledHolder
+                   extent: (Point 60 25)
+                 )
+                (ActionButtonSpec
+                   label: ' Failed'
+                   name: 'Button1'
+                   activeHelpKey: runFailed
+                   translateLabel: true
+                   model: runFailed
+                   enableChannel: runFailedEnabledHolder
+                   extent: (Point 60 25)
+                 )
+                (ActionButtonSpec
+                   label: 'Run all'
+                   name: 'RunAll'
+                   activeHelpKey: runAll
+                   translateLabel: true
+                   model: runAll
+                   enableChannel: runAllEnabledHolder
+                   extent: (Point 60 25)
+                 )
+                )
+              
+             )
+             postBuildCallback: postBuildRunnerPanel:
            )
-         
-        )
-      )
+          )
+        
+       )
+     )
 
+    "Modified: / 22-09-2014 / 14:03:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TestRunnerEmbedded class methodsFor:'plugIn spec'!
@@ -299,6 +374,18 @@
 
 ! !
 
+!TestRunnerEmbedded class methodsFor:'queries'!
+
+shouldRememberLastExtent
+    "to be redefined by concrete applications:
+     if true is answered, the application's extent is remembered on close
+     and used as a default when opened the next time"
+
+    ^ false
+
+    "Created: / 22-09-2014 / 14:02:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !TestRunnerEmbedded methodsFor:'accessing'!
 
 allTestCases
@@ -473,6 +560,31 @@
     "Modified: / 03-12-2012 / 14:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+pin
+    | runner screen |
+
+    runner := self class new.
+    runner selectedMethodsHolder: self selectedMethodsHolder copy asValue.
+    runner selectedProtocolsHolder: self selectedProtocolsHolder copy asValue.
+    runner selectedClassesHolder: self selectedClassesHolder copy asValue.
+
+    runner allButOpenInterface: #windowSpecNoPadding.
+
+    screen := Screen current.
+    (screen notNil and:[ screen platformName == #X11 ]) ifTrue:[ 
+        "/ Use EWMH hint to tell the WM that the window is
+        "/ a sort of floating tool so WM can decorate it according to
+        "/ DE standards.
+        runner window id isNil ifTrue:[ 
+            runner window create.
+        ].
+        screen setWindowType:#'_NET_WM_WINDOW_TYPE_UTILITY' in:runner window id.      
+    ].        
+    runner open.
+
+    "Modified: / 22-09-2014 / 13:55:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 run
     |suite|
 
@@ -1033,9 +1145,12 @@
 !
 
 visibility:visibility height:height 
-    |container list h|
+    | window container list h|
 
-    (container := self window container) ifNil:[ ^ self ].
+    window := self window.
+    window isNil ifTrue:[ ^ self ].
+    container := self window container.
+    container isNil ifTrue:[ ^ self ].
 
     h := visibility ifFalse:[0] ifTrue:[ height ].
     container isVisible == visibility ifFalse:[
@@ -1053,6 +1168,7 @@
     ].
 
     "Created: / 11-03-2010 / 09:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-09-2014 / 13:47:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TestRunnerEmbedded methodsFor:'queries'!
@@ -1321,14 +1437,14 @@
 !TestRunnerEmbedded class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TestRunnerEmbedded.st,v 1.38 2014-05-07 16:08:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TestRunnerEmbedded.st,v 1.39 2014-09-22 13:03:41 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__TestRunnerEmbedded.st,v 1.38 2014-05-07 16:08:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__TestRunnerEmbedded.st,v 1.39 2014-09-22 13:03:41 vrany Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__TestRunnerEmbedded.st,v 1.38 2014-05-07 16:08:57 cg Exp $'
+    ^ '$Id: Tools__TestRunnerEmbedded.st,v 1.39 2014-09-22 13:03:41 vrany Exp $'
 ! !