1
//--------------------------------------------------------------------------------------
2
// This file is part of the Lomse library.
3
// Copyright (c) 2010 Lomse project
5
// Lomse is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation,
7
// either version 3 of the License, or (at your option) any later version.
9
// Lomse is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along
14
// with Lomse; if not, see <http://www.gnu.org/licenses/>.
16
// For any comment, suggestion or feature request, please contact the manager of
17
// the project at cecilios@users.sourceforge.net
19
//-------------------------------------------------------------------------------------
21
#include <UnitTest++.h>
23
#include "lomse_config.h"
25
//classes related to these tests
26
#include "lomse_injectors.h"
27
#include "lomse_sizers.h"
28
#include "lomse_gm_basic.h"
30
using namespace UnitTest;
32
using namespace lomse;
35
class SizersTestFixture
39
SizersTestFixture() //SetUp fixture
41
m_pLibraryScope = new LibraryScope(cout);
42
m_scores_path = LOMSE_TEST_SCORES_PATH;
45
~SizersTestFixture() //TearDown fixture
47
delete m_pLibraryScope;
50
LibraryScope* m_pLibraryScope;
51
std::string m_scores_path;
57
// FlowSizer vertical -------------------------------------------------
59
TEST_FIXTURE(SizersTestFixture, SizersTest_FlowVerticalTakesAllWidth)
61
FlowSizer sizer(FlowSizer::k_vertical);
62
GmoStubScore stub(NULL);
63
GmoBoxScorePage box(&stub, NULL);
64
sizer.add_child( new SizerChild(&box) );
65
sizer.layout(2100.0f, 2970.0f);
66
CHECK( sizer.is_vertical() == true );
67
CHECK( box.get_width() == 2100.0f );
68
CHECK( box.get_height() == _LOMSE_CAN_GROW );
71
// FlowSizer horizontal -----------------------------------------------
73
TEST_FIXTURE(SizersTestFixture, SizersTest_FlowHorizontalTakesAllHeight)
75
FlowSizer sizer(FlowSizer::k_horizontal);
76
GmoStubScore stub(NULL);
77
GmoBoxScorePage box(&stub, NULL);
78
sizer.add_child( new SizerChild(&box) );
79
sizer.layout(2100.0f, 2970.0f);
80
CHECK( sizer.is_vertical() == false );
81
CHECK( box.get_width() == _LOMSE_CAN_GROW );
82
CHECK( box.get_height() == 2970.0f );