morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::testing::detail::FakeSelect Class Referencefinal

A fake SelectWidget: properties style, options, selected, caption, captionShown. More...

#include <recording_backend.hpp>

Inheritance diagram for morph::ui::testing::detail::FakeSelect:
morph::ui::testing::detail::FakeField< SelectWidget > morph::ui::testing::detail::FakeLeaf< SelectWidget > morph::ui::SelectWidget morph::ui::FieldWidget morph::ui::Widget

Public Member Functions

void setOptions (std::vector< SelectOption > const &options) override
 Records property options, and re-marks the requested key against them.
void setSelected (std::optional< Key > const &key) override
 Requests the option with key, and records property selected as the option it marks.
void setOnSelect (std::function< void(Key)> onSelect) override
 Stores the handler RecordingBackend::choose calls.
void setOnOpen (Action onOpen) override
 Stores the handler RecordingBackend::open calls.
void setCaption (std::string_view label, bool shown) override
 Sets the field's label, and whether the input draws it as a visible caption above its control. Without shown, the caption is drawn elsewhere (a form's cell), or not at all.
bool offers (Key const &key) const
 Whether one of the current options has key.
void chooseByUser (Key const &key)
 Marks the option the user chose, as the requested key; nothing is logged.
Public Member Functions inherited from morph::ui::testing::detail::FakeField< SelectWidget >
void setReadOnly (bool readonly) override
 Records property readonly; RecordingBackend's edits leave a read-only field alone.
void setRequired (bool required) override
 Records property required.
void setErrors (std::vector< std::string > const &errors) override
 Records property errors, as formatList gives the messages.
void setStale (bool stale) override
 Records property stale.
Public Member Functions inherited from morph::ui::testing::detail::FakeLeaf< SelectWidget >
 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 & operator= (FakeLeaf const &)=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.
Public Member Functions inherited from morph::ui::Widget
 Widget (Widget const &)=delete
Widget & operator= (Widget const &)=delete
 Widget (Widget &&)=delete
Widget & operator= (Widget &&)=delete

Additional Inherited Members

Protected Member Functions inherited from morph::ui::testing::detail::FakeLeaf< SelectWidget >
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

A fake SelectWidget: properties style, options, selected, caption, captionShown.

selected shows the option the widget marks: the requested key while the options contain it, else none. The requested key is kept, so options that bring it back mark it again; that re-marking is the widget's own doing and is not logged.

Definition at line 972 of file recording_backend.hpp.

Member Function Documentation

◆ setOptions()

void morph::ui::testing::detail::FakeSelect::setOptions ( std::vector< SelectOption > const & options)
inlineoverridevirtual

Records property options, and re-marks the requested key against them.

Parameters
optionsThe options, in order.

Implements morph::ui::SelectWidget.

Definition at line 978 of file recording_backend.hpp.

◆ setSelected()

void morph::ui::testing::detail::FakeSelect::setSelected ( std::optional< Key > const & key)
inlineoverridevirtual

Requests the option with key, and records property selected as the option it marks.

Parameters
keyThe key, or nullopt for no selection.

Implements morph::ui::SelectWidget.

Definition at line 990 of file recording_backend.hpp.

◆ setOnSelect()

void morph::ui::testing::detail::FakeSelect::setOnSelect ( std::function< void(Key)> onSelect)
inlineoverridevirtual

Stores the handler RecordingBackend::choose calls.

Parameters
onSelectThe handler.

Implements morph::ui::SelectWidget.

Definition at line 997 of file recording_backend.hpp.

◆ setOnOpen()

void morph::ui::testing::detail::FakeSelect::setOnOpen ( Action onOpen)
inlineoverridevirtual

Stores the handler RecordingBackend::open calls.

Parameters
onOpenThe handler.

Reimplemented from morph::ui::SelectWidget.

Definition at line 1001 of file recording_backend.hpp.

◆ setCaption()

void morph::ui::testing::detail::FakeSelect::setCaption ( std::string_view label,
bool shown )
inlineoverridevirtual

Sets the field's label, and whether the input draws it as a visible caption above its control. Without shown, the caption is drawn elsewhere (a form's cell), or not at all.

Parameters
labelThe label, UTF-8.
shownWhether the input shows it.

Implements morph::ui::SelectWidget.

Definition at line 1002 of file recording_backend.hpp.

◆ offers()

bool morph::ui::testing::detail::FakeSelect::offers ( Key const & key) const
inlinenodiscard

Whether one of the current options has key.

Parameters
keyThe key.
Returns
True when an option has it.

Definition at line 1010 of file recording_backend.hpp.

◆ chooseByUser()

void morph::ui::testing::detail::FakeSelect::chooseByUser ( Key const & key)
inline

Marks the option the user chose, as the requested key; nothing is logged.

Parameters
keyThe key of one of the current options.

Definition at line 1016 of file recording_backend.hpp.


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