MuseScore  3.4
Music composition and notation
testscript.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2018 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __TESTSCRIPT_H__
14 #define __TESTSCRIPT_H__
15 
16 #include "scriptentry.h"
17 
18 namespace Ms {
19 
20 class ScriptContext;
21 
22 //---------------------------------------------------------
23 // TestScriptEntry
24 //---------------------------------------------------------
25 
26 class TestScriptEntry : public ScriptEntry {
27  protected:
28  static QString entryTemplate(const char* testType) { return ScriptEntry::entryTemplate(SCRIPT_TEST).arg(testType) + " %1"; }
29  public:
30  static constexpr const char* TEST_SCORE = "score";
31 
32  static std::unique_ptr<ScriptEntry> deserialize(const QStringList& tokens);
33  };
34 
35 //---------------------------------------------------------
36 // ScoreTestScriptEntry
37 //---------------------------------------------------------
38 
40  QString _refPath;
41  public:
42  ScoreTestScriptEntry(QString refPath) : _refPath(refPath) {}
43  bool execute(ScriptContext& ctx) const override;
44  QString serialize() const override { return entryTemplate(TEST_SCORE).arg(_refPath); }
45  static std::unique_ptr<ScriptEntry> fromContext(const ScriptContext& ctx, QString fileName = QString());
46  };
47 
48 } // namespace Ms
49 #endif
Definition: testscript.h:39
static QString entryTemplate(const char *testType)
Definition: testscript.h:28
virtual bool execute(ScriptContext &ctx) const =0
static QString entryTemplate(const char *entryType)
Definition: scriptentry.h:36
static constexpr const char * SCRIPT_TEST
Definition: scriptentry.h:34
static constexpr const char * TEST_SCORE
Definition: testscript.h:30
Definition: aeolus.cpp:26
Definition: testscript.h:26
Definition: script.h:28
QString _refPath
Definition: testscript.h:40
QString serialize() const override
Definition: testscript.h:44
ScoreTestScriptEntry(QString refPath)
Definition: testscript.h:42
static std::unique_ptr< ScriptEntry > deserialize(const QStringList &tokens)
Definition: testscript.cpp:26
Definition: scriptentry.h:27