From fae95d5da36f4011525a96b69187805db770e04a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 25 Oct 2013 17:00:17 +0200 Subject: Test that Qt tools can handle ' as a digit separator. Change-Id: I0a3446d02184989c32367e66d4f5d9e464a56ec6 Reviewed-by: Thiago Macieira --- tests/auto/tools/moc/moc.pro | 3 +- .../tools/moc/single-quote-digit-separator-n3781.h | 58 ++++++++++++++++++++++ tests/auto/tools/qdbuscpp2xml/test1.h | 11 ++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 tests/auto/tools/moc/single-quote-digit-separator-n3781.h (limited to 'tests') diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index 0d25131c47..779e992881 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -23,7 +23,8 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n forward-declared-param.h \ parse-defines.h \ function-with-attributes.h \ - plugin_metadata.h + plugin_metadata.h \ + single-quote-digit-separator-n3781.h if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h diff --git a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h new file mode 100644 index 0000000000..0b234011d5 --- /dev/null +++ b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +class KDAB : public QObject +{ + Q_OBJECT +public: + // C++1y allows use of single quote as a digit separator, useful for large + // numbers. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf + // Ensure that moc does not get confused with this. + enum Salaries { + Steve +#ifdef Q_MOC_RUN + = 1'234'567 +#endif + }; + Q_ENUMS(Salaries) +}; diff --git a/tests/auto/tools/qdbuscpp2xml/test1.h b/tests/auto/tools/qdbuscpp2xml/test1.h index d4a7d1dab3..b08115e193 100644 --- a/tests/auto/tools/qdbuscpp2xml/test1.h +++ b/tests/auto/tools/qdbuscpp2xml/test1.h @@ -54,7 +54,18 @@ class Test1 : public QObject Q_CLASSINFO("D-Bus Interface", "org.qtProject.qdbuscpp2xmlTests.Test1") Q_PROPERTY(int numProperty1 READ numProperty1 CONSTANT) Q_PROPERTY(int numProperty2 READ numProperty2 WRITE setNumProperty2) + Q_ENUMS(Salaries) public: + // C++1y allows use of single quote as a digit separator, useful for large + // numbers. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf + // Ensure that qdbuscpp2xml does not get confused with this appearing. + enum Salaries { + Steve +#ifdef Q_MOC_RUN + = 1'234'567 +#endif + }; + Test1(QObject *parent = 0) : QObject(parent) {} int numProperty1() { return 42; } -- cgit v1.2.3