MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / testFindNextAndWrap

Function testFindNextAndWrap

tests/help_dialog_test.cpp:76–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76void testFindNextAndWrap()
77{
78 QTemporaryFile file;
79 const bool wrote = writeTempHelp(file);
80 report("temp help document created", wrote);
81 if (!wrote)
82 return;
83
84 HelpDialog dialog("Search Test", file.fileName());
85 HelpWidgets widgets = findWidgets(dialog);
86 if (!requireWidgets(widgets))
87 return;
88
89 widgets.edit->setText("target");
90 report("find button enables with query", widgets.button->isEnabled());
91
92 widgets.button->click();
93 const QTextCursor firstCursor = widgets.browser->textCursor();
94 const int firstStart = firstCursor.selectionStart();
95 report("first find selects match", selectedTextEquals(widgets.browser, "target"));
96
97 widgets.button->click();
98 const QTextCursor secondCursor = widgets.browser->textCursor();
99 const int secondStart = secondCursor.selectionStart();
100 report("find next advances", selectedTextEquals(widgets.browser, "target") && secondStart > firstStart,
101 "first=" + std::to_string(firstStart) + " second=" + std::to_string(secondStart));
102
103 widgets.button->click();
104 const QTextCursor wrapCursor = widgets.browser->textCursor();
105 report("find next wraps to first match",
106 selectedTextEquals(widgets.browser, "target") && wrapCursor.selectionStart() == firstStart);
107 report("wrap status is shown", widgets.status->text() == "Wrapped to top",
108 widgets.status->text().toStdString());
109}
110
111void testNoMatchClearsSelectionAndRecovers()
112{

Callers 1

mainFunction · 0.85

Calls 7

writeTempHelpFunction · 0.85
findWidgetsFunction · 0.85
requireWidgetsFunction · 0.85
selectedTextEqualsFunction · 0.85
reportFunction · 0.70
isEnabledMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected