morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
backend_conformance.hpp File Reference

The scripted cases every IViewBackend must pass, and the probe a backend author implements to run them. More...

#include <algorithm>
#include <array>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <utility>
#include <variant>
#include <vector>
#include "../../reactive/runtime.hpp"
#include "../../reactive/signal.hpp"
#include "../../util/datetime.hpp"
#include "../backend.hpp"
#include "../mount.hpp"
#include "../view.hpp"

Go to the source code of this file.

Classes

struct  morph::ui::testing::WidgetBounds
 Where a widget is drawn, in its backend's own units (a cell on the terminal; Theme.unitWidth and Theme.unitHeight on Qt Quick), from the top left of the window or screen. More...
class  morph::ui::testing::ConformanceProbe
 How the conformance cases read and drive one backend under test. More...
struct  morph::ui::testing::ConformanceCase
 One scripted case. More...
class  morph::ui::testing::detail::Checks
 Collects a case's checks and keeps the first failure, so a case reads top to bottom. More...
struct  morph::ui::testing::detail::Entry
 A row of the ForEach and Table cases. More...
struct  morph::ui::testing::detail::HandlerLife
 What LifeSentinel reports about the handler that holds it. More...
class  morph::ui::testing::detail::LifeSentinel
 Captured by value in a handler, tells whether the backend destroyed the handler while it ran. More...
class  morph::ui::testing::detail::Geometry
 Reads where the layout cases' widgets are drawn, and fails a case whose probe reads no geometry. More...
struct  morph::ui::testing::detail::Measured
 The container a case measures, the one child of the mounted root, and its children in order. More...

Functions

Node morph::ui::testing::detail::entryList (reactive::Signal< std::vector< Entry > > const &rows, int *builds=nullptr)
 A ForEach of Texts, one per entry, keyed by id.
Node morph::ui::testing::detail::entryTable (reactive::Signal< std::vector< Entry > > const &rows, TableOptions options)
 A one-column Table of entries, keyed by id, whose cell is a Text of the label.
ContainerWidget const * morph::ui::testing::detail::asContainer (Widget const &widget)
 A widget as a container.
ContainerWidget const & morph::ui::testing::detail::rootContainer (Mounted const &view)
 The root widget of a mounted container node, as the container it is.
Widget * morph::ui::testing::detail::childOf (ConformanceProbe &probe, Widget const *parent, std::size_t index)
 A child of a widget that should be a container.
std::string morph::ui::testing::detail::childTexts (ConformanceProbe &probe, ContainerWidget const &container)
 The texts of a container's children, joined by commas.
std::string morph::ui::testing::detail::selectedTexts (ConformanceProbe &probe, Widget const &table)
 The texts of the rows an entryTable shows as selected, joined by commas.
std::string morph::ui::testing::detail::keyTexts (std::vector< Key > const &keys)
 Keys as text, for a failure message.
std::optional< std::string > morph::ui::testing::detail::textShowsItsText (ConformanceProbe &probe)
 Case: a constant Text shows its text.
std::optional< std::string > morph::ui::testing::detail::boundTextUpdatesOncePerChange (ConformanceProbe &probe)
 Case: a bound Text follows its signal, once per batch, and not for an equal write.
std::optional< std::string > morph::ui::testing::detail::visibleAndEnabledFollowBindings (ConformanceProbe &probe)
 Case: visible and enabled follow their bindings.
std::optional< std::string > morph::ui::testing::detail::clickReachesAction (ConformanceProbe &probe)
 Case: a click runs the button's action once, and what it wrote reaches the screen.
std::optional< std::string > morph::ui::testing::detail::typingWithoutEcho (ConformanceProbe &probe)
 Case: typing reaches onChange; a value set by the application is shown and not reported back.
std::optional< std::string > morph::ui::testing::detail::switchShowsSelectedCase (ConformanceProbe &probe)
 Case: a Switch shows the selected case, nothing for a key without one, and remounts on a change.
