Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Jul 14, 2024
1 parent 26835bb commit 0850a27
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 55 deletions.
6 changes: 4 additions & 2 deletions tests/Application.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -44,7 +44,9 @@ END_NAMESPACE_DGL

int main()
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Application;
using DGL_NAMESPACE::ApplicationQuitter;
using DGL_NAMESPACE::IdleCallbackCounter;

// regular usage
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Circle.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -20,8 +20,6 @@

int main()
{
USE_NAMESPACE_DGL;

// TODO

return 0;
Expand Down
6 changes: 4 additions & 2 deletions tests/Color.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -17,13 +17,15 @@
#include "tests.hpp"

#define DPF_TEST_COLOR_CPP
#include "dgl/src/Application.cpp"
#include "dgl/src/ApplicationPrivateData.cpp"
#include "dgl/src/Color.cpp"

// --------------------------------------------------------------------------------------------------------------------

int main()
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Color;

// constructor with no arguments, must give solid black
{
Expand Down
62 changes: 34 additions & 28 deletions tests/Demo.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2022 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -66,11 +66,11 @@ typedef ExampleImagesWidget<StandaloneWindow, DemoImage> ExampleImagesStandalone
class LeftSideWidget : public SubWidget
{
public:
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
static const int kPageCount = 5;
#else
#else
static const int kPageCount = 4;
#endif
#endif

class Callback
{
Expand All @@ -92,12 +92,12 @@ class LeftSideWidget : public SubWidget
img3.loadFromMemory(ico3Data, ico3Width, ico2Height, kImageFormatBGR);
img4.loadFromMemory(ico4Data, ico4Width, ico4Height, kImageFormatBGR);

#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
img5.loadFromMemory(ico5Data, ico5Width, ico5Height, kImageFormatBGR);

// for text
nvg.loadSharedResources();
#endif
#endif
}

protected:
Expand Down Expand Up @@ -143,7 +143,7 @@ class LeftSideWidget : public SubWidget
img3.drawAt(context, pad, pad + 6 + iconSize*2);
img4.drawAt(context, pad, pad + 9 + iconSize*3);

#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
img5.drawAt(context, pad, pad + 12 + iconSize*4);

// draw some text
Expand All @@ -158,7 +158,7 @@ class LeftSideWidget : public SubWidget
nvg.textBox(15 * scaleFactor, 440 * scaleFactor, iconSize, "Look!", nullptr);

nvg.endFrame();
#endif
#endif
}

bool onMouse(const MouseEvent& ev) override
Expand Down Expand Up @@ -245,10 +245,10 @@ class LeftSideWidget : public SubWidget
Line<int> lineSep;
DemoImage img1, img2, img3, img4, img5;

#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
// for text
NanoVG nvg;
#endif
#endif
};

// --------------------------------------------------------------------------------------------------------------------
Expand All @@ -260,15 +260,13 @@ class DemoWindow : public StandaloneWindow,
static const int kSidebarWidth = 81;

public:
#ifdef DGL_CAIRO
#if defined(DGL_CAIRO)
static constexpr const char* const kExampleWidgetName = "Demo - Cairo";
#endif
#ifdef DGL_OPENGL
#elif defined(DGL_OPENGL)
static constexpr const char* const kExampleWidgetName = "Demo - OpenGL";
#endif
#ifdef DGL_VULKAN
#elif defined(DGL_VULKAN)
static constexpr const char* const kExampleWidgetName = "Demo - Vulkan";
#endif
#endif

DemoWindow(Application& app)
: StandaloneWindow(app),
Expand All @@ -293,11 +291,11 @@ class DemoWindow : public StandaloneWindow,
wShapes->hide();
wShapes->setAbsoluteX(kSidebarWidth * scaleFactor);

#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
wText = new ExampleTextSubWidget(this),
wText->hide();
wText->setAbsoluteX(kSidebarWidth * scaleFactor);
#endif
#endif
wLeft = new LeftSideWidget(this, this),
wLeft->setAbsolutePos(2 * scaleFactor, 2 * scaleFactor);

Expand Down Expand Up @@ -327,11 +325,11 @@ class DemoWindow : public StandaloneWindow,
case 3:
curWidget = wShapes;
break;
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
case 4:
curWidget = wText;
break;
#endif
#endif
default:
curWidget = nullptr;
break;
Expand Down Expand Up @@ -359,9 +357,9 @@ class DemoWindow : public StandaloneWindow,
wImages->setSize(size);
wRects->setSize(size);
wShapes->setSize(size);
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
wText->setSize(size);
#endif
#endif
wLeft->setSize((kSidebarWidth - 4) * scaleFactor, (height - 4) * scaleFactor);
}

