diff --git a/src/i18n_review.cpp b/src/i18n_review.cpp index 2310018..f3f9d80 100644 --- a/src/i18n_review.cpp +++ b/src/i18n_review.cpp @@ -503,7 +503,7 @@ namespace i18n_check // Qt L"Q_ASSERT", L"Q_ASSERT_X", L"qSetMessagePattern", L"qmlRegisterUncreatableMetaObject", L"addShaderFromSourceCode", L"QStandardPaths::findExecutable", L"QDateTime::fromString", - L"qCDebug", L"qDebug", + L"qCDebug", L"qDebug", L"Q_MOC_INCLUDE", L"Q_CLASSINFO", // Catch2 L"TEST_CASE", L"BENCHMARK", L"TEMPLATE_TEST_CASE", L"SECTION", L"DYNAMIC_SECTION", L"REQUIRE", L"REQUIRE_THROWS_WITH", L"REQUIRE_THAT", L"CHECK", L"CATCH_ENFORCE", diff --git a/tests/cpptests.cpp b/tests/cpptests.cpp index 1d3946c..fd13469 100644 --- a/tests/cpptests.cpp +++ b/tests/cpptests.cpp @@ -488,6 +488,44 @@ QString test = QApplication::translate("SomeContext", "more source content");)"; } } +TEST_CASE("Qt no-loc", "[cpp][i18n]") + { + SECTION("Q_MOC_INCLUDE") + { + cpp_i18n_review cpp; + cpp.set_min_words_for_classifying_unavailable_string(1); + const wchar_t* code = LR"(Q_MOC_INCLUDE("myheader"))"; // don't include extension + cpp(code, L""); + cpp.review_strings(); + CHECK(cpp.get_localizable_strings().size() == 0); + CHECK(cpp.get_internal_strings().size() == 1); + CHECK(cpp.get_unsafe_localizable_strings().size() == 0); + } + + SECTION("Q_CLASSINFO") + { + cpp_i18n_review cpp; + cpp.set_min_words_for_classifying_unavailable_string(1); + const wchar_t* code = LR"(class MyClass : public QObject +{ + Q_OBJECT + Q_CLASSINFO("Author", "Joe Smith") + Q_CLASSINFO("URL", "http://www.my-organization.qc.ca") + +public:)"; + cpp(code, L""); + cpp.review_strings(); + CHECK(cpp.get_localizable_strings().size() == 0); + CHECK(cpp.get_not_available_for_localization_strings().size() == 0); + REQUIRE(cpp.get_internal_strings().size() == 4); + CHECK(cpp.get_internal_strings()[0].m_string == L"Author"); + CHECK(cpp.get_internal_strings()[1].m_string == L"Joe Smith"); + CHECK(cpp.get_internal_strings()[2].m_string == L"URL"); + CHECK(cpp.get_internal_strings()[3].m_string == L"http://www.my-organization.qc.ca"); + CHECK(cpp.get_unsafe_localizable_strings().size() == 0); + } + } + TEST_CASE("Deprecated functions & macros", "[cpp][i18n]") { SECTION("Functions")