@@ -333,5 +333,43 @@ public void Test_SUMMARY_INFO_MODIFY_LPWSTRING()
333
333
}
334
334
}
335
335
336
+ // winUnicodeDictionary.doc contains a UserProperties section with the CP_WINUNICODE codepage, and LPWSTR string properties
337
+ [ TestMethod ]
338
+ public void Test_Read_Unicode_User_Properties_Dictionary ( )
339
+ {
340
+ using ( CompoundFile cf = new CompoundFile ( "winUnicodeDictionary.doc" ) )
341
+ {
342
+ var dsiStream = cf . RootStorage . GetStream ( "\u0005 DocumentSummaryInformation" ) ;
343
+ var co = dsiStream . AsOLEPropertiesContainer ( ) ;
344
+ var userProps = co . UserDefinedProperties ;
345
+
346
+ // CodePage should be CP_WINUNICODE (1200)
347
+ Assert . AreEqual ( 1200 , userProps . Context . CodePage ) ;
348
+
349
+ // There should be 5 property names present, and 6 properties (the properties include the code page)
350
+ Assert . AreEqual ( 5 , userProps . PropertyNames . Count ) ;
351
+ Assert . AreEqual ( 6 , userProps . Properties . Count ( ) ) ;
352
+
353
+ // Check for expected names and values
354
+ var propArray = userProps . Properties . ToArray ( ) ;
355
+
356
+ // CodePage prop
357
+ Assert . AreEqual ( 1u , propArray [ 0 ] . PropertyIdentifier ) ;
358
+ Assert . AreEqual ( "0x00000001" , propArray [ 0 ] . PropertyName ) ;
359
+ Assert . AreEqual ( ( short ) 1200 , propArray [ 0 ] . Value ) ;
360
+
361
+ // String properties
362
+ Assert . AreEqual ( "A\0 " , propArray [ 1 ] . PropertyName ) ;
363
+ Assert . AreEqual ( "\0 " , propArray [ 1 ] . Value ) ;
364
+ Assert . AreEqual ( "AB\0 " , propArray [ 2 ] . PropertyName ) ;
365
+ Assert . AreEqual ( "X\0 " , propArray [ 2 ] . Value ) ;
366
+ Assert . AreEqual ( "ABC\0 " , propArray [ 3 ] . PropertyName ) ;
367
+ Assert . AreEqual ( "XY\0 " , propArray [ 3 ] . Value ) ;
368
+ Assert . AreEqual ( "ABCD\0 " , propArray [ 4 ] . PropertyName ) ;
369
+ Assert . AreEqual ( "XYZ\0 " , propArray [ 4 ] . Value ) ;
370
+ Assert . AreEqual ( "ABCDE\0 " , propArray [ 5 ] . PropertyName ) ;
371
+ Assert . AreEqual ( "XYZ!\0 " , propArray [ 5 ] . Value ) ;
372
+ }
373
+ }
336
374
}
337
375
}
0 commit comments