refactor: port CommandProcessTests to QtTests
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
# SPDX-FileCopyrightText: 2025 Deskflow Developers
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
add_subdirectory(core)
|
||||
|
||||
create_test(
|
||||
NAME DotEnvTests
|
||||
DEPENDS gui
|
||||
|
||||
9
src/unittests/gui/core/CMakeLists.txt
Normal file
9
src/unittests/gui/core/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# SPDX-FileCopyrightText: 2025 Deskflow Developers
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
create_test(
|
||||
NAME CommandProcessTests
|
||||
DEPENDS gui
|
||||
SOURCE CommandProcessTests.cpp
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/gui"
|
||||
)
|
||||
@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
||||
#include "gui/core/CommandProcess.h"
|
||||
#include "CommandProcessTests.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "../../../lib/gui/core/CommandProcess.h"
|
||||
|
||||
TEST(CommandProcessTests, run_commandSucceeds_returnsOutput)
|
||||
void CommandProcessTests::runCommand()
|
||||
{
|
||||
|
||||
// it seems that on windows, you can sometimes just call echo (this worked
|
||||
// with windows 2022), but on windows 10 you can't call echo directly.
|
||||
#if defined(Q_OS_WIN)
|
||||
@ -27,5 +27,7 @@ TEST(CommandProcessTests, run_commandSucceeds_returnsOutput)
|
||||
|
||||
const QString actual = commandProcess.run();
|
||||
|
||||
EXPECT_EQ("Hello, World!", actual.toStdString());
|
||||
QCOMPARE(actual.toStdString(), "Hello, World!");
|
||||
}
|
||||
|
||||
QTEST_MAIN(CommandProcessTests)
|
||||
16
src/unittests/gui/core/CommandProcessTests.h
Normal file
16
src/unittests/gui/core/CommandProcessTests.h
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
||||
#include <QTest>
|
||||
|
||||
class CommandProcessTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
// Test are run in order top to bottom
|
||||
// void initTestCase();
|
||||
void runCommand();
|
||||
};
|
||||
Reference in New Issue
Block a user