std::optional< std::string > morph::ui::testing::detail::tabsMountPagesLazily (ConformanceProbe &probe)
 Case: Tabs mount a page on its first selection, keep it, and show only the selected one.
std::optional< std::string > morph::ui::testing::detail::forEachUpdatesInPlace (ConformanceProbe &probe)
 Case: a ForEach updates a row whose key stays in place, keeping its widget and not building its view again.
std::optional< std::string > morph::ui::testing::detail::forEachInsertsRemovesReorders (ConformanceProbe &probe)
 Case: a ForEach follows inserts, removals and reorders.
std::optional< std::string > morph::ui::testing::detail::movedRowKeepsNativeState (ConformanceProbe &probe)
 Case: a widget moved among its siblings keeps its native state; here, the text a user typed into a field.
std::optional< std::string > morph::ui::testing::detail::dialogHoldsContentWhileOpen (ConformanceProbe &probe)
 Case: a Dialog holds its content only while it is open.
std::optional< std::string > morph::ui::testing::detail::closedDialogTakesNoInput (ConformanceProbe &probe)
 Case: a new dialog is closed, and a closed dialog takes no input, neither a dismissal nor a click on a child; an open one takes both.
std::optional< std::string > morph::ui::testing::detail::unreachableWidgetsTakeNoInput (ConformanceProbe &probe)
 Case: a widget inside a hidden, disabled or collapsed container takes no input — no click, edit, drag or row selection — and takes it again once the container is shown, enabled and expanded.
std::optional< std::string > morph::ui::testing::detail::unchangedTextKeepsCursor (ConformanceProbe &probe)
 Case: a setter given the text a field already shows changes nothing; in particular the cursor stays.
std::optional< std::string > morph::ui::testing::detail::textInputIsControlled (ConformanceProbe &probe)
 Case: an edit the document refuses snaps back, and one it transforms shows the transform.
std::optional< std::string > morph::ui::testing::detail::refusedDismissalKeepsDialogOpen (ConformanceProbe &probe)
 Case: a dialog the user dismisses but the document keeps open is shown again, with its content.
std::optional< std::string > morph::ui::testing::detail::settersCallNoHandler (ConformanceProbe &probe)
 Case: no setter calls a handler. Setting a value, replacing options, items or rows, requesting a selection, opening or closing — none of it is a user's doing, so none of it reaches onChange, onToggle, onSelect, onSelectionChange and the like.
std::optional< std::string > morph::ui::testing::detail::selectReResolvesRequestedKey (ConformanceProbe &probe)
 Case: a Select marks the requested key whenever its options contain it, whichever arrives first, and remembers the request across options that lack it.
std::optional< std::string > morph::ui::testing::detail::tableReportsExistingSelectedRows (ConformanceProbe &probe)
 Case: a Table in Multiple mode reports a user's change as exactly the existing rows now selected.
std::optional< std::string > morph::ui::testing::detail::tableShowsUnboundUserSelection (ConformanceProbe &probe)
 Case: a Table shows the user's selection even when the application binds no selection.
std::optional< std::string > morph::ui::testing::detail::hiddenCellKeepsItsColumn (ConformanceProbe &probe)
 Case: a hidden Table cell keeps its column: it stays in its row, so the cells after it keep their places.
std::optional< std::string > morph::ui::testing::detail::noHandlerAfterDestruction (ConformanceProbe &probe)
 Case: no handler runs after its widget's destructor returned, even for input that arrived before.
std::optional< std::string > morph::ui::testing::detail::handlerMayDestroyItsWidget (ConformanceProbe &probe)
 Case: a handler may destroy its own widget; the backend keeps the running handler alive until it returns, and stays usable after.
std::vector< Key > morph::ui::testing::detail::dropOntoPanel (ConformanceProbe &probe, std::function< bool(Key const &)> accepts)
 Drags a card carrying key 7 onto a panel built with accepts, and returns what the panel received.
std::optional< std::string > morph::ui::testing::detail::dragOntoAcceptingTarget (ConformanceProbe &probe)
 Case: a drag onto a target that accepts the key delivers it once.
