/* Test Next by requesting one file at a time */ static void test_Next_walkList_1(void) { HRESULT hres; IBackgroundCopyFile *file; ULONG fetched; ULONG i; /* Fetch the available files */ for (i = 0; i < test_fileCount; i++) { file = NULL; fetched = 0; hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, &fetched); ok(hres == S_OK, "Next failed: %08x\n", hres); if(hres != S_OK) { skip("Unable to get file from test_enumFiles\n"); return; } ok(fetched == 1, "Next returned the incorrect number of files: %08x\n", hres); ok(file != NULL, "Next returned NULL\n"); if (file) IBackgroundCopyFile_Release(file); } /* Attempt to fetch one more than the number of available files */ fetched = 0; hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, &fetched); ok(hres == S_FALSE, "Next off end of available files failed: %08x\n", hres); ok(fetched == 0, "Next returned the incorrect number of files: %08x\n", hres); }
/* Test Next by requesting multiple files at a time */ static void test_Next_walkList_2(void) { HRESULT hres; IBackgroundCopyFile *files[NUM_FILES]; ULONG fetched; ULONG i; for (i = 0; i < test_fileCount; i++) files[i] = NULL; fetched = 0; hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, test_fileCount, files, &fetched); ok(hres == S_OK, "Next failed: %08x\n", hres); if(hres != S_OK) { skip("Unable to get file from test_enumFiles\n"); return; } ok(fetched == test_fileCount, "Next returned the incorrect number of files: %08x\n", hres); for (i = 0; i < test_fileCount; i++) { ok(files[i] != NULL, "Next returned NULL\n"); if (files[i]) IBackgroundCopyFile_Release(files[i]); } }
/* Test Next Error conditions */ static void test_Next_errors(void) { HRESULT hres; IBackgroundCopyFile *files[NUM_FILES]; /* E_INVALIDARG: pceltFetched can ONLY be NULL if celt is 1 */ hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 2, files, NULL); ok(hres == E_INVALIDARG, "Invalid call to Next succeeded: %08x\n", hres); }
/* Test Next with a NULL pceltFetched*/ static void test_Next_walkListNull(void) { HRESULT hres; IBackgroundCopyFile *file; ULONG i; /* Fetch the available files */ for (i = 0; i < test_fileCount; i++) { hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, NULL); ok(hres == S_OK, "Next failed: %08x\n", hres); IBackgroundCopyFile_Release(file); } /* Attempt to fetch one more than the number of available files */ hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, NULL); ok(hres == S_FALSE, "Next off end of available files failed: %08x\n", hres); }