Add Framework laptop controls and monitoring with hardware-aware discovery
This commit is contained in:
@@ -3,12 +3,28 @@
|
||||
#include "packageutils.h"
|
||||
|
||||
#include <QTest>
|
||||
#include <QTemporaryDir>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
|
||||
class PackageUtilsTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void frameworkCompatibility() {
|
||||
QTemporaryDir root;
|
||||
QVERIFY(packageCompatibilityError(QStringLiteral("touchpad-hold-tap"), root.path()).isEmpty());
|
||||
QVERIFY(!packageCompatibilityError(QStringLiteral("framework-laptop-tools"), root.path()).isEmpty());
|
||||
QVERIFY(QDir().mkpath(root.path() + QStringLiteral("/class/dmi/id")));
|
||||
QFile vendor(root.path() + QStringLiteral("/class/dmi/id/sys_vendor"));
|
||||
QVERIFY(vendor.open(QIODevice::WriteOnly)); vendor.write("Framework\n"); vendor.close();
|
||||
QFile product(root.path() + QStringLiteral("/class/dmi/id/product_name"));
|
||||
QVERIFY(product.open(QIODevice::WriteOnly)); product.write("Laptop 13 Pro (Intel Core Ultra Series 3)\n"); product.close();
|
||||
QVERIFY(packageCompatibilityError(QStringLiteral("framework-laptop-tools"), root.path()).isEmpty());
|
||||
QVERIFY(product.open(QIODevice::WriteOnly | QIODevice::Truncate)); product.write("Laptop 13\n"); product.close();
|
||||
QVERIFY(!packageCompatibilityError(QStringLiteral("framework-laptop-tools"), root.path()).isEmpty());
|
||||
}
|
||||
void parsesQueryOutput()
|
||||
{
|
||||
const auto records = parsePackageRecords(
|
||||
|
||||
@@ -12,6 +12,18 @@ class ToolModelTest : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void incompatibleFrameworkIsOnlyListedWhenInstalled() {
|
||||
if (packageCompatibilityError(QStringLiteral("framework-laptop-tools")).isEmpty()) QSKIP("Requires a non-Framework test host");
|
||||
const PackageRecord package{QStringLiteral("framework-laptop-tools"), QStringLiteral("1"), QStringLiteral("x86_64"), QStringLiteral("Hardware controls")};
|
||||
ToolModel model; model.setPackages({}, {package});
|
||||
QCOMPARE(model.rowCount(), 0);
|
||||
model.setPackages({package}, {package});
|
||||
QCOMPARE(model.rowCount(), 1);
|
||||
QVERIFY(!model.data(model.index(0), ToolModel::CompatibilityErrorRole).toString().isEmpty());
|
||||
QVERIFY(!model.mayInstall(package.name));
|
||||
QVERIFY(model.mayRemove(package.name));
|
||||
QVERIFY(!model.data(model.index(0), ToolModel::ConfigurableRole).toBool());
|
||||
}
|
||||
void discoversLocallyInstalledToolSettings()
|
||||
{
|
||||
QTemporaryDir directory;
|
||||
|
||||
Reference in New Issue
Block a user