std::optional< std::string > morph::ui::testing::detail::dragOntoRefusingTarget (ConformanceProbe &probe)
 Case: a drag onto a target that refuses the key delivers nothing.
std::optional< std::string > morph::ui::testing::detail::dropTargetWithoutAcceptsTakesAll (ConformanceProbe &probe)
 Case: a drop target without accepts takes every key.
std::optional< std::string > morph::ui::testing::detail::innermostChordWins (ConformanceProbe &probe)
 Case: a chord goes to the innermost widget that declares it, and one only an outer widget declares reaches that widget.
std::optional< std::string > morph::ui::testing::detail::hiddenChordRunsNothing (ConformanceProbe &probe)
 Case: a chord pressed inside a container hidden two levels up runs nothing; while shown it runs once.
std::optional< std::string > morph::ui::testing::detail::firstAutofocusWins (ConformanceProbe &probe)
 Case: the first autofocus widget in document order has focus once the mount completes.
std::optional< std::string > morph::ui::testing::detail::onlyEnabledMenuLeavesAreChosen (ConformanceProbe &probe)
 Case: a menu reports only an enabled entry without a submenu, and an entry enabled later can be chosen.
std::optional< std::string > morph::ui::testing::detail::readOnlyInputTakesNoEdit (ConformanceProbe &probe)
 Case: typing into a read-only input reaches no handler; once editable again, it does.
std::optional< std::string > morph::ui::testing::detail::dismissedBannerStays (ConformanceProbe &probe)
 Case: dismissing a dismissible banner reaches onDismiss once, and the banner stays shown.
std::optional< std::string > morph::ui::testing::detail::closedCollapsibleKeepsItsHeader (ConformanceProbe &probe)
 Case: a closed collapsible section's content takes no click and its header does; the user's opening reaches onToggle, and once the application opens it the content takes clicks.
std::optional< std::string > morph::ui::testing::detail::dropZoneTakesWholeDrops (ConformanceProbe &probe)
 Case: a drop zone takes a drop of one accepted file, compared without case, and refuses a file it does not accept and several files when it takes one.
Node morph::ui::testing::detail::sizedText (std::string text, LayoutHints layout)
 A text that sizes as layout says.
Node morph::ui::testing::detail::insideColumn (Node inner)
 inner inside a column, so it is sized as a child is: a root fills the window or screen whatever its own sizing.
Node morph::ui::testing::detail::insideRow (Node inner)
 inner inside a row, so its height is sized as a child's is.
Measured morph::ui::testing::detail::measured (ConformanceProbe &probe, Mounted const &view)
 The container a case measures, inside the root insideColumn or insideRow made.
std::optional< std::string > morph::ui::testing::detail::maximumCapsStretchShare (ConformanceProbe &probe)
 Case: along a row, a stretch child's share stops at its maximum and its stretch sibling takes the rest.
std::optional< std::string > morph::ui::testing::detail::minimumWidensContent (ConformanceProbe &probe)
 Case: along a row, a content child is at least its minimum wide.
std::optional< std::string > morph::ui::testing::detail::maximumCapsAcross (ConformanceProbe &probe)
 Case: across a column, a stretch child stops at its maximum, at the start.
std::optional< std::string > morph::ui::testing::detail::maximumCapsStretchHeight (ConformanceProbe &probe)
 Case: down a column, a stretch child's height stops at its maximum and its stretch sibling takes the rest.
std::optional< std::string > morph::ui::testing::detail::rowCentresAcross (ConformanceProbe &probe)
 Case: a row 3 units tall with align: center places a 1-unit text a unit down.
std::optional< std::string > morph::ui::testing::detail::columnJustifies (ConformanceProbe &probe)
 Case: a column with justify: end places its last child's end at its own end, and between its first child at the start and its last at the end.
std::optional< std::string > morph::ui::testing::detail::cappedChildCentres (ConformanceProbe &probe)
 Case: a child capped below its column's width with alignSelf: center has equal space either side; a stretch child with maxWidth: 44 in a 70-unit column with align: center is 44 wide and centred.
