diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-04-15 19:48:28 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2010-04-15 20:16:33 (GMT) |
commit | d758d652e1b3950f9df6aa4c1bdef67ba9b88b15 (patch) | |
tree | 338c03b07a733a553e9dbd30ec103635f8a5dbd4 /tests | |
parent | 2c0f13ccfe750241eb7ddedf6412da380a146975 (diff) | |
download | Qt-d758d652e1b3950f9df6aa4c1bdef67ba9b88b15.zip Qt-d758d652e1b3950f9df6aa4c1bdef67ba9b88b15.tar.gz Qt-d758d652e1b3950f9df6aa4c1bdef67ba9b88b15.tar.bz2 |
make QT_TR_NOOP work in static initializers
do that by ignoring all equal signs and everything between and
including brackets. this makes static initializers look
effectively like function definitions, thus creating proper
context.
Task-number: QTBUG-9276
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp | 23 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result | 17 |
2 files changed, 40 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 6e73d6d..0765bfc 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -252,3 +252,26 @@ class YetAnotherTest : QObject { //: This is a message without a source string QString test = qtTrId("yet_another_id"); + + + +// QTBUG-9276: context in static initializers +class Bogus : QObject { + Q_OBJECT + + static const char * const s_strings[]; +}; + +const char * const Bogus::s_strings[] = { + QT_TR_NOOP("this should be in Bogus") +}; + +const char * const Bogus::s_strings[SIZE] = { + QT_TR_NOOP("this should be in Bogus") +}; + +void bogosity() +{ + // no spaces here. test collateral damage from ignoring equal sign + Class::member=QObject::tr("just QObject"); +} 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 6d50c21..208191d 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -26,6 +26,15 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>Bogus</name> + <message> + <location filename="main.cpp" line="266"/> + <location filename="main.cpp" line="270"/> + <source>this should be in Bogus</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>Dialog2</name> <message numerus="yes"> <location filename="main.cpp" line="70"/> @@ -184,6 +193,14 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>QObject</name> + <message> + <location filename="main.cpp" line="276"/> + <source>just QObject</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>QTranslator</name> <message> <location filename="main.cpp" line="93"/> |