refactor: port IKeyStateTest to QtTests

This commit is contained in:
sithlord48
2025-04-06 17:55:33 -04:00
committed by Nick Bolton
parent 6c0843d088
commit 287d70a138
3 changed files with 37 additions and 6 deletions

View File

@ -38,7 +38,16 @@ create_test(
)
create_test(
NAME LanguageManagerTests
NAME IKeyStateTests
DEPENDS app
LIBS arch base ${extra_libs}
SOURCE IKeyStateTests.cpp
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/src/lib/deskflow"
)
create_test(
NAME test_LanguageManagerTests
DEPENDS app
LIBS arch base ${extra_libs}
SOURCE LanguageManagerTests.cpp

View File

@ -1,16 +1,18 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2015 - 2016 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#include "lib/deskflow/IKeyState.h"
#include "IKeyStateTests.h"
#include <gtest/gtest.h>
#include "../../lib/deskflow/IKeyState.h"
TEST(IKeyStateTests, KeyInfo_alloc_destinations)
void IKeyStateTests::allocDestination()
{
auto info = IKeyState::KeyInfo::alloc(1, 2, 3, 4, {"test1", "test2"});
EXPECT_STREQ(info->m_screensBuffer, ":test1:test2:");
QCOMPARE(info->m_screensBuffer, ":test1:test2:");
}
QTEST_MAIN(IKeyStateTests)

View File

@ -0,0 +1,20 @@
/*
* 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 "base/Log.h"
#include <QTest>
class IKeyStateTests : public QObject
{
Q_OBJECT
private slots:
void allocDestination();
private:
Arch m_arch;
Log m_log;
};