summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lupdate
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-04-15 14:06:46 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-04-15 15:08:54 +0200
commite6ad150805cc64db20d3ff3ae5fe2d356c04913b (patch)
tree0b3b6ea949c5a42005d564b79b1783b935f1a85e /tests/auto/linguist/lupdate
parent830f1db786de48d34b16905086220a6ac28a0203 (diff)
parent1b992406a6523a144c58baa9bbd1198bb9a2d98c (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: a bunch of .pro and configure.json file adjustments and some conflicting cherry-picks from dev -> 5.15 that are merged into dev again src/assistant/assistant/main.cpp Change-Id: I174c00b6a300c6d46c4e081bdcb2f15f23ae9ef2
Diffstat (limited to 'tests/auto/linguist/lupdate')
-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 b2ced9df8..ac6e4db2b 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;