feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CLASS_DB_H
|
||||
#define TEST_CLASS_DB_H
|
||||
#pragma once
|
||||
|
||||
#include "core/core_bind.h"
|
||||
#include "core/core_constants.h"
|
||||
|
|
@ -415,6 +414,9 @@ void validate_argument(const Context &p_context, const ExposedClass &p_class, co
|
|||
#ifdef DEBUG_METHODS_ENABLED
|
||||
TEST_COND((p_arg.name.is_empty() || p_arg.name.begins_with("_unnamed_arg")),
|
||||
vformat("Unnamed argument in position %d of %s '%s.%s'.", p_arg.position, p_owner_type, p_class.name, p_owner_name));
|
||||
|
||||
TEST_FAIL_COND((p_arg.name != "@varargs@" && !p_arg.name.is_valid_ascii_identifier()),
|
||||
vformat("Invalid argument name '%s' of %s '%s.%s'.", p_arg.name, p_owner_type, p_class.name, p_owner_name));
|
||||
#endif // DEBUG_METHODS_ENABLED
|
||||
|
||||
const ExposedClass *arg_class = p_context.find_exposed_class(p_arg.type);
|
||||
|
|
@ -658,9 +660,8 @@ void add_exposed_classes(Context &r_context) {
|
|||
method.return_type.name = Variant::get_type_name(return_info.type);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++i) {
|
||||
const PropertyInfo &arg_info = *itr;
|
||||
for (int64_t i = 0; i < method_info.arguments.size(); ++i) {
|
||||
const PropertyInfo &arg_info = method_info.arguments[i];
|
||||
|
||||
String orig_arg_name = arg_info.name;
|
||||
|
||||
|
|
@ -732,9 +733,8 @@ void add_exposed_classes(Context &r_context) {
|
|||
TEST_FAIL_COND(!String(signal.name).is_valid_ascii_identifier(),
|
||||
"Signal name is not a valid identifier: '", exposed_class.name, ".", signal.name, "'.");
|
||||
|
||||
int i = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++i) {
|
||||
const PropertyInfo &arg_info = *itr;
|
||||
for (int64_t i = 0; i < method_info.arguments.size(); ++i) {
|
||||
const PropertyInfo &arg_info = method_info.arguments[i];
|
||||
|
||||
String orig_arg_name = arg_info.name;
|
||||
|
||||
|
|
@ -900,5 +900,3 @@ TEST_SUITE("[ClassDB]") {
|
|||
}
|
||||
}
|
||||
} // namespace TestClassDB
|
||||
|
||||
#endif // TEST_CLASS_DB_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_METHOD_BIND_H
|
||||
#define TEST_METHOD_BIND_H
|
||||
#pragma once
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
|
||||
|
|
@ -56,6 +55,8 @@ public:
|
|||
};
|
||||
|
||||
class ObjectSubclass : public Object {
|
||||
GDSOFTCLASS(ObjectSubclass, Object);
|
||||
|
||||
public:
|
||||
int value = 1;
|
||||
};
|
||||
|
|
@ -171,5 +172,3 @@ TEST_CASE("[MethodBind] check all method binds") {
|
|||
memdelete(mbt);
|
||||
}
|
||||
} // namespace TestMethodBind
|
||||
|
||||
#endif // TEST_METHOD_BIND_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_OBJECT_H
|
||||
#define TEST_OBJECT_H
|
||||
#pragma once
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/object.h"
|
||||
|
|
@ -144,15 +143,6 @@ TEST_CASE("[Object] Core getters") {
|
|||
CHECK_MESSAGE(
|
||||
object.get_save_class() == "Object",
|
||||
"The returned save class should match the expected value.");
|
||||
|
||||
List<String> inheritance_list;
|
||||
object.get_inheritance_list_static(&inheritance_list);
|
||||
CHECK_MESSAGE(
|
||||
inheritance_list.size() == 1,
|
||||
"The inheritance list should consist of Object only");
|
||||
CHECK_MESSAGE(
|
||||
inheritance_list.front()->get() == "Object",
|
||||
"The inheritance list should consist of Object only");
|
||||
}
|
||||
|
||||
TEST_CASE("[Object] Metadata") {
|
||||
|
|
@ -429,8 +419,7 @@ TEST_CASE("[Object] Signals") {
|
|||
}
|
||||
|
||||
SUBCASE("Emitting an existing signal should call the connected method") {
|
||||
Array empty_signal_args;
|
||||
empty_signal_args.push_back(Array());
|
||||
Array empty_signal_args = { {} };
|
||||
|
||||
SIGNAL_WATCH(&object, "my_custom_signal");
|
||||
SIGNAL_CHECK_FALSE("my_custom_signal");
|
||||
|
|
@ -466,72 +455,75 @@ TEST_CASE("[Object] Signals") {
|
|||
}
|
||||
}
|
||||
|
||||
class NotificationObject1 : public Object {
|
||||
GDCLASS(NotificationObject1, Object);
|
||||
class NotificationObjectSuperclass : public Object {
|
||||
GDCLASS(NotificationObjectSuperclass, Object);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case 12345: {
|
||||
order_internal1 = order_global++;
|
||||
} break;
|
||||
}
|
||||
order_superclass = ++order_global;
|
||||
}
|
||||
|
||||
public:
|
||||
static int order_global;
|
||||
int order_internal1 = -1;
|
||||
|
||||
void reset_order() {
|
||||
order_internal1 = -1;
|
||||
order_global = 1;
|
||||
}
|
||||
static inline int order_global = 0;
|
||||
int order_superclass = -1;
|
||||
};
|
||||
|
||||
int NotificationObject1::order_global = 1;
|
||||
|
||||
class NotificationObject2 : public NotificationObject1 {
|
||||
GDCLASS(NotificationObject2, NotificationObject1);
|
||||
class NotificationObjectSubclass : public NotificationObjectSuperclass {
|
||||
GDCLASS(NotificationObjectSubclass, NotificationObjectSuperclass);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case 12345: {
|
||||
order_internal2 = order_global++;
|
||||
} break;
|
||||
}
|
||||
order_subclass = ++order_global;
|
||||
}
|
||||
|
||||
public:
|
||||
int order_internal2 = -1;
|
||||
void reset_order() {
|
||||
NotificationObject1::reset_order();
|
||||
order_internal2 = -1;
|
||||
int order_subclass = -1;
|
||||
};
|
||||
|
||||
class NotificationScriptInstance : public _MockScriptInstance {
|
||||
void notification(int p_notification, bool p_reversed) override {
|
||||
order_script = ++NotificationObjectSuperclass::order_global;
|
||||
}
|
||||
|
||||
public:
|
||||
int order_script = -1;
|
||||
};
|
||||
|
||||
TEST_CASE("[Object] Notification order") { // GH-52325
|
||||
NotificationObject2 *test_notification_object = memnew(NotificationObject2);
|
||||
NotificationObjectSubclass *object = memnew(NotificationObjectSubclass);
|
||||
|
||||
NotificationScriptInstance *script = memnew(NotificationScriptInstance);
|
||||
object->set_script_instance(script);
|
||||
|
||||
SUBCASE("regular order") {
|
||||
test_notification_object->notification(12345, false);
|
||||
NotificationObjectSubclass::order_global = 0;
|
||||
object->order_superclass = -1;
|
||||
object->order_subclass = -1;
|
||||
script->order_script = -1;
|
||||
object->notification(12345, false);
|
||||
|
||||
CHECK_EQ(test_notification_object->order_internal1, 1);
|
||||
CHECK_EQ(test_notification_object->order_internal2, 2);
|
||||
|
||||
test_notification_object->reset_order();
|
||||
CHECK_EQ(object->order_superclass, 1);
|
||||
CHECK_EQ(object->order_subclass, 2);
|
||||
// TODO If an extension is attached, it should come here.
|
||||
CHECK_EQ(script->order_script, 3);
|
||||
CHECK_EQ(NotificationObjectSubclass::order_global, 3);
|
||||
}
|
||||
|
||||
SUBCASE("reverse order") {
|
||||
test_notification_object->notification(12345, true);
|
||||
NotificationObjectSubclass::order_global = 0;
|
||||
object->order_superclass = -1;
|
||||
object->order_subclass = -1;
|
||||
script->order_script = -1;
|
||||
object->notification(12345, true);
|
||||
|
||||
CHECK_EQ(test_notification_object->order_internal1, 2);
|
||||
CHECK_EQ(test_notification_object->order_internal2, 1);
|
||||
|
||||
test_notification_object->reset_order();
|
||||
CHECK_EQ(script->order_script, 1);
|
||||
// TODO If an extension is attached, it should come here.
|
||||
CHECK_EQ(object->order_subclass, 2);
|
||||
CHECK_EQ(object->order_superclass, 3);
|
||||
CHECK_EQ(NotificationObjectSubclass::order_global, 3);
|
||||
}
|
||||
|
||||
memdelete(test_notification_object);
|
||||
memdelete(object);
|
||||
}
|
||||
|
||||
TEST_CASE("[Object] Destruction at the end of the call chain is safe") {
|
||||
|
|
@ -603,5 +595,3 @@ TEST_CASE("[Object] Destruction at the end of the call chain is safe") {
|
|||
}
|
||||
|
||||
} // namespace TestObject
|
||||
|
||||
#endif // TEST_OBJECT_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_UNDO_REDO_H
|
||||
#define TEST_UNDO_REDO_H
|
||||
#pragma once
|
||||
|
||||
#include "core/object/undo_redo.h"
|
||||
#include "tests/test_macros.h"
|
||||
|
|
@ -198,5 +197,3 @@ TEST_CASE("[UndoRedo] Merge Method UndoRedo") {
|
|||
}
|
||||
|
||||
} //namespace TestUndoRedo
|
||||
|
||||
#endif // TEST_UNDO_REDO_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue