morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::testing::detail::FakeLeaf< Interface > Class Template Reference

The Widget half of every fake: records itself on construction, records Common's setters, and records its destruction. More...

#include <recording_backend.hpp>

Inheritance diagram for morph::ui::testing::detail::FakeLeaf< Interface >:
morph::ui::testing::detail::FakeContainer< Interface > morph::ui::testing::detail::FakeField< Interface > morph::ui::testing::detail::FakeOverlay< Interface >

Public Member Functions

 FakeLeaf (std::shared_ptr< RecordStore > store, std::string kind, ContainerWidget const *parent, PropList initial={})
 Records the new widget, appended to parent, and logs its creation.
 ~FakeLeaf () override
 Forgets the widget and logs its destruction; its remaining children become roots.
 FakeLeaf (FakeLeaf const &)=delete
FakeLeaf & operator= (FakeLeaf const &)=delete
 FakeLeaf (FakeLeaf &&)=delete
FakeLeaf & operator= (FakeLeaf &&)=delete
void setVisible (bool visible) override
 Records property visible.
void setEnabled (bool enabled) override
 Records property enabled.
void setLayout (LayoutHints const &hints) override
 Records property layout, as formatLayout gives it.
void setDragKey (std::optional< Key > const &key) override
 Records property dragKey and keeps the key for RecordingBackend::drag.
void setDropHandler (std::function< bool(Key const &)> accepts, std::function< void(Key)> onDrop) override
 Records property drop=handler and keeps both handlers for RecordingBackend::drag.
void setAccessibleName (std::string_view name) override
 Records property a11yName.
void setAccessibleRole (std::string_view role) override
 Records property a11yRole.
void setTestId (std::string_view testId) override
 Records property testId.
void setTooltip (std::string_view text) override
 Records property tooltip.
void setSurface (std::string_view surface) override
 Records property surface.
void setKeys (std::vector< std::string > const &chords, std::function< void(std::string)> onChord) override
 Records property keys, the chords joined by commas, and keeps the chords and the handler for RecordingBackend::press.
void focus () override
 Moves the backend's recorded focus here, and logs focus.
void setOnHover (std::function< void()> onHover) override
 Keeps the handler for RecordingBackend::hover.

Protected Member Functions

void set (std::string_view name, std::string value)
 Records a property set through a setter.
Callbacks & callbacks ()
 This widget's handlers.
RecordStore & store () const noexcept
 The store this widget records into.
