Henri Verbeet a écrit :
2008/10/31 Jérôme Gardou <[EMAIL PROTECTED]>:
OK, patches will be sent soon. By the way, what if I call multiply on a new
stack, the push, then pop ? Will the top matrix be identity, or the one with
which I multiplied the first time ?

I guess this calls a testcase ...

I think it should return the result of the multiplication, but tests
wouldn't hurt, of course.

I think this should return identity...
Anyway, could someone try this one on a native installation ?
>From b4c72e5e0737d6fa98f352765298bbc5f86d390a Mon Sep 17 00:00:00 2001
From: =?utf-8?q?J=C3=A9r=C3=B4me=20Gardou?= <[EMAIL PROTECTED]>
Date: Sat, 1 Nov 2008 00:13:53 +0100
Subject: [PATCH] Test to know whether the top of a matrix stack is ALWAYS identity

---
 dlls/d3dx8/tests/math.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index f38ff26..9f5207a 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -1442,7 +1442,7 @@ static void test_matrix_stack(void)
 
     hr = ID3DXMatrixStack_LoadMatrix(stack, NULL);
     ok(hr == D3DERR_INVALIDCALL, "LoadMatrix returned %#x, expected D3DERR_INVALIDCALL\n", hr);
-
+    
     hr = ID3DXMatrixStack_LoadMatrix(stack, &mat1);
     ok(SUCCEEDED(hr), "LoadMatrix failed, hr %#x\n", hr);
     expect_mat(&mat1, ID3DXMatrixStack_GetTop(stack));
@@ -1479,6 +1479,19 @@ static void test_matrix_stack(void)
     ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
     ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
 
+    hr = ID3DXMatrixStack_MultMatrix(stack, &mat2) ;
+    ok(SUCCEEDED(hr), "Multiplication failed");
+    /* Identity * mat2 = mat2 */
+    expect_mat(&mat2, ID3DXMatrixStack_GetTop(stack)) ;
+    
+    hr = ID3DXMatrixStack_Push(stack);
+    ok(SUCCEEDED(hr), "Push failed, hr %#x\n", hr);
+    
+    hr = ID3DXMatrixStack_Pop(stack);
+    ok(SUCCEEDED(hr), "Pop failed, hr %#x\n", hr);
+    /* here we are on the bottom of the stack... is it always identity? */
+    ok(D3DXMatrixIsIdentity(ID3DXMatrixStack_GetTop(stack)), "The top should be an identity matrix\n");
+
     refcount = ID3DXMatrixStack_Release(stack);
     ok(!refcount, "Matrix stack has %u references left.\n", refcount);
 }
-- 
1.5.4.3



Reply via email to