Expand All @@ -370,9 +368,9 @@ class DemoWindow : public StandaloneWindow,
ScopedPointer<ExampleImagesSubWidget> wImages;
ScopedPointer<ExampleRectanglesSubWidget> wRects;
ScopedPointer<ExampleShapesSubWidget> wShapes;
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
ScopedPointer<ExampleTextSubWidget> wText;
#endif
#endif
ScopedPointer<LeftSideWidget> wLeft;
ScopedPointer<ResizeHandle> resizer;

Expand Down Expand Up @@ -401,8 +399,16 @@ END_NAMESPACE_DGL

int main(int argc, char* argv[])
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Window;
using DGL_NAMESPACE::Application;
using DGL_NAMESPACE::DemoWindow;
using DGL_NAMESPACE::ExampleColorStandaloneWindow;
using DGL_NAMESPACE::ExampleImagesStandaloneWindow;
using DGL_NAMESPACE::ExampleRectanglesStandaloneWindow;
using DGL_NAMESPACE::ExampleShapesStandaloneWindow;
#ifdef DGL_OPENGL
using DGL_NAMESPACE::ExampleTextStandaloneWindow;
#endif
using DGL_NAMESPACE::createAndShowExampleWidgetStandaloneWindow;

Application app;

Expand All @@ -416,10 +422,10 @@ int main(int argc, char* argv[])
createAndShowExampleWidgetStandaloneWindow<ExampleRectanglesStandaloneWindow>(app);
else if (std::strcmp(argv[1], "shapes") == 0)
createAndShowExampleWidgetStandaloneWindow<ExampleShapesStandaloneWindow>(app);
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
else if (std::strcmp(argv[1], "text") == 0)
createAndShowExampleWidgetStandaloneWindow<ExampleTextStandaloneWindow>(app);
#endif
#endif
else
d_stderr2("Invalid demo mode, must be one of: color, images, rectangles or shapes");
}
Expand Down
5 changes: 3 additions & 2 deletions tests/FileBrowserDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -181,7 +181,8 @@ END_NAMESPACE_DGL

int main()
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Application;
using DGL_NAMESPACE::NanoFilePicker;

Application app(true);
NanoFilePicker win(app);
Expand Down
4 changes: 1 addition & 3 deletions tests/Line.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -20,8 +20,6 @@

int main()
{
USE_NAMESPACE_DGL;

// TODO

return 0;
Expand Down
5 changes: 3 additions & 2 deletions tests/NanoImage.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -214,7 +214,8 @@ END_NAMESPACE_DGL

int main()
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Application;
using DGL_NAMESPACE::NanoImageExample;

Application app(true);
NanoImageExample win(app);
Expand Down
5 changes: 3 additions & 2 deletions tests/NanoSubWidgets.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -154,7 +154,8 @@ END_NAMESPACE_DGL

int main()
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Application;
using DGL_NAMESPACE::NanoExampleWindow;

Application app;
NanoExampleWindow win(app);
Expand Down
6 changes: 4 additions & 2 deletions tests/Point.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -17,14 +17,16 @@
#include "tests.hpp"

#define DPF_TEST_POINT_CPP
#include "dgl/src/Application.cpp"
#include "dgl/src/ApplicationPrivateData.cpp"
#include "dgl/src/Geometry.cpp"

// --------------------------------------------------------------------------------------------------------------------

template <typename T>
static int runTestsPerType()
{
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Point;

// basic usage
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Rectangle.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -20,8 +20,6 @@

int main()
{
USE_NAMESPACE_DGL;

// TODO

return 0;
Expand Down
4 changes: 1 addition & 3 deletions tests/Triangle.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand All @@ -20,8 +20,6 @@

int main()
{
USE_NAMESPACE_DGL;

// TODO

return 0;
Expand Down
6 changes: 3 additions & 3 deletions tests/Window.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2024 Filipe Coelho <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
Expand Down Expand Up @@ -29,8 +29,8 @@

int main()
{
USE_NAMESPACE_DGL;

using DGL_NAMESPACE::Application;
using DGL_NAMESPACE::ApplicationQuitter;
using DGL_NAMESPACE::Window;

// creating and destroying simple window
Expand Down

0 comments on commit 0850a27

Please sign in to comment.