|
| 1 | +/* |
| 2 | + ============================================================================== |
| 3 | +
|
| 4 | + This file is part of the YUP library. |
| 5 | + Copyright (c) 2026 - kunitoki@gmail.com |
| 6 | +
|
| 7 | + YUP is an open source library subject to open-source licensing. |
| 8 | +
|
| 9 | + The code included in this file is provided under the terms of the ISC license |
| 10 | + http://www.isc.org/downloads/software-support-policy/isc-license. Permission |
| 11 | + to use, copy, modify, and/or distribute this software for any purpose with or |
| 12 | + without fee is hereby granted provided that the above copyright notice and |
| 13 | + this permission notice appear in all copies. |
| 14 | +
|
| 15 | + YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER |
| 16 | + EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE |
| 17 | + DISCLAIMED. |
| 18 | +
|
| 19 | + ============================================================================== |
| 20 | +*/ |
| 21 | + |
| 22 | +#include <yup_audio_gui/yup_audio_gui.h> |
| 23 | + |
| 24 | +#include <gtest/gtest.h> |
| 25 | + |
| 26 | +using namespace yup; |
| 27 | + |
| 28 | +namespace yup |
| 29 | +{ |
| 30 | +extern std::unique_ptr<yup::GraphicsContext> yup_constructHeadlessGraphicsContext (yup::GraphicsContext::Options); |
| 31 | +} // namespace yup |
| 32 | + |
| 33 | +TEST (ThemeVersion1Tests, PaintsCoreComponents) |
| 34 | +{ |
| 35 | + auto context = yup_constructHeadlessGraphicsContext ({}); |
| 36 | + auto renderer = context->makeRenderer (800, 600); |
| 37 | + Graphics g (*context, *renderer); |
| 38 | + |
| 39 | + Slider slider (Slider::LinearHorizontal); |
| 40 | + slider.setRange (0.0, 1.0); |
| 41 | + slider.setValue (0.25); |
| 42 | + slider.setBounds (20.0f, 20.0f, 240.0f, 40.0f); |
| 43 | + slider.paint (g); |
| 44 | + |
| 45 | + TextButton textButton; |
| 46 | + textButton.setBounds (20.0f, 80.0f, 140.0f, 40.0f); |
| 47 | + textButton.paint (g); |
| 48 | + |
| 49 | + ToggleButton toggleButton; |
| 50 | + toggleButton.setToggleState (true, NotificationType::dontSendNotification); |
| 51 | + toggleButton.setBounds (20.0f, 140.0f, 160.0f, 40.0f); |
| 52 | + toggleButton.paint (g); |
| 53 | + |
| 54 | + SwitchButton switchButton; |
| 55 | + switchButton.setToggleState (true, NotificationType::dontSendNotification); |
| 56 | + switchButton.setBounds (20.0f, 200.0f, 120.0f, 40.0f); |
| 57 | + switchButton.paint (g); |
| 58 | + |
| 59 | + TextEditor textEditor; |
| 60 | + textEditor.setText ("Theme", NotificationType::dontSendNotification); |
| 61 | + textEditor.setBounds (20.0f, 260.0f, 240.0f, 40.0f); |
| 62 | + textEditor.paint (g); |
| 63 | + |
| 64 | + ComboBox comboBox; |
| 65 | + comboBox.addItem ("Item 1", 1); |
| 66 | + comboBox.setSelectedId (1, NotificationType::dontSendNotification); |
| 67 | + comboBox.setBounds (20.0f, 320.0f, 200.0f, 40.0f); |
| 68 | + comboBox.paint (g); |
| 69 | + |
| 70 | + Label label; |
| 71 | + label.setText ("Label", NotificationType::dontSendNotification); |
| 72 | + label.setBounds (20.0f, 380.0f, 200.0f, 30.0f); |
| 73 | + label.paint (g); |
| 74 | + |
| 75 | + ScrollBar scrollBar (ScrollBar::Orientation::horizontal); |
| 76 | + scrollBar.setRangeLimits (0.0, 100.0); |
| 77 | + scrollBar.setCurrentRange (20.0, 40.0); |
| 78 | + scrollBar.setBounds (20.0f, 430.0f, 240.0f, 18.0f); |
| 79 | + scrollBar.paint (g); |
| 80 | + |
| 81 | + ProgressBar progressBar; |
| 82 | + progressBar.setProgress (0.5, NotificationType::dontSendNotification); |
| 83 | + progressBar.setBounds (20.0f, 470.0f, 240.0f, 20.0f); |
| 84 | + progressBar.paint (g); |
| 85 | + |
| 86 | + KMeterState meterState (48000.0, 2); |
| 87 | + KMeterComponent meter (meterState, 0); |
| 88 | + meter.setBounds (300.0f, 20.0f, 60.0f, 240.0f); |
| 89 | + meter.paint (g); |
| 90 | + |
| 91 | + EXPECT_TRUE (true); |
| 92 | +} |
0 commit comments