| 687 | testReadValueNamed_REG_MULTI_SZ_03 |
| 688 | "Testing if empty REG_MULTI_SZ value is read correctly via valueNamed:" |
| 689 | |
| 690 | | readData testingRegistryPath | |
| 691 | |
| 692 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 693 | |
| 694 | readData := testingRegistryPath valueNamed: 'testEmptyMultiSZ'. |
| 695 | |
| 696 | self assert: readData isEmpty |
| 697 | |
| 698 | " |
| 699 | self run:#testReadValueNamed_REG_MULTI_SZ_03 |
| 700 | self new testReadValueNamed_REG_MULTI_SZ_03 |
| 701 | " |
| 702 | |
| 703 | "Created: / 03-12-2018 / 10:59:48 / svestkap" |
| 704 | ! |
| 705 | |
| 706 | testReadValueNamed_REG_QWORD_01 |
| 707 | "Testing if REG_QWORD values are read correctly via valueNamed:" |
| 708 | |
| 709 | | readData testingRegistryPath | |
| 710 | |
| 711 | readData := Unicode16String new. |
| 712 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 713 | |
| 714 | readData := testingRegistryPath valueNamed: 'qword_max'. |
| 715 | |
| 716 | self assert: readData = 18446744073709551615. |
| 717 | |
| 718 | " |
| 719 | self run:#testReadValueNamed_REG_QWORD_01 |
| 720 | self new testReadValueNamed_REG_QWORD_01 |
| 721 | " |
| 722 | |
| 723 | "Created: / 16-11-2018 / 12:25:47 / svestkap" |
| 724 | ! |
| 725 | |
| 1130 | !Win32OperatingSystemTest methodsFor:'tests-unicodeWrite'! |
| 1131 | |
| 1132 | testWriteValueNamedPut_REG_MULTI_SZ_01 |
| 1133 | "Testing if REG_MULTI_SZ values are write correctly via valueNamed:put:" |
| 1134 | |
| 1135 | | readData testingRegistryPath | |
| 1136 | |
| 1137 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 1138 | |
| 1139 | testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold' put: #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき'). |
| 1140 | |
| 1141 | readData := testingRegistryPath valueNamed: 'Font_Leelawadee UI Bold'. |
| 1142 | |
| 1143 | self assert: readData = #('SEGOEUIB.TTF,Segoe UI Bold,110,82' 'řeřicha - ルすしかき'). |
| 1144 | |
| 1145 | " |
| 1146 | self run:#testWriteValueNamedPut_REG_MULTI_SZ_01 |
| 1147 | self new testWriteValueNamedPut_REG_MULTI_SZ_01 |
| 1148 | " |
| 1149 | |
| 1150 | "Created: / 27-11-2018 / 09:29:57 / svestkap" |
| 1151 | ! |
| 1152 | |
| 1153 | testWriteValueNamedPut_REG_MULTI_SZ_02 |
| 1154 | "Testing if REG_MULTI_SZ values are write correctly via valueNamed:put: |
| 1155 | The value data could be up to available memory (in reality NOT recommended to go over 1MB). |
| 1156 | Testing here a 2^16 + 2 sized OrderedCollection (a reasonable compromize between size and speed)" |
| 1157 | |
| 1158 | | testingRegistryPath testData testDataArray readData | |
| 1159 | |
| 1160 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 1161 | testData := OrderedCollection new. |
| 1162 | |
| 1163 | "/ testing 2^15 + 1 which should be |
| 1164 | "/ 2^15 + 1 timeRepeat -> testData OrderedCollection size should be: 2^16 + 1 (65538) |
| 1165 | 32769 timesRepeat: [ testData add: 'SEGOEUIB.TTF,Segoe UI Bold,110,82'. |
| 1166 | testData add: 'řeřicha - ルすしかき' |
| 1167 | ]. |
| 1168 | |
| 1169 | testDataArray := testData asArray. |
| 1170 | "/ storing the array |
| 1171 | testingRegistryPath valueNamed: 'ř ž č ルすしか' put: testDataArray. |
| 1172 | "/ reading the stored array back |
| 1173 | readData := testingRegistryPath valueNamed: 'ř ž č ルすしか'. |
| 1174 | |
| 1175 | self assert: readData = testDataArray. |
| 1176 | |
| 1177 | " |
| 1178 | self run:#testWriteValueNamedPut_REG_MULTI_SZ_02 |
| 1179 | self new testWriteValueNamedPut_REG_MULTI_SZ_02 |
| 1180 | " |
| 1181 | |
| 1182 | "Created: / 28-11-2018 / 14:46:55 / svestkap" |
| 1183 | "Modified (comment): / 03-12-2018 / 09:56:15 / svestkap" |
| 1184 | ! |
| 1185 | |
| 1186 | testWriteValueNamedPut_REG_QWORD_01 |
| 1187 | "Testing if REG_QWORD values are written correctly via valueNamed:put:" |
| 1188 | |
| 1189 | | readData testingRegistryPath | |
| 1190 | |
| 1191 | readData := Unicode16String new. |
| 1192 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 1193 | |
| 1194 | "/ max DWORD value 0xffffffff -> 4294967295 (which is on x64 SmallInteger) |
| 1195 | testingRegistryPath valueNamed: 'qword_max' put: 18446744073709551600. |
| 1196 | |
| 1197 | readData := testingRegistryPath valueNamed: 'qword_max'. |
| 1198 | |
| 1199 | self assert: readData = 18446744073709551600. |
| 1200 | |
| 1201 | " |
| 1202 | self run:#testReadValueNamed_REG_QWORD_01 |
| 1203 | self new testReadValueNamed_REG_QWORD_01 |
| 1204 | " |
| 1205 | |
| 1206 | "Created: / 26-11-2018 / 14:54:45 / svestkap" |
| 1207 | "Modified: / 27-11-2018 / 09:08:16 / svestkap" |
| 1208 | ! |
| 1209 | |
| 1210 | testWriteValueNamedPut_REG_SZ_01 |
| 1211 | "Testing if REG_SZ values are written correctly via valueNamed:put: |
| 1212 | Data is written and read back again." |
| 1213 | |
| 1214 | | readData testingRegistryPath | |
| 1215 | |
| 1216 | readData := Unicode16String new. |
| 1217 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 1218 | |
| 1219 | testingRegistryPath valueNamed: 'bledesu' put: 'řeřicha - ルすしかき'. |
| 1220 | |
| 1221 | readData := testingRegistryPath valueNamed: 'bledesu'. |
| 1222 | |
| 1223 | self assert: readData = 'řeřicha - ルすしかき'. |
| 1224 | |
| 1225 | " |
| 1226 | self run:#testWriteValueNamedPut_REG_SZ_01 |
| 1227 | self new testWriteValueNamedPut_REG_SZ_01 |
| 1228 | " |
| 1229 | |
| 1230 | "Created: / 26-11-2018 / 09:51:58 / svestkap" |
| 1231 | ! |
| 1232 | |
| 1233 | testWriteValueNamedPut_REG_SZ_02 |
| 1234 | "Testing if REG_SZ values are written correctly via valueNamed:put: |
| 1235 | Data is written and read back again. |
| 1236 | Note: this is testing Unicode with spaces - probably the worst combination" |
| 1237 | |
| 1238 | | readData testingRegistryPath | |
| 1239 | |
| 1240 | readData := Unicode16String new. |
| 1241 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 1242 | |
| 1243 | testingRegistryPath valueNamed: 'しかき ' put: 'řeřicha - ルすしかき'. |
| 1244 | |
| 1245 | readData := testingRegistryPath valueNamed: 'しかき '. |
| 1246 | |
| 1247 | self assert: readData = 'řeřicha - ルすしかき'. |
| 1248 | |
| 1249 | " |
| 1250 | self run:#testReadValueNamed_REG_SZ_03 |
| 1251 | self new testReadValueNamed_REG_SZ_03 |
| 1252 | " |
| 1253 | |
| 1254 | "Created: / 26-11-2018 / 14:10:35 / svestkap" |
| 1255 | ! |
| 1256 | |
| 1257 | testWriteValueNamed_REG_DWORD_01 |
| 1258 | "Testing if REG_DWORD values are written correctly via valueNamed:put:" |
| 1259 | |
| 1260 | | readData testingRegistryPath | |
| 1261 | |
| 1262 | readData := Unicode16String new. |
| 1263 | testingRegistryPath := Win32OperatingSystem registryEntry key: registryPath. |
| 1264 | |
| 1265 | testingRegistryPath valueNamed: 'dword_value' put: 7337. |
| 1266 | |
| 1267 | readData := testingRegistryPath valueNamed: 'dword_value'. |
| 1268 | |
| 1269 | self assert: readData = 7337. |
| 1270 | |
| 1271 | " |
| 1272 | self run:#testWriteValueNamed_REG_DWORD_01 |
| 1273 | self new testWriteValueNamed_REG_DWORD_01 |
| 1274 | " |
| 1275 | |
| 1276 | "Created: / 26-11-2018 / 14:16:11 / svestkap" |
| 1277 | ! ! |
| 1278 | |