summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Hanselmann <public@hansmi.ch>2015-12-17 13:26:46 +0100
committerMichael Hanselmann <public@hansmi.ch>2016-01-05 16:20:20 +0000
commit00c523ab372c680984b17ad8d66939cd3aaa8f34 (patch)
treeb20a405bdbc50dc911daaff9bc3d977acba9c324 /tests
parentbdd4e502ffd81084f33181426df31ffcddde637c (diff)
lupdate: Support for C++11's "final" identifier
C++11 introduced the "final" identifier which may appear immediately after the name in a class definition to specify that the class cannot be derived from. lupdate collects strings for translation and did not understand "final". Instead it would use "final" as the name of the class as there may be attributes before the class name and the last token before the colon character is used. [ChangeLog][lupdate] The C++11 identifier "final" is now skipped when determining the name of a class. Task-number: QTBUG-42735 Change-Id: I2adee9a188645622fc6916158ba2b48dde921383 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp37
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result21
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index 8b91a7761..6be775994 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -410,3 +410,40 @@ int dupeFail()
// Finally, same source, but without ID.
QCoreApplication::translate("", "This is the source");
}
+
+
+
+// QTBUG-42735: lupdate confused by `final` specifier (C++11)
+namespace Abc {
+
+class NamespacedFinalClass;
+
+}
+
+class FinalClass final : public QObject
+{
+ Q_OBJECT
+
+ class SubClass final
+ {
+ void f()
+ {
+ tr("nested class context with final");
+ }
+ };
+
+ void f()
+ {
+ tr("class context with final");
+ }
+};
+
+class Abc::NamespacedFinalClass final : public QObject
+{
+ Q_OBJECT
+
+ void f()
+ {
+ tr("namespaced class with final");
+ }
+};
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index 0c0c1b511..be393f9d7 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -33,6 +33,14 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
+ <name>Abc::NamespacedFinalClass</name>
+ <message>
+ <location filename="main.cpp" line="447"/>
+ <source>namespaced class with final</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>Bogus</name>
<message>
<location filename="main.cpp" line="258"/>
@@ -117,6 +125,19 @@ backslashed \ stuff.</source>
</message>
</context>
<context>
+ <name>FinalClass</name>
+ <message>
+ <location filename="main.cpp" line="431"/>
+ <source>nested class context with final</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="437"/>
+ <source>class context with final</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>FindDialog</name>
<message>
<location filename="finddialog.cpp" line="77"/>