mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-25 04:15:49 -04:00
a8559bfbbc
* Update all CMakeLists of extensions to use clang-format * Run clang-format on all Extensions * Update GDCore CMakeLists.txt to add clang-format * Run clang-format on GDCore files * Update GDJS and GDCpp CMakeLists.txt to add clang-format * Run clang-format on GDCpp and GDJS files
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
/*
|
|
* GDevelop Core
|
|
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
|
* reserved. This project is released under the MIT License.
|
|
*/
|
|
/**
|
|
* @file Tests covering the clipboard provided by GDCore.
|
|
*/
|
|
#include "GDCore/IDE/Clipboard.h"
|
|
#include "GDCore/CommonTools.h"
|
|
#include "GDCore/Events/Builtin/StandardEvent.h"
|
|
#include "GDCore/Events/EventsList.h"
|
|
#include "GDCore/Project/ExternalEvents.h"
|
|
#include "GDCore/Project/ExternalLayout.h"
|
|
#include "GDCore/Project/Layout.h"
|
|
#include "GDCore/Project/Project.h"
|
|
#include "catch.hpp"
|
|
|
|
TEST_CASE("Clipboard", "[common][ide]") {
|
|
gd::Clipboard& clipboard = *gd::Clipboard::Get();
|
|
REQUIRE(clipboard.HasExternalEvents() == false);
|
|
REQUIRE(clipboard.HasExternalLayout() == false);
|
|
REQUIRE(clipboard.HasLayout() == false);
|
|
REQUIRE(clipboard.HasObject() == false);
|
|
REQUIRE(clipboard.HasEvents() == false);
|
|
|
|
SECTION("Is a singleton") { REQUIRE(&clipboard == gd::Clipboard::Get()); }
|
|
SECTION("Properly store objects") {
|
|
gd::ExternalEvents ev;
|
|
ev.SetName("MyExternalEvents");
|
|
clipboard.SetExternalEvents(ev);
|
|
REQUIRE(clipboard.HasExternalEvents() == true);
|
|
REQUIRE(clipboard.GetExternalEvents().GetName() == "MyExternalEvents");
|
|
|
|
gd::ExternalLayout el;
|
|
el.SetName("MyExternalLayout");
|
|
clipboard.SetExternalLayout(el);
|
|
REQUIRE(clipboard.HasExternalLayout() == true);
|
|
REQUIRE(clipboard.GetExternalLayout().GetName() == "MyExternalLayout");
|
|
|
|
gd::EventsList eList;
|
|
gd::StandardEvent evt;
|
|
eList.InsertEvent(evt);
|
|
eList.InsertEvent(evt);
|
|
clipboard.SetEvents(eList);
|
|
REQUIRE(clipboard.HasEvents() == true);
|
|
REQUIRE(clipboard.GetEvents().GetEventsCount() == 2);
|
|
}
|
|
}
|