MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / pressButton

Function pressButton

source/MRViewer/MRUITestEngineControl.cpp:160–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160Expected<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
187template <typename T>
188Expected<Value<T>> readValue( const std::vector<std::string>& path )

Callers 2

mcpToolPressButtonFunction · 0.85

Calls 11

findGroupFunction · 0.85
pathToStringFunction · 0.85
listKeysFunction · 0.85
composeStatusFunction · 0.85
errorMethod · 0.80
unexpectedFunction · 0.50
emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected