Skip to content

Commit

Permalink
Merge pull request #136 from Numpsy/users/rw/vt_r8_test
Browse files Browse the repository at this point in the history
Extend the UserDefinedProperty read/write unit test to try a VT_R8 ty…
  • Loading branch information
ironfede authored Aug 6, 2024
2 parents 1da99f6 + b17a537 commit b4c19c4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ public void Test_DOCUMENT_SUMMARY_INFO_ADD_CUSTOM()
userProperties.PropertyNames[3] = "BooleanProperty";
userProperties.PropertyNames[4] = "IntegerProperty";
userProperties.PropertyNames[5] = "DateProperty";
userProperties.PropertyNames[6] = "DoubleProperty";

var stringProperty = co.NewProperty(VTPropertyType.VT_LPSTR, 2);
stringProperty.Value = "Hello";
Expand All @@ -413,6 +414,10 @@ public void Test_DOCUMENT_SUMMARY_INFO_ADD_CUSTOM()
timeProperty.Value = testNow;
userProperties.AddProperty(timeProperty);

var doubleProperty = co.NewProperty(VTPropertyType.VT_R8, 6);
doubleProperty.Value = 1.234567d;
userProperties.AddProperty(doubleProperty);

co.Save(dsiStream);
cf.SaveAs(@"test_add_user_defined_property.doc");
}
Expand All @@ -421,7 +426,7 @@ public void Test_DOCUMENT_SUMMARY_INFO_ADD_CUSTOM()
{
var co = cf.RootStorage.GetStream("\u0005DocumentSummaryInformation").AsOLEPropertiesContainer();
var propArray = co.UserDefinedProperties.Properties.ToArray();
Assert.AreEqual(propArray.Length, 5);
Assert.AreEqual(propArray.Length, 6);

// CodePage prop
Assert.AreEqual(1u, propArray[0].PropertyIdentifier);
Expand All @@ -441,6 +446,9 @@ public void Test_DOCUMENT_SUMMARY_INFO_ADD_CUSTOM()
Assert.AreEqual("DateProperty", propArray[4].PropertyName);
Assert.AreEqual(testNow, propArray[4].Value);
Assert.AreEqual(VTPropertyType.VT_FILETIME, propArray[4].VTType);
Assert.AreEqual("DoubleProperty", propArray[5].PropertyName);
Assert.AreEqual(1.234567d, propArray[5].Value);
Assert.AreEqual(VTPropertyType.VT_R8, propArray[5].VTType);
}
}

Expand Down

0 comments on commit b4c19c4

Please sign in to comment.