std::shared_ptr< RecordStore > const & sharedStore () const noexcept
 The store, shared: what a part this widget makes (an overlay's footer) records into.
int id () const noexcept
 This widget's id.

Detailed Description

template<typename Interface>
class morph::ui::testing::detail::FakeLeaf< Interface >

The Widget half of every fake: records itself on construction, records Common's setters, and records its destruction.

Template Parameters
InterfaceThe widget interface the fake implements.

Definition at line 710 of file recording_backend.hpp.

Constructor & Destructor Documentation

◆ FakeLeaf()

template<typename Interface>
morph::ui::testing::detail::FakeLeaf< Interface >::FakeLeaf ( std::shared_ptr< RecordStore > store,
std::string kind,
ContainerWidget const * parent,
PropList initial = {} )
inline

Records the new widget, appended to parent, and logs its creation.

Parameters
storeWhere the widget records itself.
kindThe kind shown in the log and the dump.
parentThe container it is appended to, or null for a root.
initialProperties fixed at creation.

Definition at line 717 of file recording_backend.hpp.

◆ ~FakeLeaf()

template<typename Interface>
morph::ui::testing::detail::FakeLeaf< Interface >::~FakeLeaf ( )
inlineoverride

Forgets the widget and logs its destruction; its remaining children become roots.

Definition at line 722 of file recording_backend.hpp.

Member Function Documentation

◆ setVisible()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setVisible ( bool visible)
inlineoverride

Records property visible.

Parameters
visibleWhether it is shown.

Definition at line 737 of file recording_backend.hpp.

◆ setEnabled()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setEnabled ( bool enabled)
inlineoverride

Records property enabled.

Parameters
enabledWhether it accepts input.

Definition at line 741 of file recording_backend.hpp.

◆ setLayout()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setLayout ( LayoutHints const & hints)
inlineoverride

Records property layout, as formatLayout gives it.

Parameters
hintsThe request in both dimensions.

Definition at line 745 of file recording_backend.hpp.

◆ setDragKey()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setDragKey ( std::optional< Key > const & key)
inlineoverride

Records property dragKey and keeps the key for RecordingBackend::drag.

Parameters
keyEngaged: the key a drop delivers. nullopt: not draggable.

Definition at line 749 of file recording_backend.hpp.

◆ setDropHandler()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setDropHandler ( std::function< bool(Key const &)> accepts,
std::function< void(Key)> onDrop )
inlineoverride

Records property drop=handler and keeps both handlers for RecordingBackend::drag.

Parameters
acceptsWhether a dragged key may be dropped here.
onDropCalled with the key on a drop that accepts allowed.

Definition at line 757 of file recording_backend.hpp.

◆ setAccessibleName()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setAccessibleName ( std::string_view name)
inlineoverride

Records property a11yName.

Parameters
nameThe accessible name.

Definition at line 766 of file recording_backend.hpp.

◆ setAccessibleRole()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setAccessibleRole ( std::string_view role)
inlineoverride

Records property a11yRole.

Parameters
roleThe role.

Definition at line 770 of file recording_backend.hpp.

◆ setTestId()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setTestId ( std::string_view testId)
inlineoverride

Records property testId.

Parameters
testIdThe identifier.

Definition at line 774 of file recording_backend.hpp.

◆ setTooltip()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setTooltip ( std::string_view text)
inlineoverride

Records property tooltip.

Parameters
textThe tooltip.

Definition at line 778 of file recording_backend.hpp.

◆ setSurface()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setSurface ( std::string_view surface)
inlineoverride

Records property surface.

Parameters
surfaceThe surface's name.

Definition at line 782 of file recording_backend.hpp.

◆ setKeys()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setKeys ( std::vector< std::string > const & chords,
std::function< void(std::string)> onChord )
inlineoverride

Records property keys, the chords joined by commas, and keeps the chords and the handler for RecordingBackend::press.

Parameters
chordsThe chords.
onChordCalled with the chord that was pressed.

Definition at line 788 of file recording_backend.hpp.

◆ focus()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::focus ( )
inlineoverride

Moves the backend's recorded focus here, and logs focus.

Definition at line 801 of file recording_backend.hpp.

◆ setOnHover()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::setOnHover ( std::function< void()> onHover)
inlineoverride

Keeps the handler for RecordingBackend::hover.

Parameters
onHoverThe handler.

Definition at line 805 of file recording_backend.hpp.

◆ set()

template<typename Interface>
void morph::ui::testing::detail::FakeLeaf< Interface >::set ( std::string_view name,
std::string value )
inlineprotected

Records a property set through a setter.

Parameters
nameThe property.
valueIts formatted value.

Definition at line 811 of file recording_backend.hpp.

◆ callbacks()

template<typename Interface>
Callbacks & morph::ui::testing::detail::FakeLeaf< Interface >::callbacks ( )
inlinenodiscardprotected

This widget's handlers.

Returns
The handlers, for a setter to store into.

Definition at line 815 of file recording_backend.hpp.

◆ store()

template<typename Interface>
RecordStore & morph::ui::testing::detail::FakeLeaf< Interface >::store ( ) const
inlinenodiscardprotectednoexcept

The store this widget records into.

Returns
The store.

Definition at line 819 of file recording_backend.hpp.

◆ sharedStore()

template<typename Interface>
std::shared_ptr< RecordStore > const & morph::ui::testing::detail::FakeLeaf< Interface >::sharedStore ( ) const
inlinenodiscardprotectednoexcept

The store, shared: what a part this widget makes (an overlay's footer) records into.

Returns
The store.

Definition at line 823 of file recording_backend.hpp.

◆ id()

template<typename Interface>
int morph::ui::testing::detail::FakeLeaf< Interface >::id ( ) const
inlinenodiscardprotectednoexcept

This widget's id.

Returns
The id.

Definition at line 827 of file recording_backend.hpp.


The documentation for this class was generated from the following file: