GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Test.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-present Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #pragma once
7 
8 #include "GDCore/String.h"
9 
10 namespace gd {
11 class SerializerElement;
12 }
13 
14 namespace gd {
15 
28 class GD_CORE_API Test {
29  public:
30  Test();
31  virtual ~Test(){};
32 
36  Test* Clone() const { return new Test(*this); };
37 
41  const gd::String& GetName() const { return name; };
42 
46  void SetName(const gd::String& name_) { name = name_; };
47 
51  const gd::String& GetType() const { return type; };
52 
56  void SetType(const gd::String& type_) { type = type_; };
57 
61  const gd::String& GetDescription() const { return description; };
62 
66  void SetDescription(const gd::String& description_) {
67  description = description_;
68  };
69 
73  const gd::String& GetSource() const { return source; };
74 
78  void SetSource(const gd::String& source_) { source = source_; };
79 
85 
89  const gd::String& GetLastRunStatus() const { return lastRunStatus; };
90 
94  void SetLastRunStatus(const gd::String& lastRunStatus_) {
95  lastRunStatus = lastRunStatus_;
96  };
97 
102  double GetLastRunAt() const { return lastRunAt; };
103 
107  void SetLastRunAt(double lastRunAt_) { lastRunAt = lastRunAt_; };
108 
112  double GetLastRunDurationMs() const { return lastRunDurationMs; };
113 
117  void SetLastRunDurationMs(double lastRunDurationMs_) {
118  lastRunDurationMs = lastRunDurationMs_;
119  };
120 
124  int GetLastRunFramesExecuted() const { return lastRunFramesExecuted; };
125 
129  void SetLastRunFramesExecuted(int lastRunFramesExecuted_) {
130  lastRunFramesExecuted = lastRunFramesExecuted_;
131  };
133 
137  void SerializeTo(SerializerElement& element) const;
138 
142  void UnserializeFrom(const SerializerElement& element);
143 
144  private:
145  gd::String name;
146  gd::String type;
147  gd::String description;
148  gd::String source;
149  gd::String lastRunStatus;
150  double lastRunAt = 0;
151  double lastRunDurationMs = 0;
152  int lastRunFramesExecuted = 0;
153 };
154 
155 } // namespace gd
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:33
A test attached to a project or an events based extension.
Definition: Test.h:28
const gd::String & GetType() const
Get the type of the test ("gameplay" for now).
Definition: Test.h:51
double GetLastRunDurationMs() const
Get the duration (in milliseconds) of the last run.
Definition: Test.h:112
void SetLastRunStatus(const gd::String &lastRunStatus_)
Set the status of the last run.
Definition: Test.h:94
void SetLastRunDurationMs(double lastRunDurationMs_)
Set the duration (in milliseconds) of the last run.
Definition: Test.h:117
double GetLastRunAt() const
Get the timestamp (in milliseconds since epoch) of the last run, or 0 if never run.
Definition: Test.h:102
const gd::String & GetLastRunStatus() const
Get the status of the last run: empty if never run, or "passed", "failed", "error".
Definition: Test.h:89
void SetType(const gd::String &type_)
Change the type of the test.
Definition: Test.h:56
void SetSource(const gd::String &source_)
Change the JavaScript source of the test.
Definition: Test.h:78
void SetDescription(const gd::String &description_)
Change the description of the test.
Definition: Test.h:66
Test * Clone() const
Return a pointer to a new Test constructed from this one.
Definition: Test.h:36
void SetName(const gd::String &name_)
Change the name of the test.
Definition: Test.h:46
const gd::String & GetDescription() const
Get the description of the test.
Definition: Test.h:61
void SetLastRunFramesExecuted(int lastRunFramesExecuted_)
Set the number of frames executed during the last run.
Definition: Test.h:129
int GetLastRunFramesExecuted() const
Get the number of frames executed during the last run.
Definition: Test.h:124
const gd::String & GetSource() const
Get the JavaScript source of the test.
Definition: Test.h:73
void SetLastRunAt(double lastRunAt_)
Set the timestamp (in milliseconds since epoch) of the last run.
Definition: Test.h:107
const gd::String & GetName() const
Get the name of the test.
Definition: Test.h:41
Definition: CommonTools.h:24