[SCRRUN_WINETEST] Sync with Wine Staging 2.2. CORE-12823
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 26 Feb 2017 19:25:18 +0000 (19:25 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 26 Feb 2017 19:25:18 +0000 (19:25 +0000)
svn path=/trunk/; revision=73974

rostests/winetests/scrrun/dictionary.c
rostests/winetests/scrrun/filesystem.c

index 82cedc6..a6fecd1 100644 (file)
 
 #include "scrrun.h"
 
+#define test_provideclassinfo(a, b) _test_provideclassinfo((IDispatch*)a, b, __LINE__)
+static void _test_provideclassinfo(IDispatch *disp, const GUID *guid, int line)
+{
+    IProvideClassInfo *classinfo;
+    TYPEATTR *attr;
+    ITypeInfo *ti;
+    IUnknown *unk;
+    HRESULT hr;
+
+    hr = IDispatch_QueryInterface(disp, &IID_IProvideClassInfo, (void **)&classinfo);
+    ok_(__FILE__,line) (hr == S_OK, "Failed to get IProvideClassInfo, %#x.\n", hr);
+
+    hr = IProvideClassInfo_GetClassInfo(classinfo, &ti);
+    ok_(__FILE__,line) (hr == S_OK, "GetClassInfo() failed, %#x.\n", hr);
+
+    hr = ITypeInfo_GetTypeAttr(ti, &attr);
+    ok_(__FILE__,line) (hr == S_OK, "GetTypeAttr() failed, %#x.\n", hr);
+
+    ok_(__FILE__,line) (IsEqualGUID(&attr->guid, guid), "Unexpected typeinfo %s, expected %s\n", wine_dbgstr_guid(&attr->guid),
+        wine_dbgstr_guid(guid));
+
+    hr = IProvideClassInfo_QueryInterface(classinfo, &IID_IUnknown, (void **)&unk);
+    ok(hr == S_OK, "Failed to QI for IUnknown.\n");
+    ok(unk == (IUnknown *)disp, "Got unk %p, original %p\n", unk, disp);
+    IUnknown_Release(unk);
+
+    IProvideClassInfo_Release(classinfo);
+    ITypeInfo_ReleaseTypeAttr(ti, attr);
+    ITypeInfo_Release(ti);
+}
+
 static void test_interfaces(void)
 {
     static const WCHAR key_add[] = {'a', 0};
@@ -60,6 +91,8 @@ static void test_interfaces(void)
     hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex);
     ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
 
+    test_provideclassinfo(disp, &CLSID_Dictionary);
+
     V_VT(&key) = VT_BSTR;
     V_BSTR(&key) = SysAllocString(key_add);
     V_VT(&value) = VT_BSTR;
index cd0e6d6..57aacf6 100644 (file)
@@ -100,6 +100,37 @@ static IDrive *get_fixed_drive(void)
     return drive;
 }
 
+#define test_provideclassinfo(a, b) _test_provideclassinfo((IDispatch*)a, b, __LINE__)
+static void _test_provideclassinfo(IDispatch *disp, const GUID *guid, int line)
+{
+    IProvideClassInfo *classinfo;
+    TYPEATTR *attr;
+    ITypeInfo *ti;
+    IUnknown *unk;
+    HRESULT hr;
+
+    hr = IDispatch_QueryInterface(disp, &IID_IProvideClassInfo, (void **)&classinfo);
+    ok_(__FILE__,line) (hr == S_OK, "Failed to get IProvideClassInfo, %#x.\n", hr);
+
+    hr = IProvideClassInfo_GetClassInfo(classinfo, &ti);
+    ok_(__FILE__,line) (hr == S_OK, "GetClassInfo() failed, %#x.\n", hr);
+
+    hr = ITypeInfo_GetTypeAttr(ti, &attr);
+    ok_(__FILE__,line) (hr == S_OK, "GetTypeAttr() failed, %#x.\n", hr);
+
+    ok_(__FILE__,line) (IsEqualGUID(&attr->guid, guid), "Unexpected typeinfo %s, expected %s\n", wine_dbgstr_guid(&attr->guid),
+        wine_dbgstr_guid(guid));
+
+    hr = IProvideClassInfo_QueryInterface(classinfo, &IID_IUnknown, (void **)&unk);
+    ok(hr == S_OK, "Failed to QI for IUnknown.\n");
+    ok(unk == (IUnknown *)disp, "Got unk %p, original %p.\n", unk, disp);
+    IUnknown_Release(unk);
+
+    IProvideClassInfo_Release(classinfo);
+    ITypeInfo_ReleaseTypeAttr(ti, attr);
+    ITypeInfo_Release(ti);
+}
+
 static void test_interfaces(void)
 {
     static const WCHAR nonexistent_dirW[] = {
@@ -122,6 +153,8 @@ static void test_interfaces(void)
     lstrcpyW(file_path, windows_path);
     lstrcatW(file_path, file_kernel32W);
 
+    test_provideclassinfo(disp, &CLSID_FileSystemObject);
+
     hr = IDispatch_QueryInterface(disp, &IID_IObjectWithSite, (void**)&site);
     ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE);
 
@@ -927,6 +960,7 @@ static void test_GetFolder(void)
     hr = IFileSystem3_GetFolder(fs3, str, &folder);
     ok(hr == S_OK, "got 0x%08x\n", hr);
     SysFreeString(str);
+    test_provideclassinfo(folder, &CLSID_Folder);
     IFolder_Release(folder);
 }
 
@@ -978,6 +1012,7 @@ static void test_FolderCollection(void)
 
     hr = IFolder_get_SubFolders(folder, &folders);
     ok(hr == S_OK, "got 0x%08x\n", hr);
+    test_provideclassinfo(folders, &CLSID_Folders);
     IFolder_Release(folder);
 
     count = 0;
@@ -1153,6 +1188,7 @@ static void test_FileCollection(void)
 
     hr = IFolder_get_Files(folder, &files);
     ok(hr == S_OK, "got 0x%08x\n", hr);
+    test_provideclassinfo(files, &CLSID_Files);
     IFolder_Release(folder);
 
     count = 0;
@@ -1220,6 +1256,7 @@ static void test_FileCollection(void)
 
         hr = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IFile, (void **)&file);
         ok(hr == S_OK, "got 0x%08x\n", hr);
+        test_provideclassinfo(file, &CLSID_File);
 
         str = NULL;
         hr = IFile_get_Name(file, &str);
@@ -1292,6 +1329,8 @@ static void test_DriveCollection(void)
     hr = IFileSystem3_get_Drives(fs3, &drives);
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
+    test_provideclassinfo(drives, &CLSID_Drives);
+
     hr = IDriveCollection_get__NewEnum(drives, (IUnknown**)&enumvar);
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
@@ -1419,6 +1458,8 @@ static void test_CreateTextFile(void)
     hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream);
     ok(hr == S_OK, "got 0x%08x\n", hr);
 
+    test_provideclassinfo(stream, &CLSID_TextStream);
+
     hr = ITextStream_Read(stream, 1, &str);
     ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr);
 
@@ -2033,6 +2074,7 @@ static void test_GetDrive(void)
                             wine_dbgstr_w(ptr->drivespec));
                     SysFreeString(driveletter);
                 }
+                test_provideclassinfo(drive, &CLSID_Drive);
                 IDrive_Release(drive);
             } else
                 ok(drive == NULL, "got %p for drive spec %s\n", drive, wine_dbgstr_w(ptr->drivespec));