From: Jeff Smith whydoubt@gmail.com
--- dlls/ddraw/tests/ddraw1.c | 41 +++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 830ecd5d665..b009cb755a3 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15513,8 +15513,8 @@ static void test_pick(void) { for (j = 0; j < screen_height; j += 60) { - pick_rect.x1 = i; - pick_rect.y1 = j; + pick_rect.x1 = pick_rect.x2 = i; + pick_rect.y1 = pick_rect.y2 = j;
hr = IDirect3DDevice_Pick(device, execute_buffer, viewport, 0, &pick_rect); ok(SUCCEEDED(hr), "Failed to perform pick, hr %#lx.\n", hr); @@ -15532,8 +15532,8 @@ static void test_pick(void) ok(hits == nohits, "Got a non-equal amount of pick hits/misses: %i vs %i.\n", hits, nohits);
/* Pick a pixel where no quads are present */ - pick_rect.x1 = 480; - pick_rect.y1 = 360; + pick_rect.x1 = pick_rect.x2 = 480; + pick_rect.y1 = pick_rect.y2 = 360; hr = IDirect3DDevice_Pick(device, execute_buffer, viewport, 0, &pick_rect); ok(SUCCEEDED(hr), "Failed to perform pick, hr %#lx.\n", hr); rec_count = ~0; @@ -15542,8 +15542,8 @@ static void test_pick(void) todo_wine ok(rec_count == 0, "Got incorrect number of pick records (expected 0): %lu.\n", rec_count);
/* Pick a pixel where one quad is present */ - pick_rect.x1 = 240; - pick_rect.y1 = 120; + pick_rect.x1 = pick_rect.x2 = 240; + pick_rect.y1 = pick_rect.y2 = 120; hr = IDirect3DDevice_Pick(device, execute_buffer, viewport, 0, &pick_rect); ok(SUCCEEDED(hr), "Failed to perform pick, hr %#lx.\n", hr); rec_count = ~0; @@ -15566,8 +15566,8 @@ static void test_pick(void) }
/* Pick a pixel where three quads are present */ - pick_rect.x1 = 240; - pick_rect.y1 = 360; + pick_rect.x1 = pick_rect.x2 = 240; + pick_rect.y1 = pick_rect.y2 = 360; hr = IDirect3DDevice_Pick(device, execute_buffer, viewport, 0, &pick_rect); ok(SUCCEEDED(hr), "Failed to perform pick, hr %#lx.\n", hr); rec_count = ~0; @@ -15608,6 +15608,31 @@ static void test_pick(void) ok(compare_float(record[2].dvZ, 0.5, 4096), "Got incorrect dvZ: %.8e.\n", record[2].dvZ); }
+ /* Pick a rectange, though it appears that only the upper-left corner is checked. */ + pick_rect.x1 = 240; + pick_rect.y1 = 120; + pick_rect.x2 = screen_width - 1; + pick_rect.y2 = screen_height - 1; + hr = IDirect3DDevice_Pick(device, execute_buffer, viewport, 0, &pick_rect); + ok(SUCCEEDED(hr), "Failed to perform pick, hr %#lx.\n", hr); + rec_count = ~0; + hr = IDirect3DDevice_GetPickRecords(device, &rec_count, NULL); + ok(SUCCEEDED(hr), "Failed to get pick records, hr %#lx.\n", hr); + todo_wine ok(rec_count == 1, "Got incorrect number of pick records (expected 1): %lu.\n", rec_count); + + if (rec_count == 1) + { + D3DPICKRECORD record; + + hr = IDirect3DDevice_GetPickRecords(device, &rec_count, &record); + ok(SUCCEEDED(hr), "Failed to get pick records, hr %#lx.\n", hr); + + ok(record.bOpcode == 3, "Got incorrect bOpcode: %i.\n", record.bOpcode); + ok(record.bPad == 0, "Got incorrect bPad: %i.\n", record.bPad); + ok(record.dwOffset == 24, "Got incorrect dwOffset: %lu.\n", record.dwOffset); + ok(compare_float(record.dvZ, 1.0, 4096), "Got incorrect dvZ: %.8e.\n", record.dvZ); + } + if (0) /* This crashes on Windows. */ { IDirect3DDevice_GetPickRecords(device, NULL, NULL);