diff options
author | Günther Deschner <gd@samba.org> | 2010-03-02 15:19:57 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-03-02 15:29:38 +0100 |
commit | 8919a58583f3e7c610d4182ac589f1445606e46f (patch) | |
tree | f02110536dde09a5e791c4af6fbe38dcf9251f40 /testprogs/win32/spoolss | |
parent | 0e9844c70a8df89da5e9b7c0b5139fe022bab59f (diff) | |
download | samba-8919a58583f3e7c610d4182ac589f1445606e46f.tar.gz samba-8919a58583f3e7c610d4182ac589f1445606e46f.tar.bz2 samba-8919a58583f3e7c610d4182ac589f1445606e46f.zip |
testprogs: test result of GetPrinterDataEx against SetPrinterDataEx args.
Guenther
Diffstat (limited to 'testprogs/win32/spoolss')
-rw-r--r-- | testprogs/win32/spoolss/spoolss.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/testprogs/win32/spoolss/spoolss.c b/testprogs/win32/spoolss/spoolss.c index acdbb13f47..49bcc59853 100644 --- a/testprogs/win32/spoolss/spoolss.c +++ b/testprogs/win32/spoolss/spoolss.c @@ -792,6 +792,9 @@ static BOOL test_devicemode_equal(struct torture_context *tctx, return TRUE; } +/**************************************************************************** +****************************************************************************/ + static BOOL test_DeviceModes(struct torture_context *tctx, LPSTR printername, HANDLE handle) @@ -1353,22 +1356,37 @@ static BOOL test_PrinterData_Server(struct torture_context *tctx, /**************************************************************************** ****************************************************************************/ +static BOOL PrinterDataEqual(struct torture_context *tctx, + DWORD type1, DWORD type2, + DWORD size1, DWORD size2, + LPBYTE buffer1, LPBYTE buffer2) +{ + torture_assert_int_equal(tctx, type1, type2, "type mismatch"); + torture_assert_int_equal(tctx, size1, size2, "size mismatch"); + torture_assert_mem_equal(tctx, buffer1, buffer2, size1, "buffer mismatch"); + + return TRUE; +} + +/**************************************************************************** +****************************************************************************/ + static BOOL test_PrinterData(struct torture_context *tctx, LPSTR printername, HANDLE handle) { LPSTR keyname = "torture_key"; LPSTR valuename = "torture_value"; - DWORD type = REG_NONE; - LPBYTE buffer = NULL; - DWORD offered = 0; BOOL ret = TRUE; + DWORD type, type_ex; + LPBYTE buffer, buffer_ex; + DWORD size, size_ex; torture_comment(tctx, "Testing PrinterData"); type = REG_SZ; - offered = 4; - buffer = malloc(offered); + size = 4; + buffer = malloc(size); if (!buffer) { return FALSE; } @@ -1377,8 +1395,11 @@ static BOOL test_PrinterData(struct torture_context *tctx, buffer[2] = 'a'; buffer[3] = 'p'; - ret &= test_SetPrinterDataEx(tctx, printername, keyname, valuename, handle, type, buffer, offered); - ret &= test_GetPrinterDataEx(tctx, printername, keyname, valuename, handle, NULL, NULL, NULL); + ret &= test_SetPrinterDataEx(tctx, printername, keyname, valuename, handle, type, buffer, size); + ret &= test_GetPrinterDataEx(tctx, printername, keyname, valuename, handle, &type_ex, &buffer_ex, &size_ex); + if (ret == TRUE) { + ret &= PrinterDataEqual(tctx, type_ex, type, size_ex, size, buffer_ex, buffer); + } ret &= test_DeletePrinterDataEx(tctx, printername, keyname, valuename, handle); ret &= test_DeletePrinterKey(tctx, printername, keyname, handle); |