Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package qt6-grpc for openSUSE:Factory checked in at 2024-10-03 17:37:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/qt6-grpc (Old) and /work/SRC/openSUSE:Factory/.qt6-grpc.new.19354 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qt6-grpc" Thu Oct 3 17:37:31 2024 rev:14 rq:1205125 version:6.7.3 Changes: -------- --- /work/SRC/openSUSE:Factory/qt6-grpc/qt6-grpc.changes 2024-07-02 18:17:11.161035696 +0200 +++ /work/SRC/openSUSE:Factory/.qt6-grpc.new.19354/qt6-grpc.changes 2024-10-03 17:37:50.821884093 +0200 @@ -1,0 +2,6 @@ +Sat Sep 28 08:22:57 UTC 2024 - Christophe Marin <christo...@krop.fr> + +- Update to 6.7.3 + * https://www.qt.io/blog/qt-6.7.3-released + +------------------------------------------------------------------- Old: ---- qtgrpc-everywhere-src-6.7.2.tar.xz New: ---- qtgrpc-everywhere-src-6.7.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ qt6-grpc.spec ++++++ --- /var/tmp/diff_new_pack.24lYfN/_old 2024-10-03 17:37:51.477911494 +0200 +++ /var/tmp/diff_new_pack.24lYfN/_new 2024-10-03 17:37:51.481911661 +0200 @@ -16,7 +16,7 @@ # -%define real_version 6.7.2 +%define real_version 6.7.3 %define short_version 6.7 %define short_name qtgrpc %define tar_name qtgrpc-everywhere-src @@ -28,7 +28,7 @@ %endif Name: qt6-grpc%{?pkg_suffix} -Version: 6.7.2 +Version: 6.7.3 Release: 0 Summary: gRPC and Protobuf generator and bindings for Qt framework License: GPL-3.0-or-later ++++++ qtgrpc-everywhere-src-6.7.2.tar.xz -> qtgrpc-everywhere-src-6.7.3.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/.cmake.conf new/qtgrpc-everywhere-src-6.7.3/.cmake.conf --- old/qtgrpc-everywhere-src-6.7.2/.cmake.conf 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/.cmake.conf 2024-09-19 20:58:41.000000000 +0200 @@ -1,4 +1,4 @@ -set(QT_REPO_MODULE_VERSION "6.7.2") +set(QT_REPO_MODULE_VERSION "6.7.3") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_LEAN_HEADERS=1") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/.tag new/qtgrpc-everywhere-src-6.7.3/.tag --- old/qtgrpc-everywhere-src-6.7.2/.tag 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/.tag 2024-09-19 20:58:41.000000000 +0200 @@ -1 +1 @@ -2d93de389eb25c14267c45df031951a4e9eefbfb +8b7193ab0d86e090d43422056d0864c4e5bece70 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/dependencies.yaml new/qtgrpc-everywhere-src-6.7.3/dependencies.yaml --- old/qtgrpc-everywhere-src-6.7.2/dependencies.yaml 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/dependencies.yaml 2024-09-19 20:58:41.000000000 +0200 @@ -1,7 +1,7 @@ dependencies: ../qtbase: - ref: b5fbe0923cfc566036b83c3d968f225b26117efc + ref: 92b685784960eea6eb353688cf0edeb94d69c6cd required: true ../qtdeclarative: - ref: 12533cc0bd83a2076efb4af0bc1832b0db9568fc + ref: 34ffe0c15a9564fefcf01a738eb0bde370399959 required: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/grpc/qgrpchttp2channel.cpp new/qtgrpc-everywhere-src-6.7.3/src/grpc/qgrpchttp2channel.cpp --- old/qtgrpc-everywhere-src-6.7.2/src/grpc/qgrpchttp2channel.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/grpc/qgrpchttp2channel.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -15,6 +15,7 @@ #include <QtCore/qlist.h> #include <QtCore/qqueue.h> #include <QtNetwork/private/hpack_p.h> +#include <QtNetwork/private/http2protocol_p.h> #include <QtNetwork/private/qhttp2connection_p.h> #include <QtNetwork/qlocalsocket.h> #include <QtNetwork/qtcpsocket.h> @@ -68,8 +69,44 @@ constexpr QByteArrayView GrpcStatusHeader("grpc-status"); constexpr QByteArrayView GrpcStatusMessageHeader("grpc-message"); constexpr qsizetype GrpcMessageSizeHeaderSize = 5; + +// This HTTP/2 Error Codes to QGrpcStatus::StatusCode mapping should be kept in sync +// with the following docs: +// https://www.rfc-editor.org/rfc/rfc7540#section-7 +// https://github.com/grpc/grpc/blob/master/doc/statuscodes.md +// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md +constexpr QGrpcStatus::StatusCode http2ErrorToStatusCode(const quint32 http2Error) +{ + using StatusCode = QGrpcStatus::StatusCode; + using Http2Error = Http2::Http2Error; + switch (http2Error) { + case Http2Error::HTTP2_NO_ERROR: + case Http2Error::PROTOCOL_ERROR: + case Http2Error::INTERNAL_ERROR: + case Http2Error::FLOW_CONTROL_ERROR: + case Http2Error::SETTINGS_TIMEOUT: + case Http2Error::STREAM_CLOSED: + case Http2Error::FRAME_SIZE_ERROR: + return StatusCode::Internal; + case Http2Error::REFUSE_STREAM: + return StatusCode::Unavailable; + case Http2Error::CANCEL: + return StatusCode::Cancelled; + case Http2Error::COMPRESSION_ERROR: + case Http2Error::CONNECT_ERROR: + return StatusCode::Internal; + case Http2Error::ENHANCE_YOUR_CALM: + return StatusCode::ResourceExhausted; + case Http2Error::INADEQUATE_SECURITY: + return StatusCode::PermissionDenied; + case Http2Error::HTTP_1_1_REQUIRED: + return StatusCode::Unknown; + } + return StatusCode::Internal; } +} // namespace + class QGrpcSocketHandler; struct QGrpcHttp2ChannelPrivate : public QObject @@ -176,10 +213,6 @@ return typedSocket; } - // This QNetworkReply::NetworkError -> QGrpcStatus::StatusCode mapping should be kept in sync - // with original https://github.com/grpc/grpc/blob/master/doc/statuscodes.md - static std::unordered_map<quint32, QGrpcStatus::StatusCode> StatusCodeMap; - QGrpcChannelOptions m_channelOptions; std::unique_ptr<QIODevice> m_socket = nullptr; QHttp2Connection *m_connection = nullptr; @@ -288,50 +321,9 @@ processQueue(); } -std::unordered_map<quint32, QGrpcStatus::StatusCode> QGrpcHttp2ChannelPrivate::StatusCodeMap; - QGrpcHttp2ChannelPrivate::QGrpcHttp2ChannelPrivate(const QGrpcChannelOptions &options) : m_channelOptions(options) { - [[maybe_unused]] static bool statusCodeMapInitialized = []() -> bool { - QGrpcHttp2ChannelPrivate::StatusCodeMap = { - { QNetworkReply::ConnectionRefusedError, QGrpcStatus::Unavailable }, - { QNetworkReply::RemoteHostClosedError, QGrpcStatus::Unavailable }, - { QNetworkReply::HostNotFoundError, QGrpcStatus::Unavailable }, - { QNetworkReply::TimeoutError, QGrpcStatus::DeadlineExceeded }, - { QNetworkReply::OperationCanceledError, QGrpcStatus::Unavailable }, - { QNetworkReply::SslHandshakeFailedError, QGrpcStatus::PermissionDenied }, - { QNetworkReply::TemporaryNetworkFailureError, QGrpcStatus::Unknown }, - { QNetworkReply::NetworkSessionFailedError, QGrpcStatus::Unavailable }, - { QNetworkReply::BackgroundRequestNotAllowedError, QGrpcStatus::Unknown }, - { QNetworkReply::TooManyRedirectsError, QGrpcStatus::Unavailable }, - { QNetworkReply::InsecureRedirectError, QGrpcStatus::PermissionDenied }, - { QNetworkReply::UnknownNetworkError, QGrpcStatus::Unknown }, - { QNetworkReply::ProxyConnectionRefusedError, QGrpcStatus::Unavailable }, - { QNetworkReply::ProxyConnectionClosedError, QGrpcStatus::Unavailable }, - { QNetworkReply::ProxyNotFoundError, QGrpcStatus::Unavailable }, - { QNetworkReply::ProxyTimeoutError, QGrpcStatus::DeadlineExceeded }, - { QNetworkReply::ProxyAuthenticationRequiredError, QGrpcStatus::Unauthenticated }, - { QNetworkReply::UnknownProxyError, QGrpcStatus::Unknown }, - { QNetworkReply::ContentAccessDenied, QGrpcStatus::PermissionDenied }, - { QNetworkReply::ContentOperationNotPermittedError, QGrpcStatus::PermissionDenied }, - { QNetworkReply::ContentNotFoundError, QGrpcStatus::NotFound }, - { QNetworkReply::AuthenticationRequiredError, QGrpcStatus::PermissionDenied }, - { QNetworkReply::ContentReSendError, QGrpcStatus::DataLoss }, - { QNetworkReply::ContentConflictError, QGrpcStatus::InvalidArgument }, - { QNetworkReply::ContentGoneError, QGrpcStatus::DataLoss }, - { QNetworkReply::UnknownContentError, QGrpcStatus::Unknown }, - { QNetworkReply::ProtocolUnknownError, QGrpcStatus::Unknown }, - { QNetworkReply::ProtocolInvalidOperationError, QGrpcStatus::Unimplemented }, - { QNetworkReply::ProtocolFailure, QGrpcStatus::Unknown }, - { QNetworkReply::InternalServerError, QGrpcStatus::Internal }, - { QNetworkReply::OperationNotImplementedError, QGrpcStatus::Unimplemented }, - { QNetworkReply::ServiceUnavailableError, QGrpcStatus::Unavailable }, - { QNetworkReply::UnknownServerError, QGrpcStatus::Unknown } - }; - return true; - }(); - QUrl url = m_channelOptions.host(); if (url.scheme() == "unix"_L1) { auto *localSocket = initSocket<QLocalSocket>(); @@ -358,8 +350,17 @@ url.setPort(443); } - if (options.sslConfiguration()) - sslSocket->setSslConfiguration(options.sslConfiguration().value()); + if (const auto userSslConfig = options.sslConfiguration(); userSslConfig) { + sslSocket->setSslConfiguration(*userSslConfig); + } else { + static const QByteArray h2NexProtocol = "h2"_ba; + auto defautlSslConfig = QSslConfiguration::defaultConfiguration(); + auto allowedNextProtocols = defautlSslConfig.allowedNextProtocols(); + if (!allowedNextProtocols.contains(h2NexProtocol)) + allowedNextProtocols.append(h2NexProtocol); + defautlSslConfig.setAllowedNextProtocols(allowedNextProtocols); + sslSocket->setSslConfiguration(defautlSslConfig); + } QObject::connect(sslSocket, &QSslSocket::encrypted, this, &QGrpcHttp2ChannelPrivate::createHttp2Connection); @@ -524,16 +525,14 @@ }); QObject::connect(handler->stream.get(), &QHttp2Stream::errorOccurred, channelOpPtr, - [this, channelOpPtr, handler](quint32 errorCode, const QString &errorString) { + [this, channelOpPtr, handler](quint32 http2ErrorCode, const QString &errorString) { deleteHandler(handler); - if (errorCode == 0) { + // Check for HTTP2_NO_ERROR to avoid invalid error emission. + // This is fixed in Qt6.8 + if (http2ErrorCode == 0) { return; } - QGrpcStatus::StatusCode code = QGrpcStatus::Unknown; - const auto it = StatusCodeMap.find(errorCode); - if (it != StatusCodeMap.end()) { - code = it->second; - } + QGrpcStatus::StatusCode code = http2ErrorToStatusCode(http2ErrorCode); emit channelOpPtr->errorOccurred({ code, errorString }); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/grpcquick/qqmlabstractgrpcchannel.h new/qtgrpc-everywhere-src-6.7.3/src/grpcquick/qqmlabstractgrpcchannel.h --- old/qtgrpc-everywhere-src-6.7.2/src/grpcquick/qqmlabstractgrpcchannel.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/grpcquick/qqmlabstractgrpcchannel.h 2024-09-19 20:58:41.000000000 +0200 @@ -4,10 +4,11 @@ #ifndef QQMLABSTRACTGRPCCHANNEL_H #define QQMLABSTRACTGRPCCHANNEL_H -#include <QtCore/qobject.h> #include <QtGrpc/qabstractgrpcchannel.h> #include <QtGrpcQuick/qtgrpcquickexports.h> +#include <QtCore/qobject.h> + #include <memory> QT_BEGIN_NAMESPACE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/grpcquick/qqmlgrpchttp2channel.cpp new/qtgrpc-everywhere-src-6.7.3/src/grpcquick/qqmlgrpchttp2channel.cpp --- old/qtgrpc-everywhere-src-6.7.2/src/grpcquick/qqmlgrpchttp2channel.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/grpcquick/qqmlgrpchttp2channel.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -5,6 +5,8 @@ #include <QtGrpc/qabstractgrpcclient.h> #include <QtGrpc/qgrpchttp2channel.h> +#include <QtCore/qdebug.h> + QT_BEGIN_NAMESPACE QQmlGrpcHttp2Channel::QQmlGrpcHttp2Channel(QObject *parent) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/protobuf/doc/src/qt_add_protobuf.qdoc new/qtgrpc-everywhere-src-6.7.3/src/protobuf/doc/src/qt_add_protobuf.qdoc --- old/qtgrpc-everywhere-src-6.7.2/src/protobuf/doc/src/qt_add_protobuf.qdoc 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/protobuf/doc/src/qt_add_protobuf.qdoc 2024-09-19 20:58:41.000000000 +0200 @@ -6,7 +6,7 @@ \ingroup cmake-commands-qtprotobuf \title qt_add_protobuf -\target qt6_add_protobuf +\keyword qt6_add_protobuf \summary {Generates Qt-based C++ source code using a protobuf schema} \preliminarycmakecommand \cmakecommandsince 6.5 @@ -39,8 +39,7 @@ \include qtprotoccommon-options.qdocinc 0 \li \c QML enables QProtobufMessage types in QML context by registering them as a QML module. - Protobuf types can extend an existing QML module. - See code examples: + Protobuf types can extend an existing QML module: \badcode qt_add_qml_module(targetname ... @@ -52,6 +51,11 @@ ) \endcode + If \c qt_add_protobuf is called with a non-existing target + or the target is not a QML module, a new QML module will be created + implicitly. In case of the new QML module creation, the + \l {qt_add_qml_module} command is called inside the + \c qt_add_protobuf command. \badcode qt_add_executable(targetname ... @@ -62,12 +66,11 @@ ... ) \endcode - If \c qt_add_protobuf is called with a non-existing target - or the target is not a QML module, a new QML module will be created - implicitly. In case of the new QML module creation, the - \l {qt_add_qml_module} command is called inside the - \c qt_add_protobuf command. - See code example: + Every QML module has to define a \c URI name. Other QML modules may + use this name in \l{qtqml-syntax-imports.html}{import statements} + to import the module into a user application. Use the \c QML_URI + option to set the \c URI name. It has to be specified in dotted + notation, e.g. \c {Qt.Protobuf.Package}. \badcode qt_add_executable(targetname ... @@ -78,11 +81,6 @@ QML_URI proto.uri.example ) \endcode - Every QML module has to define a \c URI name. Other QML modules may - use this name in \l{qtqml-syntax-imports.html}{import statements} - to import the module into a user application. Use the \c QML_URI - option to set the \c URI name. It has to be specified in dotted - notation, e.g. \c {Qt.Protobuf.Package}. If \c QML_URI is omitted, then the protobuf package name will be used as the module \c URI. \note If \c QML_URI is passed to \c qt_add_protobuf command @@ -109,6 +107,7 @@ The project may have two or more \c .proto files with dependencies: \badcode +// test_messages.proto syntax = "proto3"; package test.messages; @@ -119,6 +118,7 @@ \endcode \badcode +// test_extensions.proto syntax = "proto3"; import "test_messages.proto"; @@ -153,10 +153,12 @@ target_link_libraries(test_extensions PUBLIC test_messages) \endcode -\note It's recommended to use the \c PUBLIC linking scope, since messages from -\c test_messages target are referenced in header files that belong to -the \c test_extensions target, so targets that link to \c test_extensions should -have the \c test_messages target as a transitive dependency. +\note Messages from \c test_messages target are used in header files that belong +to the \c test_extensions target, so targets that link to \c test_extensions +should have the \c test_messages target as a transitive dependency. It's +recommended to use the \c PUBLIC linking scope, to have the proper +\c INTERFACE_INCLUDE_DIRECTORIES and \c INTERFACE_LINK_LIBRARIES properties for +protobuf library targets. \section1 Example diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/protobuf/qprotobufjsonserializer.cpp new/qtgrpc-everywhere-src-6.7.3/src/protobuf/qprotobufjsonserializer.cpp --- old/qtgrpc-everywhere-src-6.7.2/src/protobuf/qprotobufjsonserializer.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/protobuf/qprotobufjsonserializer.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -34,20 +34,6 @@ \l {The qtprotobufgen Tool} {qtprotobufgen} directly. */ - -/*! - \fn QAbstractProtobufSerializer::DeserializationError QProtobufJsonSerializer::deserializationError() const - - Returns the last deserialization error. -*/ - -/*! - \fn QString QProtobufJsonSerializer::deserializationErrorString() const - - Returns a human-readable string describing the last deserialization error. - If there was no error, an empty string is returned. -*/ - using namespace Qt::StringLiterals; using namespace QtProtobufPrivate; @@ -600,12 +586,20 @@ QProtobufJsonSerializer::~QProtobufJsonSerializer() = default; +/*! + Returns the last deserialization error for the serializer instance. + \sa deserializationErrorString() +*/ QAbstractProtobufSerializer::DeserializationError QProtobufJsonSerializer::deserializationError() const { return d_ptr->deserializationError; } +/*! + Returns the last deserialization error string for the serializer instance. + \sa deserializationError() +*/ QString QProtobufJsonSerializer::deserializationErrorString() const { return d_ptr->deserializationErrorString; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/protobuf/qprotobufserializer.cpp new/qtgrpc-everywhere-src-6.7.3/src/protobuf/qprotobufserializer.cpp --- old/qtgrpc-everywhere-src-6.7.2/src/protobuf/qprotobufserializer.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/protobuf/qprotobufserializer.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -80,19 +80,6 @@ \l {The qtprotobufgen Tool} {qtprotobufgen} directly. */ -/*! - \fn QProtobufSerializer::DeserializationError QProtobufSerializer::deserializationError() const - - Returns the last deserialization error. -*/ - -/*! - \fn QString QProtobufSerializer::deserializationErrorString() const - - Returns a human-readable string describing the last deserialization error. - If there was no error, an empty string is returned. -*/ - using namespace Qt::StringLiterals; using namespace QtProtobufPrivate; @@ -772,11 +759,19 @@ return it == last; } +/*! + Returns the last deserialization error for the serializer instance. + \sa deserializationErrorString() +*/ QAbstractProtobufSerializer::DeserializationError QProtobufSerializer::deserializationError() const { return d_ptr->deserializationError; } +/*! + Returns the last deserialization error string for the serializer instance. + \sa deserializationError() +*/ QString QProtobufSerializer::deserializationErrorString() const { return d_ptr->deserializationErrorString; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/protobufqttypes/protobufqtguitypes/qtprotobufqtguitypesglobal.h new/qtgrpc-everywhere-src-6.7.3/src/protobufqttypes/protobufqtguitypes/qtprotobufqtguitypesglobal.h --- old/qtgrpc-everywhere-src-6.7.2/src/protobufqttypes/protobufqtguitypes/qtprotobufqtguitypesglobal.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/protobufqttypes/protobufqtguitypes/qtprotobufqtguitypesglobal.h 2024-09-19 20:58:41.000000000 +0200 @@ -2,10 +2,10 @@ // Copyright (C) 2019 Alexey Edelev <semla...@gmail.com> // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef QTPROTOBUFQTTYPESGLOBAL_H -#define QTPROTOBUFQTTYPESGLOBAL_H +#ifndef QTPROTOBUFQTGUITYPESGLOBAL_H +#define QTPROTOBUFQTGUITYPESGLOBAL_H #include <QtProtobufQtGuiTypes/qtprotobufqtguitypesexports.h> #include <QtCore/qglobal.h> -#endif // QTPROTOBUFQTTYPESGLOBAL_H +#endif // QTPROTOBUFQTGUITYPESGLOBAL_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake new/qtgrpc-everywhere-src-6.7.3/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake --- old/qtgrpc-everywhere-src-6.7.2/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake 2024-09-19 20:58:41.000000000 +0200 @@ -51,6 +51,11 @@ endforeach() endmacro() +# Returns the generator target name according to the pre-defined pattern +function(_qt_internal_get_generator_dep_target_name out_var target generator dep_index) + set(${out_var} "${target}_${generator}_deps_${dep_index}" PARENT_SCOPE) +endfunction() + # The base function that generates rules to call the protoc executable with the custom generator # plugin. # Multi-value Arguments: @@ -96,7 +101,7 @@ if(NOT num_deps) set(num_deps 0) endif() - set(deps_target ${target}_${generator}_deps_${num_deps}) + _qt_internal_get_generator_dep_target_name(deps_target ${target} ${generator} ${num_deps}) math(EXPR num_deps "${num_deps} + 1") set(generator_file $<TARGET_FILE:${QT_CMAKE_EXPORT_NAMESPACE}::${generator}>) @@ -172,6 +177,7 @@ DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::${generator} ${proto_files} + $<TARGET_FILE:WrapProtoc::WrapProtoc> COMMENT "Generating QtProtobuf ${target} sources for ${generator}..." COMMAND_EXPAND_LISTS VERBATIM @@ -543,6 +549,7 @@ set(export_macro_file "${output_directory}/${export_macro_filename}") endif() + set_source_files_properties(${type_registrations} PROPERTIES SKIP_AUTOGEN ON) if(is_static OR (WIN32 AND NOT is_executable)) if(TARGET ${target}_protobuf_registration) target_sources(${target}_protobuf_registration PRIVATE ${type_registrations}) @@ -556,6 +563,17 @@ INTERFACE "$<TARGET_OBJECTS:$<TARGET_NAME:${target}_protobuf_registration>>") add_dependencies(${target} ${target}_protobuf_registration) + get_target_property(num_deps ${target} _qt_qtprotobufgen_deps_num) + if(num_deps) + # foreach includes the last element in the RANGE + math(EXPR num_deps "${num_deps} - 1") + foreach(i RANGE 0 ${num_deps}) + _qt_internal_get_generator_dep_target_name(deps_target ${target} + qtprotobufgen ${i}) + add_dependencies(${target}_protobuf_registration ${deps_target}) + endforeach() + endif() + target_include_directories(${target}_protobuf_registration PRIVATE "$<GENEX_EVAL:$<TARGET_PROPERTY:${target},INCLUDE_DIRECTORIES>>") target_link_libraries(${target}_protobuf_registration @@ -585,22 +603,37 @@ string(REPLACE "." "/" qml_module_output_path "${qml_uri}") set(qml_module_output_full_path "${CMAKE_CURRENT_BINARY_DIR}/${qml_module_output_path}") + if(NOT is_executable) + set(plugin_options PLUGIN_TARGET "${target}plugin") + endif() + qt_policy(SET QTP0001 NEW) qt6_add_qml_module(${target} URI ${qml_uri} - PLUGIN_TARGET "${target}plugin" + ${plugin_options} VERSION 1.0 OUTPUT_DIRECTORY "${qml_module_output_full_path}" - ) - set_target_properties(${target}plugin - PROPERTIES - AUTOMOC ON - ) - target_link_libraries(${target}plugin PRIVATE - ${QT_CMAKE_EXPORT_NAMESPACE}::Protobuf + OUTPUT_TARGETS qml_output_targets ) - list(APPEND ${arg_OUTPUT_TARGETS} ${target}plugin) + if(TARGET ${target}plugin) + set_target_properties(${target}plugin + PROPERTIES + AUTOMOC ON + ) + target_link_libraries(${target}plugin PRIVATE + ${QT_CMAKE_EXPORT_NAMESPACE}::Protobuf + ) + endif() + + if(DEFINED arg_OUTPUT_TARGETS) + if(qml_output_targets) + list(APPEND ${arg_OUTPUT_TARGETS} ${qml_output_targets}) + endif() + if(TARGET ${target}plugin) + list(APPEND ${arg_OUTPUT_TARGETS} "${target}plugin") + endif() + endif() endif() if(DEFINED arg_OUTPUT_HEADERS) @@ -608,6 +641,7 @@ endif() if(DEFINED arg_OUTPUT_TARGETS) + list(REMOVE_DUPLICATES ${arg_OUTPUT_TARGETS}) set(${arg_OUTPUT_TARGETS} "${${arg_OUTPUT_TARGETS}}" PARENT_SCOPE) endif() endfunction() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/src/tools/qtprotoccommon/commontemplates.cpp new/qtgrpc-everywhere-src-6.7.3/src/tools/qtprotoccommon/commontemplates.cpp --- old/qtgrpc-everywhere-src-6.7.2/src/tools/qtprotoccommon/commontemplates.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/src/tools/qtprotoccommon/commontemplates.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -488,14 +488,21 @@ const char *CommonTemplates::GetterMessageDeclarationTemplate() { return "bool has$property_name_cap$() const;\n" - "$getter_type$ &$property_name$() const;\n"; + "$getter_type$ &$property_name$();\n" + "const $getter_type$ &$property_name$() const;\n"; } const char *CommonTemplates::GetterMessageDefinitionTemplate() { return "bool $classname$::has$property_name_cap$() const\n{\n" " return dptr->m_$property_name$.operator bool();\n" "}\n\n" - "$getter_type$ &$classname$::$property_name$() const\n{\n" + "$getter_type$ &$classname$::$property_name$()\n" + "{\n" + " dptr.detach();\n" + " return *dptr->m_$property_name$;\n" + "}\n" + "const $getter_type$ &$classname$::$property_name$() const\n" + "{\n" " return *dptr->m_$property_name$;\n" "}\n\n"; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/grpc/client/bidirstream/tst_grpc_client_bidirstream.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/grpc/client/bidirstream/tst_grpc_client_bidirstream.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/grpc/client/bidirstream/tst_grpc_client_bidirstream.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/grpc/client/bidirstream/tst_grpc_client_bidirstream.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -44,9 +44,9 @@ stream->sendMessage(request); }); - QSignalSpy streamFinishedSpy(stream.get(), &QGrpcServerStream::finished); + QSignalSpy streamFinishedSpy(stream.get(), &QGrpcBidirStream::finished); QVERIFY(streamFinishedSpy.isValid()); - QSignalSpy streamErrorSpy(stream.get(), &QGrpcServerStream::errorOccurred); + QSignalSpy streamErrorSpy(stream.get(), &QGrpcBidirStream::errorOccurred); QVERIFY(streamErrorSpy.isValid()); QTRY_COMPARE_EQ_WITH_TIMEOUT(streamFinishedSpy.count(), 1, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/grpc/client/clientstream/tst_grpc_client_clientstream.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/grpc/client/clientstream/tst_grpc_client_clientstream.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/grpc/client/clientstream/tst_grpc_client_clientstream.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/grpc/client/clientstream/tst_grpc_client_clientstream.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -45,9 +45,9 @@ sendTimer.start(MessageLatency); - QSignalSpy streamFinishedSpy(stream.get(), &QGrpcServerStream::finished); + QSignalSpy streamFinishedSpy(stream.get(), &QGrpcClientStream::finished); QVERIFY(streamFinishedSpy.isValid()); - QSignalSpy streamErrorSpy(stream.get(), &QGrpcServerStream::errorOccurred); + QSignalSpy streamErrorSpy(stream.get(), &QGrpcClientStream::errorOccurred); QVERIFY(streamErrorSpy.isValid()); QTRY_COMPARE_EQ_WITH_TIMEOUT(streamFinishedSpy.count(), 1, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/grpc/client/shared/test_server/CMakeLists.txt new/qtgrpc-everywhere-src-6.7.3/tests/auto/grpc/client/shared/test_server/CMakeLists.txt --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/grpc/client/shared/test_server/CMakeLists.txt 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/grpc/client/shared/test_server/CMakeLists.txt 2024-09-19 20:58:41.000000000 +0200 @@ -28,7 +28,7 @@ --plugin=protoc-gen-grpc=$<TARGET_FILE:WrapgRPC::WrapgRPCPlugin> "${proto_files}" WORKING_DIRECTORY ${out_dir} - DEPENDS "${proto_files}" + DEPENDS "${proto_files}" $<TARGET_FILE:WrapProtoc::WrapProtoc> COMMENT "Generating gRPC ${target} sources..." COMMAND_EXPAND_LISTS VERBATIM diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobuf/basic/tst_protobuf_basictypes.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobuf/basic/tst_protobuf_basictypes.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobuf/basic/tst_protobuf_basictypes.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobuf/basic/tst_protobuf_basictypes.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -459,6 +459,11 @@ actual.testComplexField().setTestFieldString("AccessMessageFieldsFromGetter"); QCOMPARE(actual, expected); + + ComplexMessage actualCopy = actual; + actual.testComplexField().setTestFieldString("Ensure detach"); + + QCOMPARE_NE(actual, actualCopy); } void QtProtobufTypesGenerationTest::InvalidMessageConstructorTest() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobuf/shared/qtprotobuftestscommon.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobuf/shared/qtprotobuftestscommon.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobuf/shared/qtprotobuftestscommon.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobuf/shared/qtprotobuftestscommon.h 2024-09-19 20:58:41.000000000 +0200 @@ -9,7 +9,7 @@ #include <QTest> template<typename MessageType, typename PropertyType> -static void qProtobufAssertMessagePropertyRegistered(int fieldIndex, const char *propertyTypeName, const char *propertyName, bool skipMetatypeCheck = false) +static void qProtobufAssertMessagePropertyRegistered(int fieldIndex, const char *propertyTypeName, const char *propertyName) { // TODO: there should be(?) a mapping available: PropertyType -> propertyTypeName @@ -19,10 +19,8 @@ // Q_PROPERTY returns non-aliased type for the aliases defined using the 'using' keyword. // QCOMPARE(QLatin1String(propertyTypeName), QLatin1String(MessageType::staticMetaObject.property(propertyNumber).typeName())); Q_UNUSED(propertyTypeName) - if (!skipMetatypeCheck) { - QCOMPARE(QMetaType::fromType<PropertyType>(), - MessageType::staticMetaObject.property(propertyNumber).metaType()); - } + QCOMPARE(QMetaType::fromType<PropertyType>(), + MessageType::staticMetaObject.property(propertyNumber).metaType()); QCOMPARE(QLatin1String(MessageType::staticMetaObject.property(propertyNumber).name()), QLatin1String(propertyName)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/CMakeLists.txt new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/CMakeLists.txt --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/CMakeLists.txt 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/CMakeLists.txt 2024-09-19 20:58:41.000000000 +0200 @@ -7,6 +7,8 @@ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) endif() +get_target_property(protoc_version WrapProtoc::WrapProtoc _qt_internal_protobuf_version) + qt_internal_add_test(tst_qtprotobufgen SOURCES tst_qtprotobufgen.cpp @@ -45,10 +47,18 @@ ../shared/data/proto/mapmessages.proto ../shared/data/proto/oneofmessages.proto ../shared/data/proto/repeatedmessages.proto - ../shared/data/proto/optional.proto GENERATE_PACKAGE_SUBFOLDERS OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated/folder" ) + +if(protoc_version VERSION_GREATER_EQUAL "3.12") + qt_add_protobuf(tst_qtprotobufgen_gen + PROTO_FILES + ../shared/data/proto/optional.proto + GENERATE_PACKAGE_SUBFOLDERS + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/qt_protobuf_generated/folder" + ) +endif() qt_autogen_tools_initial_setup(tst_qtprotobufgen_gen) add_library(tst_qtprotobufgen_custom_exports_gen SHARED) @@ -81,7 +91,6 @@ target_compile_options(tst_qtprotobufgen_gen PRIVATE "-Wa,-mbig-obj") endif() -get_target_property(protoc_version WrapProtoc::WrapProtoc _qt_internal_protobuf_version) if(protoc_version VERSION_GREATER_EQUAL "3.12" AND protoc_version VERSION_LESS "3.15") qt_internal_extend_target(tst_qtprotobufgen DEFINES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -1967,7 +1967,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/custom-exports/basicmessages.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -712,7 +712,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -344,7 +344,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/extra-namespace/extranamespace.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -123,7 +123,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -390,7 +390,12 @@ return dptr->m_testFieldMessage.operator bool(); } -TestStringMessage &OptionalMessage::testFieldMessage() const +TestStringMessage &OptionalMessage::testFieldMessage() +{ + dptr.detach(); + return *dptr->m_testFieldMessage; +} +const TestStringMessage &OptionalMessage::testFieldMessage() const { return *dptr->m_testFieldMessage; } @@ -413,7 +418,12 @@ return dptr->m_testFieldMessageOpt.operator bool(); } -TestStringMessage &OptionalMessage::testFieldMessageOpt() const +TestStringMessage &OptionalMessage::testFieldMessageOpt() +{ + dptr.detach(); + return *dptr->m_testFieldMessageOpt; +} +const TestStringMessage &OptionalMessage::testFieldMessageOpt() const { return *dptr->m_testFieldMessageOpt; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/optional/tests/optional.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -123,11 +123,13 @@ QString testFieldStringOpt() const; bool hasTestFieldMessage() const; - TestStringMessage &testFieldMessage() const; + TestStringMessage &testFieldMessage(); + const TestStringMessage &testFieldMessage() const; void clearTestFieldMessage(); bool hasTestFieldMessageOpt() const; - TestStringMessage &testFieldMessageOpt() const; + TestStringMessage &testFieldMessageOpt(); + const TestStringMessage &testFieldMessageOpt() const; void clearTestFieldMessageOpt(); void setTestField(const QtProtobuf::sint32 &testField); void setTestFieldOpt(const QtProtobuf::sint32 &testFieldOpt); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -1967,7 +1967,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/folder/qtprotobufnamespace/tests/basicmessages.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -712,7 +712,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -1967,7 +1967,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-exports/basicmessages.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -711,7 +711,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -1967,7 +1967,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/basicmessages.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -711,7 +711,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -344,7 +344,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/extranamespace.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -123,7 +123,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -390,7 +390,12 @@ return dptr->m_testFieldMessage.operator bool(); } -TestStringMessage &OptionalMessage::testFieldMessage() const +TestStringMessage &OptionalMessage::testFieldMessage() +{ + dptr.detach(); + return *dptr->m_testFieldMessage; +} +const TestStringMessage &OptionalMessage::testFieldMessage() const { return *dptr->m_testFieldMessage; } @@ -413,7 +418,12 @@ return dptr->m_testFieldMessageOpt.operator bool(); } -TestStringMessage &OptionalMessage::testFieldMessageOpt() const +TestStringMessage &OptionalMessage::testFieldMessageOpt() +{ + dptr.detach(); + return *dptr->m_testFieldMessageOpt; +} +const TestStringMessage &OptionalMessage::testFieldMessageOpt() const { return *dptr->m_testFieldMessageOpt; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/no-options/optional.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -122,11 +122,13 @@ QString testFieldStringOpt() const; bool hasTestFieldMessage() const; - TestStringMessage &testFieldMessage() const; + TestStringMessage &testFieldMessage(); + const TestStringMessage &testFieldMessage() const; void clearTestFieldMessage(); bool hasTestFieldMessageOpt() const; - TestStringMessage &testFieldMessageOpt() const; + TestStringMessage &testFieldMessageOpt(); + const TestStringMessage &testFieldMessageOpt() const; void clearTestFieldMessageOpt(); void setTestField(const QtProtobuf::sint32 &testField); void setTestFieldOpt(const QtProtobuf::sint32 &testFieldOpt); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -339,7 +339,12 @@ return dptr->m_testField.operator bool(); } -SimpleIntMessageExt &NoPackageExternalMessage::testField() const +SimpleIntMessageExt &NoPackageExternalMessage::testField() +{ + dptr.detach(); + return *dptr->m_testField; +} +const SimpleIntMessageExt &NoPackageExternalMessage::testField() const { return *dptr->m_testField; } @@ -484,7 +489,12 @@ return dptr->m_testField.operator bool(); } -SimpleIntMessage &NoPackageMessage::testField() const +SimpleIntMessage &NoPackageMessage::testField() +{ + dptr.detach(); + return *dptr->m_testField; +} +const SimpleIntMessage &NoPackageMessage::testField() const { return *dptr->m_testField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qml-no-package/nopackage.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -152,7 +152,8 @@ bool operator !=(const NoPackageExternalMessage &other) const; bool hasTestField() const; - SimpleIntMessageExt &testField() const; + SimpleIntMessageExt &testField(); + const SimpleIntMessageExt &testField() const; Q_INVOKABLE void clearTestField(); void setTestField(const SimpleIntMessageExt &testField); static void registerTypes(); @@ -195,7 +196,8 @@ bool operator !=(const NoPackageMessage &other) const; bool hasTestField() const; - SimpleIntMessage &testField() const; + SimpleIntMessage &testField(); + const SimpleIntMessage &testField() const; Q_INVOKABLE void clearTestField(); void setTestField(const SimpleIntMessage &testField); static void registerTypes(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -1967,7 +1967,12 @@ return dptr->m_testComplexField.operator bool(); } -SimpleStringMessage &ComplexMessage::testComplexField() const +SimpleStringMessage &ComplexMessage::testComplexField() +{ + dptr.detach(); + return *dptr->m_testComplexField; +} +const SimpleStringMessage &ComplexMessage::testComplexField() const { return *dptr->m_testComplexField; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.h new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.h --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.h 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/data/expected_result/qmlgen/basicmessages.qpb.h 2024-09-19 20:58:41.000000000 +0200 @@ -749,7 +749,8 @@ QtProtobuf::int32 testFieldInt() const; bool hasTestComplexField() const; - SimpleStringMessage &testComplexField() const; + SimpleStringMessage &testComplexField(); + const SimpleStringMessage &testComplexField() const; Q_INVOKABLE void clearTestComplexField(); void setTestFieldInt(const QtProtobuf::int32 &testFieldInt); void setTestComplexField(const SimpleStringMessage &testComplexField); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/tst_qtprotobufgen.cpp new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/tst_qtprotobufgen.cpp --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufgen/tst_qtprotobufgen.cpp 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufgen/tst_qtprotobufgen.cpp 2024-09-19 20:58:41.000000000 +0200 @@ -104,6 +104,35 @@ return result.toLocal8Bit(); } +void compareTwoFiles(const QString &expectedFileName, const QString &actualFileName) +{ + QFile expectedResultFile(expectedFileName); + QFile generatedFile(actualFileName); + + QVERIFY2(expectedResultFile.exists(), qPrintable(expectedResultFile.fileName())); + QVERIFY2(generatedFile.exists(), qPrintable(expectedResultFile.fileName())); + + QVERIFY2(expectedResultFile.open(QIODevice::ReadOnly | QIODevice::Text), + msgCannotReadFile(expectedResultFile).constData()); + QVERIFY2(generatedFile.open(QIODevice::ReadOnly | QIODevice::Text), + msgCannotReadFile(generatedFile).constData()); + + QByteArray expectedData = expectedResultFile.readAll(); + QByteArray generatedData = generatedFile.readAll(); + + expectedResultFile.close(); + generatedFile.close(); + + if (hash(expectedData).toHex() != hash(generatedData).toHex()) { + const QString diff = doCompare(splitToLines(generatedData), + splitToLines(expectedData)); + QCOMPARE_GT(diff.size(), 0); // Hashes can only differ if content does. + QFAIL(qPrintable(diff)); + } + // Ensure we do see a failure, even in the unlikely case of a hash collision: + QVERIFY(generatedData == expectedData); +} + bool containsString(const QStringList &list, const QString &comment) { return std::any_of(list.cbegin(), list.cend(), @@ -175,9 +204,10 @@ QDir testOutputBaseDir(QCoreApplication::applicationDirPath()); testOutputBaseDir.mkdir(QLatin1StringView("cmd_line_generation")); - QLatin1StringView folders[] = {"comments"_L1, "extra-namespace"_L1, - "fieldenum"_L1, "folder"_L1, - "qml-no-package"_L1, "no-options"_L1}; + QLatin1StringView folders[] = { + "comments"_L1, "extra-namespace"_L1, "fieldenum"_L1, "folder"_L1, + "qml-no-package"_L1, "no-options"_L1, "invalid_export_macro"_L1 + }; for (QLatin1StringView folder : folders) testOutputBaseDir.mkdir("cmd_line_generation/"_L1 + folder); @@ -307,32 +337,8 @@ QFETCH(QString, folder); QFETCH(QString, extension); - QFile expectedResultFile(m_expectedResult + folder + fileName + extension); - QFile generatedFile(m_cmakeGenerated + folder + fileName + extension); - - QVERIFY2(expectedResultFile.exists(), qPrintable(expectedResultFile.fileName())); - QVERIFY2(generatedFile.exists(), qPrintable(expectedResultFile.fileName())); - - QVERIFY2(expectedResultFile.open(QIODevice::ReadOnly | QIODevice::Text), - msgCannotReadFile(expectedResultFile).constData()); - QVERIFY2(generatedFile.open(QIODevice::ReadOnly | QIODevice::Text), - msgCannotReadFile(generatedFile).constData()); - - QByteArray expectedData = expectedResultFile.readAll(); - QByteArray generatedData = generatedFile.readAll(); - - expectedResultFile.close(); - generatedFile.close(); - - if (hash(expectedData).toHex() != hash(generatedData).toHex()) - { - const QString diff = doCompare(splitToLines(generatedData), - splitToLines(expectedData)); - QCOMPARE_GT(diff.size(), 0); // Hashes can only differ if content does. - QFAIL(qPrintable(diff)); - } - // Ensure we do see a failure, even in the unlikely case of a hash collision: - QVERIFY(generatedData == expectedData); + const QString filePath = folder + fileName + extension; + compareTwoFiles(m_expectedResult + filePath, m_cmakeGenerated + filePath); } void tst_qtprotobufgen::cmdLineGeneratedFile_data() @@ -458,33 +464,8 @@ QVERIFY2(process.exitStatus() == QProcess::NormalExit, msgProcessCrashed(process).constData()); QVERIFY2(process.exitCode() == 0, msgProcessFailed(process).constData()); - QString filePath = folder + generatedFolderStructure; - QFile expectedResultFile(m_expectedResult + filePath + fileName + extension); - QFile generatedFile(m_commandLineGenerated + filePath + fileName + extension); - - QVERIFY(generatedFile.exists()); - QVERIFY(expectedResultFile.exists()); - - QVERIFY2(expectedResultFile.open(QIODevice::ReadOnly | QIODevice::Text), - msgCannotReadFile(expectedResultFile).constData()); - QVERIFY2(generatedFile.open(QIODevice::ReadOnly | QIODevice::Text), - msgCannotReadFile(generatedFile).constData()); - - QByteArray expectedData = expectedResultFile.readAll(); - QByteArray generatedData = generatedFile.readAll(); - - expectedResultFile.close(); - generatedFile.close(); - - if (hash(expectedData).toHex() != hash(generatedData).toHex()) - { - const QString diff = doCompare(splitToLines(generatedData), - splitToLines(expectedData)); - QCOMPARE_GT(diff.size(), 0); // Hashes can only differ if content does. - QFAIL(qPrintable(diff)); - } - // Ensure we do see a failure, even in the unlikely case of a hash collision: - QVERIFY(generatedData == expectedData); + const QString filePath = folder + generatedFolderStructure + fileName + extension; + compareTwoFiles(m_expectedResult + filePath, m_commandLineGenerated + filePath); } void tst_qtprotobufgen::cmdLineGeneratedNoOptions_data() @@ -575,32 +556,8 @@ QVERIFY2(process.exitStatus() == QProcess::NormalExit, msgProcessCrashed(process).constData()); QVERIFY2(process.exitCode() == 0, msgProcessFailed(process).constData()); - QFile expectedResultFile(m_expectedResult + folder + fileName + extension); - QFile generatedFile(m_commandLineGenerated + folder + fileName + extension); - - QVERIFY(generatedFile.exists()); - QVERIFY(expectedResultFile.exists()); - - QVERIFY2(expectedResultFile.open(QIODevice::ReadOnly | QIODevice::Text), - msgCannotReadFile(expectedResultFile).constData()); - QVERIFY2(generatedFile.open(QIODevice::ReadOnly | QIODevice::Text), - msgCannotReadFile(generatedFile).constData()); - - QByteArray expectedData = expectedResultFile.readAll(); - QByteArray generatedData = generatedFile.readAll(); - - expectedResultFile.close(); - generatedFile.close(); - - if (hash(expectedData).toHex() != hash(generatedData).toHex()) - { - const QString diff = doCompare(splitToLines(generatedData), - splitToLines(expectedData)); - QCOMPARE_GT(diff.size(), 0); // Hashes can only differ if content does. - QFAIL(qPrintable(diff)); - } - // Ensure we do see a failure, even in the unlikely case of a hash collision: - QVERIFY(generatedData == expectedData); + const QString filePath = folder + fileName + extension; + compareTwoFiles(m_expectedResult + filePath, m_commandLineGenerated + filePath); } void tst_qtprotobufgen::cmdLineInvalidExportMacro_data() @@ -610,7 +567,6 @@ QTest::addRow("contains_dash") << "TST_QTPROTOBUFGEN-FAIL" << 1; QTest::addRow("contains_number_first") << "1Not_ALLoWeD" << 1; - QTest::addRow("valid") << "MACRO_NAME_OK" << 0; } void tst_qtprotobufgen::cmdLineInvalidExportMacro() @@ -618,15 +574,14 @@ QFETCH(QString, exportMacro); QFETCH(int, result); - QString folder = "/folder/"; + QString folder = "/invalid_export_macro/"; QString fileName = "basicmessages"; - QString generatingOption = "GENERATE_PACKAGE_SUBFOLDERS"; QString exportMacroCmd = "EXPORT_MACRO=" + exportMacro; QProcess process; process.setWorkingDirectory(m_commandLineGenerated); process.startCommand(protocolBufferCompiler + QString(" ") + protocGenQtprotobufKey - + m_protobufgen + optKey + generatingOption + ";" + exportMacroCmd + + m_protobufgen + optKey + ";" + exportMacroCmd + outputKey + m_commandLineGenerated + folder + includeKey + m_protoFiles + " " + fileName + ".proto" + allow_proto3_optional); QVERIFY2(process.waitForStarted(), msgProcessStartFailed(process).constData()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufqml/basic/qml/tst_basic.qml new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufqml/basic/qml/tst_basic.qml --- old/qtgrpc-everywhere-src-6.7.2/tests/auto/protobufqml/basic/qml/tst_basic.qml 2024-06-08 01:54:43.000000000 +0200 +++ new/qtgrpc-everywhere-src-6.7.3/tests/auto/protobufqml/basic/qml/tst_basic.qml 2024-09-19 20:58:41.000000000 +0200 @@ -8,9 +8,11 @@ pragma ValueTypeBehavior: Addressable - Item { +Item { id: root + property var usLocale: Qt.locale("en_US") + TestCase { name: "qtprotobufBasicTest" @@ -213,31 +215,31 @@ } function test_int32LocaleStringConversion() { - var field = int32Msg.testFieldInt.toLocaleString(Qt.locale()) - var answer = Number(int32Msg.testFieldInt).toLocaleString(Qt.locale()) + var field = int32Msg.testFieldInt.toLocaleString(root.usLocale) + var answer = Number(int32Msg.testFieldInt).toLocaleString(root.usLocale) expectFail("", "int32Msg number is not match" + field + " not equal " + answer) compare(field, answer) } function test_fixed32LocaleStringConversion(data) { - var field = fixed32Msg.testFieldFixedInt32.toLocaleString(Qt.locale()) - var answer = Number(fixed32Msg.testFieldFixedInt32).toLocaleString(Qt.locale()) + var field = fixed32Msg.testFieldFixedInt32.toLocaleString(root.usLocale) + var answer = Number(fixed32Msg.testFieldFixedInt32).toLocaleString(root.usLocale) expectFail("", "fixed32LocaleString number is not match" + field + " not equal " + answer) compare(field, answer) } function test_sint32LocaleStringConversion() { - compare(sint32Msg.testFieldInt.toLocaleString(Qt.locale()), - Number(sint32Msg.testFieldInt).toLocaleString(Qt.locale()), + compare(sint32Msg.testFieldInt.toLocaleString(root.usLocale), + Number(sint32Msg.testFieldInt).toLocaleString(root.usLocale), "Locale number string is not match " - + sint32Msg.testFieldInt.toLocaleString(Qt.locale()) - + " != " + Number(sint32Msg.testFieldInt).toLocaleString(Qt.locale())) + + sint32Msg.testFieldInt.toLocaleString(root.usLocale) + + " != " + Number(sint32Msg.testFieldInt).toLocaleString(root.usLocale)) } function test_sfixed32LocaleStringConversion(data) { - var field = sfixed32Msg.testFieldFixedInt32.toLocaleString(Qt.locale()) - var answer = Number(sfixed32Msg.testFieldFixedInt32).toLocaleString(Qt.locale()) + var field = sfixed32Msg.testFieldFixedInt32.toLocaleString(root.usLocale) + var answer = Number(sfixed32Msg.testFieldFixedInt32).toLocaleString(root.usLocale) expectFail("", "sfixed32LocaleString number is not match" + field + " not equal " + answer)