Browse Source

Fix tests

Signed-off-by: falkTX <falktx@falktx.com>
pull/467/head
falkTX 9 months ago
parent
commit
0850a2790c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
12 changed files with 62 additions and 55 deletions
  1. +4
    -2
      tests/Application.cpp
  2. +1
    -3
      tests/Circle.cpp
  3. +4
    -2
      tests/Color.cpp
  4. +34
    -28
      tests/Demo.cpp
  5. +3
    -2
      tests/FileBrowserDialog.cpp
  6. +1
    -3
      tests/Line.cpp
  7. +3
    -2
      tests/NanoImage.cpp
  8. +3
    -2
      tests/NanoSubWidgets.cpp
  9. +4
    -2
      tests/Point.cpp
  10. +1
    -3
      tests/Rectangle.cpp
  11. +1
    -3
      tests/Triangle.cpp
  12. +3
    -3
      tests/Window.cpp

+ 4
- 2
tests/Application.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -44,7 +44,9 @@ END_NAMESPACE_DGL


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


// regular usage // regular usage
{ {


+ 1
- 3
tests/Circle.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -20,8 +20,6 @@


int main() int main()
{ {
USE_NAMESPACE_DGL;

// TODO // TODO


return 0; return 0;


+ 4
- 2
tests/Color.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -17,13 +17,15 @@
#include "tests.hpp" #include "tests.hpp"


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


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


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


// constructor with no arguments, must give solid black // constructor with no arguments, must give solid black
{ {


+ 34
- 28
tests/Demo.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -66,11 +66,11 @@ typedef ExampleImagesWidget<StandaloneWindow, DemoImage> ExampleImagesStandalone
class LeftSideWidget : public SubWidget class LeftSideWidget : public SubWidget
{ {
public: public:
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
static const int kPageCount = 5; static const int kPageCount = 5;
#else
#else
static const int kPageCount = 4; static const int kPageCount = 4;
#endif
#endif


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


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


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


protected: protected:
@@ -143,7 +143,7 @@ protected:
img3.drawAt(context, pad, pad + 6 + iconSize*2); img3.drawAt(context, pad, pad + 6 + iconSize*2);
img4.drawAt(context, pad, pad + 9 + iconSize*3); img4.drawAt(context, pad, pad + 9 + iconSize*3);


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


// draw some text // draw some text
@@ -158,7 +158,7 @@ protected:
nvg.textBox(15 * scaleFactor, 440 * scaleFactor, iconSize, "Look!", nullptr); nvg.textBox(15 * scaleFactor, 440 * scaleFactor, iconSize, "Look!", nullptr);


nvg.endFrame(); nvg.endFrame();
#endif
#endif
} }


bool onMouse(const MouseEvent& ev) override bool onMouse(const MouseEvent& ev) override
@@ -245,10 +245,10 @@ private:
Line<int> lineSep; Line<int> lineSep;
DemoImage img1, img2, img3, img4, img5; DemoImage img1, img2, img3, img4, img5;


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


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


public: public:
#ifdef DGL_CAIRO
#if defined(DGL_CAIRO)
static constexpr const char* const kExampleWidgetName = "Demo - 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"; static constexpr const char* const kExampleWidgetName = "Demo - OpenGL";
#endif
#ifdef DGL_VULKAN
#elif defined(DGL_VULKAN)
static constexpr const char* const kExampleWidgetName = "Demo - Vulkan"; static constexpr const char* const kExampleWidgetName = "Demo - Vulkan";
#endif
#endif


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


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


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


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


@@ -401,8 +399,16 @@ END_NAMESPACE_DGL


int main(int argc, char* argv[]) 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; Application app;


@@ -416,10 +422,10 @@ int main(int argc, char* argv[])
createAndShowExampleWidgetStandaloneWindow<ExampleRectanglesStandaloneWindow>(app); createAndShowExampleWidgetStandaloneWindow<ExampleRectanglesStandaloneWindow>(app);
else if (std::strcmp(argv[1], "shapes") == 0) else if (std::strcmp(argv[1], "shapes") == 0)
createAndShowExampleWidgetStandaloneWindow<ExampleShapesStandaloneWindow>(app); createAndShowExampleWidgetStandaloneWindow<ExampleShapesStandaloneWindow>(app);
#ifdef DGL_OPENGL
#ifdef DGL_OPENGL
else if (std::strcmp(argv[1], "text") == 0) else if (std::strcmp(argv[1], "text") == 0)
createAndShowExampleWidgetStandaloneWindow<ExampleTextStandaloneWindow>(app); createAndShowExampleWidgetStandaloneWindow<ExampleTextStandaloneWindow>(app);
#endif
#endif
else else
d_stderr2("Invalid demo mode, must be one of: color, images, rectangles or shapes"); d_stderr2("Invalid demo mode, must be one of: color, images, rectangles or shapes");
} }


+ 3
- 2
tests/FileBrowserDialog.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -181,7 +181,8 @@ END_NAMESPACE_DGL


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


Application app(true); Application app(true);
NanoFilePicker win(app); NanoFilePicker win(app);


+ 1
- 3
tests/Line.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -20,8 +20,6 @@


int main() int main()
{ {
USE_NAMESPACE_DGL;

// TODO // TODO


return 0; return 0;


+ 3
- 2
tests/NanoImage.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -214,7 +214,8 @@ END_NAMESPACE_DGL


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


Application app(true); Application app(true);
NanoImageExample win(app); NanoImageExample win(app);


+ 3
- 2
tests/NanoSubWidgets.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -154,7 +154,8 @@ END_NAMESPACE_DGL


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


Application app; Application app;
NanoExampleWindow win(app); NanoExampleWindow win(app);


+ 4
- 2
tests/Point.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -17,6 +17,8 @@
#include "tests.hpp" #include "tests.hpp"


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


// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
@@ -24,7 +26,7 @@
template <typename T> template <typename T>
static int runTestsPerType() static int runTestsPerType()
{ {
USE_NAMESPACE_DGL;
using DGL_NAMESPACE::Point;


// basic usage // basic usage
{ {


+ 1
- 3
tests/Rectangle.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -20,8 +20,6 @@


int main() int main()
{ {
USE_NAMESPACE_DGL;

// TODO // TODO


return 0; return 0;


+ 1
- 3
tests/Triangle.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -20,8 +20,6 @@


int main() int main()
{ {
USE_NAMESPACE_DGL;

// TODO // TODO


return 0; return 0;


+ 3
- 3
tests/Window.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -29,8 +29,8 @@


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


// creating and destroying simple window // creating and destroying simple window


Loading…
Cancel
Save