msi: Add tests for MsiGetProperty

James Hawkins truiken at gmail.com
Mon Aug 7 12:49:18 CDT 2006


Hi,

These tests are for the off-by-one patch I sent in last week.  They
show that the patch was wrong.  The confusing part is that the tests
show that the call should fail with ERROR_MORE_DATA, and the tests do
succeed in windows, but looking at the msi log when running the
installer in windows, the call returns ERROR_SUCCESS.  I can't think
of any reason why that happens though.

Changelog
* Add tests for MsiGetProperty.

 dlls/msi/tests/package.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

--
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index 679c45c..07b9296 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -1737,6 +1737,50 @@ static void test_states(void)
     MsiCloseHandle( hpkg );
 }
 
+static void test_getproperty(void)
+{
+    MSIHANDLE hPackage = 0;
+    char prop[100];
+    DWORD size;
+    UINT r;
+
+    hPackage = package_from_db(create_package_db());
+    ok( hPackage != 0, " Failed to create package\n");
+
+    /* set the property */
+    r = MsiSetProperty(hPackage, "Name", "Value");
+    ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+    /* retrieve the size, NULL pointer */
+    size = 0;
+    r = MsiGetProperty(hPackage, "Name", NULL, &size);
+    ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+    ok( size == 5, "Expected 5, got %ld\n", size);
+
+    /* retrieve the size, empty string */
+    size = 0;
+    r = MsiGetProperty(hPackage, "Name", "", &size);
+    ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
+    ok( size == 5, "Expected 5, got %ld\n", size);
+
+    /* don't change size */
+    r = MsiGetProperty(hPackage, "Name", prop, &size);
+    ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
+    ok( size == 5, "Expected 5, got %ld\n", size);
+    ok( !lstrcmp(prop, "Valu"), "Expected Valu, got %s\n", prop);
+
+    /* increase the size by 1 */
+    size++;
+    r = MsiGetProperty(hPackage, "Name", prop, &size);
+    ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+    ok( size == 5, "Expected 5, got %ld\n", size);
+    ok( !lstrcmp(prop, "Value"), "Expected Value, got %s\n", prop);
+
+    r = MsiCloseHandle( hPackage);
+    ok( r == ERROR_SUCCESS , "Failed to close package\n" );
+    DeleteFile(msifile);
+}
+
 START_TEST(package)
 {
     test_createpackage();
@@ -1750,4 +1794,5 @@ START_TEST(package)
     test_msipackage();
     test_formatrecord2();
     test_states();
+    test_getproperty();
 }
-- 
1.3.3


More information about the wine-patches mailing list