1372
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
1353
|
3 |
"{ Package: 'exept:regression' }"
|
|
4 |
|
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
|
7 |
TestCase subclass:#Win32OLETests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression-RuntimeSystem'
|
|
12 |
!
|
|
13 |
|
|
14 |
|
1355
|
15 |
!Win32OLETests class methodsFor:'queries'!
|
|
16 |
|
|
17 |
coveredPackageNames
|
|
18 |
^ #('exept:ole')
|
|
19 |
! !
|
|
20 |
|
1353
|
21 |
!Win32OLETests methodsFor:'tests'!
|
|
22 |
|
|
23 |
test00_loadOLE
|
|
24 |
|iid_IEnum|
|
|
25 |
|
|
26 |
OperatingSystem isMSWINDOWSlike ifFalse:[
|
|
27 |
Transcript showCR:'test skipped (OS is not WINDOWS)'.
|
|
28 |
^ self.
|
|
29 |
].
|
|
30 |
|
|
31 |
Smalltalk at:#ExternalLibraryFunction:Verbose put:true.
|
|
32 |
Smalltalk at:#ObjectFileLoader:Verbose put:true.
|
|
33 |
"/
|
|
34 |
"/ this will already perform a number of calls into OLE,
|
|
35 |
"/ to get the CLSIDs of various wellknown interfaces
|
|
36 |
"/ (see OLEInterfaceConstants initialize)
|
|
37 |
Smalltalk loadPackage:'exept:ole'.
|
|
38 |
|
|
39 |
"/ so when we arrive here without error, some is already known to work..
|
|
40 |
self assert:(OLEInterfaceConstants notNil).
|
|
41 |
|
|
42 |
iid_IEnum := OLEInterfaceConstants classVarAt:#'IID_IEnum'.
|
|
43 |
self assert:(iid_IEnum notNil).
|
|
44 |
self assert:(iid_IEnum class == GUID).
|
|
45 |
self assert:(iid_IEnum printString = '{2AE64960-CDDD-101C-9029-040224007802}').
|
|
46 |
|
|
47 |
"
|
|
48 |
self new test00_loadOLE
|
|
49 |
"
|
1356
|
50 |
!
|
|
51 |
|
|
52 |
test01_SysAllocString
|
|
53 |
|ole rslt bstr|
|
|
54 |
|
|
55 |
ole := OLEAutomationDLL current.
|
|
56 |
rslt := ole SysAllocString: 'hello World'.
|
|
57 |
|
|
58 |
self assert:(rslt notNil).
|
1372
|
59 |
self assert:(rslt sizeInBytes == (4 + ('hello World' size * 2) "+ 2")).
|
|
60 |
self assert:(rslt sizeInCharacters == 'hello World' size).
|
|
61 |
self assert:(rslt characterAt:1) == $h.
|
|
62 |
self assert:(rslt characterAt:2) == $e.
|
1356
|
63 |
|
|
64 |
"
|
|
65 |
self new test01_SysAllocString
|
|
66 |
"
|
1374
|
67 |
!
|
|
68 |
|
|
69 |
test02_GuidFromProgID
|
|
70 |
|guid|
|
|
71 |
|
1376
|
72 |
self
|
|
73 |
should:[
|
|
74 |
guid := (GUID clsidFromProgID:'Foo.Bar').
|
|
75 |
] raise:OLEError.
|
|
76 |
|
1375
|
77 |
OLEError handle:[:ex |
|
|
78 |
ex hresult = (OLEStatusCodeConstants at:#CO_E_CLASSSTRING) ifTrue:[
|
1376
|
79 |
"/ kind of expected - you machine has no AcroPDF installed...
|
1375
|
80 |
Transcript showCR:'OLE: class not found: AcroPDF.PDF'
|
|
81 |
] ifFalse:[
|
|
82 |
self assert:false description:'unexpected error code'.
|
|
83 |
]
|
|
84 |
] do:[
|
|
85 |
guid := (GUID clsidFromProgID:'AcroPDF.PDF').
|
|
86 |
self assert:(guid notNil).
|
1377
|
87 |
"/ self assert:(guid printString = '').
|
1375
|
88 |
].
|
1374
|
89 |
|
1377
|
90 |
guid := (GUID clsidFromProgID:'InternetExplorer.Application').
|
|
91 |
self assert:(guid notNil).
|
|
92 |
self assert:(guid printString = '{0002DF01-0000-0000-C000-000000000046}').
|
|
93 |
|
|
94 |
guid := (GUID clsidFromProgID: 'Msxml2.DOMDocument.4.0').
|
|
95 |
self assert:(guid notNil).
|
|
96 |
self assert:(guid printString = '{88D969C0-F192-11D4-A65F-0040963251E5}').
|
|
97 |
|
|
98 |
guid := (GUID clsidFromProgID: 'Microsoft.JScript.Vsa.VsaEngine').
|
|
99 |
self assert:(guid notNil).
|
|
100 |
self assert:(guid printString = '{B71E484D-93ED-4B56-BFB9-CEED5134822B}').
|
|
101 |
|
1374
|
102 |
"
|
|
103 |
self new test02_GuidFromProgID
|
|
104 |
"
|
1377
|
105 |
|
|
106 |
"Modified: / 30-03-2016 / 02:28:15 / cg"
|
1353
|
107 |
! !
|
|
108 |
|
|
109 |
!Win32OLETests class methodsFor:'documentation'!
|
|
110 |
|
|
111 |
version
|
|
112 |
^ '$Header$'
|
|
113 |
!
|
|
114 |
|
|
115 |
version_CVS
|
|
116 |
^ '$Header$'
|
|
117 |
! !
|
|
118 |
|