diff options
Diffstat (limited to 'tests/unit/unittest/gtest-qt-printing.h')
-rw-r--r-- | tests/unit/unittest/gtest-qt-printing.h | 74 |
1 files changed, 7 insertions, 67 deletions
diff --git a/tests/unit/unittest/gtest-qt-printing.h b/tests/unit/unittest/gtest-qt-printing.h index 12238e90828..8e050ce3ad3 100644 --- a/tests/unit/unittest/gtest-qt-printing.h +++ b/tests/unit/unittest/gtest-qt-printing.h @@ -23,78 +23,18 @@ ** ****************************************************************************/ -#include <QString> -#include <QDebug> - -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#endif - -#ifdef CLANG_UNIT_TESTS -#include <clang/Basic/SourceLocation.h> -#include <clang/Basic/SourceManager.h> -#endif - -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif +#pragma once -#include <gtest/gtest-printers.h> +#include <QtGlobal> -#include <iostream> - -#pragma once +#include <iosfwd> QT_BEGIN_NAMESPACE class QVariant; -inline void PrintTo(const QVariant &variant, ::std::ostream *os) -{ - QString output; - QDebug debug(&output); - - debug << variant; - - *os << output.toUtf8().constData(); -} - -inline void PrintTo(const QString &text, ::std::ostream *os) -{ - *os << text.toUtf8().constData(); -} +class QString; +void PrintTo(const QVariant &variant, ::std::ostream *os); +void PrintTo(const QString &text, ::std::ostream *os); +void PrintTo(const QByteArray &byteArray, ::std::ostream *os); QT_END_NAMESPACE - -#ifdef CLANG_UNIT_TESTS -namespace clang { - -inline -std::ostream &operator<<(std::ostream &out, const StringRef stringReference) -{ - out.write(stringReference.data(), std::streamsize(stringReference.size())); - - return out; -} - -inline void PrintTo(const clang::FullSourceLoc &sourceLocation, ::std::ostream *os) -{ - auto &&sourceManager = sourceLocation.getManager(); - auto fileName = sourceManager.getFileEntryForID(sourceLocation.getFileID())->getName(); - - *os << "SourceLocation(\"" - << fileName << ", " - << sourceLocation.getSpellingLineNumber() << ", " - << sourceLocation.getSpellingColumnNumber() << ")"; -} - -} -#endif - -//namespace testing { -//namespace internal { - -// void PrintTo(const QVariant &variant, ::std::ostream *os); - -//} -//} |