msi: Add tests for publishing and unpublishing components.

This commit is contained in:
Hans Leidekker 2010-02-17 09:55:54 +01:00 committed by Alexandre Julliard
parent 0f0e81d14a
commit 7b660bb3d8
1 changed files with 94 additions and 0 deletions

View File

@ -1408,6 +1408,50 @@ static const CHAR crs_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n";
static const CHAR pub_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
"File\tFile\n"
"english.txt\tpublish\tenglish.txt\t1000\t\t\t8192\t1\n";
static const CHAR pub_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
"s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
"Feature\tFeature\n"
"publish\t\t\tpublish feature\t1\t2\tMSITESTDIR\t0\n";
static const CHAR pub_feature_comp_dat[] = "Feature_\tComponent_\n"
"s38\ts72\n"
"FeatureComponents\tFeature_\tComponent_\n"
"publish\tpublish\n";
static const CHAR pub_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
"s72\tS38\ts72\ti2\tS255\tS72\n"
"Component\tComponent\n"
"publish\t{B4EA0ACF-6238-426E-9C6D-7869F0F9C768}\tMSITESTDIR\t0\t\tenglish.txt\n";
static const CHAR pub_publish_component_dat[] = "ComponentId\tQualifier\tComponent_\tAppData\tFeature_\n"
"s38\ts255\ts72\tL255\ts38\n"
"PublishComponent\tComponentId\tQualifier\tComponent_\n"
"{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}\tenglish.txt\tpublish\t\tpublish\n";
static const CHAR pub_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
"LaunchConditions\t\t100\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"CostFinalize\t\t1000\n"
"InstallValidate\t\t1400\n"
"InstallInitialize\t\t1500\n"
"ProcessComponents\t\t1600\n"
"RemoveFiles\t\t1700\n"
"InstallFiles\t\t2000\n"
"PublishComponents\t\t3000\n"
"UnpublishComponents\t\t3100\n"
"RegisterProduct\t\t5000\n"
"PublishFeatures\t\t5100\n"
"PublishProduct\t\t5200\n"
"InstallFinalize\t\t6000\n";
typedef struct _msi_table
{
const CHAR *filename;
@ -2245,6 +2289,19 @@ static const msi_table crs_tables[] =
ADD_TABLE(property)
};
static const msi_table pub_tables[] =
{
ADD_TABLE(directory),
ADD_TABLE(pub_component),
ADD_TABLE(pub_feature),
ADD_TABLE(pub_feature_comp),
ADD_TABLE(pub_file),
ADD_TABLE(pub_publish_component),
ADD_TABLE(pub_install_exec_seq),
ADD_TABLE(media),
ADD_TABLE(property)
};
/* cabinet definitions */
/* make the max size large so there is only one cab file */
@ -8209,6 +8266,42 @@ static void test_create_remove_shortcut(void)
delete_test_files();
}
static void test_publish_components(void)
{
static char keypath[] =
"Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
UINT r;
LONG res;
HKEY key;
create_test_files();
create_file("msitest\\english.txt", 1000);
create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
ok(res == ERROR_SUCCESS, "value not found %d\n", res);
RegCloseKey(key);
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
delete_test_files();
}
START_TEST(install)
{
DWORD len;
@ -8310,6 +8403,7 @@ START_TEST(install)
test_install_remove_odbc();
test_register_typelib();
test_create_remove_shortcut();
test_publish_components();
DeleteFileA(log_file);