1
//---------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2011 LenMus project
5
// This program 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
// This program 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 with this
14
// program. 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 "lenmus_config.h"
25
//classes related to these tests
26
#include "lenmus_injectors.h"
27
#include "lenmus_paths.h"
28
#include "lenmus_string.h"
30
using namespace UnitTest;
32
using namespace lenmus;
38
wxConfigBase* m_pSavePrefs;
39
ApplicationScope m_appScope;
40
std::string m_scores_path;
42
AppTestFixture() //SetUp fixture
43
: m_pSavePrefs( wxConfigBase::Get() )
47
m_scores_path = LENMUS_TEST_SCORES_PATH;
50
~AppTestFixture() //TearDown fixture
52
wxConfigBase::Set(m_pSavePrefs);
59
TEST_FIXTURE(AppTestFixture, AppScope_AppNames)
61
CHECK( m_appScope.get_app_name() == _T("Lenmus Phonascus") );
62
CHECK( m_appScope.get_vendor_name() == _T("Lenmus") );
65
//TEST_FIXTURE(AppTestFixture, AppScope_GetPathDefault)
67
// #if (LENMUS_PLATFORM_WIN32 == 1)
68
// m_appScope.set_bin_folder(_T("c:\\lenmus\\bin\\"));
69
// Paths* pPaths = m_appScope.get_paths();
70
// CHECK( pPaths != NULL );
72
// CHECK( pPaths->GetRootPath() == _T("c:\\lenmus\\") );
73
// CHECK( pPaths->GetBinPath() == _T("c:\\lenmus\\bin\\") );
74
// CHECK( pPaths->GetXrcPath() == _T("c:\\lenmus\\xrc\\") );
75
// CHECK( pPaths->GetTemporaryPath() == _T("c:\\lenmus\\temp\\") );
76
// CHECK( pPaths->GetImagePath() == _T("c:\\lenmus\\res\\icons\\") );
77
// CHECK( pPaths->GetCursorsPath() == _T("c:\\lenmus\\res\\cursors\\") );
78
// CHECK( pPaths->GetSoundsPath() == _T("c:\\lenmus\\res\\sounds\\") );
79
// CHECK( pPaths->GetLocaleRootPath() == _T("c:\\lenmus\\locale\\") );
80
// CHECK( pPaths->GetScoresPath() == _T("c:\\lenmus\\scores\\") );
81
// CHECK( pPaths->GetTestScoresPath() == _T("c:\\lenmus\\test-scores\\") );
82
// CHECK( pPaths->GetSamplesPath() == _T("c:\\lenmus\\scores\\samples\\") );
83
// CHECK( pPaths->GetTemplatesPath() == _T("c:\\lenmus\\templates\\") );
84
// #if (LENMUS_DEBUG == 1)
85
// CHECK( pPaths->GetConfigPath() == _T("c:\\lenmus\\z_bin\\") );
87
// CHECK( pPaths->GetConfigPath() == _T("c:\\lenmus\\bin\\") );
89
// CHECK( pPaths->GetLogPath() == _T("c:\\lenmus\\logs\\") );
90
// CHECK( pPaths->GetFontsPath() == _T("c:\\lenmus\\res\\fonts\\") );
92
// #else if (LENMUS_PLATFORM_UNIX == 1)
93
// m_appScope.set_bin_folder(_T("/home/x/lenmus/"));
94
// Paths* pPaths = m_appScope.get_paths();
95
// CHECK( pPaths != NULL );
97
// CHECK( pPaths->GetRootPath() == _T("../../../lenmus/") );
98
// CHECK( pPaths->GetBinPath() == _T("/home/x/lenmus/") );
99
// CHECK( pPaths->GetXrcPath() == _T("../../../lenmus/xrc/") );
100
// CHECK( pPaths->GetTemporaryPath() == _T("../../../lenmus/temp/") );
101
// CHECK( pPaths->GetImagePath() == _T("../../../lenmus/res/icons/") );
102
// CHECK( pPaths->GetCursorsPath() == _T("../../../lenmus/res/cursors/") );
103
// CHECK( pPaths->GetSoundsPath() == _T("../../../lenmus/res/sounds/") );
104
// CHECK( pPaths->GetLocaleRootPath() == _T("../../../lenmus/locale/") );
105
// CHECK( pPaths->GetScoresPath() == _T("../../../lenmus/scores/") );
106
// CHECK( pPaths->GetTestScoresPath() == _T("../../../lenmus/test-scores/") );
107
// CHECK( pPaths->GetSamplesPath() == _T("../../../lenmus/scores/samples/") );
108
// CHECK( pPaths->GetTemplatesPath() == _T("../../../lenmus/templates/") );
109
// CHECK( pPaths->GetConfigPath() == _T("../../../lenmus/") );
110
// CHECK( pPaths->GetLogPath() == _T("../../../lenmus/logs/") );
111
// CHECK( pPaths->GetFontsPath() == _T("../../../lenmus/res/fonts/") );
113
// cout << "GetRootPath='" << to_std_string(pPaths->GetRootPath()) << "'" << endl;
114
// cout << "GetBinPath='" << to_std_string(pPaths->GetBinPath()) << "'" << endl;
115
// cout << "GetXrcPath='" << to_std_string(pPaths->GetXrcPath()) << "'" << endl;
116
// cout << "GetTemporaryPath='" << to_std_string(pPaths->GetTemporaryPath()) << "'" << endl;
117
// cout << "GetImagePath='" << to_std_string(pPaths->GetImagePath()) << "'" << endl;
118
// cout << "GetCursorsPath='" << to_std_string(pPaths->GetCursorsPath()) << "'" << endl;
119
// cout << "GetSoundsPath='" << to_std_string(pPaths->GetSoundsPath()) << "'" << endl;
120
// cout << "GetLocaleRootPath='" << to_std_string(pPaths->GetLocaleRootPath()) << "'" << endl;
121
// cout << "GetScoresPath='" << to_std_string(pPaths->GetScoresPath()) << "'" << endl;
122
// cout << "GetTestScoresPath='" << to_std_string(pPaths->GetTestScoresPath()) << "'" << endl;
123
// cout << "GetSamplesPath='" << to_std_string(pPaths->GetSamplesPath()) << "'" << endl;
124
// cout << "GetTemplatesPath='" << to_std_string(pPaths->GetTemplatesPath()) << "'" << endl;
125
// cout << "GetConfigPath='" << to_std_string(pPaths->GetConfigPath()) << "'" << endl;
126
// cout << "GetLogPath='" << to_std_string(pPaths->GetLogPath()) << "'" << endl;
127
// cout << "GetFontsPath='" << to_std_string(pPaths->GetFontsPath()) << "'" << endl;
130
TEST_FIXTURE(AppTestFixture, AppScope_GetMidiServer)
132
MidiServer* pMidi = m_appScope.get_midi_server();
133
CHECK( pMidi != NULL );