msi: Add some more tests for MsiOpenDatabase.

This commit is contained in:
Mike McCormack 2006-09-12 15:28:43 +09:00 committed by Alexandre Julliard
parent b6e6d4b511
commit e1757fcad2
1 changed files with 53 additions and 1 deletions

View File

@ -35,7 +35,7 @@ static const char *mstfile = "winetst.mst";
static void test_msidatabase(void) static void test_msidatabase(void)
{ {
MSIHANDLE hdb = 0; MSIHANDLE hdb = 0, hdb2 = 0;
UINT res; UINT res;
DeleteFile(msifile); DeleteFile(msifile);
@ -47,9 +47,61 @@ static void test_msidatabase(void)
res = MsiDatabaseCommit( hdb ); res = MsiDatabaseCommit( hdb );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" ); ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile ), "database should exist\n");
res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
todo_wine {
res = MsiOpenDatabase( msifile, msifile2, &hdb2 );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile2 ), "database should exist\n");
res = MsiDatabaseCommit( hdb2 );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
}
res = MsiCloseHandle( hdb2 );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
res = MsiOpenDatabase( msifile, MSIDBOPEN_READONLY, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" );
res = MsiCloseHandle( hdb ); res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" ); ok( res == ERROR_SUCCESS , "Failed to close database\n" );
res = MsiOpenDatabase( msifile, MSIDBOPEN_DIRECT, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" );
res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
res = MsiOpenDatabase( msifile, MSIDBOPEN_TRANSACT, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" );
res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
todo_wine {
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes( msifile2 ), "database should exist\n");
/* MSIDBOPEN_CREATE deletes the database if MsiCommitDatabase isn't called */
res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" );
res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
res = MsiOpenDatabase( msifile, MSIDBOPEN_CREATE, &hdb );
ok( res == ERROR_SUCCESS , "Failed to open database\n" );
res = MsiDatabaseCommit( hdb );
ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
res = MsiCloseHandle( hdb );
ok( res == ERROR_SUCCESS , "Failed to close database\n" );
res = DeleteFile( msifile2 );
ok( res == TRUE, "Failed to delete database\n" );
}
res = DeleteFile( msifile ); res = DeleteFile( msifile );
ok( res == TRUE, "Failed to delete database\n" ); ok( res == TRUE, "Failed to delete database\n" );
} }