Browse Source

Tests/QtAutogen: Test same moc/qrc source names in different directories

Sebastian Holtermann 9 years ago
parent
commit
e4f508e423

+ 4 - 0
Tests/QtAutogen/CMakeLists.txt

@@ -110,6 +110,10 @@ set_target_properties(
   AUTOMOC TRUE
 )
 
+# Test AUTOMOC and AUTORCC on source files with the same name
+# but in different subdirectories
+add_subdirectory(sameName)
+
 include(GenerateExportHeader)
 # The order is relevant here. B depends on A, and B headers depend on A
 # headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we

+ 21 - 0
Tests/QtAutogen/sameName/CMakeLists.txt

@@ -0,0 +1,21 @@
+# Test AUTOMOC and AUTORCC on source files with the same name
+# but in different subdirectories
+
+add_executable(sameName
+  aaa/bbb/item.cpp
+  aaa/bbb/data.qrc
+  aaa/item.cpp
+  aaa/data.qrc
+  bbb/aaa/item.cpp
+  bbb/aaa/data.qrc
+  bbb/item.cpp
+  bbb/data.qrc
+  ccc/item.cpp
+  ccc/data.qrc
+  item.cpp
+  data.qrc
+  main.cpp
+)
+target_include_directories(sameName PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
+target_link_libraries(sameName ${QT_LIBRARIES})
+set_target_properties( sameName PROPERTIES AUTOMOC TRUE AUTORCC TRUE )

+ 6 - 0
Tests/QtAutogen/sameName/aaa/bbb/data.qrc

@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="aaa/bbb">
+  <file>item.hpp</file>
+  <file>item.cpp</file>
+</qresource>
+</RCC>

+ 10 - 0
Tests/QtAutogen/sameName/aaa/bbb/item.cpp

@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace aaa {
+namespace bbb {
+
+void Item::go()
+{
+}
+}
+}

+ 18 - 0
Tests/QtAutogen/sameName/aaa/bbb/item.hpp

@@ -0,0 +1,18 @@
+#ifndef AAA_BBB_ITEM_HPP
+#define AAA_BBB_ITEM_HPP
+
+#include <QObject>
+
+namespace aaa {
+namespace bbb {
+
+class Item : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+}
+}
+
+#endif

+ 6 - 0
Tests/QtAutogen/sameName/aaa/data.qrc

@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="aaa/">
+  <file>item.hpp</file>
+  <file>item.cpp</file>
+</qresource>
+</RCC>

+ 8 - 0
Tests/QtAutogen/sameName/aaa/item.cpp

@@ -0,0 +1,8 @@
+#include "item.hpp"
+
+namespace aaa {
+
+void Item::go()
+{
+}
+}

+ 16 - 0
Tests/QtAutogen/sameName/aaa/item.hpp

@@ -0,0 +1,16 @@
+#ifndef AAA_ITEM_HPP
+#define AAA_ITEM_HPP
+
+#include <QObject>
+
+namespace aaa {
+
+class Item : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+}
+
+#endif

+ 6 - 0
Tests/QtAutogen/sameName/bbb/aaa/data.qrc

@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="bbb/aaa/">
+  <file>item.hpp</file>
+  <file>item.cpp</file>
+</qresource>
+</RCC>

+ 10 - 0
Tests/QtAutogen/sameName/bbb/aaa/item.cpp

@@ -0,0 +1,10 @@
+#include "item.hpp"
+
+namespace bbb {
+namespace aaa {
+
+void Item::go()
+{
+}
+}
+}

+ 18 - 0
Tests/QtAutogen/sameName/bbb/aaa/item.hpp

@@ -0,0 +1,18 @@
+#ifndef BBB_AAA_ITEM_HPP
+#define BBB_AAA_ITEM_HPP
+
+#include <QObject>
+
+namespace bbb {
+namespace aaa {
+
+class Item : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+}
+}
+
+#endif

+ 6 - 0
Tests/QtAutogen/sameName/bbb/data.qrc

@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="bbb/">
+  <file>item.hpp</file>
+  <file>item.cpp</file>
+</qresource>
+</RCC>

+ 8 - 0
Tests/QtAutogen/sameName/bbb/item.cpp

@@ -0,0 +1,8 @@
+#include "item.hpp"
+
+namespace bbb {
+
+void Item::go()
+{
+}
+}

+ 16 - 0
Tests/QtAutogen/sameName/bbb/item.hpp

@@ -0,0 +1,16 @@
+#ifndef BBB_ITEM_HPP
+#define BBB_ITEM_HPP
+
+#include <QObject>
+
+namespace bbb {
+
+class Item : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+}
+
+#endif

+ 6 - 0
Tests/QtAutogen/sameName/ccc/data.qrc

@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="ccc/">
+  <file>item.hpp</file>
+  <file>item.cpp</file>
+</qresource>
+</RCC>

+ 23 - 0
Tests/QtAutogen/sameName/ccc/item.cpp

@@ -0,0 +1,23 @@
+#include "item.hpp"
+
+namespace ccc {
+
+void Item::go()
+{
+}
+
+class MocTest : public QObject
+{
+  Q_OBJECT;
+  Q_SLOT
+  void go();
+};
+
+void MocTest::go()
+{
+}
+}
+
+// Include own moc files
+#include "item.moc"
+#include "moc_item.cpp"

+ 16 - 0
Tests/QtAutogen/sameName/ccc/item.hpp

@@ -0,0 +1,16 @@
+#ifndef CCC_ITEM_HPP
+#define CCC_ITEM_HPP
+
+#include <QObject>
+
+namespace ccc {
+
+class Item : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+}
+
+#endif

+ 5 - 0
Tests/QtAutogen/sameName/data.qrc

@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+  <file>main.cpp</file>
+</qresource>
+</RCC>

+ 5 - 0
Tests/QtAutogen/sameName/item.cpp

@@ -0,0 +1,5 @@
+#include "item.hpp"
+
+void Item::go()
+{
+}

+ 13 - 0
Tests/QtAutogen/sameName/item.hpp

@@ -0,0 +1,13 @@
+#ifndef ITEM_HPP
+#define ITEM_HPP
+
+#include <QObject>
+
+class Item : public QObject
+{
+  Q_OBJECT
+  Q_SLOT
+  void go();
+};
+
+#endif

+ 16 - 0
Tests/QtAutogen/sameName/main.cpp

@@ -0,0 +1,16 @@
+#include "aaa/bbb/item.hpp"
+#include "aaa/item.hpp"
+#include "bbb/aaa/item.hpp"
+#include "bbb/item.hpp"
+#include "ccc/item.hpp"
+
+int main(int argv, char** args)
+{
+  // Object instances
+  ::aaa::Item aaa_item;
+  ::aaa::bbb::Item aaa_bbb_item;
+  ::bbb::Item bbb_item;
+  ::bbb::aaa::Item bbb_aaa_item;
+  ::ccc::Item ccc_item;
+  return 0;
+}