std::span< ConformanceCase const > morph::ui::testing::layoutConformanceCases ()
 The layout cases: where a backend that lays widgets out draws them. Run each on a fresh probe whose boundsOf reads geometry; a probe that reads none fails every one.
std::span< ConformanceCase const > morph::ui::testing::conformanceCases ()
 Every conformance case, in a fixed order.

Detailed Description

The scripted cases every IViewBackend must pass, and the probe a backend author implements to run them.

Specified in docs/spec/ui/backend_contract.md, "The conformance suite".

Definition in file backend_conformance.hpp.

Function Documentation

◆ entryList()

Node morph::ui::testing::detail::entryList ( reactive::Signal< std::vector< Entry > > const & rows,
int * builds = nullptr )
inlinenodiscard

A ForEach of Texts, one per entry, keyed by id.

Parameters
rowsThe entries; must outlive the node's mounts.
buildsCounts the row views built, when not null; must outlive the node's mounts.
Returns
The node.

Definition at line 244 of file backend_conformance.hpp.

◆ entryTable()

Node morph::ui::testing::detail::entryTable ( reactive::Signal< std::vector< Entry > > const & rows,
TableOptions options )
inlinenodiscard

A one-column Table of entries, keyed by id, whose cell is a Text of the label.

Parameters
rowsThe entries; must outlive the node's mounts.
optionsSelection, activation and Common.
Returns
The node.

Definition at line 259 of file backend_conformance.hpp.

◆ asContainer()

ContainerWidget const * morph::ui::testing::detail::asContainer ( Widget const & widget)
inlinenodiscard

A widget as a container.

Parameters
widgetThe widget.
Returns
It, or null when it is not a ContainerWidget.

Definition at line 271 of file backend_conformance.hpp.

◆ rootContainer()

ContainerWidget const & morph::ui::testing::detail::rootContainer ( Mounted const & view)
inlinenodiscard

The root widget of a mounted container node, as the container it is.

The root of a mounted Switch, Tabs, Column, ForEach or Dialog is the widget the backend's createSlot, createTabs, createStack or createDialog returned, and each of those is a ContainerWidget by its declared type, so the downcast cannot fail for any backend that compiles.

Parameters
viewThe mount, of a container node.
Returns
The root widget as a container.

Definition at line 282 of file backend_conformance.hpp.

◆ childOf()

Widget * morph::ui::testing::detail::childOf ( ConformanceProbe & probe,
Widget const * parent,
std::size_t index )
inlinenodiscard

A child of a widget that should be a container.

Parameters
probeThe backend under test.
parentThe widget; null, or a widget that is no container, has no children.
indexThe position.
Returns
The child, or null.

Definition at line 292 of file backend_conformance.hpp.

◆ childTexts()

std::string morph::ui::testing::detail::childTexts ( ConformanceProbe & probe,
ContainerWidget const & container )
inlinenodiscard

The texts of a container's children, joined by commas.

Parameters
probeThe backend under test.
containerThe container.
Returns
For example a,b,c; a missing child reads <null>.

Definition at line 301 of file backend_conformance.hpp.

◆ selectedTexts()

std::string morph::ui::testing::detail::selectedTexts ( ConformanceProbe & probe,
Widget const & table )
inlinenodiscard

The texts of the rows an entryTable shows as selected, joined by commas.

Parameters
probeThe backend under test.
tableThe table.
Returns
For example a,c; a row without a first cell reads <null>.

Definition at line 317 of file backend_conformance.hpp.

◆ keyTexts()

std::string morph::ui::testing::detail::keyTexts ( std::vector< Key > const & keys)
inlinenodiscard

Keys as text, for a failure message.

Parameters
keysThe keys.
Returns
For example 1,"b".

Definition at line 332 of file backend_conformance.hpp.

◆ textShowsItsText()

std::optional< std::string > morph::ui::testing::detail::textShowsItsText ( ConformanceProbe & probe)
inlinenodiscard

