qmgr: Implement IBackgroundCopyFile_GetProgress.

This commit is contained in:
Roy Shea 2008-02-28 19:00:12 -08:00 committed by Alexandre Julliard
parent 4866d1bde6
commit e6cbde105f
3 changed files with 31 additions and 2 deletions

View file

@ -103,8 +103,13 @@ static HRESULT WINAPI BITS_IBackgroundCopyFile_GetProgress(
IBackgroundCopyFile* iface,
BG_FILE_PROGRESS *pVal)
{
FIXME("Not implemented\n");
return E_NOTIMPL;
BackgroundCopyFileImpl *This = (BackgroundCopyFileImpl *) iface;
pVal->BytesTotal = This->fileProgress.BytesTotal;
pVal->BytesTransferred = This->fileProgress.BytesTransferred;
pVal->Completed = This->fileProgress.Completed;
return S_OK;
}
static const IBackgroundCopyFileVtbl BITS_IBackgroundCopyFile_Vtbl =
@ -152,6 +157,10 @@ HRESULT BackgroundCopyFileConstructor(LPCWSTR remoteName,
This->lpVtbl = &BITS_IBackgroundCopyFile_Vtbl;
This->ref = 1;
This->fileProgress.BytesTotal = BG_SIZE_UNKNOWN;
This->fileProgress.BytesTransferred = 0;
This->fileProgress.Completed = FALSE;
*ppObj = &This->lpVtbl;
return S_OK;
}

View file

@ -65,6 +65,7 @@ typedef struct
const IBackgroundCopyFileVtbl *lpVtbl;
LONG ref;
BG_FILE_INFO info;
BG_FILE_PROGRESS fileProgress;
struct list entryFromJob;
} BackgroundCopyFileImpl;

View file

@ -145,6 +145,24 @@ static void test_GetLocalName(void)
CoTaskMemFree(name);
}
/* Test getting the progress of a file*/
static void test_GetProgress_PreTransfer(void)
{
HRESULT hres;
BG_FILE_PROGRESS progress;
hres = IBackgroundCopyFile_GetProgress(test_file, &progress);
ok(hres == S_OK, "GetProgress failed: %08x\n", hres);
if(hres != S_OK)
{
skip("Unable to get progress of test_file.\n");
return;
}
ok(progress.BytesTotal == BG_SIZE_UNKNOWN, "Got incorrect total size: %llu\n", progress.BytesTotal);
ok(progress.BytesTransferred == 0, "Got incorrect number of transfered bytes: %llu\n", progress.BytesTransferred);
ok(progress.Completed == FALSE, "Got incorret completion status\n");
}
typedef void (*test_t)(void);
START_TEST(file)
@ -152,6 +170,7 @@ START_TEST(file)
static const test_t tests[] = {
test_GetRemoteName,
test_GetLocalName,
test_GetProgress_PreTransfer,
0
};
const test_t *test;