Changeset View
Changeset View
Standalone View
Standalone View
tests/kded/configtest.cpp
Show First 20 Lines • Show All 402 Lines • ▼ Show 20 Line(s) | 397 | { | |||
---|---|---|---|---|---|
403 | configWrapper = std::move(configWrapper->readFile(QStringLiteral("twoScreenConfig.json"))); | 403 | configWrapper = std::move(configWrapper->readFile(QStringLiteral("twoScreenConfig.json"))); | ||
404 | 404 | | |||
405 | auto config = configWrapper->data(); | 405 | auto config = configWrapper->data(); | ||
406 | QVERIFY(config); | 406 | QVERIFY(config); | ||
407 | 407 | | |||
408 | // Make sure we don't write into TEST_DATA | 408 | // Make sure we don't write into TEST_DATA | ||
409 | QStandardPaths::setTestModeEnabled(true); | 409 | QStandardPaths::setTestModeEnabled(true); | ||
410 | configWrapper->setDirPath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QStringLiteral("/kscreen/")); | 410 | configWrapper->setDirPath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QStringLiteral("/kscreen/")); | ||
411 | // TODO: this needs setup of the control directory | ||||
411 | 412 | | |||
412 | // Basic assumptions for the remainder of our tests, this is the situation where the lid is opened | 413 | // Basic assumptions for the remainder of our tests, this is the situation where the lid is opened | ||
413 | QCOMPARE(config->connectedOutputs().count(), 2); | 414 | QCOMPARE(config->connectedOutputs().count(), 2); | ||
414 | 415 | | |||
415 | auto output = config->connectedOutputs().first(); | 416 | auto output = config->connectedOutputs().first(); | ||
416 | QCOMPARE(output->name(), QLatin1String("OUTPUT-1")); | 417 | QCOMPARE(output->name(), QLatin1String("OUTPUT-1")); | ||
417 | QCOMPARE(output->isEnabled(), true); | 418 | QCOMPARE(output->isEnabled(), true); | ||
418 | QCOMPARE(output->isPrimary(), true); | 419 | QCOMPARE(output->isPrimary(), true); | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | |||||
485 | } | 486 | } | ||
486 | 487 | | |||
487 | void TestConfig::testFixedConfig() | 488 | void TestConfig::testFixedConfig() | ||
488 | { | 489 | { | ||
489 | // Load a dualhead config | 490 | // Load a dualhead config | ||
490 | auto configWrapper = createConfig(true, true); | 491 | auto configWrapper = createConfig(true, true); | ||
491 | configWrapper = std::move(configWrapper->readFile(QStringLiteral("twoScreenConfig.json"))); | 492 | configWrapper = std::move(configWrapper->readFile(QStringLiteral("twoScreenConfig.json"))); | ||
492 | auto config = configWrapper->data(); | 493 | auto config = configWrapper->data(); | ||
493 | | ||||
494 | QVERIFY(config); | 494 | QVERIFY(config); | ||
495 | 495 | | |||
496 | // Make sure we don't write into TEST_DATA | 496 | // Make sure we don't write into TEST_DATA | ||
497 | QStandardPaths::setTestModeEnabled(true); | 497 | QStandardPaths::setTestModeEnabled(true); | ||
498 | Config::setDirPath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QStringLiteral("/kscreen/")); | 498 | Config::setDirPath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) % QStringLiteral("/kscreen/")); | ||
499 | // TODO: this needs setup of the control directory | ||||
500 | | ||||
499 | const QString fixedCfgPath = Config::configsDirPath() % Config::s_fixedConfigFileName; | 501 | const QString fixedCfgPath = Config::configsDirPath() % Config::s_fixedConfigFileName; | ||
500 | // save config as the current one, this is the config we don't want restored, and which we'll overwrite | 502 | // save config as the current one, this is the config we don't want restored, and which we'll overwrite | ||
501 | configWrapper->writeFile(fixedCfgPath); | 503 | configWrapper->writeFile(fixedCfgPath); | ||
502 | 504 | | |||
503 | // Check if both files exist | 505 | // Check if both files exist | ||
504 | QFile fixedCfg(fixedCfgPath); | 506 | QFile fixedCfg(fixedCfgPath); | ||
505 | QVERIFY(fixedCfg.exists()); | 507 | QVERIFY(fixedCfg.exists()); | ||
506 | 508 | | |||
507 | Config::setDirPath(QStringLiteral(TEST_DATA "/serializerdata/")); | 509 | Config::setDirPath(QStringLiteral(TEST_DATA "/serializerdata/")); | ||
508 | } | 510 | } | ||
509 | 511 | | |||
510 | 512 | | |||
511 | QTEST_MAIN(TestConfig) | 513 | QTEST_MAIN(TestConfig) | ||
512 | 514 | | |||
513 | #include "configtest.moc" | 515 | #include "configtest.moc" |