Commit e2090c5c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3drm: Implement object name property.

parent 48a04702
......@@ -45,6 +45,7 @@ void d3drm_object_init(struct d3drm_object *object, const char *classname)
object->appdata = 0;
list_init(&object->destroy_callbacks);
object->classname = classname;
object->name = NULL;
}
struct destroy_callback
......@@ -111,6 +112,48 @@ HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, ch
return D3DRM_OK;
}
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name)
{
DWORD req_size;
if (!size)
return E_INVALIDARG;
req_size = object->name ? strlen(object->name) + 1 : 0;
if (name && *size < req_size)
return E_INVALIDARG;
if (name)
{
if (object->name)
memcpy(name, object->name, req_size);
else if (*size)
*name = 0;
}
*size = req_size;
return D3DRM_OK;
}
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name)
{
DWORD req_size;
HeapFree(GetProcessHeap(), 0, object->name);
object->name = NULL;
if (name)
{
req_size = strlen(name) + 1;
if (!(object->name = HeapAlloc(GetProcessHeap(), 0, req_size)))
return E_OUTOFMEMORY;
memcpy(object->name, name, req_size);
}
return D3DRM_OK;
}
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
{
struct destroy_callback *callback, *callback2;
......@@ -121,4 +164,7 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
list_remove(&callback->entry);
HeapFree(GetProcessHeap(), 0, callback);
}
HeapFree(GetProcessHeap(), 0, object->name);
object->name = NULL;
}
......@@ -42,6 +42,7 @@ struct d3drm_object
DWORD appdata;
struct list destroy_callbacks;
const char *classname;
char *name;
};
struct d3drm_texture
......@@ -127,7 +128,6 @@ struct d3drm_mesh_builder
IDirect3DRMMeshBuilder3 IDirect3DRMMeshBuilder3_iface;
LONG ref;
IDirect3DRM *d3drm;
char* name;
SIZE_T nb_vertices;
SIZE_T vertices_size;
D3DVECTOR *vertices;
......@@ -193,6 +193,8 @@ void d3drm_object_init(struct d3drm_object *object, const char *classname) DECLS
HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMOBJECTCALLBACK cb, void *ctx) DECLSPEC_HIDDEN;
HRESULT d3drm_object_get_class_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
HRESULT d3drm_object_get_name(struct d3drm_object *object, DWORD *size, char *name) DECLSPEC_HIDDEN;
HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) DECLSPEC_HIDDEN;
void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) DECLSPEC_HIDDEN;
struct d3drm_frame *unsafe_impl_from_IDirect3DRMFrame(IDirect3DRMFrame *iface) DECLSPEC_HIDDEN;
......
......@@ -504,9 +504,11 @@ static DWORD WINAPI d3drm_device1_GetAppData(IDirect3DRMDevice *iface)
static HRESULT WINAPI d3drm_device3_SetName(IDirect3DRMDevice3 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&device->obj, name);
}
static HRESULT WINAPI d3drm_device2_SetName(IDirect3DRMDevice2 *iface, const char *name)
......@@ -529,9 +531,11 @@ static HRESULT WINAPI d3drm_device1_SetName(IDirect3DRMDevice *iface, const char
static HRESULT WINAPI d3drm_device3_GetName(IDirect3DRMDevice3 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&device->obj, size, name);
}
static HRESULT WINAPI d3drm_device2_GetName(IDirect3DRMDevice2 *iface, DWORD *size, char *name)
......
......@@ -130,18 +130,40 @@ static DWORD WINAPI d3drm_face1_GetAppData(IDirect3DRMFace *iface)
return 0;
}
static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&face->obj, name);
}
static HRESULT WINAPI d3drm_face1_SetName(IDirect3DRMFace *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_face2_SetName(&face->IDirect3DRMFace2_iface, name);
}
static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&face->obj, size, name);
}
static HRESULT WINAPI d3drm_face1_GetName(IDirect3DRMFace *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_face *face = impl_from_IDirect3DRMFace(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_face2_GetName(&face->IDirect3DRMFace2_iface, size, name);
}
static HRESULT WINAPI d3drm_face1_GetClassName(IDirect3DRMFace *iface, DWORD *size, char *name)
......@@ -390,20 +412,6 @@ static DWORD WINAPI d3drm_face2_GetAppData(IDirect3DRMFace2 *iface)
return 0;
}
static HRESULT WINAPI d3drm_face2_SetName(IDirect3DRMFace2 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
return E_NOTIMPL;
}
static HRESULT WINAPI d3drm_face2_GetClassName(IDirect3DRMFace2 *iface, DWORD *size, char *name)
{
struct d3drm_face *face = impl_from_IDirect3DRMFace2(iface);
......
......@@ -702,44 +702,56 @@ static DWORD WINAPI d3drm_frame1_GetAppData(IDirect3DRMFrame *iface)
static HRESULT WINAPI d3drm_frame3_SetName(IDirect3DRMFrame3 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&frame->obj, name);
}
static HRESULT WINAPI d3drm_frame2_SetName(IDirect3DRMFrame2 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_frame3_SetName(&frame->IDirect3DRMFrame3_iface, name);
}
static HRESULT WINAPI d3drm_frame1_SetName(IDirect3DRMFrame *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_frame3_SetName(&frame->IDirect3DRMFrame3_iface, name);
}
static HRESULT WINAPI d3drm_frame3_GetName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame3(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&frame->obj, size, name);
}
static HRESULT WINAPI d3drm_frame2_GetName(IDirect3DRMFrame2 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame2(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_frame3_GetName(&frame->IDirect3DRMFrame3_iface, size, name);
}
static HRESULT WINAPI d3drm_frame1_GetName(IDirect3DRMFrame *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_frame *frame = impl_from_IDirect3DRMFrame(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_frame3_GetName(&frame->IDirect3DRMFrame3_iface, size, name);
}
static HRESULT WINAPI d3drm_frame3_GetClassName(IDirect3DRMFrame3 *iface, DWORD *size, char *name)
......
......@@ -120,16 +120,20 @@ static DWORD WINAPI d3drm_light_GetAppData(IDirect3DRMLight *iface)
static HRESULT WINAPI d3drm_light_SetName(IDirect3DRMLight *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&light->obj, name);
}
static HRESULT WINAPI d3drm_light_GetName(IDirect3DRMLight *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_light *light = impl_from_IDirect3DRMLight(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&light->obj, size, name);
}
static HRESULT WINAPI d3drm_light_GetClassName(IDirect3DRMLight *iface, DWORD *size, char *name)
......
......@@ -121,16 +121,20 @@ static DWORD WINAPI d3drm_material_GetAppData(IDirect3DRMMaterial2 *iface)
static HRESULT WINAPI d3drm_material_SetName(IDirect3DRMMaterial2 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&material->obj, name);
}
static HRESULT WINAPI d3drm_material_GetName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_material *material = impl_from_IDirect3DRMMaterial2(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&material->obj, size, name);
}
static HRESULT WINAPI d3drm_material_GetClassName(IDirect3DRMMaterial2 *iface, DWORD *size, char *name)
......
......@@ -334,8 +334,7 @@ static void clean_mesh_builder_data(struct d3drm_mesh_builder *mesh_builder)
{
DWORD i;
HeapFree(GetProcessHeap(), 0, mesh_builder->name);
mesh_builder->name = NULL;
IDirect3DRMMeshBuilder3_SetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, NULL);
HeapFree(GetProcessHeap(), 0, mesh_builder->vertices);
mesh_builder->vertices = NULL;
mesh_builder->nb_vertices = 0;
......@@ -1007,20 +1006,10 @@ static DWORD WINAPI d3drm_mesh_builder3_GetAppData(IDirect3DRMMeshBuilder3 *ifac
static HRESULT WINAPI d3drm_mesh_builder3_SetName(IDirect3DRMMeshBuilder3 *iface, const char *name)
{
struct d3drm_mesh_builder *mesh_builder = impl_from_IDirect3DRMMeshBuilder3(iface);
char *string = NULL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
if (name)
{
string = HeapAlloc(GetProcessHeap(), 0, strlen(name) + 1);
if (!string) return E_OUTOFMEMORY;
strcpy(string, name);
}
HeapFree(GetProcessHeap(), 0, mesh_builder->name);
mesh_builder->name = string;
return D3DRM_OK;
return d3drm_object_set_name(&mesh_builder->obj, name);
}
static HRESULT WINAPI d3drm_mesh_builder3_GetName(IDirect3DRMMeshBuilder3 *iface,
......@@ -1030,22 +1019,7 @@ static HRESULT WINAPI d3drm_mesh_builder3_GetName(IDirect3DRMMeshBuilder3 *iface
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
if (!size)
return E_POINTER;
if (!mesh_builder->name)
{
*size = 0;
return D3DRM_OK;
}
if (*size < (strlen(mesh_builder->name) + 1))
return E_INVALIDARG;
strcpy(name, mesh_builder->name);
*size = strlen(mesh_builder->name) + 1;
return D3DRM_OK;
return d3drm_object_get_name(&mesh_builder->obj, size, name);
}
static HRESULT WINAPI d3drm_mesh_builder3_GetClassName(IDirect3DRMMeshBuilder3 *iface,
......@@ -1084,16 +1058,18 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
return hr;
if (size)
{
mesh_builder->name = HeapAlloc(GetProcessHeap(), 0, size);
if (!mesh_builder->name)
char *name = HeapAlloc(GetProcessHeap(), 0, size);
if (!name)
return E_OUTOFMEMORY;
hr = IDirectXFileData_GetName(pData, mesh_builder->name, &size);
if (SUCCEEDED(hr = IDirectXFileData_GetName(pData, name, &size)))
IDirect3DRMMeshBuilder3_SetName(iface, name);
HeapFree(GetProcessHeap(), 0, name);
if (hr != DXFILE_OK)
return hr;
}
TRACE("Mesh name is %s\n", debugstr_a(mesh_builder->name));
TRACE("Mesh name is %s\n", debugstr_a(mesh_builder->obj.name));
mesh_builder->nb_normals = 0;
......@@ -2492,16 +2468,20 @@ static DWORD WINAPI d3drm_mesh_GetAppData(IDirect3DRMMesh *iface)
static HRESULT WINAPI d3drm_mesh_SetName(IDirect3DRMMesh *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&mesh->obj, name);
}
static HRESULT WINAPI d3drm_mesh_GetName(IDirect3DRMMesh *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_mesh *mesh = impl_from_IDirect3DRMMesh(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&mesh->obj, size, name);
}
static HRESULT WINAPI d3drm_mesh_GetClassName(IDirect3DRMMesh *iface, DWORD *size, char *name)
......
......@@ -134,6 +134,81 @@ static void test_class_name_(unsigned int line, IDirect3DRMObject *object, const
ok_(__FILE__, line)(!strcmp(cname, "XXX"), "Expected unchanged buffer, but got \"%s\".\n", cname);
}
#define test_object_name(a) test_object_name_(__LINE__, a)
static void test_object_name_(unsigned int line, IDirect3DRMObject *object)
{
char name[64] = {0};
HRESULT hr;
DWORD size;
hr = IDirect3DRMObject_GetName(object, NULL, NULL);
ok_(__FILE__, line)(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
name[0] = 0x1f;
hr = IDirect3DRMObject_GetName(object, NULL, name);
ok_(__FILE__, line)(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
ok_(__FILE__, line)(name[0] == 0x1f, "Unexpected buffer contents, %#x.\n", name[0]);
/* Name is not set yet. */
size = 100;
hr = IDirect3DRMObject_GetName(object, &size, NULL);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == 0, "Unexpected size %u.\n", size);
size = sizeof(name);
name[0] = 0x1f;
hr = IDirect3DRMObject_GetName(object, &size, name);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == 0, "Unexpected size %u.\n", size);
ok_(__FILE__, line)(name[0] == 0, "Unexpected name \"%s\".\n", name);
size = 0;
name[0] = 0x1f;
hr = IDirect3DRMObject_GetName(object, &size, name);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == 0, "Unexpected size %u.\n", size);
ok_(__FILE__, line)(name[0] == 0x1f, "Unexpected name \"%s\".\n", name);
hr = IDirect3DRMObject_SetName(object, NULL);
ok_(__FILE__, line)(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
hr = IDirect3DRMObject_SetName(object, "name");
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to set a name, hr %#x.\n", hr);
size = 0;
hr = IDirect3DRMObject_GetName(object, &size, NULL);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == strlen("name") + 1, "Unexpected size %u.\n", size);
size = strlen("name") + 1;
hr = IDirect3DRMObject_GetName(object, &size, name);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == strlen("name") + 1, "Unexpected size %u.\n", size);
ok_(__FILE__, line)(!strcmp(name, "name"), "Unexpected name \"%s\".\n", name);
size = 2;
name[0] = 0x1f;
hr = IDirect3DRMObject_GetName(object, &size, name);
ok_(__FILE__, line)(hr == E_INVALIDARG, "Failed to get object name, hr %#x.\n", hr);
ok_(__FILE__, line)(size == 2, "Unexpected size %u.\n", size);
ok_(__FILE__, line)(name[0] == 0x1f, "Got unexpected name \"%s\".\n", name);
hr = IDirect3DRMObject_SetName(object, NULL);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to set object name, hr %#x.\n", hr);
size = 1;
hr = IDirect3DRMObject_GetName(object, &size, NULL);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == 0, "Unexpected size %u.\n", size);
size = 1;
name[0] = 0x1f;
hr = IDirect3DRMObject_GetName(object, &size, name);
ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to get name size, hr %#x.\n", hr);
ok_(__FILE__, line)(size == 0, "Unexpected size %u.\n", size);
ok_(__FILE__, line)(name[0] == 0, "Got unexpected name \"%s\".\n", name);
}
static char data_bad_version[] =
"xof 0302txt 0064\n"
"Header Object\n"
......@@ -331,6 +406,7 @@ static void test_MeshBuilder(void)
IDirect3DRMMeshBuilder3_Release(meshbuilder3);
test_class_name((IDirect3DRMObject *)pMeshBuilder, "Builder");
test_object_name((IDirect3DRMObject *)pMeshBuilder);
info.lpMemory = data_bad_version;
info.dSize = strlen(data_bad_version);
......@@ -588,6 +664,7 @@ static void test_MeshBuilder3(void)
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder3 interface (hr = %x)\n", hr);
test_class_name((IDirect3DRMObject *)pMeshBuilder3, "Builder");
test_object_name((IDirect3DRMObject *)pMeshBuilder3);
info.lpMemory = data_bad_version;
info.dSize = strlen(data_bad_version);
......@@ -675,6 +752,7 @@ static void test_Mesh(void)
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMesh interface (hr = %x)\n", hr);
test_class_name((IDirect3DRMObject *)mesh, "Mesh");
test_object_name((IDirect3DRMObject *)mesh);
hr = IDirect3DRMMesh_QueryInterface(mesh, &IID_IDirect3DRMObject, (void **)&unk);
ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, %#x.\n", hr);
......@@ -724,6 +802,7 @@ static void test_Face(void)
IDirect3DRMObject_Release(obj);
test_class_name((IDirect3DRMObject *)face1, "Face");
test_object_name((IDirect3DRMObject *)face1);
icount = IDirect3DRMFace_GetVertexCount(face1);
ok(!icount, "wrong VertexCount: %i\n", icount);
......@@ -805,6 +884,7 @@ static void test_Face(void)
IDirect3DRMObject_Release(obj);
test_class_name((IDirect3DRMObject *)face2, "Face");
test_object_name((IDirect3DRMObject *)face2);
icount = IDirect3DRMMeshBuilder3_GetFaceCount(MeshBuilder3);
todo_wine
......@@ -922,6 +1002,7 @@ static void test_Frame(void)
ok(ref2 > ref, "Expected d3drm object to be referenced.\n");
test_class_name((IDirect3DRMObject *)pFrameC, "Frame");
test_object_name((IDirect3DRMObject *)pFrameC);
hr = IDirect3DRMFrame_GetParent(pFrameC, NULL);
ok(hr == D3DRMERR_BADVALUE, "Should fail and return D3DRM_BADVALUE (hr = %x)\n", hr);
......@@ -1823,6 +1904,7 @@ static void test_Viewport(void)
IDirect3DRMObject_Release(obj2);
test_class_name((IDirect3DRMObject *)viewport, "Viewport");
test_object_name((IDirect3DRMObject *)viewport);
/* AppData */
hr = IDirect3DRMViewport_SetAppData(viewport, 0);
......@@ -2085,6 +2167,7 @@ static void test_Light(void)
IDirect3DRMObject_Release(object);
test_class_name((IDirect3DRMObject *)light, "Light");
test_object_name((IDirect3DRMObject *)light);
type = IDirect3DRMLight_GetType(light);
ok(type == D3DRMLIGHT_SPOT, "wrong type (%u)\n", type);
......@@ -2134,6 +2217,7 @@ static void test_Material2(void)
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMaterial2 interface (hr = %x)\n", hr);
test_class_name((IDirect3DRMObject *)material2, "Material");
test_object_name((IDirect3DRMObject *)material2);
r = IDirect3DRMMaterial2_GetPower(material2);
ok(r == 18.5f, "wrong power (%f)\n", r);
......@@ -2346,6 +2430,9 @@ static void test_Texture(void)
test_class_name((IDirect3DRMObject *)texture1, "Texture");
test_class_name((IDirect3DRMObject *)texture2, "Texture");
test_class_name((IDirect3DRMObject *)texture3, "Texture");
test_object_name((IDirect3DRMObject *)texture1);
test_object_name((IDirect3DRMObject *)texture2);
test_object_name((IDirect3DRMObject *)texture3);
d3drm_img = IDirect3DRMTexture_GetImage(texture1);
ok(!!d3drm_img, "Failed to get image.\n");
......@@ -2552,6 +2639,7 @@ static void test_Device(void)
ok(hr == D3DRM_OK, "Cannot get IDirect3DRMDevice interface (hr = %x)\n", hr);
test_class_name((IDirect3DRMObject *)device, "Device");
test_object_name((IDirect3DRMObject *)device);
/* WinDevice */
if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMWinDevice, (void **)&win_device)))
......@@ -2561,6 +2649,7 @@ static void test_Device(void)
}
test_class_name((IDirect3DRMObject *)win_device, "Device");
test_object_name((IDirect3DRMObject *)win_device);
IDirect3DRMWinDevice_Release(win_device);
cleanup:
......
......@@ -806,16 +806,20 @@ static DWORD WINAPI d3drm_texture3_GetAppData(IDirect3DRMTexture3 *iface)
static HRESULT WINAPI d3drm_texture3_SetName(IDirect3DRMTexture3 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&texture->obj, name);
}
static HRESULT WINAPI d3drm_texture3_GetName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_texture *texture = impl_from_IDirect3DRMTexture3(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&texture->obj, size, name);
}
static HRESULT WINAPI d3drm_texture3_GetClassName(IDirect3DRMTexture3 *iface, DWORD *size, char *name)
......
......@@ -250,30 +250,38 @@ static DWORD WINAPI d3drm_viewport1_GetAppData(IDirect3DRMViewport *iface)
static HRESULT WINAPI d3drm_viewport2_SetName(IDirect3DRMViewport2 *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_object_set_name(&viewport->obj, name);
}
static HRESULT WINAPI d3drm_viewport1_SetName(IDirect3DRMViewport *iface, const char *name)
{
FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name));
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
return E_NOTIMPL;
TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
return d3drm_viewport2_SetName(&viewport->IDirect3DRMViewport2_iface, name);
}
static HRESULT WINAPI d3drm_viewport2_GetName(IDirect3DRMViewport2 *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport2(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_object_get_name(&viewport->obj, size, name);
}
static HRESULT WINAPI d3drm_viewport1_GetName(IDirect3DRMViewport *iface, DWORD *size, char *name)
{
FIXME("iface %p, size %p, name %p stub!\n", iface, size, name);
struct d3drm_viewport *viewport = impl_from_IDirect3DRMViewport(iface);
return E_NOTIMPL;
TRACE("iface %p, size %p, name %p.\n", iface, size, name);
return d3drm_viewport2_GetName(&viewport->IDirect3DRMViewport2_iface, size, name);
}
static HRESULT WINAPI d3drm_viewport2_GetClassName(IDirect3DRMViewport2 *iface, DWORD *size, char *name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment