From c45a55ef2a63af6801a876f97cb1ee8ff0bcaf21 Mon Sep 17 00:00:00 2001
From: tatyana <tatyana@etersoft.ru>
Date: Wed, 7 Nov 2012 12:20:31 +0400
Subject: [PATCH 4/5] oleaut32/tests: Add test for ITypeInfo2_GetContainingTypeLib

---
 dlls/oleaut32/tests/Makefile.in |  1 +
 dlls/oleaut32/tests/typelib2.c  | 69 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 dlls/oleaut32/tests/typelib2.c

diff --git a/dlls/oleaut32/tests/Makefile.in b/dlls/oleaut32/tests/Makefile.in
index e47e2fe..a1bad99 100644
--- a/dlls/oleaut32/tests/Makefile.in
+++ b/dlls/oleaut32/tests/Makefile.in
@@ -8,6 +8,7 @@ C_SRCS = \
 	safearray.c \
 	tmarshal.c \
 	typelib.c \
+	typelib2.c \
 	usrmarshal.c \
 	varformat.c \
 	vartest.c \
diff --git a/dlls/oleaut32/tests/typelib2.c b/dlls/oleaut32/tests/typelib2.c
new file mode 100644
index 0000000..b2ea5c1
--- /dev/null
+++ b/dlls/oleaut32/tests/typelib2.c
@@ -0,0 +1,69 @@
+#define COBJMACROS
+
+#include <wine/test.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "oleauto.h"
+
+static const WCHAR jsdeb[] = {'J','S','D','e','b','.','t','l','b',0};
+static OLECHAR jsname[] = {'J','S','c','r','i','p','t','T','y','p','e','I','n','f','o',0};
+
+static void test_TypeInfo2_GetContainingTypeLib(void)
+{
+    ICreateTypeLib2 *ctl2;
+    ICreateTypeInfo *cti;
+    ITypeInfo2 *ti2;
+    ITypeLib *tl;
+    UINT *pIndex,Index;
+    HRESULT hr;
+
+    hr = CreateTypeLib2(SYS_WIN32, jsdeb, (ICreateTypeLib2 **)&ctl2);
+    if(hr != S_OK)
+    {
+        skip ("CreateTypeLib2 failed\n");
+        return;
+    }
+
+    hr = ICreateTypeLib2_CreateTypeInfo(ctl2, jsname, TKIND_DISPATCH, &cti);
+    if(hr != S_OK)
+    {
+        skip ("ICreateTypeLib2_CreateTypeInfo failed\n");
+        return;
+    }
+
+    hr = ICreateTypeInfo2_QueryInterface(cti, &IID_ITypeInfo2, (void**)&ti2);
+    if(hr != S_OK)
+    {
+        skip ("ICreateTypeInfo2_QueryInterface failed\n");
+        return;
+    }
+    hr = ITypeInfo2_GetContainingTypeLib(ti2, (ITypeLib **)&tl, &Index);
+    ok(!hr, " ITypeInfo2_GetContainingTypeLib failed on Index\n");
+    if(!hr)ITypeLib_Release(tl);
+
+    hr = ITypeInfo2_GetContainingTypeLib(ti2, (ITypeLib **)&tl, pIndex);
+    ok(!hr, " ITypeInfo2_GetContainingTypeLib failed on pIndex = NULL\n");
+    if(!hr)ITypeLib_Release(tl);
+
+    hr = ITypeInfo2_GetContainingTypeLib(ti2, (ITypeLib **)&tl, NULL);
+    ok(!hr, " ITypeInfo2_GetContainingTypeLib failed on Index = NULL\n");
+    if(!hr)ITypeLib_Release(tl);
+
+    hr = ITypeInfo2_GetContainingTypeLib(ti2, NULL, &Index);
+    ok(!hr, " ITypeInfo2_GetContainingTypeLib failed on ITypeLib = NULL\n");
+
+    hr = ITypeInfo2_GetContainingTypeLib(ti2, NULL, NULL);
+    ok(!hr, " ITypeInfo2_GetContainingTypeLib failed on ITypeLib = NULL Inpex = NULL\n");
+
+    ITypeInfo2_Release(ti2);
+    ICreateTypeInfo_Release(cti);
+    ICreateTypeLib2_Release(ctl2);
+}
+
+START_TEST(typelib2)
+{
+    test_TypeInfo2_GetContainingTypeLib();
+}
-- 
1.7.12.4
