Fix ThemeDB initialization in tests

Also fixes class name shadowing in Viewport/Window tests.
This commit is contained in:
Yuri Sizov
2023-09-04 18:07:16 +02:00
parent 75de1ca768
commit 4328ffcc79
6 changed files with 45 additions and 28 deletions

View File

@@ -43,8 +43,8 @@
namespace TestViewport {
class NotificationControl : public Control {
GDCLASS(NotificationControl, Control);
class NotificationControlViewport : public Control {
GDCLASS(NotificationControlViewport, Control);
protected:
void _notification(int p_what) {
@@ -63,11 +63,11 @@ public:
bool mouse_over = false;
};
// `NotificationControl`-derived class that additionally
// `NotificationControlViewport`-derived class that additionally
// - allows start Dragging
// - stores mouse information of last event
class DragStart : public NotificationControl {
GDCLASS(DragStart, NotificationControl);
class DragStart : public NotificationControlViewport {
GDCLASS(DragStart, NotificationControlViewport);
public:
MouseButton last_mouse_button;
@@ -93,9 +93,9 @@ public:
}
};
// `NotificationControl`-derived class that acts as a Drag and Drop target.
class DragTarget : public NotificationControl {
GDCLASS(DragTarget, NotificationControl);
// `NotificationControlViewport`-derived class that acts as a Drag and Drop target.
class DragTarget : public NotificationControlViewport {
GDCLASS(DragTarget, NotificationControlViewport);
public:
Variant drag_data;

View File

@@ -38,8 +38,8 @@
namespace TestWindow {
class NotificationControl : public Control {
GDCLASS(NotificationControl, Control);
class NotificationControlWindow : public Control {
GDCLASS(NotificationControlWindow, Control);
protected:
void _notification(int p_what) {
@@ -69,7 +69,7 @@ TEST_CASE("[SceneTree][Window]") {
w->set_content_scale_size(Size2i(200, 200));
w->set_content_scale_mode(Window::CONTENT_SCALE_MODE_CANVAS_ITEMS);
w->set_content_scale_aspect(Window::CONTENT_SCALE_ASPECT_KEEP);
NotificationControl *c = memnew(NotificationControl);
NotificationControlWindow *c = memnew(NotificationControlWindow);
w->add_child(c);
c->set_size(Size2i(100, 100));
c->set_position(Size2i(-50, -50));