| 158 | } |
| 159 | |
| 160 | Expected<std::string> pressButton( const std::vector<std::string>& path ) |
| 161 | { |
| 162 | if ( path.empty() ) |
| 163 | return unexpected( "pressButton: Empty path not allowed here." ); |
| 164 | |
| 165 | auto groupEx = findGroup( { path.data(), path.size() - 1 } ); |
| 166 | if ( !groupEx ) |
| 167 | return unexpected( groupEx.error() ); |
| 168 | const auto& group = **groupEx; |
| 169 | |
| 170 | auto iter = group.elems.find( path.back() ); |
| 171 | if ( iter == group.elems.end() ) |
| 172 | return unexpected( fmt::format( "pressButton {}: no such entry: `{}`. Known entries are: {}.", pathToString( path ), path.back(), listKeys( group ) ) ); |
| 173 | |
| 174 | auto buttonEx = iter->second.getAs<TestEngine::ButtonEntry>( path.back() ); |
| 175 | if ( !buttonEx ) |
| 176 | return unexpected( buttonEx.error() ); |
| 177 | |
| 178 | const std::string_view disabledReason = ( *buttonEx )->disabledReason; |
| 179 | if ( !disabledReason.empty() ) |
| 180 | return composeStatus( disabledReason ); |
| 181 | |
| 182 | ( *buttonEx )->simulateClick = true; |
| 183 | |
| 184 | return {}; |
| 185 | } |
| 186 | |
| 187 | template <typename T> |
| 188 | Expected<Value<T>> readValue( const std::vector<std::string>& path ) |
no test coverage detected