refactor: port base/XBaseTests to QtTests
This commit is contained in:
parent
78cbe4b775
commit
231e5c0bc5
4 changed files with 52 additions and 27 deletions
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2014 - 2024 Symless Ltd.
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
||||
#include "base/XBase.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(XBaseTests, what_emptyWhat_returnsWhatFromGetWhat)
|
||||
{
|
||||
XBase xbase;
|
||||
|
||||
const char *result = xbase.what();
|
||||
|
||||
EXPECT_STREQ("", result);
|
||||
}
|
||||
|
||||
TEST(XBaseTests, what_nonEmptyWhat_returnsWhatFromGetWhat)
|
||||
{
|
||||
XBase xbase("test");
|
||||
|
||||
const char *result = xbase.what();
|
||||
|
||||
EXPECT_STREQ("test", result);
|
||||
}
|
||||
|
|
@ -28,3 +28,12 @@ create_test(
|
|||
SOURCE UnicodeTests.cpp
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/base"
|
||||
)
|
||||
|
||||
create_test(
|
||||
NAME XBaseTests
|
||||
DEPENDS base
|
||||
LIBS arch
|
||||
SOURCE XBaseTests.cpp
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/base"
|
||||
)
|
||||
|
||||
|
|
|
|||
28
src/unittests/base/XBaseTests.cpp
Normal file
28
src/unittests/base/XBaseTests.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Deskflow -- mouse and keyboard sharing utility
|
||||
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
|
||||
* SPDX-FileCopyrightText: (C) 2014 - 2021 Symless Ltd.
|
||||
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
||||
*/
|
||||
|
||||
#include "XBaseTests.h"
|
||||
|
||||
#include "../../lib/base/XBase.h"
|
||||
|
||||
void XBaseTests::empty()
|
||||
{
|
||||
XBase xbase;
|
||||
const char *result = xbase.what();
|
||||
|
||||
QCOMPARE(result, "");
|
||||
}
|
||||
|
||||
void XBaseTests::nonEmpty()
|
||||
{
|
||||
XBase xbase("test");
|
||||
const char *result = xbase.what();
|
||||
|
||||
QCOMPARE(result, "test");
|
||||
}
|
||||
|
||||
QTEST_MAIN(XBaseTests)
|
||||
15
src/unittests/base/XBaseTests.h
Normal file
15
src/unittests/base/XBaseTests.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* 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 XBaseTests : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void empty();
|
||||
void nonEmpty();
|
||||
};
|
||||
Loading…
Reference in a new issue