Add experimental gameplay tests (#8926)

A gameplay test plays a game: it presses keys, moves the mouse, touches the screen, then checks that what should happen actually happens. For example, if the coin is collected, the score goes up, the enemy hurts the player... Tests run in a preview of the game, usually much faster than real time. [Read more about them on this page](https://wiki.gdevelop.io/gdevelop5/interface/gameplay-tests/)
This commit is contained in:
Florian Rival
2026-08-08 21:22:07 +02:00
committed by GitHub
parent accc32ee48
commit 44ba8a04ce
96 changed files with 10831 additions and 97 deletions
+11
View File
@@ -918,6 +918,11 @@ void Project::UnserializeFrom(const SerializerElement& element) {
externalEvents.UnserializeFrom(*this, externalEventElement);
}
tests.ClearTests();
if (element.HasChild("tests")) {
tests.UnserializeTestsFrom(element.GetChild("tests"));
}
externalLayouts.clear();
const SerializerElement& externalLayoutsElement =
element.GetChild("externalLayouts", 0, "ExternalLayouts");
@@ -1171,6 +1176,10 @@ void Project::SerializeTo(SerializerElement& element) const {
GetExternalEvents(i).SerializeTo(
externalEventsElement.AddChild("externalEvents"));
if (tests.GetTestsCount() > 0) {
tests.SerializeTestsTo(element.AddChild("tests"));
}
SerializerElement& eventsFunctionsExtensionsElement =
element.AddChild("eventsFunctionsExtensions");
eventsFunctionsExtensionsElement.ConsiderAsArrayOf(
@@ -1294,6 +1303,8 @@ void Project::Init(const gd::Project& game) {
externalEvents = gd::Clone(game.externalEvents);
tests = game.tests;
externalLayouts = gd::Clone(game.externalLayouts);
eventsFunctionsExtensions = gd::Clone(game.eventsFunctionsExtensions);