~s-cecilio/lenmus/v5.1.x

« back to all changes in this revision

Viewing changes to src/tests/lenmus_test_app.cpp

  • Committer: cecilios
  • Date: 2011-06-12 17:25:18 UTC
  • Revision ID: svn-v4:2587a929-2f0e-0410-ae78-fe6f687d5efe:branches/TRY-5.0:687
Initial update for v5.0 first working core using lomse

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//---------------------------------------------------------------------------------------
 
2
//    LenMus Phonascus: The teacher of music
 
3
//    Copyright (c) 2002-2011 LenMus project
 
4
//
 
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.
 
8
//
 
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.
 
12
//
 
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/>.
 
15
//
 
16
//    For any comment, suggestion or feature request, please contact the manager of
 
17
//    the project at cecilios@users.sourceforge.net
 
18
//
 
19
//---------------------------------------------------------------------------------------
 
20
 
 
21
#include <UnitTest++.h>
 
22
#include <sstream>
 
23
#include "lenmus_config.h"
 
24
 
 
25
//classes related to these tests
 
26
#include "lenmus_injectors.h"
 
27
#include "lenmus_paths.h"
 
28
#include "lenmus_string.h"
 
29
 
 
30
using namespace UnitTest;
 
31
using namespace std;
 
32
using namespace lenmus;
 
33
 
 
34
 
 
35
class AppTestFixture
 
36
{
 
37
public:
 
38
    wxConfigBase* m_pSavePrefs;
 
39
    ApplicationScope m_appScope;
 
40
    std::string m_scores_path;
 
41
 
 
42
    AppTestFixture()     //SetUp fixture
 
43
        : m_pSavePrefs( wxConfigBase::Get() )
 
44
        , m_appScope(cout)
 
45
    {
 
46
        
 
47
        m_scores_path = LENMUS_TEST_SCORES_PATH;
 
48
    }
 
49
 
 
50
    ~AppTestFixture()    //TearDown fixture
 
51
    {
 
52
        wxConfigBase::Set(m_pSavePrefs);
 
53
    }
 
54
};
 
55
 
 
56
SUITE(AppTest)
 
57
{
 
58
 
 
59
    TEST_FIXTURE(AppTestFixture, AppScope_AppNames)
 
60
    {
 
61
        CHECK( m_appScope.get_app_name() == _T("Lenmus Phonascus") );
 
62
        CHECK( m_appScope.get_vendor_name() == _T("Lenmus") );
 
63
    }
 
64
 
 
65
    //TEST_FIXTURE(AppTestFixture, AppScope_GetPathDefault)
 
66
    //{
 
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 );
 
71
 
 
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\\") );
 
86
    //        #else
 
87
    //            CHECK( pPaths->GetConfigPath() == _T("c:\\lenmus\\bin\\") );
 
88
    //        #endif
 
89
    //        CHECK( pPaths->GetLogPath() == _T("c:\\lenmus\\logs\\") );
 
90
    //        CHECK( pPaths->GetFontsPath() == _T("c:\\lenmus\\res\\fonts\\") );
 
91
 
 
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 );
 
96
 
 
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/") );
 
112
    //    #endif
 
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;
 
128
    //}
 
129
 
 
130
    TEST_FIXTURE(AppTestFixture, AppScope_GetMidiServer)
 
131
    {
 
132
        MidiServer* pMidi = m_appScope.get_midi_server();
 
133
        CHECK( pMidi != NULL );
 
134
    }
 
135
 
 
136
};
 
137