Case: a constant Text shows its text.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 350 of file backend_conformance.hpp.

◆ boundTextUpdatesOncePerChange()

std::optional< std::string > morph::ui::testing::detail::boundTextUpdatesOncePerChange ( ConformanceProbe & probe)
inlinenodiscard

Case: a bound Text follows its signal, once per batch, and not for an equal write.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 361 of file backend_conformance.hpp.

◆ visibleAndEnabledFollowBindings()

std::optional< std::string > morph::ui::testing::detail::visibleAndEnabledFollowBindings ( ConformanceProbe & probe)
inlinenodiscard

Case: visible and enabled follow their bindings.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 388 of file backend_conformance.hpp.

◆ clickReachesAction()

std::optional< std::string > morph::ui::testing::detail::clickReachesAction ( ConformanceProbe & probe)
inlinenodiscard

Case: a click runs the button's action once, and what it wrote reaches the screen.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 408 of file backend_conformance.hpp.

◆ typingWithoutEcho()

std::optional< std::string > morph::ui::testing::detail::typingWithoutEcho ( ConformanceProbe & probe)
inlinenodiscard

Case: typing reaches onChange; a value set by the application is shown and not reported back.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 425 of file backend_conformance.hpp.

◆ switchShowsSelectedCase()

std::optional< std::string > morph::ui::testing::detail::switchShowsSelectedCase ( ConformanceProbe & probe)
inlinenodiscard

Case: a Switch shows the selected case, nothing for a key without one, and remounts on a change.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 453 of file backend_conformance.hpp.

◆ tabsMountPagesLazily()

std::optional< std::string > morph::ui::testing::detail::tabsMountPagesLazily ( ConformanceProbe & probe)
inlinenodiscard

Case: Tabs mount a page on its first selection, keep it, and show only the selected one.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 478 of file backend_conformance.hpp.

◆ forEachUpdatesInPlace()

std::optional< std::string > morph::ui::testing::detail::forEachUpdatesInPlace ( ConformanceProbe & probe)
inlinenodiscard

Case: a ForEach updates a row whose key stays in place, keeping its widget and not building its view again.

The build count is the deciding check: a widget address alone cannot tell a kept widget from a new one that the allocator placed where the old one was.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 512 of file backend_conformance.hpp.

◆ forEachInsertsRemovesReorders()

std::optional< std::string > morph::ui::testing::detail::forEachInsertsRemovesReorders ( ConformanceProbe & probe)
inlinenodiscard

Case: a ForEach follows inserts, removals and reorders.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 532 of file backend_conformance.hpp.

◆ movedRowKeepsNativeState()

std::optional< std::string > morph::ui::testing::detail::movedRowKeepsNativeState ( ConformanceProbe & probe)
inlinenodiscard

Case: a widget moved among its siblings keeps its native state; here, the text a user typed into a field.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 552 of file backend_conformance.hpp.

◆ dialogHoldsContentWhileOpen()

std::optional< std::string > morph::ui::testing::detail::dialogHoldsContentWhileOpen ( ConformanceProbe & probe)
inlinenodiscard

Case: a Dialog holds its content only while it is open.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 583 of file backend_conformance.hpp.

◆ closedDialogTakesNoInput()

std::optional< std::string > morph::ui::testing::detail::closedDialogTakesNoInput ( ConformanceProbe & probe)
inlinenodiscard

Case: a new dialog is closed, and a closed dialog takes no input, neither a dismissal nor a click on a child; an open one takes both.

Built through the backend directly: a mount opens or closes every dialog it makes, and mounts a dialog's content only while it is open, so neither a new dialog nor a closed one with children can be reached through it.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 609 of file backend_conformance.hpp.

◆ unreachableWidgetsTakeNoInput()

std::optional< std::string > morph::ui::testing::detail::unreachableWidgetsTakeNoInput ( ConformanceProbe & probe)
inlinenodiscard

Case: a widget inside a hidden, disabled or collapsed container takes no input — no click, edit, drag or row selection — and takes it again once the container is shown, enabled and expanded.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 649 of file backend_conformance.hpp.

