diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-03 16:08:08 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-04 16:16:45 (GMT) |
commit | df12ef0e1fa327103b09e9a817d83b8c8d3035d7 (patch) | |
tree | 220179f8e96da96a87202e4ded868d67b2e161f9 /tests/auto/linguist | |
parent | 7a0b728452c099934dbe7860c3614dfdc4373a9c (diff) | |
download | Qt-df12ef0e1fa327103b09e9a817d83b8c8d3035d7.zip Qt-df12ef0e1fa327103b09e9a817d83b8c8d3035d7.tar.gz Qt-df12ef0e1fa327103b09e9a817d83b8c8d3035d7.tar.bz2 |
fix bogus "Class '<foo>' lacks Q_OBJECT macro"
the optimization not to look for parent definitions if we already knew
that there would be none did not consider that we only know that the
leaf node is missing, not any intermediate nodes.
Diffstat (limited to 'tests/auto/linguist')
3 files changed, 97 insertions, 0 deletions
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp index eaa271a..d720b8f 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.cpp @@ -63,3 +63,33 @@ line c++ comment } (with brace) #define This is another // comment in } define \ something } comment } // complain here + + + +// Nested class in same file +class TopLevel { + Q_OBJECT + + class Nested; +}; + +class TopLevel::Nested { + void foo(); +}; + +TopLevel::Nested::foo() +{ + TopLevel::tr("TopLevel"); +} + +// Nested class in other file +#include "main.h" + +class TopLevel2::Nested { + void foo(); +}; + +TopLevel2::Nested::foo() +{ + TopLevel2::tr("TopLevel2"); +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h new file mode 100644 index 0000000..54a76ab --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/main.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module 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$ +** +****************************************************************************/ + +// IMPORTANT!!!! If you want to add testdata to this file, +// always add it to the end in order to not change the linenumbers of translations!!! + +class TopLevel2 { + Q_OBJECT + + class Nested; +}; + + diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result index 07a7469..ef5adb2 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp2/project.ts.result @@ -1,4 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.0"> +<context> + <name>TopLevel</name> + <message> + <location filename="main.cpp" line="82"/> + <source>TopLevel</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>TopLevel2</name> + <message> + <location filename="main.cpp" line="94"/> + <source>TopLevel2</source> + <translation type="unfinished"></translation> + </message> +</context> </TS> |