You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
93 lines
2.3 KiB
C++
93 lines
2.3 KiB
C++
/**
|
|
* @file
|
|
* @brief Unit tests for openshot::Timeline
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* Copyright (c) 2008-2013 OpenShot Studios, LLC
|
|
* (http://www.openshotstudios.com). This file is part of
|
|
* OpenShot Library (http://www.openshot.org), an open-source project
|
|
* dedicated to delivering high quality video editing and animation solutions
|
|
* to the world.
|
|
*
|
|
* OpenShot Library 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 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* OpenShot 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "UnitTest++.h"
|
|
#include "../include/OpenShot.h"
|
|
|
|
using namespace std;
|
|
using namespace openshot;
|
|
|
|
TEST(Timeline_Constructor)
|
|
{
|
|
// Create a default fraction (should be 1/1)
|
|
Framerate fps(30000,1000);
|
|
Timeline t1(640, 480, fps, 44100, 2);
|
|
|
|
// Check values
|
|
CHECK_EQUAL(640, t1.Width());
|
|
CHECK_EQUAL(480, t1.Height());
|
|
|
|
// Create a default fraction (should be 1/1)
|
|
Timeline t2(300, 240, fps, 44100, 2);
|
|
|
|
// Check values
|
|
CHECK_EQUAL(300, t2.Width());
|
|
CHECK_EQUAL(240, t2.Height());
|
|
}
|
|
|
|
TEST(Timeline_Width_and_Height_Functions)
|
|
{
|
|
// Create a default fraction (should be 1/1)
|
|
Framerate fps(30000,1000);
|
|
Timeline t1(640, 480, fps, 44100, 2);
|
|
|
|
// Check values
|
|
CHECK_EQUAL(640, t1.Width());
|
|
CHECK_EQUAL(480, t1.Height());
|
|
|
|
// Set width
|
|
t1.Width(600);
|
|
|
|
// Check values
|
|
CHECK_EQUAL(600, t1.Width());
|
|
CHECK_EQUAL(480, t1.Height());
|
|
|
|
// Set height
|
|
t1.Height(400);
|
|
|
|
// Check values
|
|
CHECK_EQUAL(600, t1.Width());
|
|
CHECK_EQUAL(400, t1.Height());
|
|
}
|
|
|
|
TEST(Timeline_Framerate)
|
|
{
|
|
// Create a default fraction (should be 1/1)
|
|
Framerate fps(24,1);
|
|
Timeline t1(640, 480, fps, 44100, 2);
|
|
|
|
// Check values
|
|
CHECK_CLOSE(24.0f, t1.FrameRate().GetFPS(), 0.00001);
|
|
|
|
// Set width
|
|
t1.FrameRate(Framerate(30000,1001));
|
|
|
|
// Check values
|
|
CHECK_CLOSE(29.97002f, t1.FrameRate().GetFPS(), 0.00001);
|
|
|
|
}
|