summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <torarnv@gmail.com>2020-04-02 11:14:57 +0200
committerTor Arne Vestbø <torarnv@gmail.com>2020-04-02 13:06:15 +0200
commit128540391f27da4dce8b460883fbcdb3aba8a44c (patch)
treee250e043131d070fef5a81c5e8b3fde05e54db71
parent7c0562d06e84febceac0d8f1d36cf4d6e0758398 (diff)
Add lupdate test for Objective-C++ sources
Change-Id: I3728a77d44798e5ab71c6f775f95821513be00fe Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm51
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseobjc/project.pro3
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parseobjc/project.ts.result20
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp3
4 files changed, 77 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm b/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm
new file mode 100644
index 000000000..7cc1c34e3
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parseobjc/main.mm
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qcoreapplication.h>
+
+@interface NSObject
+@end
+
+@interface Foo : NSObject
+@property (nonatomic, retain) NSObject *child;
+- (bool)someMethodWithArg:(NSObject*)child andAnotherArg:(int)age;
+@end
+
+@implementation Foo
+- (bool)someMethodWithArg:(NSObject*)child andAnotherArg:(int)age
+{
+ QCoreApplication::translate("Biz", "Baz");
+ return self.child == child && age == 42;
+}
+@end
+
+int main()
+{
+ QCoreApplication::translate("Foo", "Bar");
+ return 0;
+}
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseobjc/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseobjc/project.pro
new file mode 100644
index 000000000..e9d4e1ec3
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parseobjc/project.pro
@@ -0,0 +1,3 @@
+SOURCES += main.mm
+
+TRANSLATIONS = project.ts
diff --git a/tests/auto/linguist/lupdate/testdata/good/parseobjc/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseobjc/project.ts.result
new file mode 100644
index 000000000..675d16449
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/parseobjc/project.ts.result
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name>Biz</name>
+ <message>
+ <location filename="main.mm" line="42"/>
+ <source>Baz</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Foo</name>
+ <message>
+ <location filename="main.mm" line="49"/>
+ <source>Bar</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp
index c55167a55..0837ee572 100644
--- a/tests/auto/linguist/lupdate/tst_lupdate.cpp
+++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp
@@ -222,6 +222,9 @@ void tst_lupdate::good_data()
#ifndef Q_OS_WIN
dirs.removeAll(QLatin1String("backslashes"));
#endif
+#ifndef Q_OS_MACOS
+ dirs.removeAll(QLatin1String("parseobjc"));
+#endif
for (const QString &dir : qAsConst(dirs))
QTest::newRow(dir.toLocal8Bit()) << dir;