Changeset View
Changeset View
Standalone View
Standalone View
autotests/syntaxrepository_test.cpp
Show First 20 Lines • Show All 544 Lines • ▼ Show 20 Line(s) | 465 | { | |||
---|---|---|---|---|---|
545 | QCOMPARE(klist.size(), 2); | 545 | QCOMPARE(klist.size(), 2); | ||
546 | QVERIFY(klist.contains(QLatin1String("e"))); | 546 | QVERIFY(klist.contains(QLatin1String("e"))); | ||
547 | QVERIFY(klist.contains(QLatin1String("f"))); | 547 | QVERIFY(klist.contains(QLatin1String("f"))); | ||
548 | 548 | | |||
549 | klist = def.keywordList(QLatin1String("f")); | 549 | klist = def.keywordList(QLatin1String("f")); | ||
550 | QCOMPARE(klist.size(), 1); | 550 | QCOMPARE(klist.size(), 1); | ||
551 | QVERIFY(klist.contains(QLatin1String("f"))); | 551 | QVERIFY(klist.contains(QLatin1String("f"))); | ||
552 | } | 552 | } | ||
553 | | ||||
554 | void testKeywordListModification() | ||||
555 | { | ||||
556 | auto def = m_repo.definitionForName(QLatin1String("Python")); | ||||
557 | QVERIFY(def.isValid()); | ||||
558 | | ||||
559 | const QStringList& lists = def.keywordLists(); | ||||
560 | QVERIFY(!lists.isEmpty()); | ||||
561 | | ||||
562 | const QString& listName = lists.first(); | ||||
563 | const QStringList keywords = def.keywordList(listName); | ||||
564 | | ||||
565 | QStringList modified = keywords; | ||||
566 | modified.append(QLatin1String("test")); | ||||
567 | | ||||
568 | QVERIFY(def.setKeywordList(listName, modified) == true); | ||||
569 | QCOMPARE(keywords + QStringList(QLatin1String("test")), def.keywordList(listName)); | ||||
570 | | ||||
571 | const QString& unexistedName = QLatin1String("unexisted-keyword-name"); | ||||
572 | QVERIFY(lists.contains(unexistedName) == false); | ||||
573 | QVERIFY(def.setKeywordList(unexistedName, QStringList()) == false); | ||||
574 | } | ||||
553 | }; | 575 | }; | ||
554 | } | 576 | } | ||
555 | 577 | | |||
556 | QTEST_GUILESS_MAIN(KSyntaxHighlighting::RepositoryTest) | 578 | QTEST_GUILESS_MAIN(KSyntaxHighlighting::RepositoryTest) | ||
557 | 579 | | |||
558 | #include "syntaxrepository_test.moc" | 580 | #include "syntaxrepository_test.moc" |