/* * Copyright 2007 Vijay Kiran Kamuju * Copyright 2007 David Adam * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include "d3drmdef.h" #include "wine/test.h" #define PI (4.0f*atanf(1.0f)) #define admit_error 0.000001f #define expect_mat( expectedmat, gotmat)\ { \ int i,j; \ BOOL equal = TRUE; \ for (i=0; i<4; i++)\ {\ for (j=0; j<4; j++)\ {\ if (fabs(expectedmat[i][j]-gotmat[i][j])>admit_error)\ {\ equal = FALSE;\ }\ }\ }\ ok(equal, "Expected matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n)\n\n" \ "Got matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f)\n", \ expectedmat[0][0],expectedmat[0][1],expectedmat[0][2],expectedmat[0][3], \ expectedmat[1][0],expectedmat[1][1],expectedmat[1][2],expectedmat[1][3], \ expectedmat[2][0],expectedmat[2][1],expectedmat[2][2],expectedmat[2][3], \ expectedmat[3][0],expectedmat[3][1],expectedmat[3][2],expectedmat[3][3], \ gotmat[0][0],gotmat[0][1],gotmat[0][2],gotmat[0][3], \ gotmat[1][0],gotmat[1][1],gotmat[1][2],gotmat[1][3], \ gotmat[2][0],gotmat[2][1],gotmat[2][2],gotmat[2][3], \ gotmat[3][0],gotmat[3][1],gotmat[3][2],gotmat[3][3] ); \ } #define expect_quat(expectedquat,gotquat) \ ok( (fabs(U1(expectedquat.v).x-U1(gotquat.v).x)1 then, then one considers this component as 1. The following test proves this fact (test only with the red component). */ red=2.37f; green=0.4f; blue=0.6f; alpha=0.41f; expected_color=0x68ff6699; got_color=D3DRMCreateColorRGBA(red,green,blue,alpha); ok((expected_color==got_color),"Expected color=%x, Got color=%x\n",expected_color,got_color); /*___________D3DRMColorGetAlpha_________________________*/ color=0x0e4921bf; expected=14.0f/255.0f; got=D3DRMColorGetAlpha(color); ok((fabs(expected-got)