◆ unchangedTextKeepsCursor()

std::optional< std::string > morph::ui::testing::detail::unchangedTextKeepsCursor ( ConformanceProbe & probe)
inlinenodiscard

Case: a setter given the text a field already shows changes nothing; in particular the cursor stays.

Built through the backend directly, so the setter is called with the shown text on purpose: a mount sends no such call for an accepted edit, but a re-assertion of a transformed one, or another renderer, may.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 735 of file backend_conformance.hpp.

◆ textInputIsControlled()

std::optional< std::string > morph::ui::testing::detail::textInputIsControlled ( ConformanceProbe & probe)
inlinenodiscard

Case: an edit the document refuses snaps back, and one it transforms shows the transform.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 755 of file backend_conformance.hpp.

◆ refusedDismissalKeepsDialogOpen()

std::optional< std::string > morph::ui::testing::detail::refusedDismissalKeepsDialogOpen ( ConformanceProbe & probe)
inlinenodiscard

Case: a dialog the user dismisses but the document keeps open is shown again, with its content.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 788 of file backend_conformance.hpp.

◆ settersCallNoHandler()

std::optional< std::string > morph::ui::testing::detail::settersCallNoHandler ( ConformanceProbe & probe)
inlinenodiscard

Case: no setter calls a handler. Setting a value, replacing options, items or rows, requesting a selection, opening or closing — none of it is a user's doing, so none of it reaches onChange, onToggle, onSelect, onSelectionChange and the like.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 819 of file backend_conformance.hpp.

◆ selectReResolvesRequestedKey()

std::optional< std::string > morph::ui::testing::detail::selectReResolvesRequestedKey ( ConformanceProbe & probe)
inlinenodiscard

Case: a Select marks the requested key whenever its options contain it, whichever arrives first, and remembers the request across options that lack it.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 904 of file backend_conformance.hpp.

◆ tableReportsExistingSelectedRows()

std::optional< std::string > morph::ui::testing::detail::tableReportsExistingSelectedRows ( ConformanceProbe & probe)
inlinenodiscard

Case: a Table in Multiple mode reports a user's change as exactly the existing rows now selected.

A requested key without a row stays requested through row changes and is marked when its row arrives, and a row that goes is unmarked, all without a handler call; a user's change drops the requested keys without a row.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 940 of file backend_conformance.hpp.

◆ tableShowsUnboundUserSelection()

std::optional< std::string > morph::ui::testing::detail::tableShowsUnboundUserSelection ( ConformanceProbe & probe)
inlinenodiscard

Case: a Table shows the user's selection even when the application binds no selection.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 999 of file backend_conformance.hpp.

◆ hiddenCellKeepsItsColumn()

std::optional< std::string > morph::ui::testing::detail::hiddenCellKeepsItsColumn ( ConformanceProbe & probe)
inlinenodiscard

Case: a hidden Table cell keeps its column: it stays in its row, so the cells after it keep their places.

This checks the row's structure only; that the cells after it are drawn under their own headers is the backend's own test to make.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1024 of file backend_conformance.hpp.

◆ noHandlerAfterDestruction()

std::optional< std::string > morph::ui::testing::detail::noHandlerAfterDestruction ( ConformanceProbe & probe)
inlinenodiscard

Case: no handler runs after its widget's destructor returned, even for input that arrived before.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1050 of file backend_conformance.hpp.

◆ handlerMayDestroyItsWidget()

std::optional< std::string > morph::ui::testing::detail::handlerMayDestroyItsWidget ( ConformanceProbe & probe)
inlinenodiscard

Case: a handler may destroy its own widget; the backend keeps the running handler alive until it returns, and stays usable after.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1113 of file backend_conformance.hpp.

◆ dropOntoPanel()

std::vector< Key > morph::ui::testing::detail::dropOntoPanel ( ConformanceProbe & probe,
std::function< bool(Key const &)> accepts )
inlinenodiscard

