[PATCH 09/12] shell32/tests: Test ShellExecuteEx()'s handling of classes.
Francois Gouget
fgouget at codeweavers.com
Wed Jan 6 03:15:41 CST 2016
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
dlls/shell32/tests/shlexec.c | 109 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 146f3b8..3691062 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -1696,6 +1696,114 @@ static void test_filename(void)
}
}
+static void test_class(void)
+{
+ HKEY classkey;
+ char filename[MAX_PATH];
+ INT_PTR rc;
+
+ if (skip_shlexec_tests ||
+ !create_test_association(".shclass") ||
+ !create_test_class("shlexec.shname", FALSE))
+ {
+ skip("Unable to create the .shclass association or shlexec.shname class\n");
+ return;
+ }
+ create_test_verb("shlexec.shclass", "open", 0, "Class \"%1\"");
+ create_test_verb("shlexec.shname", "open", 0, "ClassName \"%1\"");
+ classkey = NULL;
+ rc = RegOpenKeyExA(HKEY_CLASSES_ROOT, "shlexec.shclass", 0, KEY_READ, &classkey);
+ ok(rc == ERROR_SUCCESS, "could not open the shlexec.shclass class\n");
+ sprintf(filename, "%s\\test file.shlexec", tmpdir);
+
+ /* A class overrides the normal association */
+ /* FIXME SEE_MASK_FLAG_NO_UI is only needed due to Wine's bug */
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, "shlexec.shclass", NULL);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+
+ /* FIXME SEE_MASK_FLAG_NO_UI is only needed due to Wine's bug */
+ rc = shell_execute_ex(SEE_MASK_CLASSKEY | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL, classkey);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+
+ /* Passing an extension works too */
+ /* FIXME SEE_MASK_FLAG_NO_UI is only needed due to Wine's bug */
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, ".shclass", NULL);
+ todo_wine ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ todo_wine okChildString("argvA3", "Class");
+ todo_wine okChildString("argvA4", filename);
+
+ /* Setting the parameters has no effect without the corresponding flag */
+ rc = shell_execute_ex(SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, "shlexec.shname", classkey);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Open");
+ okChildString("argvA4", filename);
+
+ rc = shell_execute_ex(SEE_MASK_CLASSKEY | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, "shlexec.shname", classkey);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, "shlexec.shname", classkey);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "ClassName");
+ okChildString("argvA4", filename);
+
+ /* The class key overrides the class name */
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_CLASSKEY | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, ".shname", classkey);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+
+ /* The flags disable the regular lookup even if no class is specified */
+ rc = shell_execute_ex(SEE_MASK_CLASSKEY | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL, NULL);
+ todo_wine ok(rc == SE_ERR_NOASSOC || rc == SE_ERR_ACCESSDENIED, "%s returned %lu\n", shell_call, rc);
+
+ if (0) { /* FIXME Crashes in Wine */
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL, NULL);
+ ok(rc == SE_ERR_NOASSOC || rc == SE_ERR_ACCESSDENIED, "%s returned %lu\n", shell_call, rc);
+ }
+
+ /* A class compensates for the lack of an association */
+ sprintf(filename, "%s\\test file.noassoc", tmpdir);
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME, NULL, filename, NULL, NULL, "shlexec.shclass", NULL);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+
+ rc = shell_execute_ex(SEE_MASK_CLASSKEY, NULL, filename, NULL, NULL, NULL, classkey);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+
+ if (skip_noassoc_tests)
+ win_skip("Skipping nonexistent file + class test\n");
+ else
+ {
+ /* On some Windows versions nonexistent files are not an issue either */
+ sprintf(filename, "%s\\nonexistent.shlexec", tmpdir);
+ rc = shell_execute_ex(SEE_MASK_CLASSNAME, NULL, filename, NULL, NULL, "shlexec.shclass", NULL);
+ ok(rc > 32, "%s returned %lu\n", shell_call, rc);
+ okChildInt("argcA", 5);
+ okChildString("argvA3", "Class");
+ okChildString("argvA4", filename);
+ }
+ delete_test_association(".shclass");
+ delete_test_class("shlexec.shname");
+}
+
typedef struct
{
const char* urlprefix;
@@ -2811,6 +2919,7 @@ START_TEST(shlexec)
test_argify();
test_lpFile_parsed();
test_filename();
+ test_class();
test_fileurls();
test_urls();
test_find_executable();
--
2.6.4
More information about the wine-patches
mailing list