综合平台编程器项目的远程存储
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

575 lignes
24 KiB

  1. #include "domain/active_register_repository.h"
  2. #include "domain/project_storage.h"
  3. #include "domain/register_repository.h"
  4. #include "services/hmi_editor_service.h"
  5. #include "services/hmi_runtime_service.h"
  6. #include "services/logic_editor_service.h"
  7. #include "services/offline_simulation_service.h"
  8. #include "services/project_service.h"
  9. #include "services/runtime_mode_service.h"
  10. #include "services/register_monitor_service.h"
  11. #include "ui/hmi_editor_widget.h"
  12. #include "ui/free_monitor_widget.h"
  13. #include "ui/logic_editor_widget.h"
  14. #include "ui/main_window.h"
  15. #include "ui/plc_connection_dialog.h"
  16. #include <QAction>
  17. #include <QApplication>
  18. #include <QComboBox>
  19. #include <QDialog>
  20. #include <QDockWidget>
  21. #include <QGraphicsItem>
  22. #include <QGraphicsScene>
  23. #include <QLabel>
  24. #include <QLineEdit>
  25. #include <QListWidget>
  26. #include <QSpinBox>
  27. #include <QPushButton>
  28. #include <QTableWidget>
  29. #include <QTimer>
  30. #include <iostream>
  31. #include <stdexcept>
  32. #include <string>
  33. namespace {
  34. class TestProjectStorage final : public ProjectStorage
  35. {
  36. public:
  37. // 主窗口测试使用无副作用存储实现,隔离文件对 UI 行为的影响
  38. ProjectSaveResult save(const Project &, const std::string &) override
  39. {
  40. return {true, ProjectStorageError::None, {}};
  41. }
  42. ProjectLoadResult load(const std::string &) override
  43. {
  44. return {false, {}, ProjectStorageError::FileReadFailed, {}};
  45. }
  46. };
  47. class RepeatedStatusGateway final : public PlcCommunicationGateway
  48. {
  49. public:
  50. PlcCommunicationResult connectDevice(
  51. const PlcSerialConfiguration &) override
  52. {
  53. connection_state = PlcConnectionState::Connecting;
  54. notifyStateChanged();
  55. connection_state = PlcConnectionState::Connected;
  56. notifyStateChanged();
  57. notifyStateChanged();
  58. return {true, {}};
  59. }
  60. void disconnectDevice() override
  61. {
  62. connection_state = PlcConnectionState::Disconnected;
  63. notifyStateChanged();
  64. }
  65. void setPollAddresses(const std::vector<RegisterAddress> &) override {}
  66. PlcConnectionState state() const override { return connection_state; }
  67. bool initialReadCompleted() const override { return false; }
  68. const std::string &lastError() const override { return last_error; }
  69. void setCallbacks(
  70. std::function<void()> state_callback,
  71. std::function<void(bool)> initial_callback,
  72. std::function<void()> cache_callback,
  73. std::function<void(const std::string &)> error_callback) override
  74. {
  75. state_changed = std::move(state_callback);
  76. initial_read_changed = std::move(initial_callback);
  77. cache_updated = std::move(cache_callback);
  78. error_reported = std::move(error_callback);
  79. }
  80. private:
  81. void notifyStateChanged()
  82. {
  83. if (state_changed)
  84. {
  85. state_changed();
  86. }
  87. }
  88. PlcConnectionState connection_state = PlcConnectionState::Disconnected;
  89. std::string last_error;
  90. std::function<void()> state_changed;
  91. std::function<void(bool)> initial_read_changed;
  92. std::function<void()> cache_updated;
  93. std::function<void(const std::string &)> error_reported;
  94. };
  95. class OnlineReadyGateway final : public PlcCommunicationGateway
  96. {
  97. public:
  98. PlcCommunicationResult connectDevice(const PlcSerialConfiguration &) override
  99. {
  100. connection_state = PlcConnectionState::Connected;
  101. if (state_changed)
  102. {
  103. state_changed();
  104. }
  105. return {true, {}};
  106. }
  107. void disconnectDevice() override
  108. {
  109. connection_state = PlcConnectionState::Disconnected;
  110. }
  111. void setPollAddresses(const std::vector<RegisterAddress> &addresses) override
  112. {
  113. poll_addresses = addresses;
  114. }
  115. PlcConnectionState state() const override { return connection_state; }
  116. bool initialReadCompleted() const override { return initial_read; }
  117. const std::string &lastError() const override { return last_error; }
  118. void setCallbacks(
  119. std::function<void()> state_callback,
  120. std::function<void(bool)> initial_callback,
  121. std::function<void()> cache_callback,
  122. std::function<void(const std::string &)> error_callback) override
  123. {
  124. state_changed = std::move(state_callback);
  125. initial_read_changed = std::move(initial_callback);
  126. cache_updated = std::move(cache_callback);
  127. error_reported = std::move(error_callback);
  128. }
  129. void completeInitialRead()
  130. {
  131. initial_read = true;
  132. if (initial_read_changed)
  133. {
  134. initial_read_changed(true);
  135. }
  136. }
  137. PlcConnectionState connection_state = PlcConnectionState::Disconnected;
  138. bool initial_read = false;
  139. std::string last_error;
  140. std::vector<RegisterAddress> poll_addresses;
  141. std::function<void()> state_changed;
  142. std::function<void(bool)> initial_read_changed;
  143. std::function<void()> cache_updated;
  144. std::function<void(const std::string &)> error_reported;
  145. };
  146. void require(bool condition, const std::string &message)
  147. {
  148. if (!condition)
  149. {
  150. throw std::runtime_error(message);
  151. }
  152. }
  153. template<typename ObjectType>
  154. ObjectType *requiredChild(MainWindow &window, const char *name)
  155. {
  156. // 通过 objectName 取得 Designer 组件,缺失时给出明确测试失败信息
  157. ObjectType *child = window.findChild<ObjectType *>(QString::fromLatin1(name));
  158. require(child != nullptr, std::string("missing UI object ") + name);
  159. return child;
  160. }
  161. void testModeActionsControlEditingAvailability()
  162. {
  163. // 验证模式动作会同步禁用编辑入口,并在失败时恢复当前选择
  164. TestProjectStorage storage;
  165. ProjectService project_service(storage);
  166. HmiEditorService editor_service(project_service);
  167. LogicEditorService logic_editor_service(project_service);
  168. VirtualRegisterRepository repository;
  169. HmiRuntimeService runtime_service(repository);
  170. OfflineSimulationService simulation_service(repository);
  171. RuntimeModeService mode_service(project_service, simulation_service);
  172. RegisterMonitorService monitor_service(repository);
  173. MainWindow window(
  174. mode_service,
  175. project_service,
  176. editor_service,
  177. logic_editor_service,
  178. runtime_service,
  179. monitor_service);
  180. window.resize(1000, 640);
  181. window.show();
  182. QApplication::processEvents();
  183. require(window.findChild<QWidget *>(QStringLiteral("dataPointDock")) == nullptr,
  184. "the removed data point dock must not remain in the main window");
  185. require(window.findChild<QWidget *>(QStringLiteral("hmiDataPointComboBox")) == nullptr
  186. && window.findChild<QWidget *>(QStringLiteral("logicDataPointComboBox")) == nullptr,
  187. "HMI and ladder properties must use direct M/D address inputs");
  188. QAction *editing_action = requiredChild<QAction>(window, "editingModeAction");
  189. QAction *offline_action = requiredChild<QAction>(window, "offlineModeAction");
  190. QAction *online_action = requiredChild<QAction>(window, "onlineModeAction");
  191. QAction *add_button_action = requiredChild<QAction>(window, "addButtonAction");
  192. QAction *add_indicator_action = requiredChild<QAction>(window, "addIndicatorAction");
  193. QAction *delete_control_action = requiredChild<QAction>(window, "deleteControlAction");
  194. QAction *add_normally_open_action = requiredChild<QAction>(
  195. window, "addNormallyOpenAction");
  196. QAction *add_normal_coil_action = requiredChild<QAction>(
  197. window, "addNormalCoilAction");
  198. QAction *parallel_insert_action = requiredChild<QAction>(
  199. window, "parallelInsertAction");
  200. QDockWidget *project_dock = requiredChild<QDockWidget>(window, "projectDock");
  201. QDockWidget *properties_dock = requiredChild<QDockWidget>(window, "propertiesDock");
  202. QLabel *selection = requiredChild<QLabel>(window, "selectionValueLabel");
  203. QLineEdit *text_edit = requiredChild<QLineEdit>(window, "controlTextEdit");
  204. HmiEditorWidget *hmi_editor = requiredChild<HmiEditorWidget>(
  205. window, "hmiEditorWidget");
  206. QLabel *executor_status = requiredChild<QLabel>(window, "executorStatusLabel");
  207. QWidget *runtime_tab = requiredChild<QWidget>(window, "runtimeMonitorTab");
  208. QWidget *runtime_hmi = requiredChild<QWidget>(window, "runtimeHmiView");
  209. QWidget *runtime_logic = requiredChild<QWidget>(window, "runtimeLogicView");
  210. QWidget *free_monitor = requiredChild<QWidget>(window, "freeMonitorWidget");
  211. require(!runtime_tab->isVisible(),
  212. "runtime monitor workspace must be hidden while editing");
  213. const qreal compact_scale = hmi_editor->transform().m11();
  214. window.resize(1600, 900);
  215. QApplication::processEvents();
  216. require(hmi_editor->transform().m11() > compact_scale,
  217. "HMI page must refit when the window becomes larger");
  218. require(editing_action->isChecked(), "editing action must be selected initially");
  219. require(project_dock->isEnabled(), "project dock must be enabled while editing");
  220. require(properties_dock->isEnabled(), "properties dock must be enabled while editing");
  221. add_button_action->trigger();
  222. const std::string page_id = editor_service.firstPageId();
  223. require(editor_service.findPage(page_id)->controls.size() == 1,
  224. "adding a control must update the HMI page model");
  225. require(selection->text() == QStringLiteral("button-1(未绑定)"),
  226. "an unbound added control must be marked in the property panel");
  227. require(text_edit->text() == QStringLiteral("按钮"),
  228. "property panel must show the control text");
  229. const QList<QGraphicsItem *> unbound_items = hmi_editor->scene()->selectedItems();
  230. require(unbound_items.size() == 1 && unbound_items.front()->boundingRect().top() == 0,
  231. "an unbound HMI control must not reserve an address label area");
  232. HmiControl bound_button = *editor_service.findControl(page_id, "button-1");
  233. bound_button.binding = RegisterAddress{RegisterArea::M, 0};
  234. require(editor_service.updateControl(page_id, bound_button.id, bound_button).succeeded,
  235. "binding an HMI button to M0 must succeed");
  236. hmi_editor->reloadPage();
  237. hmi_editor->selectControl(bound_button.id);
  238. const QList<QGraphicsItem *> bound_items = hmi_editor->scene()->selectedItems();
  239. require(bound_items.size() == 1 && bound_items.front()->boundingRect().top() < 0,
  240. "a bound HMI control must include its address label above the control body");
  241. delete_control_action->trigger();
  242. require(editor_service.findPage(page_id)->controls.empty(),
  243. "deleting a selected control must update the HMI page model");
  244. add_indicator_action->trigger();
  245. HmiControl runtime_indicator = *editor_service.findControl(page_id, "indicator-1");
  246. runtime_indicator.binding = RegisterAddress{RegisterArea::M, 3};
  247. require(editor_service.updateControl(
  248. page_id, runtime_indicator.id, runtime_indicator).succeeded,
  249. "a configured HMI control must be available for the runtime projection");
  250. hmi_editor->reloadPage();
  251. add_normally_open_action->trigger();
  252. parallel_insert_action->trigger();
  253. add_normal_coil_action->trigger();
  254. const ControlLogic *logic = logic_editor_service.findLogic(
  255. logic_editor_service.firstLogicId());
  256. require(logic != nullptr && logic->rungs.size() == 1,
  257. "logic actions must edit the default ladder rung");
  258. require(logic->rungs.front().condition.has_value()
  259. && logic->rungs.front().condition->kind
  260. == ConditionExpressionKind::Parallel
  261. && logic->rungs.front().condition->children.size() == 2U,
  262. "parallel branch action must create a parallel expression");
  263. require(logic->rungs.front().output.has_value(),
  264. "coil action must set the fixed ladder output");
  265. offline_action->trigger();
  266. require(mode_service.mode() == ApplicationMode::Editing,
  267. "unconfigured ladder nodes must block offline running");
  268. const LadderRung &rung = logic->rungs.front();
  269. std::vector<const LogicNode *> condition_nodes;
  270. collectConditionNodes(*rung.condition, &condition_nodes);
  271. for (const LogicNode *node : condition_nodes)
  272. {
  273. require(logic_editor_service.updateNodeConfig(
  274. logic_editor_service.firstLogicId(),
  275. node->id,
  276. ContactNodeConfig{
  277. RegisterAddress{RegisterArea::M, 0},
  278. ContactMode::NormallyOpen})
  279. .succeeded,
  280. "applying a contact configuration must complete the ladder node");
  281. }
  282. require(logic_editor_service.updateNodeConfig(
  283. logic_editor_service.firstLogicId(),
  284. rung.output->id,
  285. CoilNodeConfig{
  286. RegisterAddress{RegisterArea::M, 1},
  287. CoilMode::Normal})
  288. .succeeded,
  289. "applying a coil configuration must complete the ladder node");
  290. offline_action->trigger();
  291. require(mode_service.mode() == ApplicationMode::OfflineRunning,
  292. "offline action must enter offline running");
  293. require(simulation_service.state() == SimulationState::Running,
  294. "offline action must start the actual simulation service");
  295. require(executor_status->text().contains(QStringLiteral("运行")),
  296. "executor status label must report the actual running state");
  297. require(!project_dock->isEnabled(),
  298. "project dock must be disabled while running");
  299. require(!properties_dock->isEnabled(),
  300. "properties dock must be disabled while running");
  301. require(!add_button_action->isEnabled(),
  302. "HMI add controls must be disabled while running");
  303. require(!add_normally_open_action->isEnabled(),
  304. "logic add nodes must be disabled while running");
  305. require(runtime_tab->isVisible() && runtime_hmi->isVisible()
  306. && runtime_logic->isVisible() && free_monitor->isVisible(),
  307. "offline running must show HMI, ladder trace and free monitor together");
  308. auto *runtime_hmi_view = qobject_cast<HmiEditorWidget *>(runtime_hmi);
  309. require(runtime_hmi_view != nullptr
  310. && runtime_hmi_view->scene()->items().size() == 2,
  311. "offline runtime HMI must project the configured page control");
  312. QLineEdit *monitor_address = requiredChild<QLineEdit>(window, "addressEdit");
  313. QPushButton *monitor_add = requiredChild<QPushButton>(window, "addButton");
  314. QTableWidget *monitor_table = requiredChild<QTableWidget>(window, "monitorTable");
  315. monitor_address->setText(QStringLiteral("M0"));
  316. monitor_add->click();
  317. repository.writeBit({RegisterArea::M, 0}, true);
  318. auto *monitor_widget = requiredChild<FreeMonitorWidget>(window, "freeMonitorWidget");
  319. monitor_widget->refreshValues(
  320. ApplicationMode::OfflineRunning, PlcConnectionState::Disconnected);
  321. require(monitor_table->rowCount() == 1
  322. && monitor_table->item(0, 2)->text() == QStringLiteral("ON"),
  323. "offline free monitor must read the same virtual M/D repository as HMI");
  324. online_action->trigger();
  325. require(mode_service.mode() == ApplicationMode::OfflineRunning,
  326. "running modes must not switch directly through the UI");
  327. require(offline_action->isChecked(),
  328. "failed mode changes must restore the active action");
  329. editing_action->trigger();
  330. require(mode_service.mode() == ApplicationMode::Editing,
  331. "editing action must return to editing");
  332. require(simulation_service.state() == SimulationState::Stopped,
  333. "editing action must stop the simulation service");
  334. require(executor_status->text() == QStringLiteral("逻辑执行器:停止"),
  335. "executor status label must report the actual stopped state");
  336. require(project_dock->isEnabled(),
  337. "project dock must be restored after returning to editing");
  338. require(properties_dock->isEnabled(),
  339. "properties dock must be restored after returning to editing");
  340. require(add_button_action->isEnabled(),
  341. "HMI add controls must be restored after returning to editing");
  342. require(add_normally_open_action->isEnabled(),
  343. "logic add nodes must be restored after returning to editing");
  344. require(!runtime_tab->isVisible(),
  345. "returning to editing must hide the runtime monitor workspace");
  346. online_action->trigger();
  347. require(mode_service.mode() == ApplicationMode::Editing,
  348. "online action must require an initial PLC read");
  349. require(editing_action->isChecked(),
  350. "rejected online running must restore the editing action");
  351. }
  352. void testPlcConfigurationUsesDialog()
  353. {
  354. PlcSerialConfiguration initial;
  355. initial.portName = "COM17";
  356. initial.serverAddress = 12;
  357. initial.baudRate = 38400;
  358. initial.dataBits = 7;
  359. initial.parity = 3;
  360. initial.stopBits = 2;
  361. initial.responseTimeoutMs = 2500;
  362. initial.retries = 4;
  363. initial.pollIntervalMs = 350;
  364. PlcConnectionDialog configuration_dialog(initial);
  365. const PlcSerialConfiguration actual = configuration_dialog.configuration();
  366. require(actual.portName == initial.portName,
  367. "PLC dialog must preserve a manually entered serial port");
  368. require(actual.serverAddress == initial.serverAddress
  369. && actual.baudRate == initial.baudRate
  370. && actual.dataBits == initial.dataBits
  371. && actual.parity == initial.parity
  372. && actual.stopBits == initial.stopBits,
  373. "PLC dialog must preserve Modbus RTU serial parameters");
  374. require(actual.responseTimeoutMs == initial.responseTimeoutMs
  375. && actual.retries == initial.retries
  376. && actual.pollIntervalMs == initial.pollIntervalMs,
  377. "PLC dialog must preserve communication timing parameters");
  378. TestProjectStorage storage;
  379. ProjectService project_service(storage);
  380. HmiEditorService editor_service(project_service);
  381. LogicEditorService logic_editor_service(project_service);
  382. VirtualRegisterRepository repository;
  383. HmiRuntimeService runtime_service(repository);
  384. OfflineSimulationService simulation_service(repository);
  385. RuntimeModeService mode_service(project_service, simulation_service);
  386. RegisterMonitorService monitor_service(repository);
  387. MainWindow window(
  388. mode_service,
  389. project_service,
  390. editor_service,
  391. logic_editor_service,
  392. runtime_service,
  393. monitor_service);
  394. require(window.findChild<QComboBox *>(QStringLiteral("serialPortComboBox")) == nullptr,
  395. "serial configuration controls must not be embedded in the main window");
  396. QAction *configure_action = requiredChild<QAction>(window, "configurePlcAction");
  397. bool dialog_opened = false;
  398. QTimer::singleShot(
  399. 0,
  400. [&dialog_opened]
  401. {
  402. auto *dialog = qobject_cast<PlcConnectionDialog *>(
  403. QApplication::activeModalWidget());
  404. dialog_opened = dialog != nullptr;
  405. if (dialog != nullptr)
  406. {
  407. dialog->reject();
  408. }
  409. });
  410. configure_action->trigger();
  411. require(dialog_opened,
  412. "PLC configuration action must open the dedicated configuration dialog");
  413. }
  414. void testRepeatedPlcStatusNotificationsAreCoalesced()
  415. {
  416. TestProjectStorage storage;
  417. ProjectService project_service(storage);
  418. HmiEditorService editor_service(project_service);
  419. LogicEditorService logic_editor_service(project_service);
  420. VirtualRegisterRepository virtual_repository;
  421. VirtualRegisterRepository plc_repository;
  422. ActiveRegisterRepository active_repository(virtual_repository);
  423. HmiRuntimeService runtime_service(active_repository);
  424. OfflineSimulationService simulation_service(virtual_repository);
  425. RuntimeModeService mode_service(project_service, simulation_service);
  426. RegisterMonitorService monitor_service(active_repository);
  427. RepeatedStatusGateway gateway;
  428. mode_service.configurePlc(
  429. gateway, active_repository, virtual_repository, plc_repository);
  430. MainWindow window(
  431. mode_service,
  432. project_service,
  433. editor_service,
  434. logic_editor_service,
  435. runtime_service,
  436. monitor_service);
  437. QListWidget *output = requiredChild<QListWidget>(window, "outputList");
  438. const int initial_count = output->count();
  439. const PlcCommunicationResult result = mode_service.connectPlc(
  440. {"COM3", 1, 9600, 8, 2, 1, 1000, 2, 200});
  441. require(result.succeeded, "PLC connection setup must succeed");
  442. QApplication::processEvents();
  443. const QString expected = QStringLiteral("PLC 已连接,正在读取工程使用的 M/D 地址");
  444. int matching_count = 0;
  445. for (int index = initial_count; index < output->count(); ++index)
  446. {
  447. if (output->item(index)->text() == expected)
  448. {
  449. ++matching_count;
  450. }
  451. }
  452. require(matching_count == 1,
  453. "repeated PLC status callbacks must append one coalesced output message");
  454. }
  455. void testOnlineWorkspaceShowsHmiAndFreeMonitorOnly()
  456. {
  457. TestProjectStorage storage;
  458. ProjectService project_service(storage);
  459. HmiEditorService editor_service(project_service);
  460. LogicEditorService logic_editor_service(project_service);
  461. VirtualRegisterRepository virtual_repository;
  462. VirtualRegisterRepository plc_repository;
  463. ActiveRegisterRepository active_repository(virtual_repository);
  464. HmiRuntimeService runtime_service(active_repository);
  465. OfflineSimulationService simulation_service(virtual_repository);
  466. RuntimeModeService mode_service(project_service, simulation_service);
  467. RegisterMonitorService monitor_service(active_repository);
  468. OnlineReadyGateway gateway;
  469. mode_service.configurePlc(
  470. gateway, active_repository, virtual_repository, plc_repository);
  471. MainWindow window(
  472. mode_service,
  473. project_service,
  474. editor_service,
  475. logic_editor_service,
  476. runtime_service,
  477. monitor_service);
  478. window.resize(1200, 760);
  479. window.show();
  480. QApplication::processEvents();
  481. require(mode_service.connectPlc(
  482. {"COM9", 1, 9600, 8, 2, 1, 1000, 2, 200}).succeeded,
  483. "online workspace test must connect the fake PLC gateway");
  484. gateway.completeInitialRead();
  485. QAction *online_action = requiredChild<QAction>(window, "onlineModeAction");
  486. online_action->trigger();
  487. QApplication::processEvents();
  488. QWidget *runtime_tab = requiredChild<QWidget>(window, "runtimeMonitorTab");
  489. QWidget *runtime_hmi = requiredChild<QWidget>(window, "runtimeHmiView");
  490. QWidget *runtime_logic = requiredChild<QWidget>(window, "runtimeLogicView");
  491. QWidget *free_monitor = requiredChild<QWidget>(window, "freeMonitorWidget");
  492. require(mode_service.mode() == ApplicationMode::OnlineRunning,
  493. "completed PLC initial read must allow online running");
  494. require(runtime_tab->isVisible() && runtime_hmi->isVisible()
  495. && free_monitor->isVisible(),
  496. "online running must show HMI and free monitor together");
  497. require(!runtime_logic->isVisible(),
  498. "online running must not show a misleading local ladder runtime trace");
  499. QLineEdit *monitor_address = requiredChild<QLineEdit>(window, "addressEdit");
  500. QPushButton *monitor_add = requiredChild<QPushButton>(window, "addButton");
  501. monitor_address->setText(QStringLiteral("D9"));
  502. monitor_add->click();
  503. require(std::find(
  504. gateway.poll_addresses.begin(),
  505. gateway.poll_addresses.end(),
  506. RegisterAddress{RegisterArea::D, 9}) != gateway.poll_addresses.end(),
  507. "online free monitor addresses must join the active PLC poll set immediately");
  508. }
  509. } // namespace
  510. int main(int argc, char *argv[])
  511. {
  512. // 无窗口平台使 Qt Widgets 测试可在自动化环境稳定运行
  513. qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("offscreen"));
  514. QApplication application(argc, argv);
  515. try
  516. {
  517. testModeActionsControlEditingAvailability();
  518. testPlcConfigurationUsesDialog();
  519. testRepeatedPlcStatusNotificationsAreCoalesced();
  520. testOnlineWorkspaceShowsHmiAndFreeMonitorOnly();
  521. }
  522. catch (const std::exception &error)
  523. {
  524. std::cerr << "main window tests failed: " << error.what() << '\n';
  525. return 1;
  526. }
  527. std::cout << "main window tests passed\n";
  528. return 0;
  529. }