Drags a card carrying key 7 onto a panel built with accepts, and returns what the panel received.

Parameters
probeThe backend under test.
acceptsThe panel's predicate; empty leaves Common::accepts unset.
Returns
The keys the panel's onDrop received.

Definition at line 1148 of file backend_conformance.hpp.

◆ dragOntoAcceptingTarget()

std::optional< std::string > morph::ui::testing::detail::dragOntoAcceptingTarget ( ConformanceProbe & probe)
inlinenodiscard

Case: a drag onto a target that accepts the key delivers it once.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1166 of file backend_conformance.hpp.

◆ dragOntoRefusingTarget()

std::optional< std::string > morph::ui::testing::detail::dragOntoRefusingTarget ( ConformanceProbe & probe)
inlinenodiscard

Case: a drag onto a target that refuses the key delivers nothing.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1177 of file backend_conformance.hpp.

◆ dropTargetWithoutAcceptsTakesAll()

std::optional< std::string > morph::ui::testing::detail::dropTargetWithoutAcceptsTakesAll ( ConformanceProbe & probe)
inlinenodiscard

Case: a drop target without accepts takes every key.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1187 of file backend_conformance.hpp.

◆ innermostChordWins()

std::optional< std::string > morph::ui::testing::detail::innermostChordWins ( ConformanceProbe & probe)
inlinenodiscard

Case: a chord goes to the innermost widget that declares it, and one only an outer widget declares reaches that widget.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1198 of file backend_conformance.hpp.

◆ hiddenChordRunsNothing()

std::optional< std::string > morph::ui::testing::detail::hiddenChordRunsNothing ( ConformanceProbe & probe)
inlinenodiscard

Case: a chord pressed inside a container hidden two levels up runs nothing; while shown it runs once.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1229 of file backend_conformance.hpp.

◆ firstAutofocusWins()

std::optional< std::string > morph::ui::testing::detail::firstAutofocusWins ( ConformanceProbe & probe)
inlinenodiscard

Case: the first autofocus widget in document order has focus once the mount completes.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1259 of file backend_conformance.hpp.

◆ onlyEnabledMenuLeavesAreChosen()

std::optional< std::string > morph::ui::testing::detail::onlyEnabledMenuLeavesAreChosen ( ConformanceProbe & probe)
inlinenodiscard

Case: a menu reports only an enabled entry without a submenu, and an entry enabled later can be chosen.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1279 of file backend_conformance.hpp.

◆ readOnlyInputTakesNoEdit()

std::optional< std::string > morph::ui::testing::detail::readOnlyInputTakesNoEdit ( ConformanceProbe & probe)
inlinenodiscard

Case: typing into a read-only input reaches no handler; once editable again, it does.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1311 of file backend_conformance.hpp.

◆ dismissedBannerStays()

std::optional< std::string > morph::ui::testing::detail::dismissedBannerStays ( ConformanceProbe & probe)
inlinenodiscard

Case: dismissing a dismissible banner reaches onDismiss once, and the banner stays shown.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1337 of file backend_conformance.hpp.

◆ closedCollapsibleKeepsItsHeader()

std::optional< std::string > morph::ui::testing::detail::closedCollapsibleKeepsItsHeader ( ConformanceProbe & probe)
inlinenodiscard

Case: a closed collapsible section's content takes no click and its header does; the user's opening reaches onToggle, and once the application opens it the content takes clicks.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1355 of file backend_conformance.hpp.

◆ dropZoneTakesWholeDrops()

std::optional< std::string > morph::ui::testing::detail::dropZoneTakesWholeDrops ( ConformanceProbe & probe)
inlinenodiscard

Case: a drop zone takes a drop of one accepted file, compared without case, and refuses a file it does not accept and several files when it takes one.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1390 of file backend_conformance.hpp.

◆ sizedText()

Node morph::ui::testing::detail::sizedText ( std::string text,
LayoutHints layout )
inlinenodiscard

A text that sizes as layout says.

Parameters
textThe text.
layoutIts size request.
Returns
The node.

