From 2530d9e653a9bc0da3076539500e66d42d515a49 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Tue, 26 Dec 2023 11:37:41 -0800 Subject: [PATCH] Issue #171: Need a wxGauge --- CMakeLists.txt | 1 + LATEST_RELEASE_NOTES.md | 1 + docs/ProgrammersGuide.md | 37 ++++---- docs/src/docs/ProgrammersGuide.md | 37 ++++---- include/wxUI/Gauge.h | 112 +++++++++++++++++++++++ tests/BuildTests/CMakeLists.txt | 1 + tests/BuildTests/Gauge.cpp | 38 ++++++++ tests/CMakeLists.txt | 1 + tests/wxUI_GaugeTests.cpp | 147 ++++++++++++++++++++++++++++++ 9 files changed, 339 insertions(+), 36 deletions(-) create mode 100644 include/wxUI/Gauge.h create mode 100644 tests/BuildTests/Gauge.cpp create mode 100644 tests/wxUI_GaugeTests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ed763d..fd93dfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,7 @@ add_library( include/wxUI/ComboBox.h include/wxUI/Custom.h include/wxUI/ForEach.h + include/wxUI/Gauge.h include/wxUI/Generic.h include/wxUI/GetterSetter.h include/wxUI/HelperMacros.h diff --git a/LATEST_RELEASE_NOTES.md b/LATEST_RELEASE_NOTES.md index 2f47763..f292bc9 100644 --- a/LATEST_RELEASE_NOTES.md +++ b/LATEST_RELEASE_NOTES.md @@ -11,4 +11,5 @@ Other changes: * [#164](../../issues/164) Add ForEach, which would allow a list of Controllers to be added * [#166](../../issues/166) Special Functions for Splitter * [#167](../../issues/167) VSplitter and HSplitter proxy's are hard to use +* [#171](../../issues/171) Need a wxGauge diff --git a/docs/ProgrammersGuide.md b/docs/ProgrammersGuide.md index aa4f05f..e289151 100644 --- a/docs/ProgrammersGuide.md +++ b/docs/ProgrammersGuide.md @@ -330,24 +330,25 @@ ExtendedExample::Reset() { The "Controllers" currently supported by `wxUI`: -| wxUI | wxWidget | Default Event | Proxy | Proxy accessors value | -| :------------------- | :--------------------- | :----------------- | :------------------------ | :-------------- | -| `Bitmap` | `wxStaticBitmap` | n/a | `BitmapProxy` | n/a | -| `BitmapButton` | `wxBitmapButton` | `EVT_BUTTON` | `BitmapButtonProxy` | n/a | -| `BitmapComboBox` | `wxBitmapComboBox` | `EVT_COMBOBOX` | `BitmapComboBoxProxy` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | -| `BitmapToggleButton` | `wxBitmapToggleButton` | `EVT_TOGGLEBUTTON` | `BitmapToggleButtonProxy` | `value` -> `bool`
*default*: `value` | -| `Button` | `wxButton` | `EVT_BUTTON` | `ButtonProxy` | n/a | -| `CheckBox` | `wxCheckBox` | `EVT_CHECKBOX` | `CheckBoxProxy` | `value` -> `bool`
*default*: `value` | -| `Choice` | `wxChoice` | `EVT_CHOICE` | `ChoiceProxy` | `selection` -> `int`
*default*: `selection` | -| `ComboBox` | `wxComboBox` | `EVT_COMBOBOX` | `ComboBoxProxy` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | -| `Hypertext` | `wxHypertextCtrl` | n/a | `HypertextProxy` | n/a | -| `Line` | `wxStaticLine` | n/a | `LineProxy` | n/a | -| `ListBox` | `wxListBox` | `EVT_LISTBOX` | `ListBoxProxy` | `selection` -> `int`
*default*: `selection` | -| `RadioBox` | `wxRadioBox` | `EVT_RADIOBOX` | `RadioBoxProxy` | `selection` -> `int`
*default*: `selection` | -| `Slider` | `wxSlider` | `EVT_SLIDER` | `SliderProxy` | `value` -> `int`
*default*: `value` | -| `SpinCtrl` | `wxSpinCtrl` | `EVT_SPINCTRL` | `SpinCtrlProxy` | `value` -> `int`
*default*: `value` | -| `Text` | `wxStaticText` | n/a | `TextProxy` | `label` -> `std::string`
*default*: `label` | -| `TextCtrl` | `wxTextCtrl` | `EVT_TEXT` | `TextCtrlProxy` | `label` -> `std::string`
*default*: `label` | +| wxUI | wxWidget | Default Event | Proxy accessors value | +| :------------------- | :--------------------- | :----------------- | :-------------------- | +| `Bitmap` | `wxStaticBitmap` | n/a | n/a | +| `BitmapButton` | `wxBitmapButton` | `EVT_BUTTON` | n/a | +| `BitmapComboBox` | `wxBitmapComboBox` | `EVT_COMBOBOX` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | +| `BitmapToggleButton` | `wxBitmapToggleButton` | `EVT_TOGGLEBUTTON` | `value` -> `bool`
*default*: `value` | +| `Button` | `wxButton` | `EVT_BUTTON` | n/a | +| `CheckBox` | `wxCheckBox` | `EVT_CHECKBOX` | `value` -> `bool`
*default*: `value` | +| `Choice` | `wxChoice` | `EVT_CHOICE` | `selection` -> `int`
*default*: `selection` | +| `ComboBox` | `wxComboBox` | `EVT_COMBOBOX` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | +| `Gauge` | `wxGauge` | n/a | `range` -> `int`
`value` -> `int`
*default*: `value` | +| `Hypertext` | `wxHypertextCtrl` | n/a | n/a | +| `Line` | `wxStaticLine` | n/a | n/a | +| `ListBox` | `wxListBox` | `EVT_LISTBOX` | `selection` -> `int`
*default*: `selection` | +| `RadioBox` | `wxRadioBox` | `EVT_RADIOBOX` | `selection` -> `int`
*default*: `selection` | +| `Slider` | `wxSlider` | `EVT_SLIDER` | `value` -> `int`
*default*: `value` | +| `SpinCtrl` | `wxSpinCtrl` | `EVT_SPINCTRL` | `value` -> `int`
*default*: `value` | +| `Text` | `wxStaticText` | n/a | `label` -> `std::string`
*default*: `label` | +| `TextCtrl` | `wxTextCtrl` | `EVT_TEXT` | `label` -> `std::string`
*default*: `label` | Additional "Contollers" should be easy to add in future updates. diff --git a/docs/src/docs/ProgrammersGuide.md b/docs/src/docs/ProgrammersGuide.md index 8040880..c7dd2bd 100644 --- a/docs/src/docs/ProgrammersGuide.md +++ b/docs/src/docs/ProgrammersGuide.md @@ -195,24 +195,25 @@ ExtendedExample::Reset() { The "Controllers" currently supported by `wxUI`: -| wxUI | wxWidget | Default Event | Proxy | Proxy accessors value | -| :------------------- | :--------------------- | :----------------- | :------------------------ | :-------------- | -| `Bitmap` | `wxStaticBitmap` | n/a | `BitmapProxy` | n/a | -| `BitmapButton` | `wxBitmapButton` | `EVT_BUTTON` | `BitmapButtonProxy` | n/a | -| `BitmapComboBox` | `wxBitmapComboBox` | `EVT_COMBOBOX` | `BitmapComboBoxProxy` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | -| `BitmapToggleButton` | `wxBitmapToggleButton` | `EVT_TOGGLEBUTTON` | `BitmapToggleButtonProxy` | `value` -> `bool`
*default*: `value` | -| `Button` | `wxButton` | `EVT_BUTTON` | `ButtonProxy` | n/a | -| `CheckBox` | `wxCheckBox` | `EVT_CHECKBOX` | `CheckBoxProxy` | `value` -> `bool`
*default*: `value` | -| `Choice` | `wxChoice` | `EVT_CHOICE` | `ChoiceProxy` | `selection` -> `int`
*default*: `selection` | -| `ComboBox` | `wxComboBox` | `EVT_COMBOBOX` | `ComboBoxProxy` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | -| `Hypertext` | `wxHypertextCtrl` | n/a | `HypertextProxy` | n/a | -| `Line` | `wxStaticLine` | n/a | `LineProxy` | n/a | -| `ListBox` | `wxListBox` | `EVT_LISTBOX` | `ListBoxProxy` | `selection` -> `int`
*default*: `selection` | -| `RadioBox` | `wxRadioBox` | `EVT_RADIOBOX` | `RadioBoxProxy` | `selection` -> `int`
*default*: `selection` | -| `Slider` | `wxSlider` | `EVT_SLIDER` | `SliderProxy` | `value` -> `int`
*default*: `value` | -| `SpinCtrl` | `wxSpinCtrl` | `EVT_SPINCTRL` | `SpinCtrlProxy` | `value` -> `int`
*default*: `value` | -| `Text` | `wxStaticText` | n/a | `TextProxy` | `label` -> `std::string`
*default*: `label` | -| `TextCtrl` | `wxTextCtrl` | `EVT_TEXT` | `TextCtrlProxy` | `label` -> `std::string`
*default*: `label` | +| wxUI | wxWidget | Default Event | Proxy accessors value | +| :------------------- | :--------------------- | :----------------- | :-------------------- | +| `Bitmap` | `wxStaticBitmap` | n/a | n/a | +| `BitmapButton` | `wxBitmapButton` | `EVT_BUTTON` | n/a | +| `BitmapComboBox` | `wxBitmapComboBox` | `EVT_COMBOBOX` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | +| `BitmapToggleButton` | `wxBitmapToggleButton` | `EVT_TOGGLEBUTTON` | `value` -> `bool`
*default*: `value` | +| `Button` | `wxButton` | `EVT_BUTTON` | n/a | +| `CheckBox` | `wxCheckBox` | `EVT_CHECKBOX` | `value` -> `bool`
*default*: `value` | +| `Choice` | `wxChoice` | `EVT_CHOICE` | `selection` -> `int`
*default*: `selection` | +| `ComboBox` | `wxComboBox` | `EVT_COMBOBOX` | `selection` -> `int`
`value` -> `std::string`
*default*: `value` | +| `Gauge` | `wxGauge` | n/a | `range` -> `int`
`value` -> `int`
*default*: `value` | +| `Hypertext` | `wxHypertextCtrl` | n/a | n/a | +| `Line` | `wxStaticLine` | n/a | n/a | +| `ListBox` | `wxListBox` | `EVT_LISTBOX` | `selection` -> `int`
*default*: `selection` | +| `RadioBox` | `wxRadioBox` | `EVT_RADIOBOX` | `selection` -> `int`
*default*: `selection` | +| `Slider` | `wxSlider` | `EVT_SLIDER` | `value` -> `int`
*default*: `value` | +| `SpinCtrl` | `wxSpinCtrl` | `EVT_SPINCTRL` | `value` -> `int`
*default*: `value` | +| `Text` | `wxStaticText` | n/a | `label` -> `std::string`
*default*: `label` | +| `TextCtrl` | `wxTextCtrl` | `EVT_TEXT` | `label` -> `std::string`
*default*: `label` | Additional "Contollers" should be easy to add in future updates. diff --git a/include/wxUI/Gauge.h b/include/wxUI/Gauge.h new file mode 100644 index 0000000..6d9cffd --- /dev/null +++ b/include/wxUI/Gauge.h @@ -0,0 +1,112 @@ +/* +MIT License + +Copyright (c) 2022 Richard Powell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#pragma once + +#include "GetterSetter.h" +#include "Widget.h" +#include + +#include "HelperMacros.h" + +namespace wxUI { + +// https://docs.wxwidgets.org/latest/classwx_gauge.html +struct Gauge : public details::WidgetDetails { + using super = details::WidgetDetails; + + // clang-format off + struct withRange { }; + struct withIdentity { }; + // clang-format on + + explicit Gauge() + : Gauge(withIdentity {}, wxID_ANY, 100) + { + } + + explicit Gauge([[maybe_unused]] withRange unused, int range) + : Gauge(withIdentity {}, wxID_ANY, range) + { + } + + explicit Gauge([[maybe_unused]] withIdentity unused, wxWindowID identity, int range = 100) + : super(identity, super::WithStyle { wxGA_HORIZONTAL }) + , range(range) + { + } + + explicit Gauge(wxSizerFlags const& flags) + : Gauge(flags, withIdentity {}, wxID_ANY, 100) + { + } + + explicit Gauge(wxSizerFlags const& flags, [[maybe_unused]] withRange unused, int range) + : Gauge(flags, withIdentity {}, wxID_ANY, range) + { + } + + Gauge(wxSizerFlags const& flags, [[maybe_unused]] withIdentity unused, wxWindowID identity, int range = 100) + : super(flags, identity, super::WithStyle { wxGA_HORIZONTAL }) + , range(range) + { + } + + struct Proxy : details::WidgetProxy { + PROXY_BOILERPLATE(); + [[nodiscard]] auto value() const + { + auto* controller = control(); + return details::GetterSetter { + [controller] { return static_cast(controller->GetValue()); }, + [controller](int value) { controller->SetValue(value); } + }; + } + [[nodiscard]] auto range() const + { + auto* controller = control(); + return details::GetterSetter { + [controller] { return static_cast(controller->GetRange()); }, + [controller](int range) { controller->SetRange(range); } + }; + } + + auto operator*() const { return value(); } + }; + + RULE_OF_SIX_BOILERPLATE(Gauge); + +private: + int range; + + auto createImpl(wxWindow* parent) -> wxWindow* override + { + auto* widget = new underlying_t(parent, getIdentity(), range, getPos(), getSize(), getStyle()); + return setProxy(widget); + } +}; + +WIDGET_STATIC_ASSERT_BOILERPLATE(Gauge); +} + +#include "ZapMacros.h" diff --git a/tests/BuildTests/CMakeLists.txt b/tests/BuildTests/CMakeLists.txt index 19f6dfd..769975a 100644 --- a/tests/BuildTests/CMakeLists.txt +++ b/tests/BuildTests/CMakeLists.txt @@ -12,6 +12,7 @@ target_sources(wxUI_Tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ComboBox.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Custom.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ForEach.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Gauge.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Generic.cpp ${CMAKE_CURRENT_SOURCE_DIR}/GetterSetter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/HelperMacros.cpp diff --git a/tests/BuildTests/Gauge.cpp b/tests/BuildTests/Gauge.cpp new file mode 100644 index 0000000..cbcbacb --- /dev/null +++ b/tests/BuildTests/Gauge.cpp @@ -0,0 +1,38 @@ +/* +MIT License + +Copyright (c) 2022 Richard Powell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +// Generated with bash command +// for i in *.cpp; do echo \#include \ > Layout.cpp; for j in RULE_OF_SIX_BOILERPLATE PROXY_BOILERPLATE WIDGET_STATIC_ASSERT_BOILERPLATE; do echo \#if defined\(WIDGET_STATIC_ASSERT_BOILERPLATE\) >> Layout.cpp; echo \#error Missed zapping WIDGET_STATIC_ASSERT_BOILERPLATE >> Layout.cpp; echo \#endif >> Layout.cpp; done; done +#include + +#if defined(RULE_OF_SIX_BOILERPLATE) +#error Missed zapping RULE_OF_SIX_BOILERPLATE +#endif + +#if defined(PROXY_BOILERPLATE) +#error Missed zapping PROXY_BOILERPLATE +#endif + +#if defined(WIDGET_STATIC_ASSERT_BOILERPLATE) +#error Missed zapping WIDGET_STATIC_ASSERT_BOILERPLATE +#endif diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e3b718f..f4d7c57 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,6 +10,7 @@ add_executable(wxUI_Tests ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_ChoiceTests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_ComboBoxTests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_ForEachTests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_GaugeTests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_GenericTests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_GetterSetterTests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wxUI_HSplitterTests.cpp diff --git a/tests/wxUI_GaugeTests.cpp b/tests/wxUI_GaugeTests.cpp new file mode 100644 index 0000000..26ef1c9 --- /dev/null +++ b/tests/wxUI_GaugeTests.cpp @@ -0,0 +1,147 @@ +/* +MIT License + +Copyright (c) 2022 Richard Powell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#include "wxUI_TestControlCommon.h" +#include +#include + +#include + +// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers, readability-function-cognitive-complexity, misc-use-anonymous-namespace, cppcoreguidelines-avoid-do-while) +using TypeUnderTest = wxUI::Gauge; + +struct GaugeTestPolicy { + using TypeUnderTest = TypeUnderTest; + static auto createUUT() { return TypeUnderTest {}; } + static auto testStyle() { return wxGA_VERTICAL; } + static auto testPosition() { return wxPoint { 1, 2 }; } + static auto testSize() { return wxSize { 10, 12 }; } + static auto expectedStyle() { return testStyle(); } + static auto expectedPosition() { return testPosition(); } + static auto expectedSize() { return testSize(); } +}; +static auto createUUT() { return GaugeTestPolicy::createUUT(); } + +TEST_CASE("Gauge") +{ + SECTION("noargs") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = createUUT(); + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(window->GetRange() == 100); + } + + SECTION("name") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxUI::Gauge::withRange {}, 200 }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(window->GetRange() == 200); + } + + SECTION("id") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxUI::Gauge::withIdentity {}, 10000 }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(10000 == window->GetId()); + CHECK(window->GetRange() == 100); + } + + SECTION("id.name") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxUI::Gauge::withIdentity {}, 10000, 200 }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(10000 == window->GetId()); + CHECK(window->GetRange() == 200); + } + + SECTION("size") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxSizerFlags(1) }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(window->GetRange() == 100); + } + + SECTION("size.name") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxSizerFlags(1), wxUI::Gauge::withRange {}, 200 }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(window->GetRange() == 200); + } + + SECTION("size.id") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxSizerFlags(1), wxUI::Gauge::withIdentity {}, 10000 }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(10000 == window->GetId()); + CHECK(window->GetRange() == 100); + } + + SECTION("size.id.name") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = TypeUnderTest { wxSizerFlags(1), wxUI::Gauge::withIdentity {}, 10000, 200 }; + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(10000 == window->GetId()); + CHECK(window->GetRange() == 200); + } + + SECTION("style") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = createUUT().withStyle(wxST_ELLIPSIZE_MIDDLE); + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(window->GetWindowStyle() == wxST_ELLIPSIZE_MIDDLE); + } + + SECTION("pos") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto uut = createUUT().withPosition({ 1, 2 }); + auto* window = dynamic_cast(uut.create(&frame)); + CHECK(window->GetRange() == 100); + } + + SECTION("proxy.bind") + { + wxFrame frame { nullptr, wxID_ANY, "" }; + auto proxy = TypeUnderTest::Proxy {}; + auto uut = proxy.bind(TypeUnderTest {}.withSize({ 1, 2 })); + uut.create(&frame); + CHECK(static_cast(*proxy) == 0); + *proxy = 30; + CHECK(static_cast(*proxy) == 30); + CHECK(static_cast(proxy.range()) == 100); + proxy.range() = 200; + CHECK(static_cast(proxy.range()) == 200); + } + + COMMON_TESTS(GaugeTestPolicy) +} +// NOLINTEND(cppcoreguidelines-avoid-magic-numbers, readability-magic-numbers, readability-function-cognitive-complexity, misc-use-anonymous-namespace, cppcoreguidelines-avoid-do-while)