tstMouseImpl.cpp revision cf0f0ca5aed2798e7a1c29c00ee8a75b8f3db47a
/* $Id$ */
/** @file
* Main unit test - Mouse class.
*/
/*
* Copyright (C) 2011-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/******************************************************************************
* Header Files *
******************************************************************************/
#include "MouseImpl.h"
#include "VMMDev.h"
#include "DisplayImpl.h"
#ifndef RT_OS_WINDOWS
#endif
class TestVMMDev : public VMMDevMouseInterface
{
};
class TestDisplay : public DisplayMouseInterface
{
};
class TestConsole : public ConsoleMouseInterface
{
public:
/** @todo why on earth is this not implemented? */
private:
};
{
return VERR_PDM_NO_ATTACHED_DRIVER;
}
static struct PDMDRVHLPR3 pdmHlpR3 =
{
};
static struct
{
} mouseEvent;
{
return VINF_SUCCESS;
}
static struct
{
int32_t x;
int32_t y;
{
mouseEventAbs.x = uX;
mouseEventAbs.y = uY;
return VINF_SUCCESS;
}
static struct PDMIMOUSEPORT pdmiMousePort =
{
};
{
return &pdmiMousePort;
}
{
};
static struct PDMDRVINS pdmdrvInsCore =
{
0,
&pdmHlpR3,
NULL,
NULL,
NULL,
};
static struct
{
int32_t x;
int32_t y;
{
absoluteMouse.x = x;
absoluteMouse.y = y;
return VINF_SUCCESS;
}
{
return VINF_SUCCESS;
}
{
if (px1)
*px1 = -320;
if (py1)
*py1 = -240;
if (px2)
*px2 = 320;
if (py2)
*py2 = 240;
}
{
if (pcx)
*pcx = 640;
if (pcy)
*pcy = 480;
if (pcBPP)
*pcBPP = 32;
return S_OK;
}
{
return true;
}
{
return VINF_SUCCESS;
}
/******************************************************************************
* Main test code *
******************************************************************************/
static int setup(void)
{
return VERR_GENERAL_FAILURE;
pConsole = new TestConsole;
return VINF_SUCCESS;
}
static void teardown(void)
{
if (pConsole)
delete pConsole;
if (ppdmdrvIns)
}
{
}
/** @test testAbsToVMMDevNewProtocol */
{
pMouse->PutMouseEventAbsolute(0, 0, 0, 0, 0);
("absoluteMouse.x=%d\n", absoluteMouse.x));
("absoluteMouse.y=%d\n", absoluteMouse.y));
("absoluteMouse.x=%d\n", absoluteMouse.x));
("absoluteMouse.y=%d\n", absoluteMouse.y));
("absoluteMouse.x=%d\n", absoluteMouse.x));
("absoluteMouse.y=%d\n", absoluteMouse.y));
}
/** @test testAbsToVMMDevOldProtocol */
{
("absoluteMouse.x=%d\n", absoluteMouse.x));
("absoluteMouse.y=%d\n", absoluteMouse.y));
pMouse->PutMouseEventAbsolute(0, 0, 0, 0, 0);
("absoluteMouse.x=%d\n", absoluteMouse.x));
("absoluteMouse.y=%d\n", absoluteMouse.y));
("absoluteMouse.x=%d\n", absoluteMouse.x));
("absoluteMouse.y=%d\n", absoluteMouse.y));
}
/** @test testAbsToAbsDev */
{
pMouse->PutMouseEventAbsolute(0, 0, 0, 0, 0);
("mouseEventAbs.x=%d\n", mouseEventAbs.x));
("mouseEventAbs.y=%d\n", mouseEventAbs.y));
("mouseEventAbs.x=%d\n", mouseEventAbs.x));
("mouseEventAbs.y=%d\n", mouseEventAbs.y));
("mouseEventAbs.x=%d\n", mouseEventAbs.x));
("mouseEventAbs.y=%d\n", mouseEventAbs.y));
("mouseEventAbs.x=%d\n", mouseEventAbs.x));
("mouseEventAbs.y=%d\n", mouseEventAbs.y));
}
/** @todo generate this using the @test blocks above */
{
};
int main(void)
{
/*
* Init the runtime, test and say hello.
*/
if (rcExit != RTEXITCODE_SUCCESS)
return rcExit;
/*
* Run the tests.
*/
for (unsigned i = 0; g_tests[i]; ++i)
{
if (RT_SUCCESS(rc))
teardown();
}
/*
* Summary
*/
return RTTestSummaryAndDestroy(hTest);
}