* Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
128 lines
3.3 KiB
C++
128 lines
3.3 KiB
C++
/*
|
||
Timings(Test) - document and verify basic frame step timings
|
||
|
||
Copyright (C)
|
||
2012, Hermann Vosseler <Ichthyostega@web.de>
|
||
|
||
**Lumiera** is free software; you can redistribute it and/or modify it
|
||
under the terms of the GNU General Public License as published by the
|
||
Free Software Foundation; either version 2 of the License, or (at your
|
||
option) any later version. See the file COPYING for further details.
|
||
|
||
* *****************************************************************/
|
||
|
||
/** @file dispatcher-interface-test.cpp
|
||
** unit test \ref Timings_test
|
||
**
|
||
** @warning as of 5/2023 planning-chunk generation is reworked ///////////////////////////////////////////TICKET #1301 : factor out RenderDrive
|
||
*/
|
||
|
||
|
||
#include "lib/test/run.hpp"
|
||
#include "lib/test/test-helper.hpp"
|
||
|
||
#include "steam/play/timings.hpp"
|
||
#include "lib/time/timevalue.hpp"
|
||
//#include "lib/time/timequant.hpp"
|
||
//#include "lib/format-cout.hpp"
|
||
//#include "lib/util-coll.hpp"
|
||
#include "lib/util.hpp"
|
||
|
||
//#include <functional>
|
||
//#include <vector>
|
||
|
||
using test::Test;
|
||
using util::isnil;
|
||
//using std::vector;
|
||
//using std::function;
|
||
|
||
|
||
namespace steam {
|
||
namespace engine{
|
||
namespace test {
|
||
|
||
using lib::time::FSecs;
|
||
using lib::time::FrameCnt;
|
||
using lib::time::FrameRate;
|
||
using lib::time::Duration;
|
||
using lib::time::Offset;
|
||
using lib::time::Time;
|
||
using play::Timings;
|
||
|
||
namespace { // Test fixture...
|
||
|
||
/* == test parameters == */
|
||
|
||
const uint START_FRAME(10);
|
||
|
||
|
||
|
||
FSecs
|
||
randTicks()
|
||
{
|
||
return FSecs{1 + rani(600), 1 + rani(600)};
|
||
}
|
||
|
||
} // (End) Test fixture
|
||
|
||
|
||
|
||
|
||
/***************************************************************//**
|
||
* @test document and verify frame timing calculations, which are
|
||
* used in the Player / engine::Dispatcher, to translate a CalcStream
|
||
* into individual node jobs.
|
||
* @see TimingConstraints_test
|
||
*/
|
||
class Timings_test : public Test
|
||
{
|
||
|
||
virtual void
|
||
run (Arg)
|
||
{
|
||
seedRand();
|
||
verify_simpleFrameStep();
|
||
verify_next_startPoint();
|
||
}
|
||
|
||
|
||
/** @test perform the basic dispatch step
|
||
* and verify the generated frame coordinates
|
||
*/
|
||
void
|
||
verify_simpleFrameStep()
|
||
{
|
||
Timings timings (FrameRate::PAL);
|
||
CHECK (timings.getOrigin() == Time::ZERO);
|
||
|
||
ENSURE (START_FRAME == 10);
|
||
CHECK (timings.getFrameStartAt(START_FRAME) == Time::ZERO + Duration(10, FrameRate::PAL));
|
||
CHECK (timings.getFrameStartAt(START_FRAME+1) == Time::ZERO + Duration(11, FrameRate::PAL));
|
||
}
|
||
|
||
|
||
/** @test detect boundaries of frame planning chunks for arbitrary chunk duration.
|
||
*/
|
||
void
|
||
verify_next_startPoint()
|
||
{
|
||
Timings timings (FrameRate::PAL);
|
||
Time refPoint{randTicks()};
|
||
|
||
FrameCnt startFrame = timings.getBreakPointAfter (refPoint);
|
||
Time frameStart = timings.getFrameStartAt(startFrame);
|
||
|
||
Duration frameDuration (1, FrameRate::PAL);
|
||
|
||
CHECK (frameStart >= refPoint);
|
||
CHECK (frameStart < refPoint + frameDuration);
|
||
}
|
||
};
|
||
|
||
|
||
/** Register this test class... */
|
||
LAUNCHER (Timings_test, "unit engine");
|
||
|
||
|
||
|
||
}}} // namespace steam::engine::test
|