[PATCH 2/2] winmm/tests: Add tests showing window message processing while opening a video.

Andrew Eikum aeikum at codeweavers.com
Wed Apr 27 14:08:57 CDT 2016


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/winmm/tests/Makefile.in |   2 ++
 dlls/winmm/tests/mci.c       |  80 +++++++++++++++++++++++++++++++++++++++++++
 dlls/winmm/tests/resource.rc |  22 ++++++++++++
 dlls/winmm/tests/test.mpg    | Bin 0 -> 6144 bytes
 4 files changed, 104 insertions(+)
 create mode 100644 dlls/winmm/tests/resource.rc
 create mode 100644 dlls/winmm/tests/test.mpg

diff --git a/dlls/winmm/tests/Makefile.in b/dlls/winmm/tests/Makefile.in
index 5d81e38..1ebbbf9 100644
--- a/dlls/winmm/tests/Makefile.in
+++ b/dlls/winmm/tests/Makefile.in
@@ -12,3 +12,5 @@ C_SRCS = \
 	mmio.c \
 	timer.c \
 	wave.c
+
+RC_SRCS = resource.rc
diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index 14500a5..a8f60a9 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -23,6 +23,7 @@
 #include "windows.h"
 #include "mmsystem.h"
 #include "mmreg.h"
+#include "digitalv.h"
 #include "wine/test.h"
 
 /* The tests use the MCI's own save capability to create the tempfile.wav to play.
@@ -1391,6 +1392,84 @@ static void test_asyncWaveTypeMpegvideo(HWND hwnd)
     test_notification(hwnd,"play (aborted by close)",MCI_NOTIFY_ABORTED);
 }
 
+static unsigned int rcvd_msgs = 0;
+
+static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+    ++rcvd_msgs;
+    return DefWindowProcW(hwnd, msg, wparam, lparam);
+}
+
+static void test_mci_window(void)
+{
+    MCI_DGV_OPEN_PARMSW open;
+    MCIERROR mr;
+    HWND hwnd;
+    WCHAR pathW[MAX_PATH];
+    DWORD written;
+    HANDLE file;
+    HRSRC res;
+    void *ptr;
+
+    static WCHAR filenameW[] = {'w','i','n','e','t','e','s','t','.','m','p','g',0};
+    static const WCHAR mciqtz_testW[] = {'m','c','i','q','t','z','_','t','e','s','t',0};
+
+    static WNDCLASSEXW wndclass = {
+        sizeof(WNDCLASSEXW),
+        0,
+        wnd_proc,
+        0, 0, NULL, NULL, NULL, NULL, NULL,
+        mciqtz_testW,
+        NULL
+    };
+
+    GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW);
+    lstrcatW(pathW, filenameW);
+
+    file = CreateFileW(pathW, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+    ok(file != INVALID_HANDLE_VALUE,
+            "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW), GetLastError());
+
+    res = FindResourceA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(1), (LPCSTR)RT_RCDATA);
+    ok( res != 0, "couldn't find resource\n" );
+    ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
+    WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
+    ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
+    CloseHandle( file );
+
+    RegisterClassExW(&wndclass);
+    hwnd = CreateWindowW(mciqtz_testW, mciqtz_testW,
+            WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
+            300, 300, NULL, NULL, NULL, NULL);
+
+    ShowWindow(hwnd, SW_SHOW);
+    SetForegroundWindow(hwnd);
+
+    open.dwCallback = 0;
+    open.wDeviceID = 0x1;
+    open.lpstrDeviceType = NULL;
+    open.lpstrElementName = filenameW;
+    open.lpstrAlias = NULL;
+    open.dwStyle = WS_CHILD;
+    open.hWndParent = hwnd;
+
+    rcvd_msgs = 0;
+    mr = mciSendCommandW(0, MCI_OPEN,
+            (MCI_DGV_OPEN_WS | MCI_DGV_OPEN_PARENT | MCI_OPEN_ELEMENT), (DWORD_PTR)&open);
+    if(mr != 0){
+        skip("Decoding MPEG files not supported\n");
+        goto exit;
+    }
+    ok(rcvd_msgs > 0, "Expected window messages to be processed\n");
+
+    mr = mciSendCommandW(open.wDeviceID, MCI_CLOSE, 0, 0);
+    ok(mr == 0, "MCI_CLOSE failed: %08x\n", mr);
+
+exit:
+    DestroyWindow(hwnd);
+    DeleteFileW(pathW);
+}
+
 START_TEST(mci)
 {
     char curdir[MAX_PATH], tmpdir[MAX_PATH];
@@ -1406,6 +1485,7 @@ START_TEST(mci)
     test_mciParser(hwnd);
     test_openCloseWAVE(hwnd);
     test_recordWAVE(hwnd);
+    test_mci_window();
     if(waveOutGetNumDevs()){
         test_playWAVE(hwnd);
         test_asyncWAVE(hwnd);
diff --git a/dlls/winmm/tests/resource.rc b/dlls/winmm/tests/resource.rc
new file mode 100644
index 0000000..49f2799
--- /dev/null
+++ b/dlls/winmm/tests/resource.rc
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2016 Andrew Eikum for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "windef.h"
+
+/* @makedep: test.mpg */
+1 RCDATA "test.mpg"
diff --git a/dlls/winmm/tests/test.mpg b/dlls/winmm/tests/test.mpg
new file mode 100644
index 0000000000000000000000000000000000000000..a152802fb25c7da31ffe19e2e481d1dd474ebdcf
GIT binary patch
literal 6144
zcmZQzVBDq1z{tRO*f^bmfpIqjCy1f=|G|T2K<)$f`-Tk6<&1(1%<&U}{LLH;4Wj at 5
zKac>jcQ9};H~?t|2LAs)fHb4<k6KNS?kP)^^n#{z?DPs!dP)ixXaX}K6M$-12&utu
zDbNHqLM8y!uoF^4&=v-U at c%y=fJQM26(oabW}!kEAjJaZvO&1)P%Z<*bkdYxCrLS@
zIBCjBb2}qxZf7LT?M$S(oryHJGm++YCX(EamR;BwfC*qUyI>Ry;7}ng+D5Yru7YIv
zWEY;%?1Hr(rD}Eo8V0QYnXep%)c+6I-x)HnzrQHRz<whUTyJ4iR3w#v45Kv<&WuXO
znn!swE73kHjb;~;8kvK*p{6;ST}HDDuun`{2|XnHHIVwB^AN25XRtA3;Jpj1|9Ouk
lLOQMtr1g3Bv9IC(KMF=eU^E0qLtr!nMnhmU1O{^m004!u!kGX7

literal 0
HcmV?d00001

-- 
2.8.0




More information about the wine-patches mailing list