1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
25 #include "registry/registry.hxx"
26 #include "registry/reflread.hxx"
27 #include "registry/reflwrit.hxx"
28 #include "regdiagnose.h"
29 #include <rtl/alloc.h>
30 #include <rtl/ustring.hxx>
33 sal_Int32 lValue1
= 123456789;
34 sal_Int32 lValue2
= 54321;
35 sal_Int32 lValue3
= 111333111;
36 sal_Int32 lValue4
= 333111333;
37 char* sValue
= (char*)"string Value";
38 OUString
wValue("unicode Value");
41 void test_generateMerge1()
43 Registry
*myRegistry
= new Registry();
45 RegistryKey rootKey
, key1
, key2
, key3
, key4
, key5
, key6
, key7
, key8
, key9
;
47 REG_ENSURE(!myRegistry
->create(OUString("merge1.rdb")), "testGenerateMerge1 error 1");
48 REG_ENSURE(!myRegistry
->openRootKey(rootKey
), "testGenerateMerge1 error 2");
50 REG_ENSURE(!rootKey
.createKey(OUString("MergeKey1"), key1
), "testGenerateMerge1 error 3");
51 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey1"), key2
), "testGenerateMerge1 error 4");
52 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey1/KeyWithLongValue"), key3
), "testGenerateMerge1 error 5");
53 REG_ENSURE(!key3
.setValue(OUString(), RegValueType::LONG
, &lValue1
, sizeof(sal_Int32
)), "testGenerateMerge1 error 5a");
54 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey2"), key4
), "testGenerateMerge1 error 6");
55 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey2/KeyWithStringValue"), key5
), "testGenerateMerge1 error 7");
56 REG_ENSURE(!key5
.setValue(OUString(), RegValueType::STRING
, sValue
, strlen(sValue
)+1), "testGenerateMerge1 error 7a");
57 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey3"), key6
), "testGenerateMerge1 error 8");
58 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), key7
), "testGenerateMerge1 error 9");
59 REG_ENSURE(!key7
.setValue(OUString(), RegValueType::UNICODE
, (void*)wValue
.getStr(), ((wValue
.getLength()+1)*sizeof(sal_Unicode
))), "testGenerateMerge1 error 9a");
60 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey4"), key8
), "testGenerateMerge1 error 10");
61 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), key9
), "testGenerateMerge1 error 11");
62 REG_ENSURE(!key9
.setValue(OUString(), RegValueType::BINARY
, (void*)"abcdefghijklmnopqrstuvwxyz", 27), "testGenerateMerge1 error 11a");
65 REG_ENSURE(!key1
.closeKey() &&
73 !key9
.closeKey(), "testGenerateMerge1 error 12");
75 REG_ENSURE(!rootKey
.createKey(OUString("MergeKey1u2"), key1
), "testGenerateMerge1 error 13");
76 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK1SubKey11"), key2
), "testGenerateMerge1 error 14");
77 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), key3
), "testGenerateMerge1 error 15");
78 REG_ENSURE(!key3
.setValue(OUString(), RegValueType::LONG
, &lValue2
, sizeof(sal_Int32
)), "testGenerateMerge1 error 15a");
79 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK1SubKey12"), key4
), "testGenerateMerge1 error 16");
80 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), key5
), "testGenerateMerge1 error 17");
81 REG_ENSURE(!key5
.setValue(OUString(), RegValueType::STRING
, sValue
, strlen(sValue
)+1), "testGenerateMerge1 error 17a");
82 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK1SubKey13"), key6
), "testGenerateMerge1 error 18");
83 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), key7
), "testGenerateMerge1 error 19");
84 REG_ENSURE(!key7
.setValue(OUString(), RegValueType::UNICODE
, (void*)wValue
.getStr(), ((wValue
.getLength()+1)*sizeof(sal_Unicode
))), "testGenerateMerge1 error 19a");
85 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK12SubKey1u2"), key8
), "testGenerateMerge1 error 20");
86 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9
), "testGenerateMerge1 error 21");
87 REG_ENSURE(!key9
.setValue(OUString(), RegValueType::LONG
, &lValue3
, sizeof(sal_Int32
)), "testGenerateMerge1 error 21a");
89 REG_ENSURE(!rootKey
.closeKey() &&
98 !key9
.closeKey(), "testGenerateMerge1 error 22");
103 std::cout
<< "test_generateMerge1() Ok!\n";
107 void test_generateMerge2()
109 Registry
*myRegistry
= new Registry();
111 RegistryKey rootKey
, key1
, key2
, key3
, key4
, key5
, key6
, key7
, key8
, key9
;
113 REG_ENSURE(!myRegistry
->create(OUString("merge2.rdb")), "testGenerateMerge2 error 1");
114 REG_ENSURE(!myRegistry
->openRootKey(rootKey
), "testGenerateMerge2 error 2");
116 REG_ENSURE(!rootKey
.createKey(OUString("MergeKey2"), key1
), "testGenerateMerge2 error 3");
117 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey1"), key2
), "testGenerateMerge2 error 4");
118 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), key3
), "testGenerateMerge2 error 5");
119 REG_ENSURE(!key3
.setValue(OUString(), RegValueType::BINARY
, (void*)"1234567890", 11), "testGenerateMerge1 error 5a");
120 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey2"), key4
), "testGenerateMerge2 error 6");
121 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), key5
), "testGenerateMerge2 error 7");
122 REG_ENSURE(!key5
.setValue(OUString(), RegValueType::UNICODE
, (void*)wValue
.getStr(), ((wValue
.getLength()+1)*sizeof(sal_Unicode
))), "testGenerateMerge1 error 7a");
123 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey3"), key6
), "testGenerateMerge2 error 8");
124 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey3/KeyWithStringValue"), key7
), "testGenerateMerge2 error 9");
125 REG_ENSURE(!key7
.setValue(OUString(), RegValueType::STRING
, sValue
, strlen(sValue
)+1), "testGenerateMerge1 error 9a");
126 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey4"), key8
), "testGenerateMerge2 error 10");
127 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey2/MK2SubKey4/KeyWithLongValue"), key9
), "testGenerateMerge2 error 11");
128 REG_ENSURE(!key9
.setValue(OUString(), RegValueType::LONG
, &lValue1
, sizeof(sal_Int32
)), "testGenerateMerge1 error 11a");
130 REG_ENSURE(!key1
.closeKey() &&
138 !key9
.closeKey(), "testGenerateMerge2 error 12");
140 REG_ENSURE(!rootKey
.createKey(OUString("MergeKey1u2"), key1
), "testGenerateMerge2 error 13");
141 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK2SubKey21"), key2
), "testGenerateMerge2 error 14");
142 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), key3
), "testGenerateMerge2 error 15");
143 REG_ENSURE(!key3
.setValue(OUString(), RegValueType::BINARY
, (void*)"a1b2c3d4e5f6g7h8i9", 19), "testGenerateMerge1 error 15a");
144 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK2SubKey22"), key4
), "testGenerateMerge2 error 16");
145 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), key5
), "testGenerateMerge2 error 17");
146 REG_ENSURE(!key5
.setValue(OUString(), RegValueType::LONG
, &lValue2
, sizeof(sal_Int32
)), "testGenerateMerge1 error 17a");
147 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK2SubKey23"), key6
), "testGenerateMerge2 error 18");
148 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), key7
), "testGenerateMerge2 error 19");
149 REG_ENSURE(!key7
.setValue(OUString(), RegValueType::STRING
, sValue
, strlen(sValue
)+1), "testGenerateMerge1 error 19a");
150 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK12SubKey1u2"), key8
), "testGenerateMerge2 error 20");
151 REG_ENSURE(!rootKey
.createKey(OUString("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9
), "testGenerateMerge2 error 21");
152 REG_ENSURE(!key9
.setValue(OUString(), RegValueType::LONG
, &lValue4
, sizeof(sal_Int32
)), "testGenerateMerge1 error 21a");
154 REG_ENSURE(!rootKey
.closeKey() &&
163 !key9
.closeKey(), "testGenerateMerge2 error 22");
168 std::cout
<< "test_generateMerge2() Ok!\n";
174 Registry
*myRegistry
= new Registry();
176 RegistryKey rootKey
, key1
, mkey1
, key2
, mkey2
, key1u2
, mkey1u2
;
178 REG_ENSURE(!myRegistry
->create(OUString("mergetest.rdb")), "testMerge error 1");
179 REG_ENSURE(myRegistry
->getName() == "mergetest.rdb", "testMerge error 1.a)");
180 REG_ENSURE(!myRegistry
->openRootKey(rootKey
), "testMerge error 2");
181 REG_ENSURE(!myRegistry
->loadKey(rootKey
, OUString("/stardiv/IchbineinMergeKey"),
182 OUString("merge1.rdb")), "testMerge error 3");
183 REG_ENSURE(!myRegistry
->mergeKey(rootKey
, OUString("/stardiv/IchbineinMergeKey"),
184 OUString("merge2.rdb")), "testMerge error 4");
187 REG_ENSURE(!rootKey
.openKey("/stardiv/IchbineinMergeKey", key1
), "testMerge error 5");
189 REG_ENSURE(!key1
.openKey("MergeKey1", mkey1
), "testMerge error 6");
190 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 7");
192 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey1", mkey1
), "testMerge error 8");
193 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 9");
194 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey1/KeyWithLongValue", mkey1
), "testMerge error 10");
195 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 11");
197 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey2", mkey1
), "testMerge error 12");
198 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 13");
199 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey2/KeyWithStringValue", mkey1
), "testMerge error 14");
200 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 15");
202 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey3", mkey1
), "testMerge error 16");
203 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 17");
204 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue", mkey1
), "testMerge error 18");
205 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 19");
207 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey4", mkey1
), "testMerge error 20");
208 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 21");
209 REG_ENSURE(!key1
.openKey("/MergeKey1/MK1SubKey4/KeyWithBinaryValue", mkey1
), "testMerge error 22");
210 REG_ENSURE(!mkey1
.closeKey(), "testMerge error 23");
212 REG_ENSURE(!key1
.closeKey(), "testMerge error 24");
215 REG_ENSURE(!rootKey
.openKey("/stardiv/IchbineinMergeKey", key2
), "testMerge error 25");
217 REG_ENSURE(!key2
.openKey("MergeKey2", mkey2
), "testMerge error 26");
218 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 27");
220 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey1", mkey2
), "testMerge error 28");
221 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 29");
222 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey1/KeyWithBinaryValue", mkey2
), "testMerge error 30");
223 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 31");
225 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey2", mkey2
), "testMerge error 31");
226 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 33");
227 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue", mkey2
), "testMerge error 34");
228 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 35");
230 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey3", mkey2
), "testMerge error 36");
231 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 37");
232 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey3/KeyWithStringValue", mkey2
), "testMerge error 38");
233 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 39");
235 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey4", mkey2
), "testMerge error 40");
236 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 41");
237 REG_ENSURE(!key2
.openKey("/MergeKey2/MK2SubKey4/KeyWithLongValue", mkey2
), "testMerge error 42");
238 REG_ENSURE(!mkey2
.closeKey(), "testMerge error 43");
240 REG_ENSURE(!key2
.closeKey(), "testMerge error 44");
243 REG_ENSURE(!rootKey
.openKey("/stardiv/IchbineinMergeKey", key1u2
), "testMerge error 40");
245 REG_ENSURE(!key1u2
.openKey("MergeKey1u2", mkey1u2
), "testMerge error 41");
246 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 42");
248 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK1SubKey11", mkey1u2
), "testMerge error 43");
249 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 44");
250 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK1SubKey11/KeyWithLongValue", mkey1u2
), "testMerge error 45");
251 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 46");
253 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK1SubKey12", mkey1u2
), "testMerge error 47");
254 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 48");
255 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK1SubKey12/KeyWithStringValue", mkey1u2
), "testMerge error 49");
256 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 50");
258 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK1SubKey13", mkey1u2
), "testMerge error 51");
259 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 52");
260 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue", mkey1u2
), "testMerge error 53");
261 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 54");
263 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK2SubKey21", mkey1u2
), "testMerge error 55");
264 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 56");
265 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue", mkey1u2
), "testMerge error 57");
266 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 58");
268 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK2SubKey22", mkey1u2
), "testMerge error 59");
269 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 60");
270 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK2SubKey22/KeyWithLongValue", mkey1u2
), "testMerge error 61");
271 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 62");
273 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK2SubKey23", mkey1u2
), "testMerge error 63");
274 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 64");
275 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK2SubKey23/KeyWithStringValue", mkey1u2
), "testMerge error 65");
276 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 66");
278 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK12SubKey1u2", mkey1u2
), "testMerge error 67");
279 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 68");
280 REG_ENSURE(!key1u2
.openKey("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue", mkey1u2
), "testMerge error 69");
281 REG_ENSURE(!mkey1u2
.closeKey(), "testMerge error 70");
283 REG_ENSURE(!key1u2
.closeKey(), "testMerge error 71");
286 RegValueType valueType
;
287 sal_uInt32 valueSize
;
288 sal_Int32 int32Value
;
291 REG_ENSURE(!rootKey
.openKey("/stardiv/IchbineinMergeKey", key1
), "testMerge error 72");
293 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1/MK1SubKey1/KeyWithLongValue"), &valueType
, &valueSize
), "testMerge error 73");
294 REG_ENSURE(valueType
== RegValueType::LONG
&& valueSize
== sizeof(sal_Int32
), "testMerge error 74");
295 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1/MK1SubKey1/KeyWithLongValue"), (RegValue
)&int32Value
), "testMerge error 74.a)");
296 REG_ENSURE(int32Value
== lValue1
, "testMerge error 74.b)");
298 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1/MK1SubKey2/KeyWithStringValue"), &valueType
, &valueSize
), "testMerge error 75");
299 REG_ENSURE(valueType
== RegValueType::STRING
&& valueSize
== strlen(sValue
)+1, "testMerge error 76");
300 Value
= new sal_uInt8
[valueSize
];
301 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1/MK1SubKey2/KeyWithStringValue"), (RegValue
)Value
), "testMerge error 76.a)");
302 REG_ENSURE(strcmp((const char*)Value
, sValue
) == 0, "testMerge error 76.b)");
305 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), &valueType
, &valueSize
), "testMerge error 77");
306 REG_ENSURE(valueType
== RegValueType::UNICODE
&& valueSize
== (wValue
.getLength()+1)*sizeof(sal_Unicode
), "testMerge error 78");
307 Value
= new sal_uInt8
[valueSize
];
308 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), (RegValue
)Value
), "testMerge error 78.a)");
309 REG_ENSURE(wValue
.equals( (const sal_Unicode
*)Value
), "testMerge error 78.b)");
312 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), &valueType
, &valueSize
), "testMerge error 79");
313 REG_ENSURE(valueType
== RegValueType::BINARY
&& valueSize
== 27, "testMerge error 80");
314 Value
= new sal_uInt8
[valueSize
];
315 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), (RegValue
)Value
), "testMerge error 80.a)");
316 REG_ENSURE(strcmp((const char*)Value
, "abcdefghijklmnopqrstuvwxyz") == 0, "testMerge error 80.b)");
319 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), &valueType
, &valueSize
), "testMerge error 81");
320 REG_ENSURE(valueType
== RegValueType::BINARY
&& valueSize
== 11, "testMerge error 82");
321 Value
= new sal_uInt8
[valueSize
];
322 REG_ENSURE(!key1
.getValue(OUString("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), (RegValue
)Value
), "testMerge error 82.a)");
323 REG_ENSURE(strcmp((const char*)Value
, "1234567890") == 0, "testMerge error 82.b)");
326 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), &valueType
, &valueSize
), "testMerge error 83");
327 REG_ENSURE(valueType
== RegValueType::UNICODE
&& valueSize
== (wValue
.getLength()+1)*sizeof(sal_Unicode
), "testMerge error 84");
328 Value
= new sal_uInt8
[valueSize
];
329 REG_ENSURE(!key1
.getValue(OUString("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), (RegValue
)Value
), "testMerge error 84.a)");
330 REG_ENSURE(wValue
.equals( (const sal_Unicode
*)Value
), "testMerge error 84.b)");
333 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey2/MK2SubKey3/KeyWithStringValue"), &valueType
, &valueSize
), "testMerge error 85");
334 REG_ENSURE(valueType
== RegValueType::STRING
&& valueSize
== strlen(sValue
)+1, "testMerge error 86");
335 Value
= new sal_uInt8
[valueSize
];
336 REG_ENSURE(!key1
.getValue(OUString("/MergeKey2/MK2SubKey3/KeyWithStringValue"), (RegValue
)Value
), "testMerge error 86.a)");
337 REG_ENSURE(strcmp((const char*)Value
, sValue
) == 0, "testMerge error 86.b)");
340 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey2/MK2SubKey4/KeyWithLongValue"), &valueType
, &valueSize
), "testMerge error 87");
341 REG_ENSURE(valueType
== RegValueType::LONG
&& valueSize
== sizeof(sal_Int32
), "testMerge error 88");
342 REG_ENSURE(!key1
.getValue(OUString("/MergeKey2/MK2SubKey4/KeyWithLongValue"), (RegValue
)&int32Value
), "testMerge error 88.a)");
343 REG_ENSURE(int32Value
== lValue1
, "testMerge error 88.b)");
345 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), &valueType
, &valueSize
), "testMerge error 89");
346 REG_ENSURE(valueType
== RegValueType::LONG
&& valueSize
== sizeof(sal_Int32
), "testMerge error 90");
347 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), (RegValue
)&int32Value
), "testMerge error 90.a)");
348 REG_ENSURE(int32Value
== lValue2
, "testMerge error 90.b)");
350 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), &valueType
, &valueSize
), "testMerge error 91");
351 REG_ENSURE(valueType
== RegValueType::STRING
&& valueSize
== strlen(sValue
)+1, "testMerge error 92");
352 Value
= new sal_uInt8
[valueSize
];
353 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), (RegValue
)Value
), "testMerge error 92.a)");
354 REG_ENSURE(strcmp((const char*)Value
, sValue
) == 0, "testMerge error 92.b)");
357 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), &valueType
, &valueSize
), "testMerge error 93");
358 REG_ENSURE(valueType
== RegValueType::UNICODE
&& valueSize
== (wValue
.getLength()+1)*sizeof(sal_Unicode
), "testMerge error 94");
359 Value
= new sal_uInt8
[valueSize
];
360 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), (RegValue
)Value
), "testMerge error 94.a)");
361 REG_ENSURE(wValue
.equals( (const sal_Unicode
*)Value
), "testMerge error 94.b)");
364 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), &valueType
, &valueSize
), "testMerge error 95");
365 REG_ENSURE(valueType
== RegValueType::BINARY
&& valueSize
== 19, "testMerge error 96");
366 Value
= new sal_uInt8
[valueSize
];
367 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), (RegValue
)Value
), "testMerge error 96.a)");
368 REG_ENSURE(strcmp((const char*)Value
, "a1b2c3d4e5f6g7h8i9") == 0, "testMerge error 96.b)");
371 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), &valueType
, &valueSize
), "testMerge error 97");
372 REG_ENSURE(valueType
== RegValueType::LONG
&& valueSize
== sizeof(sal_Int32
), "testMerge error 98");
373 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), (RegValue
)&int32Value
), "testMerge error 98.a)");
374 REG_ENSURE(int32Value
== lValue2
, "testMerge error 98.b)");
376 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), &valueType
, &valueSize
), "testMerge error 99");
377 REG_ENSURE(valueType
== RegValueType::STRING
&& valueSize
== strlen(sValue
)+1, "testMerge error 100");
378 Value
= new sal_uInt8
[valueSize
];
379 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), (RegValue
)Value
), "testMerge error 100.a)");
380 REG_ENSURE(strcmp((const char*)Value
, sValue
) == 0, "testMerge error 100.b)");
383 REG_ENSURE(!key1
.getValueInfo(OUString("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), &valueType
, &valueSize
), "testMerge error 101");
384 REG_ENSURE(valueType
== RegValueType::LONG
&& valueSize
== sizeof(sal_Int32
), "testMerge error 102");
385 REG_ENSURE(!key1
.getValue(OUString("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), (RegValue
)&int32Value
), "testMerge error 102.a)");
386 REG_ENSURE(int32Value
== lValue4
, "testMerge error 102.b)");
389 REG_ENSURE(!key1
.closeKey(), "testMerge error 24");
392 REG_ENSURE(!rootKey
.closeKey(), "testMerge error 10");
394 REG_ENSURE(!myRegistry
->destroy( OUString("merge1.rdb") ), "test_registry_CppApi error 11");
395 REG_ENSURE(!myRegistry
->destroy( OUString("merge2.rdb") ), "test_registry_CppApi error 12");
396 REG_ENSURE(!myRegistry
->destroy( OUString() ), "test_registry_CppApi error 13");
400 std::cout
<< "test_merge() Ok!\n";
405 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */