mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
Ported non-interactive window manager test.
This commit is contained in:
parent
7df5684af1
commit
fbd97b0cf8
2 changed files with 58 additions and 538 deletions
58
Engine/source/windowManager/test/windowManagerTest.cpp
Normal file
58
Engine/source/windowManager/test/windowManagerTest.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef TORQUE_TESTS_ENABLED
|
||||
#include "testing/unitTesting.h"
|
||||
#include "windowManager/platformWindowMgr.h"
|
||||
|
||||
// Mysteriously, TEST(WindowManager, BasicAPI) gives an error. Huh.
|
||||
TEST(WinMgr, BasicAPI)
|
||||
{
|
||||
PlatformWindowManager *pwm = CreatePlatformWindowManager();
|
||||
|
||||
// Check out the primary desktop area...
|
||||
RectI primary = pwm->getPrimaryDesktopArea();
|
||||
|
||||
EXPECT_TRUE(primary.isValidRect())
|
||||
<< "Got some sort of invalid rect from the window manager!";
|
||||
|
||||
// Now try to get info about all the monitors.
|
||||
Vector<RectI> monitorRects;
|
||||
pwm->getMonitorRegions(monitorRects);
|
||||
|
||||
EXPECT_GT(monitorRects.size(), 0)
|
||||
<< "Should get at least one monitor rect back from getMonitorRegions!";
|
||||
|
||||
// This test is here just to detect overflow/runaway situations. -- BJG
|
||||
EXPECT_LT(monitorRects.size(), 64)
|
||||
<< "Either something's wrong, or you have a lot of monitors...";
|
||||
|
||||
for(S32 i=0; i<monitorRects.size(); i++)
|
||||
{
|
||||
EXPECT_TRUE(monitorRects[i].isValidRect())
|
||||
<< "Got an invalid rect for this monitor - no good.";
|
||||
}
|
||||
|
||||
// No way to destroy the window manager.
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue