summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lupdate/testdata/good/namespaces
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/linguist/lupdate/testdata/good/namespaces')
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp198
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result106
3 files changed, 307 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp
new file mode 100644
index 000000000..e99171f16
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+
+class Class : public QObject
+{
+ Q_OBJECT
+
+ class SubClass
+ {
+ void f()
+ {
+ tr("nested class context");
+ }
+ };
+
+ void f()
+ {
+ tr("just class context");
+ }
+};
+
+namespace Outer {
+
+class Class : public QObject { Q_OBJECT };
+
+namespace Middle1 {
+
+class Class : public QObject { Q_OBJECT };
+
+namespace Inner1 {
+
+class Class : public QObject { Q_OBJECT };
+
+}
+
+namespace I = Inner1;
+
+class Something;
+class Different;
+
+}
+
+namespace Middle2 {
+
+class Class : public QObject { Q_OBJECT };
+
+namespace Inner2 {
+
+class Class : public QObject { Q_OBJECT };
+
+namespace IO = Middle2;
+
+}
+
+namespace I = Inner2;
+
+}
+
+namespace MI = Middle1::Inner1;
+
+namespace O = ::Outer;
+
+class Middle1::Different : QObject {
+Q_OBJECT
+ void f() {
+ tr("different namespaced class def");
+ }
+};
+
+}
+
+namespace O = Outer;
+namespace OM = Outer::Middle1;
+namespace OMI = Outer::Middle1::I;
+
+int main()
+{
+ Class::tr("outestmost class");
+ Outer::Class::tr("outer class");
+ Outer::MI::Class::tr("innermost one");
+ OMI::Class::tr("innermost two");
+ O::Middle1::I::Class::tr("innermost three");
+ O::Middle2::I::Class::tr("innermost three b");
+ OM::I::Class::tr("innermost four");
+ return 0;
+}
+
+class OM::Something : QObject {
+Q_OBJECT
+ void f() {
+ tr("namespaced class def");
+ }
+ void g() {
+ tr("namespaced class def 2");
+ }
+};
+
+// QTBUG-8360
+namespace A {
+
+void foo()
+{
+ using namespace A;
+}
+
+void goo()
+{
+ return QObject::tr("Bla");
+}
+
+}
+
+
+namespace AA {
+namespace B {
+
+using namespace AA;
+
+namespace C {
+
+class Test : public QObject {
+ Q_OBJECT
+};
+
+}
+
+}
+
+using namespace B;
+using namespace C;
+
+void goo()
+{
+ AA::Test::tr("howdy?");
+}
+
+}
+
+
+namespace A1 {
+namespace B {
+
+class Test : public QObject {
+ Q_OBJECT
+};
+
+using namespace A1;
+
+void foo()
+{
+ B::B::B::Test::tr("yeeee-ha!");
+}
+
+}
+}
+
+
+#include "main.moc"
diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro
new file mode 100644
index 000000000..c96859bdb
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.pro
@@ -0,0 +1,3 @@
+SOURCES += main.cpp
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result
new file mode 100644
index 000000000..94df9d3f8
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>A1::B::Test</name>
+ <message>
+ <location filename="main.cpp" line="191"/>
+ <source>yeeee-ha!</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>AA::B::C::Test</name>
+ <message>
+ <location filename="main.cpp" line="174"/>
+ <source>howdy?</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Class</name>
+ <message>
+ <location filename="main.cpp" line="52"/>
+ <source>nested class context</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="58"/>
+ <source>just class context</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="118"/>
+ <source>outestmost class</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Outer::Class</name>
+ <message>
+ <location filename="main.cpp" line="119"/>
+ <source>outer class</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Outer::Middle1::Different</name>
+ <message>
+ <location filename="main.cpp" line="106"/>
+ <source>different namespaced class def</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Outer::Middle1::Inner1::Class</name>
+ <message>
+ <location filename="main.cpp" line="120"/>
+ <source>innermost one</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="121"/>
+ <source>innermost two</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="122"/>
+ <source>innermost three</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="124"/>
+ <source>innermost four</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Outer::Middle1::Something</name>
+ <message>
+ <location filename="main.cpp" line="131"/>
+ <source>namespaced class def</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="134"/>
+ <source>namespaced class def 2</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Outer::Middle2::Inner2::Class</name>
+ <message>
+ <location filename="main.cpp" line="123"/>
+ <source>innermost three b</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>QObject</name>
+ <message>
+ <location filename="main.cpp" line="148"/>
+ <source>Bla</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>