Author: akhaldi Date: Sat Nov 21 10:03:55 2015 New Revision: 69989
URL: http://svn.reactos.org/svn/reactos?rev=69989&view=rev Log: [MSVFW32_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
Modified: trunk/rostests/winetests/msvfw32/msvfw.c
Modified: trunk/rostests/winetests/msvfw32/msvfw.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvfw32/msvfw.c?... ============================================================================== --- trunk/rostests/winetests/msvfw32/msvfw.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvfw32/msvfw.c [iso-8859-1] Sat Nov 21 10:03:55 2015 @@ -28,6 +28,27 @@ static void test_OpenCase(void) { HIC h; + ICINFO info; + /* Check if default handler works */ + h = ICOpen(mmioFOURCC('v','i','d','c'),0,ICMODE_DECOMPRESS); + ok(0!=h,"ICOpen(vidc.0) failed\n"); + if (h) { + info.dwSize = sizeof(info); + info.szName[0] = 0; + ICGetInfo(h, &info, sizeof(info)); + trace("The default decompressor is %s\n", wine_dbgstr_w(info.szName)); + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('v','i','d','c'),0,ICMODE_COMPRESS); + ok(0!=h || broken(h == 0),"ICOpen(vidc.0) failed\n"); /* Not present in Win8 */ + if (h) { + info.dwSize = sizeof(info); + info.szName[0] = 0; + ICGetInfo(h, &info, sizeof(info)); + trace("The default compressor is %s\n", wine_dbgstr_w(info.szName)); + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + /* Open a compressor with combinations of lowercase * and uppercase compressortype and handler. */ @@ -99,7 +120,7 @@
bo.biHeight = -bo.biHeight; err = ICDecompressQuery(h, &bi, &bo); - todo_wine ok(err == ICERR_OK, "Query cvid->RGB32 height<0: %d\n", err); + ok(err == ICERR_OK, "Query cvid->RGB32 height<0: %d\n", err); bo.biHeight = -bo.biHeight;
ok(ICClose(h) == ICERR_OK,"ICClose failed\n"); @@ -120,7 +141,7 @@ if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n"); bo.biHeight = - bo.biHeight; h = ICLocate(ICTYPE_VIDEO, 0, &bi, &bo, ICMODE_DECOMPRESS); - todo_wine ok(h != 0, "cvid->RGB16 height<0 failed\n"); + ok(h != 0, "cvid->RGB16 height<0 failed\n"); if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n"); bo.biHeight = - bo.biHeight;
@@ -130,7 +151,7 @@ if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n"); bo.biHeight = - bo.biHeight; h = ICLocate(ICTYPE_VIDEO, 0, &bi, &bo, ICMODE_DECOMPRESS); - todo_wine ok(h != 0, "cvid->RGB32 height<0 failed\n"); + ok(h != 0, "cvid->RGB32 height<0 failed\n"); if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n"); bo.biHeight = - bo.biHeight;
@@ -191,17 +212,82 @@ bi.biCompression = BI_RGB; bo.biBitCount = bi.biBitCount = 8; h = ICLocate(ICTYPE_VIDEO, 0, &bi, &bo, ICMODE_DECOMPRESS); - todo_wine ok(h != 0, "RGB8->RGB identity failed\n"); + ok(h != 0, "RGB8->RGB identity failed\n"); if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n");
bi.biCompression = BI_RLE8; h = ICLocate(ICTYPE_VIDEO, 0, &bi, &bo, ICMODE_DECOMPRESS); ok(h != 0, "RLE8->RGB again failed\n"); if (h) ok(ICClose(h) == ICERR_OK,"ICClose failed\n"); +} + +static void test_ICSeqCompress(void) +{ + /* The purpose of this test is to validate sequential frame compressing + * functions. The MRLE codec will be used because Wine supports it and + * it is present in any Windows. + */ + HIC h; + DWORD err, vidc = mmioFOURCC('v','i','d','c'), mrle = mmioFOURCC('m', 'r', 'l', 'e'); + DWORD i; + LONG frame_len; + BOOL key_frame, ret; + char *frame; + COMPVARS pc; + struct { BITMAPINFOHEADER header; RGBQUAD map[256]; } + input_header = { {sizeof(BITMAPINFOHEADER), 32, 1, 1, 8, 0, 32*8, 0, 0, 256, 256}, + {{255,0,0}, {0,255,0}, {0,0,255}, {255,255,255}}}; + PBITMAPINFO bitmap = (PBITMAPINFO) &input_header; + static BYTE input[32] = {1,2,3,3,3,3,2,3,1}; + static const BYTE output_kf[] = {1,1,1,2,4,3,0,3,2,3,1,0,23,0,0,0,0,1}, /* key frame*/ + output_nkf[] = {0,0,0,1}; /* non key frame */ + + h = ICOpen(vidc, mrle, ICMODE_COMPRESS); + ok(h != NULL, "Expected non-NULL\n"); + + pc.cbSize = sizeof(pc); + pc.dwFlags = ICMF_COMPVARS_VALID; + pc.fccType = vidc; + pc.fccHandler = mrle; + pc.hic = h; + pc.lpbiIn = NULL; + pc.lpbiOut = NULL; + pc.lpBitsOut = pc.lpBitsPrev = pc.lpState = NULL; + pc.lQ = ICQUALITY_DEFAULT; + pc.lKey = 1; + pc.lDataRate = 300; + pc.lpState = NULL; + pc.cbState = 0; + + ret = ICSeqCompressFrameStart(&pc, bitmap); + ok(ret == TRUE, "Expected TRUE\n"); + /* Check that reserved pointers were allocated */ + ok(pc.lpbiIn != NULL, "Expected non-NULL\n"); + ok(pc.lpbiOut != NULL, "Expected non-NULL\n"); + + for(i = 0; i < 9; i++) + { + frame_len = 0; + frame = ICSeqCompressFrame(&pc, 0, input, &key_frame, &frame_len); + ok(frame != NULL, "Frame[%d]: Expected non-NULL\n", i); + if (frame_len == sizeof(output_nkf)) + ok(!memcmp(output_nkf, frame, frame_len), "Frame[%d]: Contents do not match\n", i); + else if (frame_len == sizeof(output_kf)) + ok(!memcmp(output_kf, frame, frame_len), "Frame[%d]: Contents do not match\n", i); + else + ok(0, "Unknown frame size of %d byten\n", frame_len); + } + + ICSeqCompressFrameEnd(&pc); + ICCompressorFree(&pc); + /* ICCompressorFree already closed the HIC */ + err = ICClose(h); + ok(err == ICERR_BADHANDLE, "Expected -8, got %d\n", err); }
START_TEST(msvfw) { test_OpenCase(); test_Locate(); -} + test_ICSeqCompress(); +}