Definition at line 1444 of file backend_conformance.hpp.

◆ insideColumn()

Node morph::ui::testing::detail::insideColumn ( Node inner)
inlinenodiscard

inner inside a column, so it is sized as a child is: a root fills the window or screen whatever its own sizing.

Parameters
innerThe container a case measures.
Returns
The column.

Definition at line 1454 of file backend_conformance.hpp.

◆ insideRow()

Node morph::ui::testing::detail::insideRow ( Node inner)
inlinenodiscard

inner inside a row, so its height is sized as a child's is.

Parameters
innerThe container a case measures.
Returns
The row.

Definition at line 1459 of file backend_conformance.hpp.

◆ measured()

Measured morph::ui::testing::detail::measured ( ConformanceProbe & probe,
Mounted const & view )
inlinenodiscard

The container a case measures, inside the root insideColumn or insideRow made.

Parameters
probeThe backend under test.
viewThe mount.
Returns
It and its children.

Definition at line 1473 of file backend_conformance.hpp.

◆ maximumCapsStretchShare()

std::optional< std::string > morph::ui::testing::detail::maximumCapsStretchShare ( ConformanceProbe & probe)
inlinenodiscard

Case: along a row, a stretch child's share stops at its maximum and its stretch sibling takes the rest.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1486 of file backend_conformance.hpp.

◆ minimumWidensContent()

std::optional< std::string > morph::ui::testing::detail::minimumWidensContent ( ConformanceProbe & probe)
inlinenodiscard

Case: along a row, a content child is at least its minimum wide.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1506 of file backend_conformance.hpp.

◆ maximumCapsAcross()

std::optional< std::string > morph::ui::testing::detail::maximumCapsAcross ( ConformanceProbe & probe)
inlinenodiscard

Case: across a column, a stretch child stops at its maximum, at the start.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1524 of file backend_conformance.hpp.

◆ maximumCapsStretchHeight()

std::optional< std::string > morph::ui::testing::detail::maximumCapsStretchHeight ( ConformanceProbe & probe)
inlinenodiscard

Case: down a column, a stretch child's height stops at its maximum and its stretch sibling takes the rest.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1548 of file backend_conformance.hpp.

◆ rowCentresAcross()

std::optional< std::string > morph::ui::testing::detail::rowCentresAcross ( ConformanceProbe & probe)
inlinenodiscard

Case: a row 3 units tall with align: center places a 1-unit text a unit down.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1568 of file backend_conformance.hpp.

◆ columnJustifies()

std::optional< std::string > morph::ui::testing::detail::columnJustifies ( ConformanceProbe & probe)
inlinenodiscard

Case: a column with justify: end places its last child's end at its own end, and between its first child at the start and its last at the end.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1590 of file backend_conformance.hpp.

◆ cappedChildCentres()

std::optional< std::string > morph::ui::testing::detail::cappedChildCentres ( ConformanceProbe & probe)
inlinenodiscard

Case: a child capped below its column's width with alignSelf: center has equal space either side; a stretch child with maxWidth: 44 in a 70-unit column with align: center is 44 wide and centred.

Parameters
probeThe backend under test.
Returns
nullopt, or what went wrong.

Definition at line 1621 of file backend_conformance.hpp.

◆ layoutConformanceCases()

std::span< ConformanceCase const > morph::ui::testing::layoutConformanceCases ( )
inlinenodiscard

The layout cases: where a backend that lays widgets out draws them. Run each on a fresh probe whose boundsOf reads geometry; a probe that reads none fails every one.

Returns
The cases.

Definition at line 1656 of file backend_conformance.hpp.

◆ conformanceCases()

std::span< ConformanceCase const > morph::ui::testing::conformanceCases ( )
inlinenodiscard

Every conformance case, in a fixed order.

Run each on a fresh probe; nullopt is a pass, anything else is the failure message. A backend's test suite loops over these with its own ConformanceProbe.

Returns
The cases.

Definition at line 1676 of file backend_conformance.hpp.