|
| 1 | +Class { |
| 2 | + #name : #ClyInstallMetaLinkPresenterTest, |
| 3 | + #superclass : #TestCase, |
| 4 | + #instVars : [ |
| 5 | + 'node', |
| 6 | + 'metalink', |
| 7 | + 'metalink2', |
| 8 | + 'breakpoint', |
| 9 | + 'executionCounter', |
| 10 | + 'watchpoint' |
| 11 | + ], |
| 12 | + #category : #'Calypso-SystemPlugins-Reflectivity-Browser-Tests-Metalinks' |
| 13 | +} |
| 14 | + |
| 15 | +{ #category : #'helper methods' } |
| 16 | +ClyInstallMetaLinkPresenterTest >> dummyMethod [ |
| 17 | + self |
| 18 | +] |
| 19 | + |
| 20 | +{ #category : #'helper methods' } |
| 21 | +ClyInstallMetaLinkPresenterTest >> nodeInRealMethod [ |
| 22 | + ^(self class >> #dummyMethod) ast statements first |
| 23 | +] |
| 24 | + |
| 25 | +{ #category : #running } |
| 26 | +ClyInstallMetaLinkPresenterTest >> presenterForMetalinkInstallation [ |
| 27 | + ^ClyMetaLinkInstallationPresenter onNode: node forInstallation: true |
| 28 | +] |
| 29 | + |
| 30 | +{ #category : #running } |
| 31 | +ClyInstallMetaLinkPresenterTest >> presenterForMetalinkUninstallation [ |
| 32 | + ^ ClyMetaLinkInstallationPresenter onNode: node forInstallation: false |
| 33 | +] |
| 34 | + |
| 35 | +{ #category : #running } |
| 36 | +ClyInstallMetaLinkPresenterTest >> setUp [ |
| 37 | + super setUp. |
| 38 | + MetaLink uninstallAll. |
| 39 | + node := RBTemporaryNode named: 'test'. |
| 40 | + metalink := MetaLink new. |
| 41 | + metalink2 := MetaLink new. |
| 42 | + breakpoint := MetaLink new metaObject: Break; yourself. |
| 43 | + executionCounter := MetaLink new metaObject: ExecutionCounter new; yourself. |
| 44 | + watchpoint := MetaLink new metaObject: Watchpoint new; yourself. |
| 45 | + node propertyAt: #links put: {metalink. breakpoint. executionCounter. watchpoint} asOrderedCollection |
| 46 | + |
| 47 | +] |
| 48 | + |
| 49 | +{ #category : #running } |
| 50 | +ClyInstallMetaLinkPresenterTest >> tearDown [ |
| 51 | + metalink uninstall. |
| 52 | + metalink2 uninstall. |
| 53 | + super tearDown |
| 54 | +] |
| 55 | + |
| 56 | +{ #category : #tests } |
| 57 | +ClyInstallMetaLinkPresenterTest >> testInstallSelectedMetalink [ |
| 58 | + |presenter list| |
| 59 | + presenter := ClyMetaLinkInstallationPresenter onNode: self nodeInRealMethod forInstallation: true. |
| 60 | + list := presenter metalinkListPresenter. |
| 61 | + list clickItem: 1. |
| 62 | + self deny: self nodeInRealMethod hasLinks. |
| 63 | + presenter installSelectedMetalink. |
| 64 | + self assert: self nodeInRealMethod hasLinks. |
| 65 | + self assert: self nodeInRealMethod links asArray first identicalTo: list items first |
| 66 | +] |
| 67 | + |
| 68 | +{ #category : #tests } |
| 69 | +ClyInstallMetaLinkPresenterTest >> testInstallSelectedMetalinkActionButton [ |
| 70 | + |presenter list| |
| 71 | + presenter := ClyMetaLinkInstallationPresenter onNode: self nodeInRealMethod forInstallation: true. |
| 72 | + list := presenter metalinkListPresenter. |
| 73 | + list clickItem: 1. |
| 74 | + self deny: self nodeInRealMethod hasLinks. |
| 75 | + presenter toolbarButtons first execute. |
| 76 | + self assert: self nodeInRealMethod hasLinks. |
| 77 | + self assert: self nodeInRealMethod links asArray first identicalTo: list items first |
| 78 | +] |
| 79 | + |
| 80 | +{ #category : #tests } |
| 81 | +ClyInstallMetaLinkPresenterTest >> testRelevantMetalinksForInstallation [ |
| 82 | + |links| |
| 83 | + links := self presenterForMetalinkInstallation allRelevantMetaLinks. |
| 84 | + self assert: links size >= 2. |
| 85 | + self assertCollection: links includesAll: { metalink. metalink2 }. |
| 86 | + self denyCollection: links includesAll: { breakpoint. watchpoint. executionCounter }. |
| 87 | + |
| 88 | +] |
| 89 | + |
| 90 | +{ #category : #tests } |
| 91 | +ClyInstallMetaLinkPresenterTest >> testRelevantMetalinksForUninstallation [ |
| 92 | + | links | |
| 93 | + links := self presenterForMetalinkUninstallation allRelevantMetaLinks. |
| 94 | + self assert: links size equals: 1. |
| 95 | + self assertCollection: links hasSameElements: { metalink } |
| 96 | +] |
| 97 | + |
| 98 | +{ #category : #tests } |
| 99 | +ClyInstallMetaLinkPresenterTest >> testToolbarButtonsCollectionSize [ |
| 100 | + self assert: self presenterForMetalinkInstallation toolbarButtons size equals: 2. |
| 101 | + self assert: self presenterForMetalinkUninstallation toolbarButtons size equals: 2. |
| 102 | +] |
| 103 | + |
| 104 | +{ #category : #tests } |
| 105 | +ClyInstallMetaLinkPresenterTest >> testToolbarButtonsForMetalinkInstallation [ |
| 106 | + |toolbarButtons| |
| 107 | + toolbarButtons := self presenterForMetalinkInstallation toolbarButtons. |
| 108 | + self assert: toolbarButtons first label equals: 'Install'. |
| 109 | + self assert: toolbarButtons last label equals: 'Cancel'. |
| 110 | +] |
| 111 | + |
| 112 | +{ #category : #tests } |
| 113 | +ClyInstallMetaLinkPresenterTest >> testToolbarButtonsForMetalinkUninstallation [ |
| 114 | + |toolbarButtons| |
| 115 | + toolbarButtons := self presenterForMetalinkUninstallation toolbarButtons. |
| 116 | + self assert: toolbarButtons first label equals: 'Uninstall'. |
| 117 | + self assert: toolbarButtons last label equals: 'Cancel'. |
| 118 | +] |
| 119 | + |
| 120 | +{ #category : #tests } |
| 121 | +ClyInstallMetaLinkPresenterTest >> testUninstallSelectedMetalink [ |
| 122 | + |presenter list| |
| 123 | + self nodeInRealMethod link: metalink. |
| 124 | + presenter := ClyMetaLinkInstallationPresenter onNode: self nodeInRealMethod forInstallation: false. |
| 125 | + list := presenter metalinkListPresenter. |
| 126 | + list clickItem: 1. |
| 127 | + self assert: self nodeInRealMethod hasLinks. |
| 128 | + presenter uninstallSelectedMetalink. |
| 129 | + self deny: self nodeInRealMethod hasLinks |
| 130 | +] |
| 131 | + |
| 132 | +{ #category : #tests } |
| 133 | +ClyInstallMetaLinkPresenterTest >> testUninstallSelectedMetalinkActionButton [ |
| 134 | + |presenter list| |
| 135 | + self nodeInRealMethod link: metalink. |
| 136 | + presenter := ClyMetaLinkInstallationPresenter onNode: self nodeInRealMethod forInstallation: false. |
| 137 | + list := presenter metalinkListPresenter. |
| 138 | + list clickItem: 1. |
| 139 | + self assert: self nodeInRealMethod hasLinks. |
| 140 | + presenter toolbarButtons first execute. |
| 141 | + self deny: self nodeInRealMethod hasLinks |
| 142 | +] |
0 commit comments