diff options
191 files changed, 2219 insertions, 1441 deletions
diff --git a/demos/embedded/anomaly/anomaly.pro b/demos/embedded/anomaly/anomaly.pro index 165ce89..e16ef66 100644 --- a/demos/embedded/anomaly/anomaly.pro +++ b/demos/embedded/anomaly/anomaly.pro @@ -27,7 +27,7 @@ symbian { TARGET.UID3 = 0xA000CF71 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock -linsock -lconnmon + LIBS += -lesock -lcommdb -linsock # For IAP selection TARGET.CAPABILITY = NetworkServices TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } diff --git a/demos/embedded/flightinfo/flightinfo.pro b/demos/embedded/flightinfo/flightinfo.pro index 8e5535c..7391f88 100644 --- a/demos/embedded/flightinfo/flightinfo.pro +++ b/demos/embedded/flightinfo/flightinfo.pro @@ -9,7 +9,7 @@ symbian { TARGET.UID3 = 0xA000CF74 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock -lconnmon -linsock + LIBS += -lesock -lcommdb -linsock # For IAP selection TARGET.CAPABILITY = NetworkServices } diff --git a/demos/embedded/lightmaps/lightmaps.pro b/demos/embedded/lightmaps/lightmaps.pro index c9bfa0a..ef1a0a6 100644 --- a/demos/embedded/lightmaps/lightmaps.pro +++ b/demos/embedded/lightmaps/lightmaps.pro @@ -6,7 +6,7 @@ symbian { TARGET.UID3 = 0xA000CF75 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock -lconnmon -linsock + LIBS += -lesock -lcommdb -linsock # For IAP selection TARGET.CAPABILITY = NetworkServices TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } diff --git a/demos/embedded/weatherinfo/weatherinfo.pro b/demos/embedded/weatherinfo/weatherinfo.pro index 57f1684..f007bbb 100644 --- a/demos/embedded/weatherinfo/weatherinfo.pro +++ b/demos/embedded/weatherinfo/weatherinfo.pro @@ -8,7 +8,7 @@ symbian { TARGET.UID3 = 0xA000CF77 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock -lconnmon -linsock + LIBS += -lesock -lcommdb -linsock # For IAP selection TARGET.CAPABILITY = NetworkServices } diff --git a/dist/changes-4.5.4 b/dist/changes-4.5.4 index e60e507..ac91edb 100644 --- a/dist/changes-4.5.4 +++ b/dist/changes-4.5.4 @@ -9,12 +9,12 @@ The Qt version 4.5 series is binary compatible with the 4.4.x series. Applications compiled for 4.4 will continue to run with 4.5. Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Task Tracker: +corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task +Tracker, or the Merge Request queue of the public source repository. - http://qt.nokia.com/developer/task-tracker - -Each of these identifiers can be entered in the task tracker to obtain more -information about a particular change. +Qt Bug Tracker: http://bugreports.qt.nokia.com +Task Tracker: http://qt.nokia.com/developer/task-tracker +Merge Request: http://qt.gitorious.org **************************************************************************** * General * diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index b17e255..8e1d970 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -2884,9 +2884,9 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 144 - This will add the specified statement to the end of the generated - registration resource file. As an impact of this statement, the application - will not be visible in application shell. + This will add the specified statement to the end of the \c APP_REGISTRATION_INFO + resource struct in the generated registration resource file. + As an impact of this statement, the application will not be visible in application shell. It is also possible to add multiple rows in a single block. Each double quoted string will be placed on a new row in the registration resource file. @@ -2899,16 +2899,36 @@ For example: platform application shell. In addition it will make the application to be launched in background. - For detailed list of possible RSS statements, please refer to the - Symbian platform help. + For detailed list of possible \c APP_REGISTRATION_INFO statements, please refer to the + Symbian platform help. \note You should not use \c RSS_RULES variable to set the following RSS statements: - - app_file - localisable_resource_file - localisable_resource_id + \c app_file, \c localisable_resource_file, and \c localisable_resource_id. + + These statements are internally handled by qmake. + + There is a number of special modifiers you can attach to \c RSS_RULES to specify where + in the application registration file the rule will be written: + + \table + \header \o Modifier \o Location of the rule + \row \o <no modifier> \o Inside \c APP_REGISTRATION_INFO resource struct. + \row \o .header \o Before \c APP_REGISTRATION_INFO resource struct. + \row \o .footer \o After \c APP_REGISTRATION_INFO resource struct. + \row \o .service_list \o Inside a \c SERVICE_INFO item in the \c service_list + of \c APP_REGISTRATION_INFO + \row \o .file_ownership_list \o Inside a \c FILE_OWNERSHIP_INFO item in the + \c file_ownership_list of \c APP_REGISTRATION_INFO + \row \o .datatype_list \o Inside a \c DATATYPE item in the \c datatype_list of + \c APP_REGISTRATION_INFO + \endtable + + For example: + + \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 151 - These statements are internally handled by qmake. + This example will define service information for a fictional service that requires + an icon to be supplied via the \c opaque_data of the service information. \target S60_VERSION \section1 S60_VERSION diff --git a/doc/src/platforms/supported-platforms.qdoc b/doc/src/platforms/supported-platforms.qdoc index a84ad56..578ec37 100644 --- a/doc/src/platforms/supported-platforms.qdoc +++ b/doc/src/platforms/supported-platforms.qdoc @@ -116,7 +116,7 @@ \o aCC 3.57, gcc 3.4 \row \o HPUXi 11.23 \o aCC 6.10 - \row \o Solaris 10 UltraSparc + \row \o Solaris 10 (UltraSparc, x86) \o Sun Studio 12 \row \o AIX 6 \o Power5 xlC 7 diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc index e8c00d3..36676ae 100644 --- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc +++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc @@ -996,3 +996,8 @@ symbian { emulator_dll.condition = WINSCW } //! [150] + +//! [151] +RSS_RULES.service_list += "uid = 0x12345678; datatype_list = \{\}; opaque_data = r_my_icon;" +RSS_RULES.footer +="RESOURCE CAPTION_AND_ICON_INFO r_my_icon \{ icon_file =\"$$PWD/my_icon.svg\"; \}" +//! [151] diff --git a/examples/animation/animatedtiles/animatedtiles.pro b/examples/animation/animatedtiles/animatedtiles.pro index 1840b17..d700642 100644 --- a/examples/animation/animatedtiles/animatedtiles.pro +++ b/examples/animation/animatedtiles/animatedtiles.pro @@ -6,3 +6,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/animation/animatedtiles sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS animatedtiles.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/animation/animatedtiles INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000D7D1 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/animation/appchooser/appchooser.pro b/examples/animation/appchooser/appchooser.pro index 847b60a..7d45da2 100644 --- a/examples/animation/appchooser/appchooser.pro +++ b/examples/animation/appchooser/appchooser.pro @@ -6,3 +6,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/animation/appchooser sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS appchooser.pro sources.path = $$[QT_INSTALL_EXAMPLES]/animation/appchooser INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000E3F5 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/animation/easing/easing.pro b/examples/animation/easing/easing.pro index 8e8a35f..a8eda70 100644 --- a/examples/animation/easing/easing.pro +++ b/examples/animation/easing/easing.pro @@ -12,3 +12,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/animation/easing sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS easing.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/animation/easing INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000E3F6 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/animation/moveblocks/moveblocks.pro b/examples/animation/moveblocks/moveblocks.pro index b8e88b2..0a32ecf 100644 --- a/examples/animation/moveblocks/moveblocks.pro +++ b/examples/animation/moveblocks/moveblocks.pro @@ -5,3 +5,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS moveblocks.pro sources.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000E3F7 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/animation/states/states.pro b/examples/animation/states/states.pro index f4d1e0b..9d9a9c1 100644 --- a/examples/animation/states/states.pro +++ b/examples/animation/states/states.pro @@ -6,3 +6,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/animation/states sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS states.pro sources.path = $$[QT_INSTALL_EXAMPLES]/animation/states INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000E3F8 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/animation/stickman/stickman.pro b/examples/animation/stickman/stickman.pro index 487ff3a..37ff8d3 100644 --- a/examples/animation/stickman/stickman.pro +++ b/examples/animation/stickman/stickman.pro @@ -17,3 +17,8 @@ target.path = $$[QT_INSTALL_EXAMPLES]/animation/stickman sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS stickman.pro sources.path = $$[QT_INSTALL_EXAMPLES]/animation/stickman INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000E3F9 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/examples.pro b/examples/examples.pro index 8941eae..ec5cc5f9 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -36,6 +36,8 @@ symbian: SUBDIRS = \ mainwindows \ sql \ uitools \ + animation \ + gestures \ xml contains(QT_CONFIG, multimedia) { diff --git a/examples/gestures/imagegestures/imagegestures.pro b/examples/gestures/imagegestures/imagegestures.pro index 8c947e4..5365558 100644 --- a/examples/gestures/imagegestures/imagegestures.pro +++ b/examples/gestures/imagegestures/imagegestures.pro @@ -14,3 +14,8 @@ sources.files = $$SOURCES \ sources.path = $$[QT_INSTALL_EXAMPLES]/gestures/imagegestures INSTALLS += target \ sources + +symbian { + TARGET.UID3 = 0xA000D7D0 + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/network/fortuneclient/fortuneclient.pro b/examples/network/fortuneclient/fortuneclient.pro index c9dc39a..2b65f2f 100644 --- a/examples/network/fortuneclient/fortuneclient.pro +++ b/examples/network/fortuneclient/fortuneclient.pro @@ -12,7 +12,7 @@ INSTALLS += target sources symbian { include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock + LIBS += -lesock -lcommdb -linsock # For IAP selection TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData" TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro index 4dbc2e8..acb285b 100644 --- a/examples/network/fortuneserver/fortuneserver.pro +++ b/examples/network/fortuneserver/fortuneserver.pro @@ -13,7 +13,7 @@ symbian { TARGET.UID3 = 0xA000CF71 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock + LIBS += -lesock -lcommdb -linsock # For IAP selection TARGET.CAPABILITY = "All -TCB" TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } diff --git a/examples/network/network-chat/network-chat.pro b/examples/network/network-chat/network-chat.pro index 16c11e3..7438641 100644 --- a/examples/network/network-chat/network-chat.pro +++ b/examples/network/network-chat/network-chat.pro @@ -21,7 +21,8 @@ INSTALLS += target sources symbian { include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h - LIBS += -lesock -lconnmon -lcharconv -linsock + LIBS += -lesock -lcommdb -linsock # For IAP selection + LIBS += -lcharconv TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData" TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 } diff --git a/examples/sql/masterdetail/masterdetail.pro b/examples/sql/masterdetail/masterdetail.pro index 89e7e73..41a0274 100644 --- a/examples/sql/masterdetail/masterdetail.pro +++ b/examples/sql/masterdetail/masterdetail.pro @@ -15,4 +15,7 @@ sources.files = $$SOURCES *.h $$RESOURCES $$FORMS masterdetail.pro *.xml images sources.path = $$[QT_INSTALL_EXAMPLES]/sql/masterdetail INSTALLS += target sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +symbian { + TARGET.UID3 = 0xA000D7CF + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/sql/sql.pro b/examples/sql/sql.pro index 644e2c7..331a210 100644 --- a/examples/sql/sql.pro +++ b/examples/sql/sql.pro @@ -5,10 +5,12 @@ SUBDIRS = drilldown relationaltablemodel \ sqlwidgetmapper +!wince*: SUBDIRS += masterdetail + !wince*:!symbian: SUBDIRS += \ querymodel \ - tablemodel \ - masterdetail + tablemodel + # install sources.files = connection.h sql.pro README diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 9c5bcf4..b42ab6a 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -133,14 +133,17 @@ MMP_RULES += PAGED BYTEPAIRCOMPRESSTARGET MMP_RULES += $$MMP_RULES_DONT_EXPORT_ALL_CLASS_IMPEDIMENTA SYMBIAN_PLATFORMS = WINSCW GCCE ARMV5 ARMV6 -# Legacy support requires some hardcoded stdapis paths. INCLUDEPATH = \ $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/stl-off \ $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian \ $${EPOCROOT}epoc32/include \ $$OS_LAYER_LIBC_SYSTEMINCLUDE \ $$INCLUDEPATH - + +# Ensure '.' directory is the first in include path. +# RVCT seems to do this automatically, but WINSCW compiler does not, so add it here. +MMP_RULES += "USERINCLUDE ." + # Supports S60 3.0, 3.1, 3.2 and 5.0 by default default_deployment.pkg_prerules = \ "; Default HW/platform dependencies" \ diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index b790463..ebef8b2 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -3,7 +3,7 @@ load(data_caging_paths) # If no_icon keyword exist, the S60 UI app is just made hidden. This because S60 app FW # requires the registration resource file to exist always contains( CONFIG, no_icon ) { - symbian:RSS_RULES ="hidden = KAppIsHidden;" + symbian:RSS_RULES += "hidden = KAppIsHidden;" CONFIG -= no_icon } else { # There is no point in compiling the MIF icon if no_icon CONFIGS is set diff --git a/mkspecs/features/symbian/platform_paths.prf b/mkspecs/features/symbian/platform_paths.prf index c723d8c..a55e842 100644 --- a/mkspecs/features/symbian/platform_paths.prf +++ b/mkspecs/features/symbian/platform_paths.prf @@ -230,33 +230,6 @@ exists($${EPOCROOT}epoc32/include/platform_paths.prf) { OS_LAYER_LIBUTILITY_SYSTEMINCLUDE = $$OS_LAYER_PLATFORM_EXPORT_PATH(stdapis/utility) - # --------------------------------------- - # Definitions to export IBY files to different folders where they will be taken - # to ROM image - # --------------------------------------- - - defineReplace(CORE_APP_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/app/$$1) - } - defineReplace(CORE_MW_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/mw/$$1) - } - defineReplace(CORE_OSEXT_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/os/$$1) - } - defineReplace(CORE_OS_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/os/$$1) - } - defineReplace(CORE_ADAPT_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/$$1) - } - - # You need to define the following in pro-file, if you are using the stllib: - # QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS - # DEFINES *= $$STLLIB_USAGE_DEFINES - STLLIB_USAGE_CW_FLAGS = "-wchar_t on" - STLLIB_USAGE_DEFINES = _WCHAR_T_DECLARED - } else { # Old pre-SF structure # --------------------------------------- @@ -450,34 +423,49 @@ exists($${EPOCROOT}epoc32/include/platform_paths.prf) { OS_LAYER_LIBUTILITY_SYSTEMINCLUDE = $$OS_LAYER_PLATFORM_EXPORT_PATH(stdapis/utility) \ /epoc32/include/stdapis/utility - # --------------------------------------- - # Definitions to export IBY files to different folders where they will be taken - # to ROM image - # --------------------------------------- - - defineReplace(CORE_APP_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/app/$$1) - } - defineReplace(CORE_MW_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/mw/$$1) - } - defineReplace(CORE_OSEXT_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/osext/$$1) - } - defineReplace(CORE_OS_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/core/osext/$$1) - } - defineReplace(CORE_ADAPT_LAYER_IBY_EXPORT_PATH) { - return(/epoc32/rom/include/$$1) - } - - # You need to define the following in pro-file, if you are using the stllib: - # QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS - # DEFINES *= $$STLLIB_USAGE_DEFINES - STLLIB_USAGE_CW_FLAGS = "-wchar_t on" - STLLIB_USAGE_DEFINES = _WCHAR_T_DECLARED - } + + # Definitions common to both structures + + # --------------------------------------- + # Definitions to export IBY files to different folders where they will be taken + # to ROM image + # --------------------------------------- + + defineReplace(CORE_APP_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/core/app/$$1) + } + defineReplace(CORE_MW_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/core/mw/$$1) + } + + defineReplace(LANGUAGE_APP_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/language/app/$$1) + } + defineReplace(LANGUAGE_MW_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/language/mw/$$1) + } + + defineReplace(CUSTOMER_APP_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/customer/app/$$1) + } + defineReplace(CUSTOMER_MW_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/customer/mw/$$1) + } + + defineReplace(CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/customervariant/app/$$1) + } + defineReplace(CUSTOMER_VARIANT_MW_LAYER_IBY_EXPORT_PATH) { + return(/epoc32/rom/include/customervariant/mw/$$1) + } + + # You need to define the following in pro-file, if you are using the stllib: + # QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS + # DEFINES *= $$STLLIB_USAGE_DEFINES + STLLIB_USAGE_CW_FLAGS = "-wchar_t on" + STLLIB_USAGE_DEFINES = _WCHAR_T_DECLARED + } diff --git a/src/plugins/audio/symbian/symbianaudio.h b/mkspecs/symbian-abld/qplatformdefs.h index 3fc0419..4cd0d73 100644 --- a/src/plugins/audio/symbian/symbianaudio.h +++ b/mkspecs/symbian-abld/qplatformdefs.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtMultimedia module of the Qt Toolkit. +** This file is part of the qmake spec of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,38 +39,5 @@ ** ****************************************************************************/ -#ifndef SYMBIANAUDIO_H -#define SYMBIANAUDIO_H +#include "../common/symbian/qplatformdefs.h" -#include <QtCore/qnamespace.h> - -QT_BEGIN_NAMESPACE - -namespace SymbianAudio { - -/** - * Default values used by audio input and output classes, when underlying - * DevSound instance has not yet been created. - */ - -const int DefaultBufferSize = 4096; // bytes -const int DefaultNotifyInterval = 1000; // ms - -/** - * Enumeration used to track state of internal DevSound instances. - * Values are translated to the corresponding QAudio::State values by - * SymbianAudio::Utils::stateNativeToQt. - */ -enum State { - ClosedState - , InitializingState - , ActiveState - , IdleState - , SuspendedState -}; - -} // namespace SymbianAudio - -QT_END_NAMESPACE - -#endif diff --git a/mkspecs/symbian-sbsv2/qplatformdefs.h b/mkspecs/symbian-sbsv2/qplatformdefs.h new file mode 100644 index 0000000..4cd0d73 --- /dev/null +++ b/mkspecs/symbian-sbsv2/qplatformdefs.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec 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$ +** +****************************************************************************/ + +#include "../common/symbian/qplatformdefs.h" + diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index b15baf4..b84f0f1 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -70,6 +70,12 @@ #define RSS_RULES_BASE "RSS_RULES." #define RSS_TAG_NBROFICONS "number_of_icons" #define RSS_TAG_ICONFILE "icon_file" +#define RSS_TAG_HEADER "header" +#define RSS_TAG_SERVICE_LIST "service_list" +#define RSS_TAG_FILE_OWNERSHIP_LIST "file_ownership_list" +#define RSS_TAG_DATATYPE_LIST "datatype_list" +#define RSS_TAG_FOOTER "footer" +#define RSS_TAG_DEFAULT "default_rules" // Same as just giving rules without tag #define MMP_TARGET "TARGET" #define MMP_TARGETTYPE "TARGETTYPE" @@ -192,7 +198,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) QString numberOfIcons; QString iconFile; - QStringList userRssRules; + QMap<QString, QStringList> userRssRules; readRssRules(numberOfIcons, iconFile, userRssRules); // Get the application translations and convert to symbian OS lang code, i.e. decical number @@ -1418,7 +1424,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy } } -void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) +void SymbianMakefileGenerator::writeRegRssFile(QMap<QString, QStringList> &userItems) { QString filename(fixedTarget); filename.append("_reg.rss"); @@ -1435,6 +1441,8 @@ void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) t << endl; t << "#include <" << fixedTarget << ".rsg>" << endl; t << "#include <appinfo.rh>" << endl; + foreach(QString item, userItems[RSS_TAG_HEADER]) + t << item << endl; t << endl; t << "UID2 KUidAppRegistrationResourceFile" << endl; t << "UID3 " << uid3 << endl << endl; @@ -1442,16 +1450,51 @@ void SymbianMakefileGenerator::writeRegRssFile(QStringList &userItems) t << "\t{" << endl; t << "\tapp_file=\"" << fixedTarget << "\";" << endl; t << "\tlocalisable_resource_file=\"" RESOURCE_DIRECTORY_RESOURCE << fixedTarget << "\";" << endl; + + writeRegRssList(t, userItems[RSS_TAG_SERVICE_LIST], + QLatin1String(RSS_TAG_SERVICE_LIST), + QLatin1String("SERVICE_INFO")); + writeRegRssList(t, userItems[RSS_TAG_FILE_OWNERSHIP_LIST], + QLatin1String(RSS_TAG_FILE_OWNERSHIP_LIST), + QLatin1String("FILE_OWNERSHIP_INFO")); + writeRegRssList(t, userItems[RSS_TAG_DATATYPE_LIST], + QLatin1String(RSS_TAG_DATATYPE_LIST), + QLatin1String("DATATYPE")); t << endl; - foreach(QString item, userItems) - t << "\t" << item << endl; + foreach(QString item, userItems[RSS_TAG_DEFAULT]) + t << "\t" << item.replace("\n","\n\t") << endl; t << "\t}" << endl; + + foreach(QString item, userItems[RSS_TAG_FOOTER]) + t << item << endl; } else { PRINT_FILE_CREATE_ERROR(filename) } } +void SymbianMakefileGenerator::writeRegRssList(QTextStream &t, + QStringList &userList, + const QString &listTag, + const QString &listItem) +{ + int itemCount = userList.count(); + if (itemCount) { + t << "\t" << listTag << " ="<< endl; + t << "\t\t{" << endl; + foreach(QString item, userList) { + t << "\t\t" << listItem << endl; + t << "\t\t\t{" << endl; + t << "\t\t\t" << item.replace("\n","\n\t\t\t") << endl; + t << "\t\t\t}"; + if (--itemCount) + t << ","; + t << endl; + } + t << "\t\t}; "<< endl; + } +} + void SymbianMakefileGenerator::writeRssFile(QString &numberOfIcons, QString &iconFile) { QString filename(fixedTarget); @@ -1530,7 +1573,9 @@ void SymbianMakefileGenerator::writeLocFile(QStringList &symbianLangCodes) } } -void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules) +void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, + QString &iconFile, QMap<QString, + QStringList> &userRssRules) { for (QMap<QString, QStringList>::iterator it = project->variables().begin(); it != project->variables().end(); ++it) { if (it.key().startsWith(RSS_RULES_BASE)) { @@ -1542,14 +1587,16 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico QStringList newValues; QStringList values = it.value(); foreach(QString item, values) { - // If there is no stringlist defined for a rule, use rule name directly + // If there is no stringlist defined for a rule, use rule value directly // This is convenience for defining single line statements if (project->values(item).isEmpty()) { newValues << item; } else { + QStringList itemList; foreach(QString itemRow, project->values(item)) { - newValues << itemRow; + itemList << itemRow; } + newValues << itemList.join("\n"); } } // Verify thet there is exactly one value in RSS_TAG_NBROFICONS @@ -1570,6 +1617,14 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico RSS_RULES_BASE, RSS_TAG_ICONFILE); continue; } + } else if (newKey == RSS_TAG_HEADER + || newKey == RSS_TAG_SERVICE_LIST + || newKey == RSS_TAG_FILE_OWNERSHIP_LIST + || newKey == RSS_TAG_DATATYPE_LIST + || newKey == RSS_TAG_FOOTER + || newKey == RSS_TAG_DEFAULT) { + userRssRules[newKey] = newValues; + continue; } else { fprintf(stderr, "Warning: Unsupported key:'%s%s'\n", RSS_RULES_BASE, newKey.toLatin1().constData()); @@ -1578,15 +1633,17 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico } } + QStringList newValues; foreach(QString item, project->values(RSS_RULES)) { - // If there is no stringlist defined for a rule, use rule name directly - // This is convenience for defining single line mmp statements + // If there is no stringlist defined for a rule, use rule value directly + // This is convenience for defining single line statements if (project->values(item).isEmpty()) { - userRssRules << item; + newValues << item; } else { - userRssRules << project->values(item); + newValues << project->values(item); } } + userRssRules[RSS_TAG_DEFAULT] << newValues; // Validate that either both RSS_TAG_NBROFICONS and RSS_TAG_ICONFILE keys exist // or neither of them exist diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index fa55ae7..0847ee8 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -107,7 +107,10 @@ protected: QString &checkString); void writeHeader(QTextStream &t); - void writeBldInfContent(QTextStream& t, bool addDeploymentExtension, const QString &iconFile, DeploymentList &depList); + void writeBldInfContent(QTextStream& t, + bool addDeploymentExtension, + const QString &iconFile, + DeploymentList &depList); static bool removeDuplicatedStrings(QStringList& stringList); @@ -127,10 +130,15 @@ protected: void writeCustomDefFile(); - void writeRegRssFile(QStringList &useritems); + void writeRegRssFile(QMap<QString, QStringList> &useritems); + void writeRegRssList(QTextStream &t, QStringList &userList, + const QString &listTag, + const QString &listItem); void writeRssFile(QString &numberOfIcons, QString &iconfile); void writeLocFile(QStringList &symbianLangCodes); - void readRssRules(QString &numberOfIcons, QString &iconFile, QStringList &userRssRules); + void readRssRules(QString &numberOfIcons, + QString &iconFile, + QMap<QString, QStringList> &userRssRules); QStringList symbianLangCodesFromTsFiles(); void fillQt2S60LangMapTable(); diff --git a/src/3rdparty/phonon/mmf/utils.cpp b/src/3rdparty/phonon/mmf/utils.cpp index 2d17bd2..c556afc 100644 --- a/src/3rdparty/phonon/mmf/utils.cpp +++ b/src/3rdparty/phonon/mmf/utils.cpp @@ -52,22 +52,24 @@ void MMF::Utils::panic(PanicCode code) User::Panic(PanicCategory, code); } - -static const TInt KMimePrefixLength = 6; // either "audio/" or "video/" _LIT(KMimePrefixAudio, "audio/"); _LIT(KMimePrefixVideo, "video/"); +_LIT(KMimeSDP, "application/sdp"); + +enum ConstantStringLengths { + KMimePrefixLength = 6, // either "audio/" or "video/", + KMimeSDPLength = 15 // "application/sdp" +}; MMF::MediaType MMF::Utils::mimeTypeToMediaType(const TDesC& mimeType) { - MediaType result = MediaTypeUnknown; - if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixAudio) == 0) { - result = MediaTypeAudio; - } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0) { - result = MediaTypeVideo; - } - - return result; + return MediaTypeAudio; + } else if (mimeType.Left(KMimePrefixLength).Compare(KMimePrefixVideo) == 0 || + mimeType.Left(KMimeSDPLength).Compare(KMimeSDP) == 0) { + return MediaTypeVideo; + } else + return MediaTypeUnknown; } QString MMF::Utils::symbianErrorToString(int errorCode) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 6a2e75f..a2d5f37 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - f3110d2f94c825477afac054ed448e45d47f5670 + 266a6c4f1938dd9edf4a8125faf91c62495e3ce2 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 61c2227..a3f70d3 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-03-11 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Avoid double-buffering with Qt image decoders + + Pass QIODevice::Unbuffered when opening the QBuffer that + wraps the image data, to hint to Qt that no extra buffering + is needed. + + * platform/graphics/qt/ImageDecoderQt.cpp: + (WebCore::ImageDecoderQt::setData): + 2010-01-14 Diego Gonzalez <diego.gonzalez@openbossa.org> Reviewed by Kenneth Christiansen. diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp index b6823dd..9bcb3e9 100644 --- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/ImageDecoderQt.cpp @@ -79,7 +79,7 @@ void ImageDecoderQt::setData(SharedBuffer* data, bool allDataReceived) QByteArray imageData = QByteArray::fromRawData(m_data->data(), m_data->size()); m_buffer = new QBuffer; m_buffer->setData(imageData); - m_buffer->open(QBuffer::ReadOnly); + m_buffer->open(QBuffer::ReadOnly | QIODevice::Unbuffered); m_reader = new QImageReader(m_buffer, m_format); } diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 662100a..c93f0c3 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -282,8 +282,7 @@ QIODevicePrivate::~QIODevicePrivate() Certain flags, such as \c Unbuffered and \c Truncate, are meaningless when used with some subclasses. Some of these restrictions are implied by the type of device that is represented - by a subclass; for example, access to a QBuffer is always - unbuffered. In other cases, the restriction may be due to the + by a subclass. In other cases, the restriction may be due to the implementation, or may be imposed by the underlying platform; for example, QTcpSocket does not support \c Unbuffered mode, and limitations in the native API prevent QFile from supporting \c diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 1069b816..aecb66e 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -222,7 +222,6 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a } } else { qMemCopy(ptr, oldPtr, qMin(asize, osize) * sizeof(T)); - s = asize; } } else { ptr = oldPtr; @@ -233,7 +232,7 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a if (QTypeInfo<T>::isComplex) { while (osize > asize) (oldPtr+(--osize))->~T(); - if( oldPtr == ptr ) + if (!QTypeInfo<T>::isStatic) s = osize; } diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 2d75913..4faa193 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -415,8 +415,15 @@ bool QDialog::event(QEvent *e) result = true; } #else - if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) - adjustPosition(parentWidget()); + if ((e->type() == QEvent::StyleChange) || (e->type() == QEvent::Resize )) { + if (!testAttribute(Qt::WA_Moved)) { + Qt::WindowStates state = windowState(); + adjustPosition(parentWidget()); + setAttribute(Qt::WA_Moved, false); // not really an explicit position + if (state != windowState()) + setWindowState(state); + } + } #endif return result; } diff --git a/src/gui/dialogs/qprintdialog.h b/src/gui/dialogs/qprintdialog.h index ecd50c1..94177ea 100644 --- a/src/gui/dialogs/qprintdialog.h +++ b/src/gui/dialogs/qprintdialog.h @@ -56,7 +56,7 @@ class QPrintDialogPrivate; class QPushButton; class QPrinter; -#if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) +#if defined (Q_OS_UNIX) && !defined(QTOPIA_PRINTDIALOG) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) class QUnixPrintWidgetPrivate; class Q_GUI_EXPORT QUnixPrintWidget : public QWidget diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 0487f23..17283f5 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -152,6 +152,9 @@ public: bool checkFields(); void setupPrinter(); void setOptionsPane(QPrintDialogPrivate *pane); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + void setCupsProperties(); +#endif // slots void _q_printerChanged(int index); @@ -949,7 +952,7 @@ bool QUnixPrintWidgetPrivate::checkFields() void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() { - if (propertiesDialog == 0) { + if (!propertiesDialog) { propertiesDialog = new QPrintPropertiesDialog(q); propertiesDialog->setResult(QDialog::Rejected); } @@ -969,6 +972,35 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() propertiesDialog->exec(); } +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) +void QUnixPrintWidgetPrivate::setCupsProperties() +{ + if (cups && QCUPSSupport::isAvailable()) { + QPrintEngine *engine = printer->printEngine(); + const ppd_option_t* pageSizes = cups->pageSizes(); + QByteArray cupsPageSize; + for (int i = 0; i < pageSizes->num_choices; ++i) { + if (static_cast<int>(pageSizes->choices[i].marked) == 1) + cupsPageSize = pageSizes->choices[i].choice; + } + engine->setProperty(PPK_CupsStringPageSize, QString::fromLatin1(cupsPageSize)); + engine->setProperty(PPK_CupsOptions, cups->options()); + + QRect pageRect = cups->pageRect(cupsPageSize); + engine->setProperty(PPK_CupsPageRect, pageRect); + + QRect paperRect = cups->paperRect(cupsPageSize); + engine->setProperty(PPK_CupsPaperRect, paperRect); + + for (int ps = 0; ps < QPrinter::NPaperSize; ++ps) { + QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(ps)); + if (size.width == paperRect.width() && size.height == paperRect.height()) + printer->setPaperSize(static_cast<QPrinter::PaperSize>(ps)); + } + } +} +#endif + void QUnixPrintWidgetPrivate::setupPrinter() { const int printerCount = widget.printers->count(); @@ -993,6 +1025,10 @@ void QUnixPrintWidgetPrivate::setupPrinter() if (propertiesDialog && propertiesDialog->result() == QDialog::Accepted) propertiesDialog->setupPrinter(); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (!propertiesDialog) + setCupsProperties(); +#endif } diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index 033a996..c8a0028 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -77,6 +77,8 @@ protected: QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); QScopedPointer<QGraphicsSceneEventPrivate> d_ptr; Q_DECLARE_PRIVATE(QGraphicsSceneEvent) +private: + Q_DISABLE_COPY(QGraphicsSceneEvent) }; class QGraphicsSceneMouseEventPrivate; @@ -124,6 +126,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) + Q_DISABLE_COPY(QGraphicsSceneMouseEvent) }; class QGraphicsSceneWheelEventPrivate; @@ -156,6 +159,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) + Q_DISABLE_COPY(QGraphicsSceneWheelEvent) }; class QGraphicsSceneContextMenuEventPrivate; @@ -184,6 +188,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) + Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent) }; class QGraphicsSceneHoverEventPrivate; @@ -216,6 +221,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) + Q_DISABLE_COPY(QGraphicsSceneHoverEvent) }; class QGraphicsSceneHelpEventPrivate; @@ -233,6 +239,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) + Q_DISABLE_COPY(QGraphicsSceneHelpEvent) }; class QGraphicsSceneDragDropEventPrivate; @@ -275,12 +282,14 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) + Q_DISABLE_COPY(QGraphicsSceneDragDropEvent) }; class QGraphicsSceneResizeEventPrivate; class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) + Q_DISABLE_COPY(QGraphicsSceneResizeEvent) public: QGraphicsSceneResizeEvent(); ~QGraphicsSceneResizeEvent(); @@ -296,6 +305,7 @@ class QGraphicsSceneMoveEventPrivate; class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) + Q_DISABLE_COPY(QGraphicsSceneMoveEvent) public: QGraphicsSceneMoveEvent(); ~QGraphicsSceneMoveEvent(); diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 46fd9d0..702a8bb 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -2549,7 +2549,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) // check if we really need to do anything if (!d->isIndexValid(index) || (d->model->parent(index) != d->root) - || isIndexHidden(index)) + || isRowHidden(index.row()) || isColumnHidden(index.column())) return; QSpanCollection::Span span; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index ccc39c9..4a15cf2 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1034,7 +1034,7 @@ void QSymbianControl::HandleResourceChange(int resourceType) qwidget->adjustSize(); qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize } - if (!qwidget->testAttribute(Qt::WA_Moved)) { + if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) { TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); SetPosition(r.iTl); qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index f38e4f5..ae1f60d 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -348,7 +348,8 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY) \o B=1 and M=1 gives black. \o B=0 and M=1 gives white. \o B=0 and M=0 gives transparent. - \o B=1 and M=0 gives an XOR'd result. + \o B=1 and M=0 gives an XOR'd result under Windows, undefined + results on all other platforms. \endlist Use the global Qt color Qt::color0 to draw 0-pixels and Qt::color1 to diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 84e3c5d..e4d0bf3 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -88,6 +88,7 @@ QDesktopWidgetPrivate::~QDesktopWidgetPrivate() void QDesktopWidgetPrivate::init(QDesktopWidget *that) { + Q_UNUSED(that); // int screenCount=0; // ### TODO: Implement proper multi-display support diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 735ca7a..cedede1 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -68,12 +68,12 @@ #include <eikappui.h> #ifdef Q_WS_S60 -#include <aknutils.h> // AknLayoutUtils +#include <AknUtils.h> // AknLayoutUtils #include <avkon.hrh> // EEikStatusPaneUidTitle #include <akntitle.h> // CAknTitlePane #include <akncontext.h> // CAknContextPane #include <eikspane.h> // CEikStatusPane -#include <aknpopupfader.h> // MAknFadedComponent and TAknPopupFader +#include <AknPopupFader.h> // MAknFadedComponent and TAknPopupFader #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 4b45abd..a0e4050 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4783,8 +4783,10 @@ void QWidgetPrivate::syncCocoaMask() if (!q->testAttribute(Qt::WA_WState_Created) || !extra) return; - if (extra->hasMask && extra->maskBits.size() != q->size()) { - extra->maskBits = QImage(q->size(), QImage::Format_Mono); + if (extra->hasMask) { + if(extra->maskBits.size() != q->size()) { + extra->maskBits = QImage(q->size(), QImage::Format_Mono); + } extra->maskBits.fill(QColor(Qt::color1).rgba()); extra->maskBits.setNumColors(2); extra->maskBits.setColor(0, QColor(Qt::color0).rgba()); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 7fb21d2..79702af 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1037,6 +1037,17 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const return widgetPos; } +static Qt::WindowStates effectiveState(Qt::WindowStates state) +{ + if (state & Qt::WindowMinimized) + return Qt::WindowMinimized; + else if (state & Qt::WindowFullScreen) + return Qt::WindowFullScreen; + else if (state & Qt::WindowMaximized) + return Qt::WindowMaximized; + return Qt::WindowNoState; +} + void QWidget::setWindowState(Qt::WindowStates newstate) { Q_D(QWidget); @@ -1052,6 +1063,8 @@ void QWidget::setWindowState(Qt::WindowStates newstate) return; if (isWindow()) { + const bool wasResized = testAttribute(Qt::WA_Resized); + const bool wasMoved = testAttribute(Qt::WA_Moved); QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId()); if (window && newstate & Qt::WindowMinimized) { @@ -1090,7 +1103,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) createWinId(); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); // Ensure the initial size is valid, since we store it as normalGeometry below. - if (!testAttribute(Qt::WA_Resized) && !isVisible()) + if (!wasResized && !isVisible()) adjustSize(); QTLWExtra *top = d->topData(); @@ -1105,6 +1118,15 @@ void QWidget::setWindowState(Qt::WindowStates newstate) //restore normal geometry top->normalGeometry = normalGeometry; + + // FixMe QTBUG-8977 + // In some platforms, WA_Resized and WA_Moved are also not set when application window state is + // anything else than normal. In Symbian we can restore them only for normal window state since + // restoring for other modes, will make fluidlauncher to be launched in wrong size (200x100) + if (effectiveState(newstate) == Qt::WindowNoState) { + setAttribute(Qt::WA_Resized, wasResized); + setAttribute(Qt::WA_Moved, wasMoved); + } } data->window_state = newstate; diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 614d2c0..bea2b6e 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3134,8 +3134,8 @@ SOFTWARE. ************************************************************************/ /* $XFree86: xc/lib/X11/PolyReg.c,v 1.1.1.2.8.2 1998/10/04 15:22:49 hohndel Exp $ */ -#define LARGE_COORDINATE 1000000 -#define SMALL_COORDINATE -LARGE_COORDINATE +#define LARGE_COORDINATE INT_MAX +#define SMALL_COORDINATE INT_MIN /* * InsertEdgeInET diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 9909643..212a582 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -293,7 +293,8 @@ inline QTransform &QTransform::operator*=(qreal num) affine._dx *= num; affine._dy *= num; m_33 *= num; - m_dirty |= TxScale; + if (m_dirty < TxScale) + m_dirty = TxScale; return *this; } inline QTransform &QTransform::operator/=(qreal div) @@ -316,7 +317,7 @@ inline QTransform &QTransform::operator+=(qreal num) affine._dx += num; affine._dy += num; m_33 += num; - m_dirty |= TxProject; + m_dirty = TxProject; return *this; } inline QTransform &QTransform::operator-=(qreal num) @@ -332,7 +333,7 @@ inline QTransform &QTransform::operator-=(qreal num) affine._dx -= num; affine._dy -= num; m_33 -= num; - m_dirty |= TxProject; + m_dirty = TxProject; return *this; } diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 028ec48..d05c7e4 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -70,13 +70,13 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); - + QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); if (data) { data->fromSymbianBitmap(bitmap, true); d_ptr->device = QPixmap(data); } - + setStaticContentsSupport(true); } QS60WindowSurface::~QS60WindowSurface() @@ -89,24 +89,15 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) if (!qt_widget_private(window())->isOpaque) { QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); pixmapData->beginDataAccess(); - QImage &image = pixmapData->image; - QRgb *data = reinterpret_cast<QRgb *>(image.bits()); - const int row_stride = image.bytesPerLine() / 4; + QPainter p(&pixmapData->image); + p.setCompositionMode(QPainter::CompositionMode_Source); const QVector<QRect> rects = rgn.rects(); + const QColor blank = Qt::transparent; for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - const int x_start = it->x(); - const int width = it->width(); - - const int y_start = it->y(); - const int height = it->height(); - - QRgb *row = data + row_stride * y_start; - for (int y = 0; y < height; ++y) { - qt_memfill(row + x_start, 0U, width); - row += row_stride; - } + p.fillRect(*it, blank); } + pixmapData->endDataAccess(); } } @@ -128,7 +119,7 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget) const QPoint off = offset(widget); QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image); - + QRect rect(off, widget->size()); rect &= QRect(QPoint(), img->size()); diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 438b80c..553675f 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -46,7 +46,7 @@ #ifdef Q_WS_S60 -#include <akndoc.h> +#include <AknDoc.h> class CEikApplication; diff --git a/src/gui/s60framework/s60framework.pri b/src/gui/s60framework/s60framework.pri index 5884b68..6080e6d 100644 --- a/src/gui/s60framework/s60framework.pri +++ b/src/gui/s60framework/s60framework.pri @@ -5,7 +5,7 @@ minimalAppResource31 = \ "SOURCEPATH s60framework" \ "START RESOURCE s60main.rss" \ "HEADER" \ - "TARGETPATH resource\apps" \ + "TARGETPATH /resource/apps" \ "END" MMP_RULES += minimalAppResource31 diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index cb49fbc..ecac3d6 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -50,17 +50,17 @@ #include "qapplication.h" #include <w32std.h> -#include <aknsconstants.h> +#include <AknsConstants.h> #include <aknconsts.h> -#include <aknsitemid.h> -#include <aknsutils.h> -#include <aknsdrawutils.h> -#include <aknsskininstance.h> -#include <aknsbasicbackgroundcontrolcontext.h> +#include <AknsItemID.h> +#include <AknsUtils.h> +#include <AknsDrawUtils.h> +#include <AknsSkinInstance.h> +#include <AknsBasicBackgroundControlContext.h> #include <avkon.mbg> #include <aknfontaccess.h> #include <aknlayoutfont.h> -#include <aknutils.h> +#include <AknUtils.h> #include <aknnavi.h> #include <gulicon.h> #include <AknBitmapAnimation.h> diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 676f59e..5084442 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -164,17 +164,17 @@ contains( styles, windowsmobile ) { } contains( styles, s60 ):contains(QT_CONFIG, s60) { - HEADERS += \ - styles/qs60style.h \ - styles/qs60style_p.h - SOURCES += styles/qs60style.cpp - symbian { - SOURCES += styles/qs60style_s60.cpp - LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul -lbmpanim - } else { - SOURCES += styles/qs60style_simulated.cpp - RESOURCES += styles/qstyle_s60_simulated.qrc - } + HEADERS += \ + styles/qs60style.h \ + styles/qs60style_p.h + SOURCES += styles/qs60style.cpp + symbian { + SOURCES += styles/qs60style_s60.cpp + LIBS += -lAknIcon -lAKNSKINS -lAKNSKINSRV -lFontUtils -legul -lbmpanim + } else { + SOURCES += styles/qs60style_simulated.cpp + RESOURCES += styles/qstyle_s60_simulated.qrc + } } else { - DEFINES += QT_NO_STYLE_S60 + DEFINES += QT_NO_STYLE_S60 } diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index dca2da5..140cf43 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3085,7 +3085,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) f.d = new QTextFormatPrivate; f.d->resolveFont(defaultFnt); - hashes.insert(hash, idx); + if (!hashes.contains(hash, idx)) + hashes.insert(hash, idx); } QT_CATCH(...) { formats.pop_back(); diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 65b998f..a415180 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -62,8 +62,8 @@ const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 #ifdef Q_WS_S60 # include <pathinfo.h> // PathInfo # ifdef USE_DOCUMENTHANDLER -# include <documenthandler.h> // CDocumentHandler -# include <aknserverapp.h> +# include <DocumentHandler.h> // CDocumentHandler +# include <AknServerApp.h> # endif #else # warning CDocumentHandler requires support for S60 diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index cdbb7cc..3074367 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -41,5 +41,5 @@ embedded { symbian { LIBS += -lsendas2 -letext -lapmime - contains(QT_CONFIG, s60): LIBS += -lplatformenv -lcommonui + contains(QT_CONFIG, s60): LIBS += -lplatformenv -lCommonUI } diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index f44858a..806654c 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1995,16 +1995,19 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> #ifdef QT_NO_TABBAR const int tabBarShape = 0; #endif - QDockAreaLayoutInfo *info = new QDockAreaLayoutInfo(sep, dockPos, o, - tabBarShape, mainWindow); - QDockAreaLayoutItem item(info); + QDockAreaLayoutItem item(new QDockAreaLayoutInfo(sep, dockPos, o, + tabBarShape, mainWindow)); stream >> item.pos >> item.size >> dummy >> dummy; - if (!info->restoreState(stream, widgets, testing)) + //we need to make sure the element is in the list so the dock widget can eventually be docked correctly + if (!testing) + item_list.append(item); + + //here we need to make sure we change the item in the item_list + QDockAreaLayoutItem &lastItem = testing ? item : item_list.last(); + + if (!lastItem.subinfo->restoreState(stream, widgets, testing)) return false; - if (!testing) { - item_list.append(item); - } } else { return false; } diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 2c76a5c..468c111 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -134,7 +134,7 @@ void QLineEditPrivate::_q_selectionChanged() q->initStyleOption(&opt); bool showCursor = control->hasSelectedText() ? q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q): - true; + q->hasFocus(); setCursorVisible(showCursor); } diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index bf926f8..d2eda80 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -65,9 +65,6 @@ QT_BEGIN_NAMESPACE extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp QT_END_NAMESPACE #endif -#ifdef QT_SOFTKEYS_ENABLED -#include <private/qsoftkeymanager_p.h> -#endif QT_BEGIN_NAMESPACE @@ -80,9 +77,6 @@ public: #ifdef Q_WS_MAC , useHIToolBar(false) #endif -#ifdef QT_SOFTKEYS_ENABLED - , menuBarAction(0) -#endif #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) , hasOldCursor(false) , cursorAdjusted(false) #endif @@ -94,9 +88,6 @@ public: #ifdef Q_WS_MAC bool useHIToolBar; #endif -#ifdef QT_SOFTKEYS_ENABLED - QAction *menuBarAction; -#endif void init(); QList<int> hoverSeparator; QPoint hoverPos; @@ -117,10 +108,6 @@ void QMainWindowPrivate::init() const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); iconSize = QSize(metric, metric); q->setAttribute(Qt::WA_Hover); -#ifdef QT_SOFTKEYS_ENABLED - menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); - menuBarAction->setVisible(false); -#endif } /* @@ -492,13 +479,6 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) oldMenuBar->deleteLater(); } d->layout->setMenuBar(menuBar); - -#ifdef QT_SOFTKEYS_ENABLED - if (menuBar) - addAction(d->menuBarAction); - else - removeAction(d->menuBarAction); -#endif } /*! @@ -1428,11 +1408,6 @@ bool QMainWindow::event(QEvent *event) } break; #endif -#ifdef QT_SOFTKEYS_ENABLED - case QEvent::LanguageChange: - d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey)); - break; -#endif default: break; } diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index 276ffe6..39cbbd8 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -347,7 +347,7 @@ public: void syncAction(QWceMenuAction *); inline void syncAction(QAction *a) { syncAction(findAction(a)); } void removeAction(QWceMenuAction *); - void rebuild(bool reCreate = false); + void rebuild(); inline void removeAction(QAction *a) { removeAction(findAction(a)); } inline QWceMenuAction *findAction(QAction *a) { for(int i = 0; i < actionItems.size(); i++) { diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index e46688c..7224768 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -324,6 +324,14 @@ void QMenuBarPrivate::symbianDestroyMenuBar() symbian_menubar = 0; } +void QMenuBarPrivate::reparentMenuBar(QWidget *oldParent, QWidget *newParent) +{ + if (menubars()->contains(oldParent)) { + QMenuBarPrivate *object = menubars()->take(oldParent); + menubars()->insert(newParent, object); + } +} + QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar) { d = menubar; diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index 28b6b8b..1577f0a 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -101,7 +101,6 @@ struct qt_SHMENUBARINFO COLORREF clrBk; }; -typedef int (WINAPI *superfunc)(int, int); typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*); typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL); @@ -254,6 +253,12 @@ static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action, bool create } } +// Removes all items from the menu without destroying the handles. +static void qt_wce_clear_menu(HMENU hMenu) +{ + while (RemoveMenu(hMenu, 0, MF_BYPOSITION)); +} + /*! \internal @@ -404,7 +409,8 @@ QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate() { QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate() { qt_wce_delete_action_list(&actionItems); - menuHandle = 0; + if (menuHandle) + DestroyMenu(menuHandle); } void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before) { @@ -439,14 +445,17 @@ HMENU QMenuPrivate::wceMenu(bool create) { if (!wce_menu) wce_menu = new QWceMenuPrivate; if (!wce_menu->menuHandle || create) - wce_menu->rebuild(create); + wce_menu->rebuild(); return wce_menu->menuHandle; } -void QMenuPrivate::QWceMenuPrivate::rebuild(bool reCreate) { - if (menuHandle && !reCreate) - DestroyMenu(menuHandle); - menuHandle = CreatePopupMenu(); +void QMenuPrivate::QWceMenuPrivate::rebuild() +{ + if (!menuHandle) + menuHandle = CreatePopupMenu(); + else + qt_wce_clear_menu(menuHandle); + for (int i = 0; i < actionItems.size(); ++i) { QWceMenuAction *action = actionItems.at(i); action->menuHandle = menuHandle; @@ -522,6 +531,7 @@ void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() { resourceHandle = IDR_MAIN_MENU5; } Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); + qt_wce_clear_menu(menuHandle); DestroyWindow(menubarHandle); menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle); Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource"); @@ -563,6 +573,7 @@ void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() { leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu()); Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); + qt_wce_clear_menu(menuHandle); DestroyWindow(menubarHandle); if (leftButtonIsMenu) { menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2); diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 9caadb7..13aa02b 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -71,6 +71,10 @@ extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp #endif +#ifdef QT_SOFTKEYS_ENABLED +#include <private/qsoftkeymanager_p.h> +#endif + QT_BEGIN_NAMESPACE class QMenuBarExtension : public QToolButton @@ -740,17 +744,14 @@ void QMenuBarPrivate::init() QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); } #endif -#ifdef Q_WS_S60 - symbianCreateMenuBar(q->parentWidget()); - if(symbian_menubar) - q->hide(); -#endif - q->setBackgroundRole(QPalette::Button); oldWindow = oldParent = 0; #ifdef QT3_SUPPORT doAutoResize = false; #endif +#ifdef QT_SOFTKEYS_ENABLED + menuBarAction = 0; +#endif handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -1384,10 +1385,38 @@ void QMenuBarPrivate::handleReparent() wce_menubar->rebuild(); #endif #ifdef Q_WS_S60 - if (symbian_menubar) + + // Construct symbian_menubar when this code path is entered first time + // and when newParent != NULL + if (!symbian_menubar) + symbianCreateMenuBar(newParent); + + // Reparent and rebuild menubar when parent is changed + if (symbian_menubar) { + if (oldParent != newParent) + reparentMenuBar(oldParent, newParent); + q->hide(); symbian_menubar->rebuild(); -#endif + } +#ifdef QT_SOFTKEYS_ENABLED + // Constuct menuBarAction when this code path is entered first time + if (!menuBarAction) { + if (newParent) { + menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, newParent); + menuBarAction->setVisible(false); + newParent->addAction(menuBarAction); + } + } else { + // If reparenting i.e. we already have menuBarAction, remove it from old parent + // and add for a new parent + if (oldParent) + oldParent->removeAction(menuBarAction); + if (newParent) + newParent->addAction(menuBarAction); + } +#endif // QT_SOFTKEYS_ENABLED +#endif // Q_WS_S60 } #ifdef QT3_SUPPORT @@ -1440,7 +1469,13 @@ void QMenuBar::changeEvent(QEvent *e) || e->type() == QEvent::ApplicationFontChange) { d->itemsDirty = true; d->updateGeometries(); +#ifdef QT_SOFTKEYS_ENABLED + } else if (e->type() == QEvent::LanguageChange) { + if (d->menuBarAction) + d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey)); +#endif } + QWidget::changeEvent(e); } diff --git a/src/gui/widgets/qmenubar_p.h b/src/gui/widgets/qmenubar_p.h index 819aee4..82070fe 100644 --- a/src/gui/widgets/qmenubar_p.h +++ b/src/gui/widgets/qmenubar_p.h @@ -244,6 +244,7 @@ public: #ifdef Q_WS_S60 void symbianCreateMenuBar(QWidget *); void symbianDestroyMenuBar(); + void reparentMenuBar(QWidget *oldParent, QWidget *newParent); struct QSymbianMenuBarPrivate { QList<QSymbianMenuAction*> actionItems; QMenuBarPrivate *d; @@ -268,7 +269,9 @@ public: } *symbian_menubar; static int symbianCommands(int command); - +#ifdef QT_SOFTKEYS_ENABLED + QAction *menuBarAction; +#endif #endif }; #endif diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index 625b871c..ae28a26 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -41,6 +41,21 @@ mac { !wince*:LIBS += -lwinmm wince*:LIBS += -lcoredll +} else:symbian { + INCLUDEPATH += /epoc32/include/mmf/common + INCLUDEPATH += /epoc32/include/mmf/server + + HEADERS += $$PWD/qaudio_symbian_p.h \ + $$PWD/qaudiodeviceinfo_symbian_p.h \ + $$PWD/qaudioinput_symbian_p.h \ + $$PWD/qaudiooutput_symbian_p.h + + SOURCES += $$PWD/qaudio_symbian_p.cpp \ + $$PWD/qaudiodeviceinfo_symbian_p.cpp \ + $$PWD/qaudioinput_symbian_p.cpp \ + $$PWD/qaudiooutput_symbian_p.cpp + + LIBS += -lmmfdevsound } else:unix { unix:contains(QT_CONFIG, alsa) { linux-*|freebsd-*|openbsd-*:{ diff --git a/src/plugins/audio/symbian/symbianaudioutils.cpp b/src/multimedia/audio/qaudio_symbian_p.cpp index f04c198..58e3745 100644 --- a/src/plugins/audio/symbian/symbianaudioutils.cpp +++ b/src/multimedia/audio/qaudio_symbian_p.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "symbianaudioutils.h" +#include "qaudio_symbian_p.h" #include <mmffourcc.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/audio/symbian/symbianaudioutils.h b/src/multimedia/audio/qaudio_symbian_p.h index 53274e0..d5238b4 100644 --- a/src/plugins/audio/symbian/symbianaudioutils.h +++ b/src/multimedia/audio/qaudio_symbian_p.h @@ -39,19 +39,50 @@ ** ****************************************************************************/ -#ifndef SYMBIANAUDIOUTILS_H -#define SYMBIANAUDIOUTILS_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QAUDIO_SYMBIAN_P_H +#define QAUDIO_SYMBIAN_P_H #include <QtCore/qnamespace.h> #include <QtMultimedia/qaudioformat.h> #include <QtMultimedia/qaudio.h> #include <sounddevice.h> -#include "symbianaudio.h" QT_BEGIN_NAMESPACE namespace SymbianAudio { +/** + * Default values used by audio input and output classes, when underlying + * DevSound instance has not yet been created. + */ + +const int DefaultBufferSize = 4096; // bytes +const int DefaultNotifyInterval = 1000; // ms + +/** + * Enumeration used to track state of internal DevSound instances. + * Values are translated to the corresponding QAudio::State values by + * SymbianAudio::Utils::stateNativeToQt. + */ +enum State { + ClosedState + , InitializingState + , ActiveState + , IdleState + , SuspendedState +}; + /* * Helper class for querying DevSound codec / format support */ diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 459b7f5..4f45110 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -58,6 +58,10 @@ #include "qaudiodeviceinfo_alsa_p.h" #include "qaudiooutput_alsa_p.h" #include "qaudioinput_alsa_p.h" +#elif defined(Q_OS_SYMBIAN) +#include "qaudiodeviceinfo_symbian_p.h" +#include "qaudiooutput_symbian_p.h" +#include "qaudioinput_symbian_p.h" #endif #endif @@ -128,7 +132,7 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) { QList<QAudioDeviceInfo> devices; #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode)) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif @@ -158,7 +162,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); #endif #endif @@ -175,7 +179,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); #endif #endif @@ -187,7 +191,7 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re QAbstractAudioDeviceInfo *rc = 0; #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) if (realm == QLatin1String("builtin")) return new QAudioDeviceInfoInternal(handle, mode); #endif @@ -216,7 +220,7 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con if (deviceInfo.isNull()) return new QNullInputDevice(); #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) if (deviceInfo.realm() == QLatin1String("builtin")) return new QAudioInputPrivate(deviceInfo.handle(), format); #endif @@ -235,7 +239,7 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c if (deviceInfo.isNull()) return new QNullOutputDevice(); #ifndef QT_NO_AUDIO_BACKEND -#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) +#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) if (deviceInfo.realm() == QLatin1String("builtin")) return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif diff --git a/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo_symbian_p.cpp index 9701dad..36284d3 100644 --- a/src/plugins/audio/symbian/symbianaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_symbian_p.cpp @@ -39,26 +39,26 @@ ** ****************************************************************************/ -#include "symbianaudiodeviceinfo.h" -#include "symbianaudioutils.h" +#include "qaudiodeviceinfo_symbian_p.h" +#include "qaudio_symbian_p.h" QT_BEGIN_NAMESPACE -SymbianAudioDeviceInfo::SymbianAudioDeviceInfo(QByteArray device, +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray device, QAudio::Mode mode) - : m_deviceName(device) + : m_deviceName(QLatin1String(device)) , m_mode(mode) , m_updated(false) { QT_TRAP_THROWING(m_devsound.reset(CMMFDevSound::NewL())); } -SymbianAudioDeviceInfo::~SymbianAudioDeviceInfo() +QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() { } -QAudioFormat SymbianAudioDeviceInfo::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat format; switch (m_mode) { @@ -100,7 +100,7 @@ QAudioFormat SymbianAudioDeviceInfo::preferredFormat() const return format; } -bool SymbianAudioDeviceInfo::isFormatSupported( +bool QAudioDeviceInfoInternal::isFormatSupported( const QAudioFormat &format) const { getSupportedFormats(); @@ -115,7 +115,7 @@ bool SymbianAudioDeviceInfo::isFormatSupported( return supported; } -QAudioFormat SymbianAudioDeviceInfo::nearestFormat(const QAudioFormat &format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat &format) const { if (isFormatSupported(format)) return format; @@ -123,56 +123,65 @@ QAudioFormat SymbianAudioDeviceInfo::nearestFormat(const QAudioFormat &format) c return preferredFormat(); } -QString SymbianAudioDeviceInfo::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return m_deviceName; } -QStringList SymbianAudioDeviceInfo::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { getSupportedFormats(); return m_codecs; } -QList<int> SymbianAudioDeviceInfo::frequencyList() +QList<int> QAudioDeviceInfoInternal::frequencyList() { getSupportedFormats(); return m_frequencies; } -QList<int> SymbianAudioDeviceInfo::channelsList() +QList<int> QAudioDeviceInfoInternal::channelsList() { getSupportedFormats(); return m_channels; } -QList<int> SymbianAudioDeviceInfo::sampleSizeList() +QList<int> QAudioDeviceInfoInternal::sampleSizeList() { getSupportedFormats(); return m_sampleSizes; } -QList<QAudioFormat::Endian> SymbianAudioDeviceInfo::byteOrderList() +QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::byteOrderList() { getSupportedFormats(); return m_byteOrders; } -QList<QAudioFormat::SampleType> SymbianAudioDeviceInfo::sampleTypeList() +QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::sampleTypeList() { getSupportedFormats(); return m_sampleTypes; } -QList<QByteArray> SymbianAudioDeviceInfo::deviceList(QAudio::Mode mode) +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { - Q_UNUSED(mode) - QList<QByteArray> devices; - devices.append("default"); - return devices; + return QByteArray("default"); } -void SymbianAudioDeviceInfo::getSupportedFormats() const +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() +{ + return QByteArray("default"); +} + +QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode) +{ + QList<QByteArray> result; + result += QByteArray("default"); + return result; +} + +void QAudioDeviceInfoInternal::getSupportedFormats() const { if (!m_updated) { QScopedPointer<SymbianAudio::DevSoundCapabilities> caps( diff --git a/src/plugins/audio/symbian/symbianaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h index 250804d..89e539f 100644 --- a/src/plugins/audio/symbian/symbianaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo_symbian_p.h @@ -39,22 +39,33 @@ ** ****************************************************************************/ -#ifndef SYMBIANAUDIODEVICEINFO_H -#define SYMBIANAUDIODEVICEINFO_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QAUDIODEVICEINFO_SYMBIAN_P_H +#define QAUDIODEVICEINFO_SYMBIAN_P_H #include <QtMultimedia/qaudioengine.h> #include <sounddevice.h> QT_BEGIN_NAMESPACE -class SymbianAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { Q_OBJECT public: - SymbianAudioDeviceInfo(QByteArray device, QAudio::Mode mode); - ~SymbianAudioDeviceInfo(); + QAudioDeviceInfoInternal(QByteArray device, QAudio::Mode mode); + ~QAudioDeviceInfoInternal(); // QAbstractAudioDeviceInfo QAudioFormat preferredFormat() const; @@ -67,7 +78,9 @@ public: QList<int> sampleSizeList(); QList<QAudioFormat::Endian> byteOrderList(); QList<QAudioFormat::SampleType> sampleTypeList(); - QList<QByteArray> deviceList(QAudio::Mode); + static QByteArray defaultInputDevice(); + static QByteArray defaultOutputDevice(); + static QList<QByteArray> availableDevices(QAudio::Mode); private: void getSupportedFormats() const; diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index fd892dd..10bab01 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -95,7 +95,7 @@ QT_BEGIN_NAMESPACE format.setByteOrder(QAudioFormat::LittleEndian); format.setSampleType(QAudioFormat::UnSignedInt); - if (QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice()); + QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); if (!info.isFormatSupported(format)) { qWarning()<<"default format not supported try to use nearest"; format = info.nearestFormat(format); diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 6010f3c..ead9995 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -121,6 +121,11 @@ int QAudioInputPrivate::xrun_recovery(int err) err = snd_pcm_prepare(handle); if(err < 0) reset = true; + else { + bytesAvailable = bytesReady(); + if (bytesAvailable <= 0) + reset = true; + } } else if((err == -ESTRPIPE)||(err == -EIO)) { errorState = QAudio::IOError; @@ -443,6 +448,7 @@ int QAudioInputPrivate::bytesReady() const if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState) return 0; int frames = snd_pcm_avail_update(handle); + if (frames < 0) return frames; if((int)frames > (int)buffer_frames) frames = buffer_frames; @@ -459,6 +465,20 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) bytesAvailable = bytesReady(); + if (bytesAvailable < 0) { + // bytesAvailable as negative is error code, try to recover from it. + xrun_recovery(bytesAvailable); + bytesAvailable = bytesReady(); + if (bytesAvailable < 0) { + // recovery failed must stop and set error. + close(); + errorState = QAudio::IOError; + deviceState = QAudio::StoppedState; + emit stateChanged(deviceState); + return 0; + } + } + int count=0, err = 0; while(count < 5) { int chunks = bytesAvailable/period_size; @@ -588,7 +608,11 @@ int QAudioInputPrivate::notifyInterval() const qint64 QAudioInputPrivate::processedUSecs() const { - return qint64(1000000) * totalTimeValue / settings.frequency(); + qint64 result = qint64(1000000) * totalTimeValue / + (settings.channels()*(settings.sampleSize()/8)) / + settings.frequency(); + + return result; } void QAudioInputPrivate::suspend() diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index bd2de52..f394ca4 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -229,6 +229,7 @@ public: QObject* parent): QObject(parent), m_deviceError(false), + m_audioConverter(0), m_inputFormat(inputFormat), m_outputFormat(outputFormat) { diff --git a/src/plugins/audio/symbian/symbianaudioinput.cpp b/src/multimedia/audio/qaudioinput_symbian_p.cpp index 8200925..52daa88 100644 --- a/src/plugins/audio/symbian/symbianaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput_symbian_p.cpp @@ -39,8 +39,7 @@ ** ****************************************************************************/ -#include "symbianaudioinput.h" -#include "symbianaudioutils.h" +#include "qaudioinput_symbian_p.h" QT_BEGIN_NAMESPACE @@ -56,7 +55,7 @@ const int PushInterval = 50; // ms //----------------------------------------------------------------------------- SymbianAudioInputPrivate::SymbianAudioInputPrivate( - SymbianAudioInput *audioDevice) + QAudioInputPrivate *audioDevice) : m_audioDevice(audioDevice) { @@ -104,7 +103,7 @@ void SymbianAudioInputPrivate::dataReady() // Public functions //----------------------------------------------------------------------------- -SymbianAudioInput::SymbianAudioInput(const QByteArray &device, +QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat &format) : m_device(device) , m_format(format) @@ -132,12 +131,12 @@ SymbianAudioInput::SymbianAudioInput(const QByteArray &device, connect(m_pullTimer.data(), SIGNAL(timeout()), this, SLOT(pullData())); } -SymbianAudioInput::~SymbianAudioInput() +QAudioInputPrivate::~QAudioInputPrivate() { close(); } -QIODevice* SymbianAudioInput::start(QIODevice *device) +QIODevice* QAudioInputPrivate::start(QIODevice *device) { stop(); @@ -157,19 +156,19 @@ QIODevice* SymbianAudioInput::start(QIODevice *device) return m_sink; } -void SymbianAudioInput::stop() +void QAudioInputPrivate::stop() { close(); } -void SymbianAudioInput::reset() +void QAudioInputPrivate::reset() { m_totalSamplesRecorded += getSamplesRecorded(); m_devSound->Stop(); startRecording(); } -void SymbianAudioInput::suspend() +void QAudioInputPrivate::suspend() { if (SymbianAudio::ActiveState == m_internalState || SymbianAudio::IdleState == m_internalState) { @@ -188,24 +187,24 @@ void SymbianAudioInput::suspend() } } -void SymbianAudioInput::resume() +void QAudioInputPrivate::resume() { if (SymbianAudio::SuspendedState == m_internalState) startDataTransfer(); } -int SymbianAudioInput::bytesReady() const +int QAudioInputPrivate::bytesReady() const { Q_ASSERT(m_devSoundBufferPos <= m_totalBytesReady); return m_totalBytesReady - m_devSoundBufferPos; } -int SymbianAudioInput::periodSize() const +int QAudioInputPrivate::periodSize() const { return bufferSize(); } -void SymbianAudioInput::setBufferSize(int value) +void QAudioInputPrivate::setBufferSize(int value) { // Note that DevSound does not allow its client to specify the buffer size. // This functionality is available via custom interfaces, but since these @@ -218,12 +217,12 @@ void SymbianAudioInput::setBufferSize(int value) m_clientBufferSize = value; } -int SymbianAudioInput::bufferSize() const +int QAudioInputPrivate::bufferSize() const { return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize; } -void SymbianAudioInput::setNotifyInterval(int ms) +void QAudioInputPrivate::setNotifyInterval(int ms) { if (ms > 0) { const int oldNotifyInterval = m_notifyInterval; @@ -233,12 +232,12 @@ void SymbianAudioInput::setNotifyInterval(int ms) } } -int SymbianAudioInput::notifyInterval() const +int QAudioInputPrivate::notifyInterval() const { return m_notifyInterval; } -qint64 SymbianAudioInput::processedUSecs() const +qint64 QAudioInputPrivate::processedUSecs() const { int samplesPlayed = 0; if (m_devSound && SymbianAudio::SuspendedState != m_internalState) @@ -254,24 +253,24 @@ qint64 SymbianAudioInput::processedUSecs() const return result; } -qint64 SymbianAudioInput::elapsedUSecs() const +qint64 QAudioInputPrivate::elapsedUSecs() const { const qint64 result = (QAudio::StoppedState == state()) ? 0 : m_elapsed.elapsed() * 1000; return result; } -QAudio::Error SymbianAudioInput::error() const +QAudio::Error QAudioInputPrivate::error() const { return m_error; } -QAudio::State SymbianAudioInput::state() const +QAudio::State QAudioInputPrivate::state() const { return m_externalState; } -QAudioFormat SymbianAudioInput::format() const +QAudioFormat QAudioInputPrivate::format() const { return m_format; } @@ -280,7 +279,7 @@ QAudioFormat SymbianAudioInput::format() const // MDevSoundObserver implementation //----------------------------------------------------------------------------- -void SymbianAudioInput::InitializeComplete(TInt aError) +void QAudioInputPrivate::InitializeComplete(TInt aError) { Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState, Q_FUNC_INFO, "Invalid state"); @@ -289,7 +288,7 @@ void SymbianAudioInput::InitializeComplete(TInt aError) startRecording(); } -void SymbianAudioInput::ToneFinished(TInt aError) +void QAudioInputPrivate::ToneFinished(TInt aError) { Q_UNUSED(aError) // This class doesn't use DevSound's tone playback functions, so should @@ -297,7 +296,7 @@ void SymbianAudioInput::ToneFinished(TInt aError) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioInput::BufferToBeFilled(CMMFBuffer *aBuffer) +void QAudioInputPrivate::BufferToBeFilled(CMMFBuffer *aBuffer) { Q_UNUSED(aBuffer) // This class doesn't use DevSound in play mode, so should never receive @@ -305,7 +304,7 @@ void SymbianAudioInput::BufferToBeFilled(CMMFBuffer *aBuffer) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioInput::PlayError(TInt aError) +void QAudioInputPrivate::PlayError(TInt aError) { Q_UNUSED(aError) // This class doesn't use DevSound in play mode, so should never receive @@ -313,7 +312,7 @@ void SymbianAudioInput::PlayError(TInt aError) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioInput::BufferToBeEmptied(CMMFBuffer *aBuffer) +void QAudioInputPrivate::BufferToBeEmptied(CMMFBuffer *aBuffer) { // Following receipt of this callback, DevSound should not provide another // buffer until we have returned the current one. @@ -338,13 +337,13 @@ void SymbianAudioInput::BufferToBeEmptied(CMMFBuffer *aBuffer) } } -void SymbianAudioInput::RecordError(TInt aError) +void QAudioInputPrivate::RecordError(TInt aError) { Q_UNUSED(aError) setError(QAudio::IOError); } -void SymbianAudioInput::ConvertError(TInt aError) +void QAudioInputPrivate::ConvertError(TInt aError) { Q_UNUSED(aError) // This class doesn't use DevSound's format conversion functions, so @@ -352,7 +351,7 @@ void SymbianAudioInput::ConvertError(TInt aError) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioInput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg) +void QAudioInputPrivate::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg) { Q_UNUSED(aMessageType) Q_UNUSED(aMsg) @@ -363,7 +362,7 @@ void SymbianAudioInput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg) // Private functions //----------------------------------------------------------------------------- -void SymbianAudioInput::open() +void QAudioInputPrivate::open() { Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState, Q_FUNC_INFO, "DevSound already opened"); @@ -388,7 +387,7 @@ void SymbianAudioInput::open() } } -void SymbianAudioInput::startRecording() +void QAudioInputPrivate::startRecording() { const int samplesRecorded = m_devSound->SamplesRecorded(); Q_ASSERT(samplesRecorded == 0); @@ -402,7 +401,7 @@ void SymbianAudioInput::startRecording() } } -void SymbianAudioInput::startDevSoundL() +void QAudioInputPrivate::startDevSoundL() { TMMFCapabilities nativeFormat = m_devSound->Config(); m_nativeFormat.iBufferSize = nativeFormat.iBufferSize; @@ -410,7 +409,7 @@ void SymbianAudioInput::startDevSoundL() m_devSound->RecordInitL(); } -void SymbianAudioInput::startDataTransfer() +void QAudioInputPrivate::startDataTransfer() { m_notifyTimer->start(m_notifyInterval); @@ -429,7 +428,7 @@ void SymbianAudioInput::startDataTransfer() } } -CMMFDataBuffer* SymbianAudioInput::currentBuffer() const +CMMFDataBuffer* QAudioInputPrivate::currentBuffer() const { CMMFDataBuffer *result = m_devSoundBuffer; if (!result && !m_devSoundBufferQ.empty()) @@ -437,14 +436,14 @@ CMMFDataBuffer* SymbianAudioInput::currentBuffer() const return result; } -void SymbianAudioInput::pushData() +void QAudioInputPrivate::pushData() { Q_ASSERT_X(bytesReady(), Q_FUNC_INFO, "No data available"); Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO, "pushData called when in pull mode"); qobject_cast<SymbianAudioInputPrivate *>(m_sink)->dataReady(); } -qint64 SymbianAudioInput::read(char *data, qint64 len) +qint64 QAudioInputPrivate::read(char *data, qint64 len) { // SymbianAudioInputPrivate is ready to read data @@ -478,7 +477,7 @@ qint64 SymbianAudioInput::read(char *data, qint64 len) return bytesRead; } -void SymbianAudioInput::pullData() +void QAudioInputPrivate::pullData() { Q_ASSERT_X(m_pullMode, Q_FUNC_INFO, "pullData called when in push mode"); @@ -504,7 +503,7 @@ void SymbianAudioInput::pullData() } } -void SymbianAudioInput::bufferEmptied() +void QAudioInputPrivate::bufferEmptied() { m_devSoundBufferPos = 0; @@ -525,7 +524,7 @@ void SymbianAudioInput::bufferEmptied() Q_ASSERT(m_totalBytesReady >= 0); } -void SymbianAudioInput::close() +void QAudioInputPrivate::close() { m_notifyTimer->stop(); m_pullTimer->stop(); @@ -551,7 +550,7 @@ void SymbianAudioInput::close() setState(SymbianAudio::ClosedState); } -qint64 SymbianAudioInput::getSamplesRecorded() const +qint64 QAudioInputPrivate::getSamplesRecorded() const { qint64 result = 0; if (m_devSound) @@ -559,7 +558,7 @@ qint64 SymbianAudioInput::getSamplesRecorded() const return result; } -void SymbianAudioInput::setError(QAudio::Error error) +void QAudioInputPrivate::setError(QAudio::Error error) { m_error = error; @@ -576,7 +575,7 @@ void SymbianAudioInput::setError(QAudio::Error error) QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection); } -void SymbianAudioInput::setState(SymbianAudio::State newInternalState) +void QAudioInputPrivate::setState(SymbianAudio::State newInternalState) { const QAudio::State oldExternalState = m_externalState; m_internalState = newInternalState; @@ -587,7 +586,7 @@ void SymbianAudioInput::setState(SymbianAudio::State newInternalState) emit stateChanged(m_externalState); } -QAudio::State SymbianAudioInput::initializingState() const +QAudio::State QAudioInputPrivate::initializingState() const { return QAudio::IdleState; } diff --git a/src/plugins/audio/symbian/symbianaudioinput.h b/src/multimedia/audio/qaudioinput_symbian_p.h index 34b7d38..ca3ccf7 100644 --- a/src/plugins/audio/symbian/symbianaudioinput.h +++ b/src/multimedia/audio/qaudioinput_symbian_p.h @@ -39,25 +39,36 @@ ** ****************************************************************************/ -#ifndef SYMBIANAUDIOINPUT_H -#define SYMBIANAUDIOINPUT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QAUDIOINPUT_SYMBIAN_P_H +#define QAUDIOINPUT_SYMBIAN_P_H #include <QtMultimedia/qaudioengine.h> #include <QTime> #include <QTimer> #include <sounddevice.h> -#include "symbianaudio.h" +#include "qaudio_symbian_p.h" QT_BEGIN_NAMESPACE -class SymbianAudioInput; +class QAudioInputPrivate; class SymbianAudioInputPrivate : public QIODevice { - friend class SymbianAudioInput; + friend class QAudioInputPrivate; Q_OBJECT public: - SymbianAudioInputPrivate(SymbianAudioInput *audio); + SymbianAudioInputPrivate(QAudioInputPrivate *audio); ~SymbianAudioInputPrivate(); qint64 readData(char *data, qint64 len); @@ -66,19 +77,19 @@ public: void dataReady(); private: - SymbianAudioInput *const m_audioDevice; + QAudioInputPrivate *const m_audioDevice; }; -class SymbianAudioInput +class QAudioInputPrivate : public QAbstractAudioInput , public MDevSoundObserver { friend class SymbianAudioInputPrivate; Q_OBJECT public: - SymbianAudioInput(const QByteArray &device, + QAudioInputPrivate(const QByteArray &device, const QAudioFormat &audioFormat); - ~SymbianAudioInput(); + ~QAudioInputPrivate(); // QAbstractAudioInput QIODevice* start(QIODevice *device = 0); diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index e49c75a..1cef335 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -648,9 +648,10 @@ void QAudioOutputPrivate::userFeed() void QAudioOutputPrivate::feedback() { - QMetaObject::invokeMethod(this, SLOT(updateAvailable()), Qt::QueuedConnection); + updateAvailable(); } + void QAudioOutputPrivate::updateAvailable() { #ifdef DEBUG_AUDIO diff --git a/src/plugins/audio/symbian/symbianaudiooutput.cpp b/src/multimedia/audio/qaudiooutput_symbian_p.cpp index 385e169..945a08d 100644 --- a/src/plugins/audio/symbian/symbianaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput_symbian_p.cpp @@ -39,8 +39,7 @@ ** ****************************************************************************/ -#include "symbianaudiooutput.h" -#include "symbianaudioutils.h" +#include "qaudiooutput_symbian_p.h" QT_BEGIN_NAMESPACE @@ -56,7 +55,7 @@ const int UnderflowTimerInterval = 50; // ms //----------------------------------------------------------------------------- SymbianAudioOutputPrivate::SymbianAudioOutputPrivate( - SymbianAudioOutput *audioDevice) + QAudioOutputPrivate *audioDevice) : m_audioDevice(audioDevice) { @@ -99,7 +98,7 @@ qint64 SymbianAudioOutputPrivate::writeData(const char *data, qint64 len) // Public functions //----------------------------------------------------------------------------- -SymbianAudioOutput::SymbianAudioOutput(const QByteArray &device, +QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat &format) : m_device(device) , m_format(format) @@ -132,12 +131,12 @@ SymbianAudioOutput::SymbianAudioOutput(const QByteArray &device, SLOT(underflowTimerExpired())); } -SymbianAudioOutput::~SymbianAudioOutput() +QAudioOutputPrivate::~QAudioOutputPrivate() { close(); } -QIODevice* SymbianAudioOutput::start(QIODevice *device) +QIODevice* QAudioOutputPrivate::start(QIODevice *device) { stop(); @@ -164,12 +163,12 @@ QIODevice* SymbianAudioOutput::start(QIODevice *device) return m_source; } -void SymbianAudioOutput::stop() +void QAudioOutputPrivate::stop() { close(); } -void SymbianAudioOutput::reset() +void QAudioOutputPrivate::reset() { m_totalSamplesPlayed += getSamplesPlayed(); m_devSound->Stop(); @@ -177,7 +176,7 @@ void SymbianAudioOutput::reset() startPlayback(); } -void SymbianAudioOutput::suspend() +void QAudioOutputPrivate::suspend() { if (SymbianAudio::ActiveState == m_internalState || SymbianAudio::IdleState == m_internalState) { @@ -208,13 +207,13 @@ void SymbianAudioOutput::suspend() } } -void SymbianAudioOutput::resume() +void QAudioOutputPrivate::resume() { if (SymbianAudio::SuspendedState == m_internalState) startPlayback(); } -int SymbianAudioOutput::bytesFree() const +int QAudioOutputPrivate::bytesFree() const { int result = 0; if (m_devSoundBuffer) { @@ -224,12 +223,12 @@ int SymbianAudioOutput::bytesFree() const return result; } -int SymbianAudioOutput::periodSize() const +int QAudioOutputPrivate::periodSize() const { return bufferSize(); } -void SymbianAudioOutput::setBufferSize(int value) +void QAudioOutputPrivate::setBufferSize(int value) { // Note that DevSound does not allow its client to specify the buffer size. // This functionality is available via custom interfaces, but since these @@ -242,12 +241,12 @@ void SymbianAudioOutput::setBufferSize(int value) m_clientBufferSize = value; } -int SymbianAudioOutput::bufferSize() const +int QAudioOutputPrivate::bufferSize() const { return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize; } -void SymbianAudioOutput::setNotifyInterval(int ms) +void QAudioOutputPrivate::setNotifyInterval(int ms) { if (ms > 0) { const int oldNotifyInterval = m_notifyInterval; @@ -257,12 +256,12 @@ void SymbianAudioOutput::setNotifyInterval(int ms) } } -int SymbianAudioOutput::notifyInterval() const +int QAudioOutputPrivate::notifyInterval() const { return m_notifyInterval; } -qint64 SymbianAudioOutput::processedUSecs() const +qint64 QAudioOutputPrivate::processedUSecs() const { int samplesPlayed = 0; if (m_devSound && SymbianAudio::SuspendedState != m_internalState) @@ -278,24 +277,24 @@ qint64 SymbianAudioOutput::processedUSecs() const return result; } -qint64 SymbianAudioOutput::elapsedUSecs() const +qint64 QAudioOutputPrivate::elapsedUSecs() const { const qint64 result = (QAudio::StoppedState == state()) ? 0 : m_elapsed.elapsed() * 1000; return result; } -QAudio::Error SymbianAudioOutput::error() const +QAudio::Error QAudioOutputPrivate::error() const { return m_error; } -QAudio::State SymbianAudioOutput::state() const +QAudio::State QAudioOutputPrivate::state() const { return m_externalState; } -QAudioFormat SymbianAudioOutput::format() const +QAudioFormat QAudioOutputPrivate::format() const { return m_format; } @@ -304,7 +303,7 @@ QAudioFormat SymbianAudioOutput::format() const // MDevSoundObserver implementation //----------------------------------------------------------------------------- -void SymbianAudioOutput::InitializeComplete(TInt aError) +void QAudioOutputPrivate::InitializeComplete(TInt aError) { Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState, Q_FUNC_INFO, "Invalid state"); @@ -313,7 +312,7 @@ void SymbianAudioOutput::InitializeComplete(TInt aError) startPlayback(); } -void SymbianAudioOutput::ToneFinished(TInt aError) +void QAudioOutputPrivate::ToneFinished(TInt aError) { Q_UNUSED(aError) // This class doesn't use DevSound's tone playback functions, so should @@ -321,7 +320,7 @@ void SymbianAudioOutput::ToneFinished(TInt aError) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioOutput::BufferToBeFilled(CMMFBuffer *aBuffer) +void QAudioOutputPrivate::BufferToBeFilled(CMMFBuffer *aBuffer) { // Following receipt of this callback, DevSound should not provide another // buffer until we have returned the current one. @@ -339,7 +338,7 @@ void SymbianAudioOutput::BufferToBeFilled(CMMFBuffer *aBuffer) pullData(); } -void SymbianAudioOutput::PlayError(TInt aError) +void QAudioOutputPrivate::PlayError(TInt aError) { switch (aError) { case KErrUnderflow: @@ -355,7 +354,7 @@ void SymbianAudioOutput::PlayError(TInt aError) } } -void SymbianAudioOutput::BufferToBeEmptied(CMMFBuffer *aBuffer) +void QAudioOutputPrivate::BufferToBeEmptied(CMMFBuffer *aBuffer) { Q_UNUSED(aBuffer) // This class doesn't use DevSound in record mode, so should never receive @@ -363,7 +362,7 @@ void SymbianAudioOutput::BufferToBeEmptied(CMMFBuffer *aBuffer) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioOutput::RecordError(TInt aError) +void QAudioOutputPrivate::RecordError(TInt aError) { Q_UNUSED(aError) // This class doesn't use DevSound in record mode, so should never receive @@ -371,7 +370,7 @@ void SymbianAudioOutput::RecordError(TInt aError) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioOutput::ConvertError(TInt aError) +void QAudioOutputPrivate::ConvertError(TInt aError) { Q_UNUSED(aError) // This class doesn't use DevSound's format conversion functions, so @@ -379,7 +378,7 @@ void SymbianAudioOutput::ConvertError(TInt aError) Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback"); } -void SymbianAudioOutput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg) +void QAudioOutputPrivate::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg) { Q_UNUSED(aMessageType) Q_UNUSED(aMsg) @@ -390,7 +389,7 @@ void SymbianAudioOutput::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg) // Private functions //----------------------------------------------------------------------------- -void SymbianAudioOutput::dataReady() +void QAudioOutputPrivate::dataReady() { // Client-provided QIODevice has data ready to read. @@ -401,7 +400,7 @@ void SymbianAudioOutput::dataReady() pullData(); } -void SymbianAudioOutput::underflowTimerExpired() +void QAudioOutputPrivate::underflowTimerExpired() { const TInt samplesPlayed = getSamplesPlayed(); if (m_samplesPlayed && (samplesPlayed == m_samplesPlayed)) { @@ -412,7 +411,7 @@ void SymbianAudioOutput::underflowTimerExpired() } } -void SymbianAudioOutput::open() +void QAudioOutputPrivate::open() { Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState, Q_FUNC_INFO, "DevSound already opened"); @@ -438,7 +437,7 @@ void SymbianAudioOutput::open() } } -void SymbianAudioOutput::startPlayback() +void QAudioOutputPrivate::startPlayback() { TRAPD(err, startDevSoundL()); if (KErrNone == err) { @@ -462,7 +461,7 @@ void SymbianAudioOutput::startPlayback() } } -void SymbianAudioOutput::startDevSoundL() +void QAudioOutputPrivate::startDevSoundL() { TMMFCapabilities nativeFormat = m_devSound->Config(); m_nativeFormat.iBufferSize = nativeFormat.iBufferSize; @@ -470,7 +469,7 @@ void SymbianAudioOutput::startDevSoundL() m_devSound->PlayInitL(); } -void SymbianAudioOutput::writePaddingData() +void QAudioOutputPrivate::writePaddingData() { // See comments in suspend() @@ -494,7 +493,7 @@ void SymbianAudioOutput::writePaddingData() } } -qint64 SymbianAudioOutput::pushData(const char *data, qint64 len) +qint64 QAudioOutputPrivate::pushData(const char *data, qint64 len) { // Data has been written to SymbianAudioOutputPrivate @@ -538,7 +537,7 @@ qint64 SymbianAudioOutput::pushData(const char *data, qint64 len) return bytesWritten; } -void SymbianAudioOutput::pullData() +void QAudioOutputPrivate::pullData() { Q_ASSERT_X(m_pullMode, Q_FUNC_INFO, "pullData called when in push mode"); @@ -575,7 +574,7 @@ void SymbianAudioOutput::pullData() } } -void SymbianAudioOutput::bufferFilled() +void QAudioOutputPrivate::bufferFilled() { Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to return"); @@ -593,7 +592,7 @@ void SymbianAudioOutput::bufferFilled() m_devSound->PlayData(); } -void SymbianAudioOutput::lastBufferFilled() +void QAudioOutputPrivate::lastBufferFilled() { Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to fill"); Q_ASSERT_X(!m_lastBuffer, Q_FUNC_INFO, "Last buffer already sent"); @@ -602,7 +601,7 @@ void SymbianAudioOutput::lastBufferFilled() bufferFilled(); } -void SymbianAudioOutput::close() +void QAudioOutputPrivate::close() { m_notifyTimer->stop(); m_underflowTimer->stop(); @@ -631,7 +630,7 @@ void SymbianAudioOutput::close() setState(SymbianAudio::ClosedState); } -qint64 SymbianAudioOutput::getSamplesPlayed() const +qint64 QAudioOutputPrivate::getSamplesPlayed() const { qint64 result = 0; if (m_devSound) { @@ -651,7 +650,7 @@ qint64 SymbianAudioOutput::getSamplesPlayed() const return result; } -void SymbianAudioOutput::setError(QAudio::Error error) +void QAudioOutputPrivate::setError(QAudio::Error error) { m_error = error; @@ -671,7 +670,7 @@ void SymbianAudioOutput::setError(QAudio::Error error) QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection); } -void SymbianAudioOutput::setState(SymbianAudio::State newInternalState) +void QAudioOutputPrivate::setState(SymbianAudio::State newInternalState) { const QAudio::State oldExternalState = m_externalState; m_internalState = newInternalState; @@ -682,14 +681,14 @@ void SymbianAudioOutput::setState(SymbianAudio::State newInternalState) emit stateChanged(m_externalState); } -bool SymbianAudioOutput::isDataReady() const +bool QAudioOutputPrivate::isDataReady() const { return (m_source && m_source->bytesAvailable()) || m_bytesPadding || m_pushDataReady; } -QAudio::State SymbianAudioOutput::initializingState() const +QAudio::State QAudioOutputPrivate::initializingState() const { return isDataReady() ? QAudio::ActiveState : QAudio::IdleState; } diff --git a/src/plugins/audio/symbian/symbianaudiooutput.h b/src/multimedia/audio/qaudiooutput_symbian_p.h index 8994e46..00ccb24 100644 --- a/src/plugins/audio/symbian/symbianaudiooutput.h +++ b/src/multimedia/audio/qaudiooutput_symbian_p.h @@ -39,44 +39,55 @@ ** ****************************************************************************/ -#ifndef SYMBIANAUDIOOUTPUT_H -#define SYMBIANAUDIOOUTPUT_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef QAUDIOOUTPUT_SYMBIAN_P_H +#define QAUDIOOUTPUT_SYMBIAN_P_H #include <QtMultimedia/qaudioengine.h> #include <QTime> #include <QTimer> #include <sounddevice.h> -#include "symbianaudio.h" +#include "qaudio_symbian_p.h" QT_BEGIN_NAMESPACE -class SymbianAudioOutput; +class QAudioOutputPrivate; class SymbianAudioOutputPrivate : public QIODevice { - friend class SymbianAudioOutput; + friend class QAudioOutputPrivate; Q_OBJECT public: - SymbianAudioOutputPrivate(SymbianAudioOutput *audio); + SymbianAudioOutputPrivate(QAudioOutputPrivate *audio); ~SymbianAudioOutputPrivate(); qint64 readData(char *data, qint64 len); qint64 writeData(const char *data, qint64 len); private: - SymbianAudioOutput *const m_audioDevice; + QAudioOutputPrivate *const m_audioDevice; }; -class SymbianAudioOutput +class QAudioOutputPrivate : public QAbstractAudioOutput , public MDevSoundObserver { friend class SymbianAudioOutputPrivate; Q_OBJECT public: - SymbianAudioOutput(const QByteArray &device, + QAudioOutputPrivate(const QByteArray &device, const QAudioFormat &audioFormat); - ~SymbianAudioOutput(); + ~QAudioOutputPrivate(); // QAbstractAudioOutput QIODevice* start(QIODevice *device = 0); diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index c7f5752..ab8da53 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -455,6 +455,9 @@ void QAudioOutputPrivate::feedback() bool QAudioOutputPrivate::deviceReady() { + if(deviceState == QAudio::StoppedState) + return false; + if(pullMode) { int chunks = bytesAvailable/period_size; #ifdef DEBUG_AUDIO diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 4800e9d..3d0c32d 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -639,7 +639,7 @@ void qt_qhostinfo_clear_cache() } } -void Q_NETWORK_EXPORT qt_qhostinfo_enable_cache(bool e) +void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e) { QHostInfoLookupManager* manager = theHostInfoLookupManager(); if (manager) { diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp index 41b2384..da39662 100644 --- a/src/network/ssl/qsslkey.cpp +++ b/src/network/ssl/qsslkey.cpp @@ -119,9 +119,7 @@ void QSslKeyPrivate::decodePem(const QByteArray &pem, const QByteArray &passPhra if (!bio) return; - void *phrase = passPhrase.isEmpty() - ? (void *)0 - : (void *)passPhrase.constData(); + void *phrase = (void *)passPhrase.constData(); if (algorithm == QSsl::Rsa) { RSA *result = (type == QSsl::PublicKey) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index ee04166..c88c041 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -331,9 +331,14 @@ static const char* const qglslImageSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ uniform lowp sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ - { \n\ - return texture2D(imageTexture, textureCoords); \n\ - }\n"; + { \n" +#ifdef QT_OPENGL_ES_2 + // work-around for driver bug + "return 1.0 * texture2D(imageTexture, textureCoords); \n" +#else + "return texture2D(imageTexture, textureCoords); \n" +#endif + "}\n"; static const char* const qglslCustomSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 9c44545..693312a 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -177,7 +177,8 @@ void qt_vg_unregister_pixmap(QVGPixmapData *pd) pd->prev->next = pd->next; } else { QVGSharedContext *shared = sharedContext(); - shared->firstPixmap = pd->next; + if (shared) + shared->firstPixmap = pd->next; } } diff --git a/src/plugins/audio/audio.pro b/src/plugins/audio/audio.pro index 5f75a8d..b7a775b 100644 --- a/src/plugins/audio/audio.pro +++ b/src/plugins/audio/audio.pro @@ -1,9 +1,3 @@ TEMPLATE = subdirs SUBDIRS = -contains(QT_CONFIG, audio-backend) { - symbian { - SUBDIRS += symbian - } -} - diff --git a/src/plugins/audio/symbian/main.cpp b/src/plugins/audio/symbian/main.cpp deleted file mode 100644 index 536a8ec..0000000 --- a/src/plugins/audio/symbian/main.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia 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$ -** -****************************************************************************/ - -#include <QtMultimedia/qaudioengineplugin.h> -#include <QtMultimedia/qaudioengine.h> - -#include <qstringlist.h> -#include <qiodevice.h> -#include <qbytearray.h> -#include <qdebug.h> - -#include "symbianaudiodeviceinfo.h" -#include "symbianaudioinput.h" -#include "symbianaudiooutput.h" - -QT_BEGIN_NAMESPACE - -class SymbianAudioPlugin : public QAudioEnginePlugin -{ -public: - SymbianAudioPlugin(QObject *parent = 0); - ~SymbianAudioPlugin(); - - QStringList keys() const; - - QList<QByteArray> availableDevices(QAudio::Mode) const; - QAbstractAudioInput* createInput(const QByteArray& device, - const QAudioFormat& format = QAudioFormat()); - QAbstractAudioOutput* createOutput(const QByteArray& device, - const QAudioFormat& format = QAudioFormat()); - QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, - QAudio::Mode mode); -}; - -SymbianAudioPlugin::SymbianAudioPlugin(QObject *parent) - : QAudioEnginePlugin(parent) -{ - -} - -SymbianAudioPlugin::~SymbianAudioPlugin() -{ - -} - -QStringList SymbianAudioPlugin::keys() const -{ - QStringList keys(QLatin1String("default")); - keys << QLatin1String("default"); - return keys; -} - -QList<QByteArray> SymbianAudioPlugin::availableDevices(QAudio::Mode mode) const -{ - Q_UNUSED(mode) - QList<QByteArray> devices; - devices.append("default"); - return devices; -} - -QAbstractAudioInput* SymbianAudioPlugin::createInput( - const QByteArray &device, const QAudioFormat &format) -{ - return new SymbianAudioInput(device, format); -} - -QAbstractAudioOutput* SymbianAudioPlugin::createOutput( - const QByteArray &device, const QAudioFormat &format) -{ - return new SymbianAudioOutput(device, format); -} - -QAbstractAudioDeviceInfo* SymbianAudioPlugin::createDeviceInfo( - const QByteArray& device, QAudio::Mode mode) -{ - return new SymbianAudioDeviceInfo(device, mode); -} - -Q_EXPORT_STATIC_PLUGIN(SymbianAudioPlugin) -Q_EXPORT_PLUGIN2(qaudio, SymbianAudioPlugin) - -QT_END_NAMESPACE - diff --git a/src/plugins/audio/symbian/symbian.pro b/src/plugins/audio/symbian/symbian.pro deleted file mode 100644 index 7355daa..0000000 --- a/src/plugins/audio/symbian/symbian.pro +++ /dev/null @@ -1,31 +0,0 @@ -QT += multimedia -TARGET = qaudio - -# Paths to DevSound headers -INCLUDEPATH += /epoc32/include/mmf/common -INCLUDEPATH += /epoc32/include/mmf/server - -HEADERS += \ - symbianaudio.h \ - symbianaudiodeviceinfo.h \ - symbianaudioinput.h \ - symbianaudiooutput.h \ - symbianaudioutils.h - -SOURCES += \ - main.cpp \ - symbianaudiodeviceinfo.cpp \ - symbianaudioinput.cpp \ - symbianaudiooutput.cpp \ - symbianaudioutils.cpp - -LIBS += -lmmfdevsound - -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/audio -target.path = $$[QT_INSTALL_PLUGINS]/audio -INSTALLS += target - -include(../../qpluginbase.pri) - -TARGET.UID3 = 0x2001E630 - diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 54f4a8a..e4a0135 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -216,12 +216,12 @@ static void initRasterFallbacksMasks(int *warningMask, int *disableMask) int idx = warning.indexOf(name); if (idx != -1) { *warningMask |= operations[i].operation; - warning.remove(warning.begin() + idx); + warning.erase(warning.begin() + idx); } idx = disable.indexOf(name); if (idx != -1) { *disableMask |= operations[i].operation; - disable.remove(disable.begin() + idx); + disable.erase(disable.begin() + idx); } } } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index b5ac67d..4219f6f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -174,6 +174,8 @@ bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags) { + if (!QFile::exists(filename)) + return false; if (flags == Qt::AutoColor) { if (filename.startsWith(QLatin1Char(':'))) { // resource QFile file(filename); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index a8bdb65..51969fc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -61,6 +61,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) + , flushPending(false) { #ifdef QT_NO_DIRECTFB_WM mode = Offscreen; @@ -80,6 +81,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) + , flushPending(false) { SurfaceFlags flags = 0; if (!widget || widget->window()->windowOpacity() == 0xff) @@ -299,28 +301,19 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) } } -static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) -{ - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; - surface->Flip(surface, ®ion, DSFLIP_BLIT); -} - bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) { - if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.isEmpty()) + if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1) return false; - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - if (region.rectCount() == 1) { - scrollSurface(dfbSurface, region.boundingRect(), dx, dy); + if (flushPending) { + dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT); } else { - const QVector<QRect> rects = region.rects(); - const int n = rects.size(); - for (int i=0; i<n; ++i) { - scrollSurface(dfbSurface, rects.at(i), dx, dy); - } + flushPending = true; } + dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); + const QRect r = region.boundingRect(); + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy); return true; } @@ -384,6 +377,7 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, timer.restart(); } #endif + flushPending = false; } void QDirectFBWindowSurface::beginPaint(const QRegion &) @@ -391,6 +385,7 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &) if (!engine) { engine = new QDirectFBPaintEngine(this); } + flushPending = true; } void QDirectFBWindowSurface::endPaint(const QRegion &) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index a6138f6..4370a8f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -114,6 +114,7 @@ private: DFBSurfaceFlipFlags flipFlags; bool boundingRectFlip; + bool flushPending; #ifdef QT_DIRECTFB_TIMING int frames; QTime timer; diff --git a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp index e78fec1..f5ad70c 100644 --- a/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp +++ b/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp @@ -2163,6 +2163,9 @@ bool QVNCScreen::connect(const QString &displaySpec) if (QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive)) { const int id = getDisplayId(dspec); QScreen *s = qt_get_screen(id, dspec.toLatin1().constData()); + if (s->pixelFormat() == QImage::Format_Indexed8 + || s->pixelFormat() == QImage::Format_Invalid && s->depth() == 8) + qFatal("QVNCScreen: unsupported screen format"); setScreen(s); } else { // create virtual screen #if Q_BYTE_ORDER == Q_BIG_ENDIAN diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index 0f0d6f6..abe3ffe 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -766,7 +766,11 @@ bool QJpegHandler::canRead(QIODevice *device) return false; } - return device->peek(2) == "\xFF\xD8"; + char buffer[2]; + if (device->peek(buffer, 2) != 2) + return false; + + return uchar(buffer[0]) == 0xff && uchar(buffer[1]) == 0xd8; } bool QJpegHandler::read(QImage *image) diff --git a/src/plugins/s60/3_2/3_2.pro b/src/plugins/s60/3_2/3_2.pro index 4b28eb9..468197d 100644 --- a/src/plugins/s60/3_2/3_2.pro +++ b/src/plugins/s60/3_2/3_2.pro @@ -10,7 +10,7 @@ contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_2.cpp \ ../src/qdesktopservices_3_2.cpp \ ../src/qcoreapplication_3_2.cpp - LIBS += -ldirectorylocalizer -lefsrv + LIBS += -lDirectoryLocalizer -lefsrv INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/plugins/s60/5_0/5_0.pro b/src/plugins/s60/5_0/5_0.pro index 4cdce12..86e3dc9 100644 --- a/src/plugins/s60/5_0/5_0.pro +++ b/src/plugins/s60/5_0/5_0.pro @@ -10,7 +10,7 @@ contains(S60_VERSION, 3.1) { SOURCES += ../src/qlocale_3_2.cpp \ ../src/qdesktopservices_3_2.cpp \ ../src/qcoreapplication_3_2.cpp - LIBS += -ldirectorylocalizer -lefsrv + LIBS += -lDirectoryLocalizer -lefsrv INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE } diff --git a/src/plugins/s60/src/qdesktopservices_3_2.cpp b/src/plugins/s60/src/qdesktopservices_3_2.cpp index a2f30f2..b4ca9a3 100644 --- a/src/plugins/s60/src/qdesktopservices_3_2.cpp +++ b/src/plugins/s60/src/qdesktopservices_3_2.cpp @@ -45,7 +45,7 @@ #ifdef Q_WS_S60 #include <e32base.h> // CBase -> Required by cdirectorylocalizer.h -#include <cdirectorylocalizer.h> // CDirectoryLocalizer +#include <CDirectoryLocalizer.h> // CDirectoryLocalizer EXPORT_C QString localizedDirectoryName(QString& rawPath) { diff --git a/src/plugins/sqldrivers/sqlite/sqlite.pro b/src/plugins/sqldrivers/sqlite/sqlite.pro index c609a9e..fb31233 100644 --- a/src/plugins/sqldrivers/sqlite/sqlite.pro +++ b/src/plugins/sqldrivers/sqlite/sqlite.pro @@ -14,4 +14,6 @@ SOURCES = smain.cpp \ QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE } +wince*: DEFINES += HAVE_LOCALTIME_S=0 + include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip b/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip Binary files differindex 923cca4..df78644 100644 --- a/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip +++ b/src/plugins/sqldrivers/sqlite_symbian/SQLite3_v9.2.zip diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 9379163..2feaffd 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -8995,7 +8995,7 @@ EXPORTS ?setFocus@QTextControl@@QAEX_NW4FocusReason@Qt@@@Z @ 8994 NONAME ; void QTextControl::setFocus(bool, enum Qt::FocusReason) ?setFocus@QWidget@@QAEXW4FocusReason@Qt@@@Z @ 8995 NONAME ; void QWidget::setFocus(enum Qt::FocusReason) ?setFocus@QWidget@@QAEXXZ @ 8996 NONAME ; void QWidget::setFocus(void) - ?setFocusHelper@QGraphicsItemPrivate@@QAEXW4FocusReason@Qt@@_N@Z @ 8997 NONAME ; void QGraphicsItemPrivate::setFocusHelper(enum Qt::FocusReason, bool) + ?setFocusHelper@QGraphicsItemPrivate@@QAEXW4FocusReason@Qt@@_N@Z @ 8997 NONAME ABSENT ; void QGraphicsItemPrivate::setFocusHelper(enum Qt::FocusReason, bool) ?setFocusItem@QGraphicsScene@@QAEXPAVQGraphicsItem@@W4FocusReason@Qt@@@Z @ 8998 NONAME ; void QGraphicsScene::setFocusItem(class QGraphicsItem *, enum Qt::FocusReason) ?setFocusPolicy@QGraphicsWidget@@QAEXW4FocusPolicy@Qt@@@Z @ 8999 NONAME ; void QGraphicsWidget::setFocusPolicy(enum Qt::FocusPolicy) ?setFocusPolicy@QWidget@@QAEXW4FocusPolicy@Qt@@@Z @ 9000 NONAME ; void QWidget::setFocusPolicy(enum Qt::FocusPolicy) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index b82fe4c..7c91264 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -4663,7 +4663,7 @@ EXPORTS _ZN20QGraphicsItemPrivate12resolveDepthEv @ 4662 NONAME _ZN20QGraphicsItemPrivate12setPosHelperERK7QPointF @ 4663 NONAME _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItem @ 4664 NONAME - _ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEb @ 4665 NONAME + _ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEb @ 4665 NONAME ABSENT _ZN20QGraphicsItemPrivate15resetFocusProxyEv @ 4666 NONAME _ZN20QGraphicsItemPrivate16setEnabledHelperEbbb @ 4667 NONAME _ZN20QGraphicsItemPrivate16setVisibleHelperEbbb @ 4668 NONAME diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index 724451b..ec019e2 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -3,92 +3,57 @@ #include <bldvariant.hrh> -// Dependancies for more than one module -#include <base.iby> -#include <openenv.iby> // QtCore, QtGui, QtNetwork, QtOpenGL, QSvgIconEngine, -#include <cone.iby> // QtGui, QtOpenGL -#include <stdcpp.iby> // for std C++ support - -// QtGui dependancies -#include <bafl.iby> -#include <store.iby> -#include <fntstore.iby> -#include <ecom.iby> -#include <fontutils.iby> -#include <fepbase.iby> -#include <fbserv.iby> -#include <bitgdi.iby> -#include <gdi.iby> -#include <wserv.iby> -#include <apparc.iby> -#include <uikon.iby> -#include <etext.iby> -#include <emime.iby> -#include <eikstd.iby> -#include <mmf.iby> -#include <avkon.iby> -#include <commonui.iby> -#include <platformenv.iby> -#include <senduiservices.iby> -#include <aknicon.iby> -#include <aknskins.iby> - -// QtNetwork dependancies -#include <esock_core.iby> -#include <insock.iby> - -// QtOpenGL dependancies -///@todo Problem here as we need libegl.dll and libglesv2.dll but they may come from a variety of places -/// depending on the platform we're on - #warning("qt.iby: hack - BINARY_SELECTION_ORDER really needs to be at the baseport/device level as it depends on the device type"); BINARY_SELECTION_ORDER ARMV6,ARMV5 // hack - this really needs to be at the baseport/device level as it depends on the device type -file=ABI_DIR\BUILD_DIR\QtCore.dll SHARED_LIB_DIR\QtCore.dll PAGED -file=ABI_DIR\BUILD_DIR\QtGui.dll SHARED_LIB_DIR\QtGui.dll PAGED -file=ABI_DIR\BUILD_DIR\QtOpenGL.dll SHARED_LIB_DIR\QtOpenGL.dll PAGED -file=ABI_DIR\BUILD_DIR\QtOpenVG.dll SHARED_LIB_DIR\QtOpenVG.dll PAGED -file=ABI_DIR\BUILD_DIR\QtSvg.dll SHARED_LIB_DIR\QtSvg.dll PAGED -file=ABI_DIR\BUILD_DIR\QtSql.dll SHARED_LIB_DIR\QtSql.dll PAGED -file=ABI_DIR\BUILD_DIR\QtXml.dll SHARED_LIB_DIR\QtXml.dll PAGED -file=ABI_DIR\BUILD_DIR\QtNetwork.dll SHARED_LIB_DIR\QtNetwork.dll PAGED -file=ABI_DIR\BUILD_DIR\QtScript.dll SHARED_LIB_DIR\QtScript.dll PAGED -file=ABI_DIR\BUILD_DIR\QtTest.dll SHARED_LIB_DIR\QtTest.dll PAGED -file=ABI_DIR\BUILD_DIR\QtWebKit.dll SHARED_LIB_DIR\QtWebKit.dll PAGED -file=ABI_DIR\BUILD_DIR\phonon.dll SHARED_LIB_DIR\phonon.dll PAGED -file=ABI_DIR\BUILD_DIR\QtMultimedia.dll SHARED_LIB_DIR\QtMultimedia.dll PAGED -file=ABI_DIR\BUILD_DIR\QtXmlPatterns.dll SHARED_LIB_DIR\QtXmlPatterns.dll PAGED -file=ABI_DIR\BUILD_DIR\QtDeclarative.dll SHARED_LIB_DIR\QtDeclarative.dll PAGED +file=ABI_DIR\BUILD_DIR\QtCore.dll SHARED_LIB_DIR\QtCore.dll +file=ABI_DIR\BUILD_DIR\QtGui.dll SHARED_LIB_DIR\QtGui.dll +file=ABI_DIR\BUILD_DIR\QtOpenVG.dll SHARED_LIB_DIR\QtOpenVG.dll +file=ABI_DIR\BUILD_DIR\QtSvg.dll SHARED_LIB_DIR\QtSvg.dll +file=ABI_DIR\BUILD_DIR\QtSql.dll SHARED_LIB_DIR\QtSql.dll +file=ABI_DIR\BUILD_DIR\QtXml.dll SHARED_LIB_DIR\QtXml.dll +file=ABI_DIR\BUILD_DIR\QtNetwork.dll SHARED_LIB_DIR\QtNetwork.dll +file=ABI_DIR\BUILD_DIR\QtScript.dll SHARED_LIB_DIR\QtScript.dll +file=ABI_DIR\BUILD_DIR\QtTest.dll SHARED_LIB_DIR\QtTest.dll +file=ABI_DIR\BUILD_DIR\QtWebKit.dll SHARED_LIB_DIR\QtWebKit.dll +file=ABI_DIR\BUILD_DIR\phonon.dll SHARED_LIB_DIR\phonon.dll +file=ABI_DIR\BUILD_DIR\QtMultimedia.dll SHARED_LIB_DIR\QtMultimedia.dll +file=ABI_DIR\BUILD_DIR\QtXmlPatterns.dll SHARED_LIB_DIR\QtXmlPatterns.dll +file=ABI_DIR\BUILD_DIR\QtDeclarative.dll SHARED_LIB_DIR\QtDeclarative.dll // imageformats -file=ABI_DIR\BUILD_DIR\qgif.dll SHARED_LIB_DIR\qgif.dll PAGED -file=ABI_DIR\BUILD_DIR\qico.dll SHARED_LIB_DIR\qico.dll PAGED -file=ABI_DIR\BUILD_DIR\qjpeg.dll SHARED_LIB_DIR\qjpeg.dll PAGED -file=ABI_DIR\BUILD_DIR\qmng.dll SHARED_LIB_DIR\qmng.dll PAGED -file=ABI_DIR\BUILD_DIR\qsvg.dll SHARED_LIB_DIR\qsvg.dll PAGED -file=ABI_DIR\BUILD_DIR\qtiff.dll SHARED_LIB_DIR\qtiff.dll PAGED +file=ABI_DIR\BUILD_DIR\qgif.dll SHARED_LIB_DIR\qgif.dll +file=ABI_DIR\BUILD_DIR\qico.dll SHARED_LIB_DIR\qico.dll +file=ABI_DIR\BUILD_DIR\qjpeg.dll SHARED_LIB_DIR\qjpeg.dll +file=ABI_DIR\BUILD_DIR\qmng.dll SHARED_LIB_DIR\qmng.dll +file=ABI_DIR\BUILD_DIR\qsvg.dll SHARED_LIB_DIR\qsvg.dll +file=ABI_DIR\BUILD_DIR\qtiff.dll SHARED_LIB_DIR\qtiff.dll // codecs -file=ABI_DIR\BUILD_DIR\qcncodecs.dll SHARED_LIB_DIR\qcncodecs.dll PAGED -file=ABI_DIR\BUILD_DIR\qjpcodecs.dll SHARED_LIB_DIR\qjpcodecs.dll PAGED -file=ABI_DIR\BUILD_DIR\qkrcodecs.dll SHARED_LIB_DIR\qkrcodecs.dll PAGED -file=ABI_DIR\BUILD_DIR\qtwcodecs.dll SHARED_LIB_DIR\qtwcodecs.dll PAGED +file=ABI_DIR\BUILD_DIR\qcncodecs.dll SHARED_LIB_DIR\qcncodecs.dll +file=ABI_DIR\BUILD_DIR\qjpcodecs.dll SHARED_LIB_DIR\qjpcodecs.dll +file=ABI_DIR\BUILD_DIR\qkrcodecs.dll SHARED_LIB_DIR\qkrcodecs.dll +file=ABI_DIR\BUILD_DIR\qtwcodecs.dll SHARED_LIB_DIR\qtwcodecs.dll // iconengines -file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll PAGED +file=ABI_DIR\BUILD_DIR\qsvgicon.dll SHARED_LIB_DIR\qsvgicon.dll // Phonon MMF backend -file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll PAGED +// This is commented out by default, as normally Helix backend will be used. +// If the Helix backend is present, it will override MMF backend, so make sure to remove it from +// image creation in addition to uncommenting the following lines if you want to use MMF backend. +//file=ABI_DIR\BUILD_DIR\phonon_mmf.dll SHARED_LIB_DIR\phonon_mmf.dll +//data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin // QtMultimedia audio backend -file=ABI_DIR\BUILD_DIR\qaudio.dll SHARED_LIB_DIR\qaudio.dll PAGED +file=ABI_DIR\BUILD_DIR\qaudio.dll SHARED_LIB_DIR\qaudio.dll // graphicssystems -file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll PAGED +file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll // S60 version compatibility plugins for 5.0 (3.1 and 3.2 devices are never likely to have this in ROM, // so don't bother including those plugins -file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll PAGED +file=ABI_DIR\BUILD_DIR\qts60plugin_5_0.dll SHARED_LIB_DIR\qts60plugin_5_0.dll S60_APP_RESOURCE(s60main) @@ -109,8 +74,6 @@ data=\epoc32\data\z\resource\qt\plugins\codecs\qtwcodecs.qtplugin resou // iconengines stubs data=\epoc32\data\z\resource\qt\plugins\iconengines\qsvgicon.qtplugin resource\qt\plugins\iconengines\qsvgicon.qtplugin -// Phonon MMF backend -data=\epoc32\data\z\resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin resource\qt\plugins\phonon_backend\phonon_mmf.qtplugin // QtMultimedia audio backend data=\epoc32\data\qt\qtlibspluginstubs\qaudio.qtplugin resource\qt\plugins\audio\qaudio.qtplugin @@ -123,3 +86,4 @@ data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis data=ZSYSTEM\install\qtwebkit_stub.sis System\Install\qtwebkit_stub.sis #endif // __QT_IBY__ + diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 5d5bee9..841fce4 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -78,12 +78,6 @@ symbian: { DEPLOYMENT += phonon_backend_plugins } - contains(QT_CONFIG, audio-backend) { - qaudio_backend_plugins.sources += qaudio.dll - qaudio_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/audio - DEPLOYMENT += qaudio_backend_plugins - } - # Support backup & restore for Qt libraries qtbackup.sources = backup_registration.xml qtbackup.path = c:/private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) @@ -134,5 +128,5 @@ symbian: { } BLD_INF_RULES.prj_exports += "qt.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qt.iby)" - BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CORE_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" + BLD_INF_RULES.prj_exports += "qtdemoapps.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtdemoapps.iby)" } diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index de2be89..2f0cfdc 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -523,7 +523,7 @@ QVariant::Type qDecodeOCIType(const QString& ocitype, QSql::NumericalPrecisionPo } else if (ocitype == QLatin1String("LONG") || ocitype == QLatin1String("NCLOB") || ocitype == QLatin1String("CLOB")) - type = QVariant::String; + type = QVariant::ByteArray; else if (ocitype == QLatin1String("RAW") || ocitype == QLatin1String("LONG RAW") || ocitype == QLatin1String("ROWID") || ocitype == QLatin1String("BLOB") || ocitype == QLatin1String("CFILE") || ocitype == QLatin1String("BFILE")) @@ -549,7 +549,6 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis case SQLT_AVC: case SQLT_RDD: case SQLT_LNG: - case SQLT_CLOB: #ifdef SQLT_INTERVAL_YM case SQLT_INTERVAL_YM: #endif @@ -587,6 +586,7 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis case SQLT_LVC: case SQLT_LVB: case SQLT_BLOB: + case SQLT_CLOB: case SQLT_FILE: case SQLT_NTY: case SQLT_REF: diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 4590f17..63e22cc 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -980,7 +980,7 @@ static void qParseArgs(int argc, char *argv[]) " -xunitxml : Outputs results as XML XUnit document\n" " -xml : Outputs results as XML document\n" " -lightxml : Outputs results as stream of XML tags\n" - " -flush : Flushes the resutls\n" + " -flush : Flushes the results\n" " -o filename: Writes all output into a file\n" " -silent : Only outputs warnings and failures\n" " -v1 : Print enter messages for each testfunction\n" diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 6ed28af..fd0b95c 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -264,16 +264,31 @@ XsdSchemaParser::XsdSchemaParser(const XsdSchemaContext::Ptr &context, const Xsd setupBuiltinTypeNames(); } +void XsdSchemaParser::addIncludedSchemas(const NamespaceSet &schemas) +{ + m_includedSchemas += schemas; +} + void XsdSchemaParser::setIncludedSchemas(const NamespaceSet &schemas) { m_includedSchemas = schemas; } +void XsdSchemaParser::addImportedSchemas(const NamespaceSet &schemas) +{ + m_importedSchemas += schemas; +} + void XsdSchemaParser::setImportedSchemas(const NamespaceSet &schemas) { m_importedSchemas = schemas; } +void XsdSchemaParser::addRedefinedSchemas(const NamespaceSet &schemas) +{ + m_redefinedSchemas += schemas; +} + void XsdSchemaParser::setRedefinedSchemas(const NamespaceSet &schemas) { m_redefinedSchemas = schemas; @@ -297,6 +312,7 @@ void XsdSchemaParser::setDocumentURI(const QUrl &uri) // prevent to get included/imported/redefined twice m_includedSchemas.insert(uri); m_importedSchemas.insert(uri); + m_redefinedSchemas.insert(uri); } QUrl XsdSchemaParser::documentURI() const @@ -594,8 +610,14 @@ void XsdSchemaParser::parseInclude() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::IncludeParser)) + if (!parser.parse(XsdSchemaParser::IncludeParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } } } @@ -684,8 +706,14 @@ void XsdSchemaParser::parseImport() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::ImportParser)) + if (!parser.parse(XsdSchemaParser::ImportParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } } } } else { @@ -702,8 +730,14 @@ void XsdSchemaParser::parseImport() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::ImportParser)) + if (!parser.parse(XsdSchemaParser::ImportParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } } } } else { @@ -839,8 +873,14 @@ void XsdSchemaParser::parseRedefine() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::RedefineParser)) + if (!parser.parse(XsdSchemaParser::RedefineParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } delete reply; } diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h index ad5e9ce..80d44a5 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser_p.h +++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h @@ -120,20 +120,38 @@ namespace QPatternist typedef QSet<QUrl> NamespaceSet; /** + * Adds @p schemas to the list of already included schemas, so the parser + * can detect multiple includes of the same schema. + */ + void addIncludedSchemas(const NamespaceSet &schemas); + + /** * Sets which @p schemas have been included already, so the parser - * can detect circular includes. + * can detect multiple includes of the same schema. */ void setIncludedSchemas(const NamespaceSet &schemas); /** + * Adds @p schemas to the list of already imported schemas, so the parser + * can detect multiple imports of the same schema. + */ + void addImportedSchemas(const NamespaceSet &schemas); + + /** * Sets which @p schemas have been imported already, so the parser * can detect circular imports. */ void setImportedSchemas(const NamespaceSet &schemas); /** + * Adds @p schemas to the list of already redefined schemas, so the parser + * can detect multiple redefines of the same schema. + */ + void addRedefinedSchemas(const NamespaceSet &schemas); + + /** * Sets which @p schemas have been redefined already, so the parser - * can detect circular redefines. + * can detect multiple redefines of the same schema. */ void setRedefinedSchemas(const NamespaceSet &schemas); diff --git a/tests/auto/mediaobject/media/test.sdp b/tests/auto/mediaobject/media/test.sdp new file mode 100644 index 0000000..0d8706c --- /dev/null +++ b/tests/auto/mediaobject/media/test.sdp @@ -0,0 +1,32 @@ +v=0 +o=- 3476526279 2351211129 IN IP4 XXX.XXX.XXX.XXX +s=SOME STRING +e=support@localhost +c=IN IP4 XXX.XXX.XXX.XXX +t=0 0 +a=range:npt=now- +a=random_access_denied +a=control:rtsp://link +m=video 0 RTP/AVP 96 +b=AS:100 +b=RR:2500 +b=RS:2500 +a=control:rtsp://link +a=rtpmap:96 MP4V-ES/90000 +a=3GPP-Adaptation-Support:1 +a=cliprect:0,0,144,176 +a=mpeg4-esid:201 +a=x-envivio-verid:00022B15 +a=fmtp:96 profile-level-id=2;config=000001b002000001b50ea020202f000001000000012000c788ba9850584121463f +a=framerate:15.0 +m=audio 0 RTP/AVP 97 +b=AS:14 +b=RR:350 +b=RS:350 +a=control:rtsp://link +a=rtpmap:97 AMR/8000 +a=3GPP-Adaptation-Support:1 +a=mpeg4-esid:101 +a=x-envivio-verid:00022B15 +a=fmtp:97 octet-align=1 +a=maxptime:200 diff --git a/tests/auto/mediaobject/mediaobject.pro b/tests/auto/mediaobject/mediaobject.pro index 5d4a098..bef2fe9 100755 --- a/tests/auto/mediaobject/mediaobject.pro +++ b/tests/auto/mediaobject/mediaobject.pro @@ -14,3 +14,9 @@ wince*{ DEFINES += tst_MediaObject=tst_MediaObject_waveout } +symbian*:{ + addFiles.sources = media/test.sdp + addFiles.path = media + DEPLOYMENT += addFiles +} + diff --git a/tests/auto/mediaobject/mediaobject.qrc b/tests/auto/mediaobject/mediaobject.qrc index 4f46213..77954f4 100644 --- a/tests/auto/mediaobject/mediaobject.qrc +++ b/tests/auto/mediaobject/mediaobject.qrc @@ -3,5 +3,6 @@ <file>media/sax.wav</file> <file>media/sax.ogg</file> <file>media/sax.mp3</file> +<file>media/test.sdp</file> </qresource> </RCC> diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp index 5ae80b9..5b0943e 100644 --- a/tests/auto/mediaobject/tst_mediaobject.cpp +++ b/tests/auto/mediaobject/tst_mediaobject.cpp @@ -139,6 +139,7 @@ class tst_MediaObject : public QObject void pauseToPause(); void pauseToPlay(); void pauseToStop(); + void playSDP(); void testPrefinishMark(); void testSeek(); @@ -160,6 +161,11 @@ class tst_MediaObject : public QObject Phonon::MediaObject *m_media; QSignalSpy *m_stateChangedSignalSpy; QString m_tmpFileName; + + static void copyMediaFile(const QString &original, + const QString &name, + QString &resultFilePath, + QUrl *const asURL = 0); #endif //QT_NO_PHONON bool m_success; }; @@ -352,6 +358,24 @@ void tst_MediaObject::_pausePlayback() m_success = true; } +/*! + Copies the file \a name to the testing area. The resulting file name path is + returned in resultFilePath, and also set as a URL in \a asURL. + */ +void tst_MediaObject::copyMediaFile(const QString &original, + const QString &name, + QString &resultFilePath, + QUrl *const asURL) +{ + resultFilePath = QDir::toNativeSeparators(QDir::tempPath() + name); + if (asURL) + *asURL = QUrl::fromLocalFile(resultFilePath); + + QFile::remove(resultFilePath); + QVERIFY(QFile::copy(original, resultFilePath)); + QFile::setPermissions(resultFilePath, QFile::permissions(resultFilePath) | QFile::WriteOther); +} + void tst_MediaObject::initTestCase() { QCoreApplication::setApplicationName("tst_MediaObject"); @@ -375,14 +399,8 @@ void tst_MediaObject::initTestCase() QVERIFY(m_stateChangedSignalSpy->isValid()); m_stateChangedSignalSpy->clear(); - if (m_url.isEmpty()) { - m_tmpFileName = QDir::toNativeSeparators(QDir::tempPath() + MEDIA_FILE); - QFile::remove(m_tmpFileName); - QVERIFY(QFile::copy(MEDIA_FILEPATH, m_tmpFileName)); - QFile::Permissions p = QFile::permissions(m_tmpFileName); - QFile::setPermissions(m_tmpFileName, p | QFile::WriteOther); - m_url = QUrl::fromLocalFile(m_tmpFileName); - } + if (m_url.isEmpty()) + copyMediaFile(MEDIA_FILEPATH, MEDIA_FILE, m_tmpFileName, &m_url); qDebug() << "Using url:" << m_url.toString(); @@ -533,6 +551,47 @@ void tst_MediaObject::pauseToStop() stopPlayback(Phonon::PausedState); } +/*! + + We attempt to play a SDP file. An SDP file essentially describes different + media streams and is hence a layer in front of the actual media(s). + Sometimes the backend handles the SDP file, in other cases not. + + Some Phonon backends doesn't support SDP at all, ifdef appropriately. Real + Player and Helix, the two backends for Symbian, are known to support SDP. + */ +void tst_MediaObject::playSDP() +{ +#ifdef Q_OS_SYMBIAN + QString sdpFile; + copyMediaFile(QLatin1String(":/media/test.sdp"), QLatin1String("test.sdp"), sdpFile); + + // Let's verify our test setup. + QVERIFY(QFileInfo(sdpFile).isReadable()); + + // We need a window in order to setup the video. + QWidget widget; + widget.show(); + + const MediaSource oldSource(m_media->currentSource()); + const MediaSource sdpSource(sdpFile); + m_media->setCurrentSource(sdpSource); + if (m_media->state() != Phonon::StoppedState) + QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000); + + // At this point we're in error state due to absent media, but it has now loaded the SDP: + QCOMPARE(m_media->errorString(), QString::fromLatin1("Buffering clip failed: Unknown error (-39)")); + + // We cannot play the SDP, we can neither attempt to play it, because we + // won't get a state change from ErrorState to ErrorState, and hence block + // on a never occuring signal. + m_media->setCurrentSource(oldSource); + +#else + QSKIP("Unsupported on this platform.", SkipAll); +#endif +} + void tst_MediaObject::testPrefinishMark() { const qint32 requestedPrefinishMarkTime = 2000; diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 874eb7b..f837564 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -48,6 +48,7 @@ #include "../qsqldatabase/tst_databases.h" +const QString qtest(qTableName( "qtest", __FILE__ )); //TESTED_FILES= @@ -142,26 +143,26 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) // please never ever change this table; otherwise fix all tests ;) if ( tst_Databases::isMSAccess( db ) ) { - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," + QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null," "t_char char(40), t_numeric number, primary key (id, t_varchar) )" )); } else { - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," + QVERIFY_SQL(q, exec( "create table " + qtest + " ( id int not null, t_varchar varchar(40) not null," "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" )); } if ( tst_Databases::isSqlServer( db ) ) { //workaround for SQL SERVER since he can store unicode only in nvarchar fields - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode") + " (id int not null, " + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, " "t_varchar nvarchar(80) not null, t_char nchar(80) )" )); } else { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode") + " (id int not null, " + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode", __FILE__) + " (id int not null, " "t_varchar varchar(100) not null," "t_char char(100))" )); } if (tst_Databases::isMSAccess(db)) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 number)")); + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision", __FILE__) + " (col1 number)")); } else { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision") + " (col1 numeric(15, 14))")); + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_precision", __FILE__) + " (col1 numeric(15, 14))")); } } @@ -170,12 +171,12 @@ void tst_Q3SqlCursor::dropTestTables( QSqlDatabase db ) if ( !db.isValid() ) return; QStringList tableNames; - tableNames << qTableName( "qtest" ) - << qTableName( "qtest_unicode" ) - << qTableName( "qtest_precision" ) - << qTableName( "qtest_ovchar" ) - << qTableName( "qtest_onvchar" ) - << qTableName( "qtestPK" ); + tableNames << qtest + << qTableName( "qtest_unicode", __FILE__ ) + << qTableName( "qtest_precision", __FILE__ ) + << qTableName( "qtest_ovchar", __FILE__ ) + << qTableName( "qtest_onvchar", __FILE__ ) + << qTableName( "qtestPK", __FILE__ ); tst_Databases::safeDropTables( db, tableNames ); } @@ -185,8 +186,8 @@ void tst_Q3SqlCursor::populateTestTables( QSqlDatabase db ) return; QSqlQuery q( db ); - q.exec( "delete from " + qTableName( "qtest" ) ); //not fatal - QVERIFY_SQL(q, prepare("insert into " + qTableName( "qtest" ) + " (id, t_varchar, t_char, t_numeric) values (?, ?, ?, ?)")); + q.exec( "delete from " + qtest ); //not fatal + QVERIFY_SQL(q, prepare("insert into " + qtest + " (id, t_varchar, t_char, t_numeric) values (?, ?, ?, ?)")); q.addBindValue(QVariantList() << 0 << 1 << 2 << 3); q.addBindValue(QVariantList() << "VarChar0" << "VarChar1" << "VarChar2" << "VarChar3"); q.addBindValue(QVariantList() << "Char0" << "Char1" << "Char2" << "Char3"); @@ -243,7 +244,7 @@ void tst_Q3SqlCursor::copyConstructor() Q3SqlCursor cur2; { - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); QVERIFY_SQL(cur, select( cur.index( QString("id") ) )); cur2 = Q3SqlCursor( cur ); // let "cur" run out of scope... @@ -266,7 +267,7 @@ void tst_Q3SqlCursor::value() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); QVERIFY_SQL(cur, select( cur.index( QString("id") ) )); int i = 0; while ( cur.next() ) { @@ -281,7 +282,7 @@ void tst_Q3SqlCursor::primaryIndex() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); QSqlIndex index = cur.primaryIndex(); if ( tst_Databases::isMSAccess( db ) ) { QCOMPARE( index.fieldName(1).upper(), QString( "ID" ) ); @@ -300,7 +301,7 @@ void tst_Q3SqlCursor::insert() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); QSqlRecord* irec = cur.primeInsert(); QVERIFY( irec != 0 ); @@ -338,7 +339,7 @@ void tst_Q3SqlCursor::insertSpecial() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); QSqlRecord* irec = cur.primeInsert(); QVERIFY( irec != 0 ); @@ -386,9 +387,9 @@ void tst_Q3SqlCursor::batchInsert() CHECK_DATABASE( db ); QSqlQuery q( db ); - q.exec( "delete from " + qTableName( "qtest" ) ); + q.exec( "delete from " + qtest ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); int i = 0; for ( ; i < 100; ++i ) { @@ -420,7 +421,7 @@ void tst_Q3SqlCursor::batchInsert() } i = 0; - QVERIFY_SQL(q, exec( "select * from " + qTableName( "qtest" ) + " order by id" )); + QVERIFY_SQL(q, exec( "select * from " + qtest + " order by id" )); while ( q.next() ) { QCOMPARE( q.value( 0 ).toInt(), i ); i++; @@ -452,11 +453,11 @@ void tst_Q3SqlCursor::insertORA() /****** CHARSET TEST ******/ QSqlQuery q( db ); - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest_ovchar" ) + " ( id int primary key, t_char varchar(40) )" )); + QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest_ovchar", __FILE__ ) + " ( id int primary key, t_char varchar(40) )" )); static const QString val1( "blah1" ); - Q3SqlCursor cur ( qTableName( "qtest_ovchar" ), true, db ); + Q3SqlCursor cur ( qTableName( "qtest_ovchar", __FILE__ ), true, db ); QSqlRecord* irec = cur.primeInsert(); irec->setValue( "id", 1 ); irec->setValue( "t_char", val1 ); @@ -486,9 +487,9 @@ void tst_Q3SqlCursor::insertORA() /****** NCHARSET TEST ********/ - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest_onvchar" ) + " ( id int primary key, t_nchar nvarchar2(40) )" )); + QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest_onvchar", __FILE__ ) + " ( id int primary key, t_nchar nvarchar2(40) )" )); - Q3SqlCursor cur2 ( qTableName( "qtest_onvchar" ), true, db ); + Q3SqlCursor cur2 ( qTableName( "qtest_onvchar", __FILE__ ), true, db ); irec = cur2.primeInsert(); irec->setValue( "id", 1 ); irec->setValue( "t_nchar", val1 ); @@ -529,7 +530,7 @@ void tst_Q3SqlCursor::unicode() if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb")) QSKIP("Can't transliterate extended unicode to ascii", SkipSingle); - Q3SqlCursor cur( qTableName( "qtest_unicode" ), true, db ); + Q3SqlCursor cur( qTableName( "qtest_unicode", __FILE__ ), true, db ); QSqlRecord* irec = cur.primeInsert(); irec->setValue( 0, 500 ); irec->setValue( 1, utf8str ); @@ -566,7 +567,7 @@ void tst_Q3SqlCursor::precision() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest_precision" ), true, db ); + Q3SqlCursor cur( qTableName( "qtest_precision", __FILE__ ), true, db ); cur.setTrimmed( "col1", true ); QSqlRecord* irec = cur.primeInsert(); irec->setValue( 0, precStr ); @@ -589,7 +590,7 @@ void tst_Q3SqlCursor::setFilter() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); cur.setFilter( "id = 2" ); QVERIFY_SQL(cur, select()); @@ -619,23 +620,23 @@ void tst_Q3SqlCursor::select() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor cur( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur( qtest, true, db ); QVERIFY_SQL(cur, select()); QVERIFY( cur.next() ); QVERIFY( cur.next() ); - Q3SqlCursor cur2( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur2( qtest, true, db ); QVERIFY_SQL(cur2, select( "id = 1" )); QVERIFY( cur2.next() ); QCOMPARE( cur2.value( 0 ).toInt(), 1 ); - Q3SqlCursor cur3( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur3( qtest, true, db ); QVERIFY_SQL(cur3, select( cur3.primaryIndex( false ) )); QVERIFY( cur3.next() ); QVERIFY( cur3.next() ); QCOMPARE( cur3.value( 0 ).toInt(), 1 ); - Q3SqlCursor cur4( qTableName( "qtest" ), true, db ); + Q3SqlCursor cur4( qtest, true, db ); QSqlIndex idx = cur4.primaryIndex( false ); QCOMPARE( (int)idx.count(), 2 ); if ( tst_Databases::isMSAccess( db ) ) { @@ -667,17 +668,17 @@ void tst_Q3SqlCursor::setName() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlCursor c2( qTableName( "qtest" ), true, db ); - QCOMPARE( c2.name(), qTableName( "qtest" ) ); + Q3SqlCursor c2( qtest, true, db ); + QCOMPARE( c2.name(), qtest ); QCOMPARE( c2.fieldName( 0 ).lower(), QString( "id" ) ); Q3SqlCursor c( QString(), true, db ); - c.setName( qTableName( "qtest" ) ); - QCOMPARE( c.name(), qTableName( "qtest" ) ); + c.setName( qtest ); + QCOMPARE( c.name(), qtest ); QCOMPARE( c.fieldName( 0 ).lower(), QString( "id" ) ); - c.setName( qTableName( "qtest_precision" ) ); - QCOMPARE( c.name(), qTableName( "qtest_precision" ) ); + c.setName( qTableName( "qtest_precision", __FILE__ ) ); + QCOMPARE( c.name(), qTableName( "qtest_precision", __FILE__ ) ); QCOMPARE( c.fieldName( 0 ).lower(), QString( "col1" ) ); } @@ -689,9 +690,9 @@ void tst_Q3SqlCursor::updateNoPK() CHECK_DATABASE( db ); QSqlQuery q(db); - QVERIFY_SQL(q, exec("create table " + qTableName( "qtestPK" ) + " (id int, name varchar(20), num numeric)")); + QVERIFY_SQL(q, exec("create table " + qTableName( "qtestPK", __FILE__ ) + " (id int, name varchar(20), num numeric)")); - Q3SqlCursor cur(qTableName("qtestPK"), true, db); + Q3SqlCursor cur(qTableName("qtestPK", __FILE__), true, db); QSqlRecord* rec = cur.primeInsert(); Q_ASSERT(rec); rec->setNull(0); @@ -705,14 +706,14 @@ void tst_Q3SqlCursor::updateNoPK() db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QODBC") || db.driverName().startsWith("QOCI")) { - QString query = QString::fromLatin1("insert into " + qTableName("qtestPK") + + QString query = QString::fromLatin1("insert into " + qTableName("qtestPK", __FILE__) + " (" + db.driver()->escapeIdentifier("id", QSqlDriver::FieldName) + ',' + db.driver()->escapeIdentifier("name", QSqlDriver::FieldName) + ',' + db.driver()->escapeIdentifier("num", QSqlDriver::FieldName) + ')' + " values (NULL,NULL,NULL)"); QCOMPARE(cur.lastQuery(), query); } else { - QCOMPARE(cur.lastQuery(), QString::fromLatin1("insert into " + qTableName("qtestPK") + + QCOMPARE(cur.lastQuery(), QString::fromLatin1("insert into " + qTableName("qtestPK", __FILE__) + " (\"id\",\"name\",\"num\") values (NULL,NULL,NULL)")); } } @@ -724,12 +725,12 @@ void tst_Q3SqlCursor::updateNoPK() rec->setNull(2); // Sqlite returns 2, don't ask why. QVERIFY(cur.update() != 0); - QString expect = "update " + qTableName("qtestPK") + + QString expect = "update " + qTableName("qtestPK", __FILE__) + " set "+db.driver()->escapeIdentifier("id", QSqlDriver::FieldName)+" = 1 , " +db.driver()->escapeIdentifier("name", QSqlDriver::FieldName)+" = NULL , " - +db.driver()->escapeIdentifier("num", QSqlDriver::FieldName)+" = NULL where " + qTableName("qtestPK") + ".id" - " IS NULL and " + qTableName("qtestPK") + ".name IS NULL and " + - qTableName("qtestPK") + ".num IS NULL"; + +db.driver()->escapeIdentifier("num", QSqlDriver::FieldName)+" = NULL where " + qTableName("qtestPK", __FILE__) + ".id" + " IS NULL and " + qTableName("qtestPK", __FILE__) + ".name IS NULL and " + + qTableName("qtestPK", __FILE__) + ".num IS NULL"; if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) { if (!db.driverName().startsWith("QSQLITE")) { QCOMPARE(cur.lastQuery(), expect); @@ -760,7 +761,7 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() { return; } - QString tableName = qTableName("qtestws"); + QString tableName = qTableName("qtestws", __FILE__); QSqlQuery q(db); tst_Databases::safeDropTable(db, tableName); diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp index c19f9fd..b69ae79 100644 --- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp +++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp @@ -111,16 +111,16 @@ void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db ) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if (tst_Databases::isMSAccess(db)) - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," + QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest", __FILE__ ) + " ( id int not null, t_varchar varchar(40) not null," "t_char char(40), t_numeric number, primary key (id, t_varchar) )" )); else - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," + QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest", __FILE__ ) + " ( id int not null, t_varchar varchar(40) not null," "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" )); } void tst_Q3SqlSelectCursor::dropTestTables( QSqlDatabase db ) { - tst_Databases::safeDropTable( db, qTableName( "qtest" ) ); + tst_Databases::safeDropTable( db, qTableName( "qtest", __FILE__ ) ); } void tst_Q3SqlSelectCursor::populateTestTables( QSqlDatabase db ) @@ -129,11 +129,11 @@ void tst_Q3SqlSelectCursor::populateTestTables( QSqlDatabase db ) return; QSqlQuery q( db ); - q.exec( "delete from " + qTableName( "qtest" ) ); //non-fatal - QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest" ) + " (id, t_varchar, t_char, t_numeric) values ( 0, 'VarChar0', 'Char0', 1.1 )" )); - QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest" ) + " (id, t_varchar, t_char, t_numeric) values ( 1, 'VarChar1', 'Char1', 2.2 )" )); - QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest" ) + " (id, t_varchar, t_char, t_numeric) values ( 2, 'VarChar2', 'Char2', 3.3 )" )); - QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest" ) + " (id, t_varchar, t_char, t_numeric) values ( 3, 'VarChar3', 'Char3', 4.4 )" )); + q.exec( "delete from " + qTableName( "qtest", __FILE__ ) ); //non-fatal + QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest", __FILE__ ) + " (id, t_varchar, t_char, t_numeric) values ( 0, 'VarChar0', 'Char0', 1.1 )" )); + QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest", __FILE__ ) + " (id, t_varchar, t_char, t_numeric) values ( 1, 'VarChar1', 'Char1', 2.2 )" )); + QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest", __FILE__ ) + " (id, t_varchar, t_char, t_numeric) values ( 2, 'VarChar2', 'Char2', 3.3 )" )); + QVERIFY_SQL(q, exec( "insert into " + qTableName( "qtest", __FILE__ ) + " (id, t_varchar, t_char, t_numeric) values ( 3, 'VarChar3', 'Char3', 4.4 )" )); } void tst_Q3SqlSelectCursor::initTestCase() @@ -184,7 +184,7 @@ void tst_Q3SqlSelectCursor::value() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); - Q3SqlSelectCursor cur( "select * from " + qTableName( "qtest" ) + " order by id", db ); + Q3SqlSelectCursor cur( "select * from " + qTableName( "qtest", __FILE__ ) + " order by id", db ); QVERIFY( cur.select() ); QVERIFY_SQL(cur, isActive()); int i = 0; @@ -203,7 +203,7 @@ void tst_Q3SqlSelectCursor::_exec() Q3SqlSelectCursor cur( QString(), db ); QVERIFY_SQL(cur, isActive() == false); - cur.exec( "select * from " + qTableName( "qtest" ) ); //nothing should happen + cur.exec( "select * from " + qTableName( "qtest", __FILE__ ) ); //nothing should happen QVERIFY_SQL(cur, isActive()); int i = 0; while ( cur.next() ) { diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index 4e99f18..5837719 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -95,12 +95,14 @@ static QString qGetHostName() // to prevent nameclashes on our database server, each machine // will use its own set of table names. Call this function to get // "tablename_hostname" -inline static QString qTableName( const QString& prefix, QSqlDriver* driver = 0 ) +inline static QString qTableName( const QString& prefix, const char *sourceFileName ) { - if ( !driver ) - return prefix + "_" + qGetHostName().replace( "-", "_" ); - else - return driver->escapeIdentifier( prefix + "_" + qGetHostName(), QSqlDriver::TableName ); + return QLatin1String("dbtst")+QString::number(qHash(QLatin1String(sourceFileName) + "_" + qGetHostName().replace( "-", "_" )), 16)+"_"+prefix; +} + +inline static QString qTableName( const QString& prefix, QSqlDriver* driver ) +{ + return driver->escapeIdentifier( prefix + "_" + qGetHostName(), QSqlDriver::TableName ); } inline static bool testWhiteSpaceNames( const QString &name ) @@ -250,8 +252,8 @@ public: // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.nokia.troll.no\\ICEBLINK", "troll", "trond", "" ); // addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" ); -// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql5-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); -// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=mysql4-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=bq-mysql50.apac.nokia.com;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={MySQL ODBC 5.1 Driver};SERVER=bq-mysql51.apac.nokia.com;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=horsehead.nokia.troll.no;DATABASE=testdb;PORT=4101;UID=troll;PWD=trondk", "troll", "trondk", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=silence.nokia.troll.no;DATABASE=testdb;PORT=2392;UID=troll;PWD=trond", "troll", "trond", "" ); // addDb( "QODBC", "DRIVER={FreeTDS};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433;UID=testuser;PWD=Ee4Gabf6_;TDS_Version=8.0", "", "", "" ); @@ -261,7 +263,7 @@ public: // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC", "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\dbs\\access\\testdb.mdb", "", "", "" ); -// addDb( "QODBC", "DRIVER={Postgresql};SERVER=postgres81-nokia.trolltech.com.au;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={Postgresql};SERVER=bq-pgsql84.apac.nokia.com;DATABASE=testdb", "testuser", "Ee4Gabf6_", "" ); } void open() @@ -338,7 +340,7 @@ public: foreach(const QString &table2, dbtables.filter(table, Qt::CaseInsensitive)) { if(table2.compare(table.section('.', -1, -1), Qt::CaseInsensitive) == 0) { table=db.driver()->escapeIdentifier(table2, QSqlDriver::TableName); - if(db.driverName().startsWith( "QPSQL" )) + if(isPostgreSQL(db)) wasDropped = q.exec( "drop table " + table + " cascade"); else wasDropped = q.exec( "drop table " + table); @@ -483,16 +485,16 @@ public: static bool isPostgreSQL( QSqlDatabase db ) { - return db.driverName().startsWith("QPSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("PostgreSQL") ); + return db.driverName().startsWith("QPSQL") || (db.driverName().startsWith("QODBC") && ( db.databaseName().contains("PostgreSQL", Qt::CaseInsensitive) || db.databaseName().contains("pgsql", Qt::CaseInsensitive) ) ); } static bool isMySQL( QSqlDatabase db ) { - return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL") ); + return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL", Qt::CaseInsensitive) ); } static bool isDB2( QSqlDatabase db ) { - return db.driverName().startsWith("QDB2") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("db2") ); + return db.driverName().startsWith("QDB2") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("db2", Qt::CaseInsensitive) ); } // -1 on fail, else Oracle version diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index fe084fa..b2b592b 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -259,10 +259,10 @@ struct FieldDef { // excluding the primary key field static int createFieldTable(const FieldDef fieldDefs[], QSqlDatabase db) { - tst_Databases::safeDropTable(db, qTableName("qtestfields")); + tst_Databases::safeDropTable(db, qTableName("qtestfields", __FILE__)); QSqlQuery q(db); // construct a create table statement consisting of all fieldtypes - QString qs = "create table " + qTableName("qtestfields"); + QString qs = "create table " + qTableName("qtestfields", __FILE__); QString autoName = tst_Databases::autoFieldName(db); if (tst_Databases::isMSAccess(db)) qs.append(" (id int not null"); @@ -316,18 +316,18 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) // please never ever change this table; otherwise fix all tests ;) if (tst_Databases::isMSAccess(db)) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest") + + QVERIFY_SQL(q, exec("create table " + qTableName("qtest", __FILE__) + " (id int not null, t_varchar varchar(40) not null, t_char char(40), " "t_numeric number, primary key (id, t_varchar))")); } else { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest") + + QVERIFY_SQL(q, exec("create table " + qTableName("qtest", __FILE__) + " (id integer not null, t_varchar varchar(40) not null, " "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar))")); } if (testWhiteSpaceNames(db.driverName())) { QString qry = "create table " - + db.driver()->escapeIdentifier(qTableName("qtest") + " test", QSqlDriver::TableName) + + db.driver()->escapeIdentifier(qTableName("qtest", __FILE__) + " test", QSqlDriver::TableName) + '(' + db.driver()->escapeIdentifier(QLatin1String("test test"), QSqlDriver::FieldName) + " int not null primary key)"; @@ -346,45 +346,45 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) } // drop the view first, otherwise we'll get dependency problems - tst_Databases::safeDropViews(db, QStringList() << qTableName("qtest_view") << qTableName("qtest_view2")); + tst_Databases::safeDropViews(db, QStringList() << qTableName("qtest_view", __FILE__) << qTableName("qtest_view2", __FILE__)); QStringList tableNames; - tableNames << qTableName("qtest") - << qTableName("qtestfields") - << qTableName("qtestalter") - << qTableName("qtest_temp") - << qTableName("qtest_bigint") - << qTableName("qtest_xmltype") - << qTableName("latin1table") - << qTableName("qtest_sqlguid") - << qTableName("batable") - << qTableName("qtest_prec") - << qTableName("uint") - << qTableName("strings") - << qTableName("numericfields") - << qTableName("qtest_ibaseblobs") - << qTableName("qtestBindBool") - << qTableName("testqGetString") - << qTableName("qtest_sqlguid") - << qTableName("uint_table") - << qTableName("uint_test") - << qTableName("bug_249059"); + tableNames << qTableName("qtest", __FILE__) + << qTableName("qtestfields", __FILE__) + << qTableName("qtestalter", __FILE__) + << qTableName("qtest_temp", __FILE__) + << qTableName("qtest_bigint", __FILE__) + << qTableName("qtest_xmltype", __FILE__) + << qTableName("latin1table", __FILE__) + << qTableName("qtest_sqlguid", __FILE__) + << qTableName("batable", __FILE__) + << qTableName("qtest_prec", __FILE__) + << qTableName("uint", __FILE__) + << qTableName("strings", __FILE__) + << qTableName("numericfields", __FILE__) + << qTableName("qtest_ibaseblobs", __FILE__) + << qTableName("qtestBindBool", __FILE__) + << qTableName("testqGetString", __FILE__) + << qTableName("qtest_sqlguid", __FILE__) + << qTableName("uint_table", __FILE__) + << qTableName("uint_test", __FILE__) + << qTableName("bug_249059", __FILE__); QSqlQuery q(0, db); if (db.driverName().startsWith("QPSQL")) { - q.exec("drop schema " + qTableName("qtestschema") + " cascade"); - q.exec("drop schema " + qTableName("qtestScHeMa") + " cascade"); + q.exec("drop schema " + qTableName("qtestschema", __FILE__) + " cascade"); + q.exec("drop schema " + qTableName("qtestScHeMa", __FILE__) + " cascade"); } if (testWhiteSpaceNames(db.driverName())) - tableNames << db.driver()->escapeIdentifier(qTableName("qtest") + " test", QSqlDriver::TableName); + tableNames << db.driver()->escapeIdentifier(qTableName("qtest", __FILE__) + " test", QSqlDriver::TableName); tst_Databases::safeDropTables(db, tableNames); if (db.driverName().startsWith("QOCI")) { - q.exec("drop user "+qTableName("CREATOR")+" cascade"); - q.exec("drop user "+qTableName("APPUSER")+" cascade"); - q.exec("DROP TABLE system."+qTableName("mypassword")); + q.exec("drop user "+qTableName("CREATOR", __FILE__)+" cascade"); + q.exec("drop user "+qTableName("APPUSER", __FILE__)+" cascade"); + q.exec("DROP TABLE system."+qTableName("mypassword", __FILE__)); } } @@ -394,13 +394,14 @@ void tst_QSqlDatabase::populateTestTables(QSqlDatabase db) if (!db.isValid()) return; QSqlQuery q(db); + const QString qtest(qTableName("qtest", __FILE__)); - q.exec("delete from " + qTableName("qtest")); //non-fatal - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (0, 'VarChar0', 'Char0', 1.1)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (1, 'VarChar1', 'Char1', 2.2)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (2, 'VarChar2', 'Char2', 3.3)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (3, 'VarChar3', 'Char3', 4.4)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " (id, t_varchar, t_char, t_numeric) values (4, 'VarChar4', NULL, NULL)")); + q.exec("delete from " + qtest); //non-fatal + QVERIFY_SQL(q, exec("insert into " + qtest + " (id, t_varchar, t_char, t_numeric) values (0, 'VarChar0', 'Char0', 1.1)")); + QVERIFY_SQL(q, exec("insert into " + qtest + " (id, t_varchar, t_char, t_numeric) values (1, 'VarChar1', 'Char1', 2.2)")); + QVERIFY_SQL(q, exec("insert into " + qtest + " (id, t_varchar, t_char, t_numeric) values (2, 'VarChar2', 'Char2', 3.3)")); + QVERIFY_SQL(q, exec("insert into " + qtest + " (id, t_varchar, t_char, t_numeric) values (3, 'VarChar3', 'Char3', 4.4)")); + QVERIFY_SQL(q, exec("insert into " + qtest + " (id, t_varchar, t_char, t_numeric) values (4, 'VarChar4', NULL, NULL)")); } void tst_QSqlDatabase::initTestCase() @@ -496,7 +497,7 @@ void tst_QSqlDatabase::recordNonSelect() Q3SqlRecordInfo rInf = db.recordInfo(q); QVERIFY(rInf.isEmpty()); - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_temp") + " (id int)")); + QVERIFY_SQL(q, exec("create table " + qTableName("qtest_temp", __FILE__) + " (id int)")); // query without result set should return empty record rec = db.record(q); @@ -512,6 +513,8 @@ void tst_QSqlDatabase::tables() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString qtest(qTableName("qtest", __FILE__)), qtest_view(qTableName("qtest_view", __FILE__)), temp_tab(qTableName("test_tab", __FILE__)); + bool views = true; bool tempTables = false; @@ -520,50 +523,50 @@ void tst_QSqlDatabase::tables() QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); - if (!q.exec("CREATE VIEW " + qTableName("qtest_view") + " as select * from " + qTableName("qtest"))) { + if (!q.exec("CREATE VIEW " + qtest_view + " as select * from " + qtest)) { qDebug(QString("DBMS '%1' cannot handle VIEWs: %2").arg( tst_Databases::dbToString(db)).arg(QString(tst_Databases::printError(q.lastError()))).toLatin1()); views = false; } if (db.driverName().startsWith("QSQLITE3")) { - QVERIFY_SQL(q, exec("CREATE TEMPORARY TABLE " + qTableName("temp_tab") + " (id int)")); + QVERIFY_SQL(q, exec("CREATE TEMPORARY TABLE " + temp_tab + " (id int)")); tempTables = true; } QStringList tables = db.tables(QSql::Tables); - QVERIFY(tables.contains(qTableName("qtest"), Qt::CaseInsensitive)); + QVERIFY(tables.contains(qtest, Qt::CaseInsensitive)); QVERIFY(!tables.contains("sql_features", Qt::CaseInsensitive)); //check for postgres 7.4 internal tables if (views) { - QVERIFY(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)); + QVERIFY(!tables.contains(qtest_view, Qt::CaseInsensitive)); } if (tempTables) - QVERIFY(tables.contains(qTableName("temp_tab"), Qt::CaseInsensitive)); + QVERIFY(tables.contains(temp_tab, Qt::CaseInsensitive)); tables = db.tables(QSql::Views); if (views) { - if(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)) - qDebug() << "failed to find" << qTableName("qtest_view") << "in" << tables; - QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)); + if(!tables.contains(qtest_view, Qt::CaseInsensitive)) + qDebug() << "failed to find" << qtest_view << "in" << tables; + QVERIFY(tables.contains(qtest_view, Qt::CaseInsensitive)); } if (tempTables) - QVERIFY(!tables.contains(qTableName("temp_tab"), Qt::CaseInsensitive)); - QVERIFY(!tables.contains(qTableName("qtest"), Qt::CaseInsensitive)); + QVERIFY(!tables.contains(temp_tab, Qt::CaseInsensitive)); + QVERIFY(!tables.contains(qtest, Qt::CaseInsensitive)); tables = db.tables(QSql::SystemTables); - QVERIFY(!tables.contains(qTableName("qtest"), Qt::CaseInsensitive)); - QVERIFY(!tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)); - QVERIFY(!tables.contains(qTableName("temp_tab"), Qt::CaseInsensitive)); + QVERIFY(!tables.contains(qtest, Qt::CaseInsensitive)); + QVERIFY(!tables.contains(qtest_view, Qt::CaseInsensitive)); + QVERIFY(!tables.contains(temp_tab, Qt::CaseInsensitive)); tables = db.tables(QSql::AllTables); if (views) - QVERIFY(tables.contains(qTableName("qtest_view"), Qt::CaseInsensitive)); + QVERIFY(tables.contains(qtest_view, Qt::CaseInsensitive)); if (tempTables) - QVERIFY(tables.contains(qTableName("temp_tab"), Qt::CaseInsensitive)); - QVERIFY(tables.contains(qTableName("qtest"), Qt::CaseInsensitive)); + QVERIFY(tables.contains(temp_tab, Qt::CaseInsensitive)); + QVERIFY(tables.contains(qtest, Qt::CaseInsensitive)); if (db.driverName().startsWith("QPSQL")) { - QVERIFY(tables.contains(qTableName("qtest") + " test")); + QVERIFY(tables.contains(qtest + " test")); } } @@ -574,7 +577,7 @@ void tst_QSqlDatabase::whitespaceInIdentifiers() CHECK_DATABASE(db); if (testWhiteSpaceNames(db.driverName())) { - QString tableName = qTableName("qtest") + " test"; + const QString tableName(qTableName("qtest", __FILE__) + " test"); QVERIFY(db.tables().contains(tableName, Qt::CaseInsensitive)); QSqlRecord rec = db.record(db.driver()->escapeIdentifier(tableName, QSqlDriver::TableName)); @@ -602,14 +605,15 @@ void tst_QSqlDatabase::alterTable() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString qtestalter(qTableName("qtestalter", __FILE__)); QSqlQuery q(db); - QVERIFY_SQL(q, exec("create table " + qTableName("qtestalter") + " (F1 char(20), F2 char(20), F3 char(20))")); - QSqlRecord rec = db.record(qTableName("qtestalter")); + QVERIFY_SQL(q, exec("create table " + qtestalter + " (F1 char(20), F2 char(20), F3 char(20))")); + QSqlRecord rec = db.record(qtestalter); QCOMPARE((int)rec.count(), 3); #ifdef QT3_SUPPORT - Q3SqlRecordInfo rinf = db.recordInfo(qTableName("qtestalter")); + Q3SqlRecordInfo rinf = db.recordInfo(qtestalter); QCOMPARE((int)rinf.count(), 3); #endif @@ -622,13 +626,13 @@ void tst_QSqlDatabase::alterTable() #endif } - if (!q.exec("alter table " + qTableName("qtestalter") + " drop column F2")) { + if (!q.exec("alter table " + qtestalter + " drop column F2")) { QSKIP("DBMS doesn't support dropping columns in ALTER TABLE statement", SkipSingle); } - rec = db.record(qTableName("qtestalter")); + rec = db.record(qtestalter); #ifdef QT3_SUPPORT - rinf = db.recordInfo(qTableName("qtestalter")); + rinf = db.recordInfo(qtestalter); #endif QCOMPARE((int)rec.count(), 2); @@ -643,7 +647,7 @@ void tst_QSqlDatabase::alterTable() QCOMPARE(rinf[ 1 ].name().upper(), QString("F3")); #endif - q.exec("select * from " + qTableName("qtestalter")); + q.exec("select * from " + qtestalter); #ifdef QT3_SUPPORT rec = db.record(q); @@ -730,17 +734,17 @@ void tst_QSqlDatabase::commonFieldTest(const FieldDef fieldDefs[], QSqlDatabase // check whether recordInfo returns the right types #ifdef QT3_SUPPORT - Q3SqlRecordInfo inf = db.recordInfo(qTableName("qtestfields")); + Q3SqlRecordInfo inf = db.recordInfo(qTableName("qtestfields", __FILE__)); QCOMPARE((int)inf.count(), fieldCount+1); testRecordInfo(fieldDefs, inf); #endif - QSqlRecord rec = db.record(qTableName("qtestfields")); + QSqlRecord rec = db.record(qTableName("qtestfields", __FILE__)); QCOMPARE((int)rec.count(), fieldCount+1); testRecord(fieldDefs, rec, db); QSqlQuery q(db); - QVERIFY_SQL(q, exec("select * from " + qTableName("qtestfields"))); + QVERIFY_SQL(q, exec("select * from " + qTableName("qtestfields", __FILE__))); #ifdef QT3_SUPPORT inf = db.recordInfo(q); @@ -760,7 +764,7 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db) #ifdef QT3_SUPPORT CHECK_DATABASE(db); - Q3SqlCursor cur(qTableName("qtestfields"), true, db); + Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db); QVERIFY_SQL(cur, select()); QSqlRecord* rec = cur.primeInsert(); Q_ASSERT(rec); @@ -821,7 +825,7 @@ void tst_QSqlDatabase::checkNullValues(const FieldDef fieldDefs[], QSqlDatabase #ifdef QT3_SUPPORT CHECK_DATABASE(db); - Q3SqlCursor cur(qTableName("qtestfields"), true, db); + Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db); QVERIFY_SQL(cur, select()); QSqlRecord* rec = cur.primeInsert(); Q_ASSERT(rec); @@ -955,12 +959,12 @@ void tst_QSqlDatabase::recordOCI() checkValues(fieldDefs, db); // some additional tests - QSqlRecord rec = db.record(qTableName("qtestfields")); + QSqlRecord rec = db.record(qTableName("qtestfields", __FILE__)); QCOMPARE(rec.field("T_NUMBER").length(), 10); QCOMPARE(rec.field("T_NUMBER").precision(), 5); QSqlQuery q(db); - QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtestfields"))); + QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtestfields", __FILE__))); rec = q.record(); QCOMPARE(rec.field("T_NUMBER").length(), 10); QCOMPARE(rec.field("T_NUMBER").precision(), 5); @@ -1024,11 +1028,11 @@ void tst_QSqlDatabase::recordPSQL() if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - q.exec("drop sequence " + qTableName("qtestfields") + "_t_bigserial_seq"); - q.exec("drop sequence " + qTableName("qtestfields") + "_t_serial_seq"); + q.exec("drop sequence " + qTableName("qtestfields", __FILE__) + "_t_bigserial_seq"); + q.exec("drop sequence " + qTableName("qtestfields", __FILE__) + "_t_serial_seq"); // older psql cut off the table name - q.exec("drop sequence " + qTableName("qtestfields").left(15) + "_t_bigserial_seq"); - q.exec("drop sequence " + qTableName("qtestfields").left(18) + "_t_serial_seq"); + q.exec("drop sequence " + qTableName("qtestfields", __FILE__).left(15) + "_t_bigserial_seq"); + q.exec("drop sequence " + qTableName("qtestfields", __FILE__).left(18) + "_t_serial_seq"); const int fieldCount = createFieldTable(fieldDefs, db); QVERIFY(fieldCount > 0); @@ -1325,6 +1329,7 @@ void tst_QSqlDatabase::transaction() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString qtest(qTableName("qtest", __FILE__)); if (!db.driver()->hasFeature(QSqlDriver::Transactions)) { QSKIP("DBMS not transaction capable", SkipSingle); @@ -1333,8 +1338,8 @@ void tst_QSqlDatabase::transaction() QVERIFY(db.transaction()); QSqlQuery q(db); - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " values (40, 'VarChar40', 'Char40', 40.40)")); - QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 40")); + QVERIFY_SQL(q, exec("insert into " + qtest + " values (40, 'VarChar40', 'Char40', 40.40)")); + QVERIFY_SQL(q, exec("select * from " + qtest + " where id = 40")); QVERIFY(q.next()); QCOMPARE(q.value(0).toInt(), 40); q.clear(); @@ -1342,15 +1347,15 @@ void tst_QSqlDatabase::transaction() QVERIFY(db.commit()); QVERIFY(db.transaction()); - QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 40")); + QVERIFY_SQL(q, exec("select * from " + qtest + " where id = 40")); QVERIFY(q.next()); QCOMPARE(q.value(0).toInt(), 40); q.clear(); QVERIFY(db.commit()); QVERIFY(db.transaction()); - QVERIFY_SQL(q, exec("insert into " + qTableName("qtest") + " values (41, 'VarChar41', 'Char41', 41.41)")); - QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 41")); + QVERIFY_SQL(q, exec("insert into " + qtest + " values (41, 'VarChar41', 'Char41', 41.41)")); + QVERIFY_SQL(q, exec("select * from " + qtest + " where id = 41")); QVERIFY(q.next()); QCOMPARE(q.value(0).toInt(), 41); q.clear(); // for SQLite which does not allow any references on rows that shall be rolled back @@ -1363,7 +1368,7 @@ void tst_QSqlDatabase::transaction() } } - QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 41")); + QVERIFY_SQL(q, exec("select * from " + qtest + " where id = 41")); if(db.driverName().startsWith("QODBC") && dbName.contains("MySQL")) QEXPECT_FAIL("", "Some odbc drivers don't actually roll back despite telling us they do, especially the mysql driver", Continue); QVERIFY(!q.next()); @@ -1377,6 +1382,7 @@ void tst_QSqlDatabase::bigIntField() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); QString drvName = db.driverName(); + const QString qtest_bigint(qTableName("qtest_bigint", __FILE__)); QSqlQuery q(db); q.setForwardOnly(true); @@ -1384,19 +1390,19 @@ void tst_QSqlDatabase::bigIntField() q.setNumericalPrecisionPolicy(QSql::LowPrecisionInt64); if (drvName.startsWith("QMYSQL")) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + " (id int, t_s64bit bigint, t_u64bit bigint unsigned)")); + QVERIFY_SQL(q, exec("create table " + qtest_bigint + " (id int, t_s64bit bigint, t_u64bit bigint unsigned)")); } else if (drvName.startsWith("QPSQL") || drvName.startsWith("QDB2") || tst_Databases::isSqlServer(db)) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + "(id int, t_s64bit bigint, t_u64bit bigint)")); + QVERIFY_SQL(q, exec("create table " + qtest_bigint + "(id int, t_s64bit bigint, t_u64bit bigint)")); } else if (drvName.startsWith("QOCI")) { - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + " (id int, t_s64bit int, t_u64bit int)")); + QVERIFY_SQL(q, exec("create table " + qtest_bigint + " (id int, t_s64bit int, t_u64bit int)")); //} else if (drvName.startsWith("QIBASE")) { - // QVERIFY_SQL(q, exec("create table " + qTableName("qtest_bigint") + " (id int, t_s64bit int64, t_u64bit int64)")); + // QVERIFY_SQL(q, exec("create table " + qtest_bigint + " (id int, t_s64bit int64, t_u64bit int64)")); } else { QSKIP("no 64 bit integer support", SkipAll); } - QVERIFY(q.prepare("insert into " + qTableName("qtest_bigint") + " values (?, ?, ?)")); + QVERIFY(q.prepare("insert into " + qtest_bigint + " values (?, ?, ?)")); qlonglong ll = Q_INT64_C(9223372036854775807); qulonglong ull = Q_UINT64_C(18446744073709551615); @@ -1420,7 +1426,7 @@ void tst_QSqlDatabase::bigIntField() q.bindValue(2, (qlonglong) ull); QVERIFY_SQL(q, exec()); } - QVERIFY(q.exec("select * from " + qTableName("qtest_bigint") + " order by id")); + QVERIFY(q.exec("select * from " + qtest_bigint + " order by id")); QVERIFY(q.next()); QCOMPARE(q.value(1).toDouble(), (double)ll); QCOMPARE(q.value(1).toLongLong(), ll); @@ -1447,32 +1453,32 @@ void tst_QSqlDatabase::caseSensivity() || db.driverName().startsWith("QODBC")) cs = true; - QSqlRecord rec = db.record(qTableName("qtest")); + QSqlRecord rec = db.record(qTableName("qtest", __FILE__)); QVERIFY((int)rec.count() > 0); if (!cs) { - rec = db.record(qTableName("QTEST").toUpper()); + rec = db.record(qTableName("QTEST", __FILE__).toUpper()); QVERIFY((int)rec.count() > 0); - rec = db.record(qTableName("qTesT")); + rec = db.record(qTableName("qTesT", __FILE__)); QVERIFY((int)rec.count() > 0); } #ifdef QT3_SUPPORT - Q3SqlRecordInfo rInf = db.recordInfo(qTableName("qtest")); + Q3SqlRecordInfo rInf = db.recordInfo(qTableName("qtest", __FILE__)); QVERIFY((int)rInf.count() > 0); if (!cs) { - rInf = db.recordInfo(qTableName("QTEST").upper()); + rInf = db.recordInfo(qTableName("QTEST", __FILE__).upper()); QVERIFY((int)rInf.count() > 0); - rInf = db.recordInfo(qTableName("qTesT")); + rInf = db.recordInfo(qTableName("qTesT", __FILE__)); QVERIFY((int)rInf.count() > 0); } #endif - rec = db.primaryIndex(qTableName("qtest")); + rec = db.primaryIndex(qTableName("qtest", __FILE__)); QVERIFY((int)rec.count() > 0); if (!cs) { - rec = db.primaryIndex(qTableName("QTEST").toUpper()); + rec = db.primaryIndex(qTableName("QTEST", __FILE__).toUpper()); QVERIFY((int)rec.count() > 0); - rec = db.primaryIndex(qTableName("qTesT")); + rec = db.primaryIndex(qTableName("qTesT", __FILE__)); QVERIFY((int)rec.count() > 0); } } @@ -1488,7 +1494,7 @@ void tst_QSqlDatabase::noEscapedFieldNamesInRecord() fieldname = fieldname.toUpper(); QSqlQuery q(db); - QString query = "SELECT " + db.driver()->escapeIdentifier(fieldname, QSqlDriver::FieldName) + " FROM " + qTableName("qtest"); + QString query = "SELECT " + db.driver()->escapeIdentifier(fieldname, QSqlDriver::FieldName) + " FROM " + qTableName("qtest", __FILE__); QVERIFY_SQL(q, exec(query)); QCOMPARE(q.record().fieldName(0), fieldname); } @@ -1508,9 +1514,9 @@ void tst_QSqlDatabase::psql_schemas() QVERIFY_SQL( q, exec("set client_min_messages='warning'")); } - QVERIFY_SQL(q, exec("CREATE SCHEMA " + qTableName("qtestschema"))); + QVERIFY_SQL(q, exec("CREATE SCHEMA " + qTableName("qtestschema", __FILE__))); - QString table = qTableName("qtestschema") + '.' + qTableName("qtesttable"); + QString table = qTableName("qtestschema", __FILE__) + '.' + qTableName("qtesttable", __FILE__); QVERIFY_SQL(q, exec("CREATE TABLE " + table + " (id int primary key, name varchar(20))")); QVERIFY(db.tables().contains(table)); @@ -1546,10 +1552,10 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - QString schemaName = qTableName("qtestScHeMa"); - QString tableName = qTableName("qtest"); - QString field1Name = QString("fIeLdNaMe"); - QString field2Name = QString("ZuLu"); + const QString schemaName(qTableName("qtestScHeMa", __FILE__)), + tableName(qTableName("qtest", __FILE__)), + field1Name(QLatin1String("fIeLdNaMe")), + field2Name(QLatin1String("ZuLu")); q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName)); QString createSchema = QString("CREATE SCHEMA \"%1\"").arg(schemaName); @@ -1576,7 +1582,6 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() q.exec(QString("DROP SCHEMA \"%1\" CASCADE").arg(schemaName)); } - void tst_QSqlDatabase::psql_escapeBytea() { QFETCH(QString, dbName); @@ -1587,7 +1592,7 @@ void tst_QSqlDatabase::psql_escapeBytea() QByteArray ba(dta, 4); QSqlQuery q(db); - QString tableName = qTableName("batable"); + const QString tableName(qTableName("batable", __FILE__)); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (ba bytea)").arg(tableName))); QSqlQuery iq(db); @@ -1620,7 +1625,7 @@ void tst_QSqlDatabase::bug_249059() QSKIP("Test requires PostgreSQL >= 7.3", SkipSingle); QSqlQuery q(db); - QString tableName = qTableName("bug_249059"); + const QString tableName(qTableName("bug_249059", __FILE__)); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (dt timestamp, t time)").arg(tableName))); QSqlQuery iq(db); @@ -1655,7 +1660,7 @@ void tst_QSqlDatabase::precisionPolicy() // DBMS_SPECIFIC(db, "QPSQL"); QSqlQuery q(db); - QString tableName = qTableName("qtest_prec"); + const QString tableName(qTableName("qtest_prec", __FILE__)); if(!db.driver()->hasFeature(QSqlDriver::LowPrecisionNumbers)) QSKIP("Driver or database doesn't support setting precision policy", SkipSingle); @@ -1752,7 +1757,7 @@ void tst_QSqlDatabase::mysqlOdbc_unsignedIntegers() } QSqlQuery q(db); - QString tableName = qTableName("uint"); + const QString tableName(qTableName("uint", __FILE__)); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (foo integer(10) unsigned, bar integer(10))").arg(tableName))); QVERIFY_SQL(q, exec(QString("INSERT INTO %1 VALUES (-4000000000, -4000000000)").arg(tableName))); QVERIFY_SQL(q, exec(QString("INSERT INTO %1 VALUES (4000000000, 4000000000)").arg(tableName))); @@ -1778,7 +1783,7 @@ void tst_QSqlDatabase::accessOdbc_strings() } QSqlQuery q(db); - QString tableName = qTableName("strings"); + const QString tableName(qTableName("strings", __FILE__)); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (aStr memo, bStr memo, cStr memo, dStr memo" ", eStr memo, fStr memo, gStr memo, hStr memo)").arg(tableName))); @@ -1816,7 +1821,7 @@ void tst_QSqlDatabase::ibase_numericFields() CHECK_DATABASE(db); QSqlQuery q(db); - QString tableName = qTableName("numericfields"); + const QString tableName(qTableName("numericfields", __FILE__)); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (id int not null, num1 NUMERIC(2,1), " "num2 NUMERIC(5,2), num3 NUMERIC(10,3), " "num4 NUMERIC(18,4))").arg(tableName))); @@ -1888,7 +1893,7 @@ void tst_QSqlDatabase::ibase_fetchBlobs() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tableName = qTableName("qtest_ibaseblobs"); + const QString tableName(qTableName("qtest_ibaseblobs", __FILE__)); QSqlQuery q(db); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (blob1 BLOB segment size 256)").arg(tableName))); @@ -1921,7 +1926,7 @@ void tst_QSqlDatabase::ibase_procWithoutReturnValues() CHECK_DATABASE(db); QSqlQuery q(db); - QString procName = qTableName("qtest_proc1"); + const QString procName(qTableName("qtest_proc1", __FILE__)); q.exec(QString("drop procedure %1").arg(procName)); QVERIFY_SQL(q, exec("CREATE PROCEDURE " + procName + " (str VARCHAR(10))\nAS BEGIN\nstr='test';\nEND;")); QVERIFY_SQL(q, exec(QString("execute procedure %1('qtest')").arg(procName))); @@ -1939,7 +1944,7 @@ void tst_QSqlDatabase::ibase_procWithReturnValues() return; } - QString procName = qTableName("qtest_proc2"); + const QString procName(qTableName("qtest_proc2", __FILE__)); QSqlQuery q(db); q.exec(QString("drop procedure %1").arg(procName)); @@ -1981,11 +1986,11 @@ void tst_QSqlDatabase::formatValueTrimStrings() QSqlQuery q(db); - QVERIFY_SQL(q, exec(QString("INSERT INTO %1 (id, t_varchar, t_char) values (50, 'Trim Test ', 'Trim Test 2 ')").arg(qTableName("qtest")))); - QVERIFY_SQL(q, exec(QString("INSERT INTO %1 (id, t_varchar, t_char) values (51, 'TrimTest', 'Trim Test 2')").arg(qTableName("qtest")))); - QVERIFY_SQL(q, exec(QString("INSERT INTO %1 (id, t_varchar, t_char) values (52, ' ', ' ')").arg(qTableName("qtest")))); + QVERIFY_SQL(q, exec(QString("INSERT INTO %1 (id, t_varchar, t_char) values (50, 'Trim Test ', 'Trim Test 2 ')").arg(qTableName("qtest", __FILE__)))); + QVERIFY_SQL(q, exec(QString("INSERT INTO %1 (id, t_varchar, t_char) values (51, 'TrimTest', 'Trim Test 2')").arg(qTableName("qtest", __FILE__)))); + QVERIFY_SQL(q, exec(QString("INSERT INTO %1 (id, t_varchar, t_char) values (52, ' ', ' ')").arg(qTableName("qtest", __FILE__)))); - QVERIFY_SQL(q, exec(QString("SELECT t_varchar, t_char FROM %1 WHERE id >= 50 AND id <= 52 ORDER BY id").arg(qTableName("qtest")))); + QVERIFY_SQL(q, exec(QString("SELECT t_varchar, t_char FROM %1 WHERE id >= 50 AND id <= 52 ORDER BY id").arg(qTableName("qtest", __FILE__)))); QVERIFY_SQL(q, next()); @@ -2009,10 +2014,10 @@ void tst_QSqlDatabase::odbc_reopenDatabase() CHECK_DATABASE(db); QSqlQuery q(db); - QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest"))); + QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest", __FILE__))); QVERIFY_SQL(q, next()); db.open(); - QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest"))); + QVERIFY_SQL(q, exec("SELECT * from " + qTableName("qtest", __FILE__))); QVERIFY_SQL(q, next()); db.open(); } @@ -2029,10 +2034,10 @@ void tst_QSqlDatabase::odbc_bindBoolean() } QSqlQuery q(db); - QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool") + "(id int, boolvalue bit)")); + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool", __FILE__) + "(id int, boolvalue bit)")); // Bind and insert - QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("qtestBindBool") + " VALUES(?, ?)")); + QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("qtestBindBool", __FILE__) + " VALUES(?, ?)")); q.bindValue(0, 1); q.bindValue(1, true); QVERIFY_SQL(q, exec()); @@ -2041,7 +2046,7 @@ void tst_QSqlDatabase::odbc_bindBoolean() QVERIFY_SQL(q, exec()); // Retrive - QVERIFY_SQL(q, exec("SELECT id, boolvalue FROM " + qTableName("qtestBindBool") + " ORDER BY id")); + QVERIFY_SQL(q, exec("SELECT id, boolvalue FROM " + qTableName("qtestBindBool", __FILE__) + " ORDER BY id")); QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).toInt(), 1); QCOMPARE(q.value(1).toBool(), true); @@ -2055,20 +2060,21 @@ void tst_QSqlDatabase::odbc_testqGetString() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString testqGetString(qTableName("testqGetString", __FILE__)); QSqlQuery q(db); if (tst_Databases::isSqlServer(db)) - QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(MAX))")); + QVERIFY_SQL(q, exec("CREATE TABLE " + testqGetString + "(id int, vcvalue varchar(MAX))")); else if(tst_Databases::isMSAccess(db)) - QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue memo)")); + QVERIFY_SQL(q, exec("CREATE TABLE " + testqGetString + "(id int, vcvalue memo)")); else - QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))")); + QVERIFY_SQL(q, exec("CREATE TABLE " + testqGetString + "(id int, vcvalue varchar(65538))")); QString largeString; largeString.fill('A', 65536); // Bind and insert - QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("testqGetString") + " VALUES(?, ?)")); + QVERIFY_SQL(q, prepare("INSERT INTO " + testqGetString + " VALUES(?, ?)")); q.bindValue(0, 1); q.bindValue(1, largeString); QVERIFY_SQL(q, exec()); @@ -2080,7 +2086,7 @@ void tst_QSqlDatabase::odbc_testqGetString() QVERIFY_SQL(q, exec()); // Retrive - QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + qTableName("testqGetString") + " ORDER BY id")); + QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + testqGetString + " ORDER BY id")); QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).toInt(), 1); QCOMPARE(q.value(1).toString().length(), 65536); @@ -2098,6 +2104,7 @@ void tst_QSqlDatabase::mysql_multiselect() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString qtest(qTableName("qtest", __FILE__)); QSqlQuery q(db); QString version=tst_Databases::getMySqlVersion( db ); @@ -2105,11 +2112,11 @@ void tst_QSqlDatabase::mysql_multiselect() if (ver < 4.1) QSKIP("Test requires MySQL >= 4.1", SkipSingle); - QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtest") + "; SELECT * FROM " + qTableName("qtest"))); + QVERIFY_SQL(q, exec("SELECT * FROM " + qtest + "; SELECT * FROM " + qtest)); QVERIFY_SQL(q, next()); - QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtest") + "; SELECT * FROM " + qTableName("qtest"))); + QVERIFY_SQL(q, exec("SELECT * FROM " + qtest + "; SELECT * FROM " + qtest)); QVERIFY_SQL(q, next()); - QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtest"))); + QVERIFY_SQL(q, exec("SELECT * FROM " + qtest)); } void tst_QSqlDatabase::ibase_useCustomCharset() @@ -2123,7 +2130,7 @@ void tst_QSqlDatabase::ibase_useCustomCharset() db.setConnectOptions("ISC_DPB_LC_CTYPE=Latin1"); db.open(); - QString tableName = qTableName("latin1table"); + const QString tableName(qTableName("latin1table", __FILE__)); QSqlQuery q(db); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1(text VARCHAR(6) CHARACTER SET Latin1)").arg(tableName))); @@ -2161,7 +2168,7 @@ void tst_QSqlDatabase::oci_xmltypeSupport() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tableName = qTableName("qtest_xmltype"); + const QString tableName(qTableName("qtest_xmltype", __FILE__)); QString xml("<?xml version=\"1.0\"?><TABLE_NAME>MY_TABLE</TABLE_NAME>"); QSqlQuery q(db); @@ -2189,7 +2196,7 @@ void tst_QSqlDatabase::oci_fieldLength() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tableName = qTableName("qtest"); + const QString tableName(qTableName("qtest", __FILE__)); QSqlQuery q(db); QVERIFY_SQL(q, exec(QString("SELECT t_varchar, t_char FROM %1").arg(tableName))); @@ -2205,7 +2212,7 @@ void tst_QSqlDatabase::oci_synonymstest() CHECK_DATABASE(db); QSqlQuery q(db); - QString creator(qTableName("CREATOR")), appuser(qTableName("APPUSER")), table1(qTableName("TABLE1")); + const QString creator(qTableName("CREATOR", __FILE__)), appuser(qTableName("APPUSER", __FILE__)), table1(qTableName("TABLE1", __FILE__)); // QVERIFY_SQL(q, exec("drop public synonym "+table1)); QVERIFY_SQL(q, exec(QString("create user %1 identified by %2 default tablespace users temporary tablespace temp").arg(creator).arg(creator))); QVERIFY_SQL(q, exec(QString("grant CONNECT to %1").arg(creator))); @@ -2223,8 +2230,8 @@ void tst_QSqlDatabase::oci_synonymstest() db3.close(); QVERIFY_SQL(db3, open(appuser,appuser)); QSqlQuery q3(db3); - QVERIFY_SQL(q3, exec("create synonym "+appuser+'.'+qTableName("synonyms")+" for "+creator+'.'+table1)); - QVERIFY_SQL(db3, tables().filter(qTableName("synonyms"), Qt::CaseInsensitive).count() >= 1); + QVERIFY_SQL(q3, exec("create synonym "+appuser+'.'+qTableName("synonyms", __FILE__)+" for "+creator+'.'+table1)); + QVERIFY_SQL(db3, tables().filter(qTableName("synonyms", __FILE__), Qt::CaseInsensitive).count() >= 1); } @@ -2240,7 +2247,7 @@ void tst_QSqlDatabase::odbc_uniqueidentifier() return; } - QString tableName = qTableName("qtest_sqlguid"); + const QString tableName(qTableName("qtest_sqlguid", __FILE__)); QString guid = QString("AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE"); QString invalidGuid = QString("GAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE"); @@ -2283,7 +2290,7 @@ void tst_QSqlDatabase::odbc_uintfield() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tableName = qTableName("uint_table"); + const QString tableName(qTableName("uint_table", __FILE__)); unsigned int val = 4294967295U; QSqlQuery q(db); @@ -2347,7 +2354,7 @@ void tst_QSqlDatabase::eventNotificationIBase() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString procedureName = qTableName("posteventProc"); + const QString procedureName(qTableName("posteventProc", __FILE__)); QSqlDriver *driver=db.driver(); QVERIFY_SQL(*driver, subscribeToNotification(procedureName)); QTest::qWait(300); // Interbase needs some time to call the driver callback. @@ -2381,7 +2388,7 @@ void tst_QSqlDatabase::eventNotificationPSQL() #endif QSqlQuery query(db); - QString procedureName = qTableName("posteventProc"); + QString procedureName = qTableName("posteventProc", __FILE__); QSqlDriver &driver=*(db.driver()); QVERIFY_SQL(driver, subscribeToNotification(procedureName)); @@ -2405,7 +2412,7 @@ void tst_QSqlDatabase::sqlite_bindAndFetchUInt() } QSqlQuery q(db); - QString tableName = qTableName("uint_test"); + const QString tableName(qTableName("uint_test", __FILE__)); QVERIFY_SQL(q, exec(QString("CREATE TABLE %1(uint_field UNSIGNED INTEGER)").arg(tableName))); QVERIFY_SQL(q, prepare(QString("INSERT INTO %1 VALUES(?)").arg(tableName))); q.addBindValue(4000000000U); @@ -2425,7 +2432,7 @@ void tst_QSqlDatabase::db2_valueCacheUpdate() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tableName = qTableName("qtest"); + const QString tableName(qTableName("qtest", __FILE__)); QSqlQuery q(db); q.exec(QString("SELECT id, t_varchar, t_char, t_numeric FROM %1").arg(tableName)); q.next(); @@ -2448,7 +2455,7 @@ void tst_QSqlDatabase::sqlStatementUseIsNull_189093() // select a record with NULL value QSqlQuery q(QString::null, db); - QVERIFY_SQL(q, exec("select * from " + qTableName("qtest") + " where id = 4")); + QVERIFY_SQL(q, exec("select * from " + qTableName("qtest", __FILE__) + " where id = 4")); QVERIFY_SQL(q, next()); QSqlDriver *driver = db.driver(); @@ -2471,7 +2478,7 @@ void tst_QSqlDatabase::mysql_savepointtest() QSqlQuery q(db); QVERIFY_SQL(q, exec("begin")); - QVERIFY_SQL(q, exec("insert into "+qTableName("qtest")+" VALUES (54, 'foo', 'foo', 54.54)")); + QVERIFY_SQL(q, exec("insert into "+qTableName("qtest", __FILE__)+" VALUES (54, 'foo', 'foo', 54.54)")); QVERIFY_SQL(q, exec("savepoint foo")); } @@ -2481,7 +2488,7 @@ void tst_QSqlDatabase::oci_tables() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); QSqlQuery q(db); - QString systemTableName("system."+qTableName("mypassword")); + const QString systemTableName("system."+qTableName("mypassword", __FILE__)); QVERIFY_SQL(q, exec("CREATE TABLE "+systemTableName+"(name VARCHAR(20))")); QVERIFY(!db.tables().contains(systemTableName.toUpper())); QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper())); @@ -2501,8 +2508,8 @@ void tst_QSqlDatabase::sqlite_enable_cache_mode() db2.setConnectOptions("QSQLITE_ENABLE_SHARED_CACHE"); QVERIFY_SQL(db2, open()); QSqlQuery q(db), q2(db2); - QVERIFY_SQL(q, exec("select * from "+qTableName("qtest"))); - QVERIFY_SQL(q2, exec("select * from "+qTableName("qtest"))); + QVERIFY_SQL(q, exec("select * from "+qTableName("qtest", __FILE__))); + QVERIFY_SQL(q2, exec("select * from "+qTableName("qtest", __FILE__))); } QTEST_MAIN(tst_QSqlDatabase) diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index 19e4001..f2393ba 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -84,18 +84,19 @@ void tst_QSqlDriver::initTestCase_data() void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) { QSqlQuery q(db); + const QString relTEST1(qTableName("relTEST1", __FILE__)); if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - tst_Databases::safeDropTable( db, qTableName( "relTEST1" ) ); + tst_Databases::safeDropTable( db, relTEST1 ); - QVERIFY_SQL( q, exec("create table " + qTableName("relTEST1") + + QVERIFY_SQL( q, exec("create table " + relTEST1 + " (id int not null primary key, name varchar(20), title_key int, another_title_key int)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(1, 'harry', 1, 2)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(2, 'trond', 2, 1)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(3, 'vohi', 1, 2)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("relTEST1") + " values(4, 'boris', 2, 2)")); + QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(1, 'harry', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(2, 'trond', 2, 1)")); + QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(3, 'vohi', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(4, 'boris', 2, 2)")); } void tst_QSqlDriver::initTestCase() @@ -108,7 +109,7 @@ void tst_QSqlDriver::cleanupTestCase() { foreach (const QString &dbName, dbs.dbNames) { QSqlDatabase db = QSqlDatabase::database(dbName); - tst_Databases::safeDropTable( db, qTableName( "relTEST1" ) ); + tst_Databases::safeDropTable( db, qTableName( "relTEST1", __FILE__ ) ); } dbs.close(); } @@ -127,7 +128,7 @@ void tst_QSqlDriver::record() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tablename = qTableName("relTEST1"); + QString tablename(qTableName("relTEST1", __FILE__)); QStringList fields; fields << "id" << "name" << "title_key" << "another_title_key"; @@ -180,7 +181,7 @@ void tst_QSqlDriver::primaryIndex() QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - QString tablename = qTableName("relTEST1"); + QString tablename(qTableName("relTEST1", __FILE__)); //check that we can get primary index using unquoted mixed case table name QSqlIndex index = db.driver()->primaryIndex(tablename); QCOMPARE(index.count(), 1); diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 5339132..b9ab73f 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -44,6 +44,8 @@ #include "../qsqldatabase/tst_databases.h" +const QString qtest(qTableName( "qtest", __FILE__ )); + //TESTED_FILES= class tst_QSqlQuery : public QObject @@ -295,56 +297,56 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) { QStringList tablenames; // drop all the table in case a testcase failed - tablenames << qTableName( "qtest" ) - << qTableName( "qtest_null" ) - << qTableName( "qtest_blob" ) - << qTableName( "qtest_bittest" ) - << qTableName( "qtest_nullblob" ) - << qTableName( "qtest_rawtest" ) - << qTableName( "qtest_precision" ) - << qTableName( "qtest_prepare" ) - << qTableName( "qtestj1" ) - << qTableName( "qtestj2" ) - << qTableName( "char1Select" ) - << qTableName( "char1SelectUnicode" ) - << qTableName( "qxmltest" ) - << qTableName( "qtest_exerr" ) - << qTableName( "qtest_empty" ) - << qTableName( "clobby" ) - << qTableName( "bindtest" ) - << qTableName( "more_results" ) - << qTableName( "blobstest" ) - << qTableName( "oraRowId" ) - << qTableName( "qtest_batch" ) - << qTableName("bug6421").toUpper() - << qTableName("bug5765") - << qTableName("bug6852") - << qTableName( "qtest_lockedtable" ) - << qTableName( "Planet" ) - << qTableName( "task_250026" ) - << qTableName( "task_234422" ) - << qTableName("test141895"); + tablenames << qtest + << qTableName( "qtest_null", __FILE__ ) + << qTableName( "qtest_blob", __FILE__ ) + << qTableName( "qtest_bittest", __FILE__ ) + << qTableName( "qtest_nullblob", __FILE__ ) + << qTableName( "qtest_rawtest", __FILE__ ) + << qTableName( "qtest_precision", __FILE__ ) + << qTableName( "qtest_prepare", __FILE__ ) + << qTableName( "qtestj1", __FILE__ ) + << qTableName( "qtestj2", __FILE__ ) + << qTableName( "char1Select", __FILE__ ) + << qTableName( "char1SU", __FILE__ ) + << qTableName( "qxmltest", __FILE__ ) + << qTableName( "qtest_exerr", __FILE__ ) + << qTableName( "qtest_empty", __FILE__ ) + << qTableName( "clobby", __FILE__ ) + << qTableName( "bindtest", __FILE__ ) + << qTableName( "more_results", __FILE__ ) + << qTableName( "blobstest", __FILE__ ) + << qTableName( "oraRowId", __FILE__ ) + << qTableName( "qtest_batch", __FILE__ ) + << qTableName("bug6421", __FILE__).toUpper() + << qTableName("bug5765", __FILE__) + << qTableName("bug6852", __FILE__) + << qTableName( "qtest_lockedtable", __FILE__ ) + << qTableName( "Planet", __FILE__ ) + << qTableName( "task_250026", __FILE__ ) + << qTableName( "task_234422", __FILE__ ) + << qTableName("test141895", __FILE__); if ( db.driverName().startsWith("QPSQL") ) - tablenames << qTableName("task_233829"); + tablenames << qTableName("task_233829", __FILE__); if ( db.driverName().startsWith("QSQLITE") ) - tablenames << qTableName( "record_sqlite" ); + tablenames << qTableName( "record_sqlite", __FILE__ ); if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QOCI" ) ) - tablenames << qTableName( "qtest_longstr" ); + tablenames << qTableName( "qtest_longstr", __FILE__ ); if (tst_Databases::isSqlServer( db )) - db.exec("DROP PROCEDURE " + qTableName("test141895_proc")); + db.exec("DROP PROCEDURE " + qTableName("test141895_proc", __FILE__)); if (tst_Databases::isMySQL( db )) - db.exec("DROP PROCEDURE IF EXISTS "+qTableName("bug6852_proc")); + db.exec("DROP PROCEDURE IF EXISTS "+qTableName("bug6852_proc", __FILE__)); tst_Databases::safeDropTables( db, tablenames ); if ( db.driverName().startsWith( "QOCI" ) ) { QSqlQuery q( db ); - q.exec( "DROP PACKAGE " + qTableName("pkg") ); + q.exec( "DROP PACKAGE " + qTableName("pkg", __FILE__) ); } } @@ -360,31 +362,32 @@ void tst_QSqlQuery::createTestTables( QSqlDatabase db ) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); if(tst_Databases::isPostgreSQL(db)) - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) ); + QVERIFY_SQL( q, exec( "create table " + qtest + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) ); else - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) ); + QVERIFY_SQL( q, exec( "create table " + qtest + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) ); if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) ) - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null" ) + " (id int null, t_varchar varchar(20) null)" ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null", __FILE__ ) + " (id int null, t_varchar varchar(20) null)" ) ); else - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null" ) + " (id int, t_varchar varchar(20))" ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null", __FILE__ ) + " (id int, t_varchar varchar(20))" ) ); } void tst_QSqlQuery::populateTestTables( QSqlDatabase db ) { QSqlQuery q( db ); - q.exec( "delete from " + qTableName( "qtest" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (1, 'VarChar1', 'Char1')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (2, 'VarChar2', 'Char2')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (3, 'VarChar3', 'Char3')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (4, 'VarChar4', 'Char4')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (5, 'VarChar5', 'Char5')" ) ); + const QString qtest_null(qTableName( "qtest_null", __FILE__ )); + q.exec( "delete from " + qtest ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (1, 'VarChar1', 'Char1')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (2, 'VarChar2', 'Char2')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (3, 'VarChar3', 'Char3')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (4, 'VarChar4', 'Char4')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (5, 'VarChar5', 'Char5')" ) ); - q.exec( "delete from " + qTableName( "qtest_null" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_null" ) + " values (0, NULL)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_null" ) + " values (1, 'n')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_null" ) + " values (2, 'i')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_null" ) + " values (3, NULL)" ) ); + q.exec( "delete from " + qtest_null ); + QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (0, NULL)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (1, 'n')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (2, 'i')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_null + " values (3, NULL)" ) ); } // There were problems with char fields of size 1 @@ -396,9 +399,9 @@ void tst_QSqlQuery::char1Select() { QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "char1Select" ) + " (id char(1))" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "char1Select" ) + " values ('a')" ) ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "char1Select" ) ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "char1Select", __FILE__ ) + " (id char(1))" ) ); + QVERIFY_SQL( q, exec( "insert into " + qTableName( "char1Select", __FILE__ ) + " values ('a')" ) ); + QVERIFY_SQL( q, exec( "select * from " + qTableName( "char1Select", __FILE__ ) ) ); QVERIFY( q.next() ); if ( db.driverName().startsWith( "QIBASE" ) ) @@ -427,31 +430,32 @@ void tst_QSqlQuery::char1SelectUnicode() QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); QString createQuery; + const QString char1SelectUnicode(qTableName( "char1SU", __FILE__ )); if ( tst_Databases::isSqlServer( db ) ) - createQuery = "create table " + qTableName( "char1SelectUnicode" ) + "(id nchar(1))"; + createQuery = "create table " + char1SelectUnicode + "(id nchar(1))"; else if ( db.driverName().startsWith( "QDB2" ) || db.driverName().startsWith( "QOCI" ) || db.driverName().startsWith( "QPSQL" ) ) - createQuery = "create table " + qTableName( "char1SelectUnicode" ) + " (id char(3))"; + createQuery = "create table " + char1SelectUnicode + " (id char(3))"; else if ( db.driverName().startsWith( "QIBASE" ) ) - createQuery = "create table " + qTableName( "char1SelectUnicode" ) + + createQuery = "create table " + char1SelectUnicode + " (id char(1) character set unicode_fss)"; else if ( db.driverName().startsWith( "QMYSQL" ) ) - createQuery = "create table " + qTableName( "char1SelectUnicode" ) + " (id char(1)) " + createQuery = "create table " + char1SelectUnicode + " (id char(1)) " "default character set 'utf8'"; else - createQuery = "create table " + qTableName( "char1SelectUnicode" ) + " (id char(1))"; + createQuery = "create table " + char1SelectUnicode + " (id char(1))"; QVERIFY_SQL( q, exec( createQuery ) ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "char1SelectUnicode" ) + " values(?)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + char1SelectUnicode + " values(?)" ) ); q.bindValue( 0, uniStr ); QVERIFY_SQL( q, exec() ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "char1SelectUnicode" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + char1SelectUnicode ) ); QVERIFY( q.next() ); @@ -471,24 +475,25 @@ void tst_QSqlQuery::oraRowId() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString oraRowId(qTableName("oraRowId", __FILE__)); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "select rowid from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select rowid from " + qtest ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).type(), QVariant::String ); QVERIFY( !q.value( 0 ).toString().isEmpty() ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "oraRowId" ) + " (id char(1))" ) ); + QVERIFY_SQL( q, exec( "create table " + oraRowId + " (id char(1))" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "oraRowId" ) + " values('a')" ) ); + QVERIFY_SQL( q, exec( "insert into " + oraRowId + " values('a')" ) ); QVariant v1 = q.lastInsertId(); QVERIFY( v1.isValid() ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "oraRowId" ) + " values('b')" ) ); + QVERIFY_SQL( q, exec( "insert into " + oraRowId + " values('b')" ) ); QVariant v2 = q.lastInsertId(); QVERIFY( v2.isValid() ); - QVERIFY_SQL( q, prepare( "select * from " + qTableName( "oraRowId" ) + " where rowid = ?" ) ); + QVERIFY_SQL( q, prepare( "select * from " + oraRowId + " where rowid = ?" ) ); q.addBindValue( v1 ); QVERIFY_SQL( q, exec() ); QVERIFY( q.next() ); @@ -505,49 +510,50 @@ void tst_QSqlQuery::mysqlOutValues() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString hello(qTableName( "hello", __FILE__ )), qtestproc(qTableName( "qtestproc", __FILE__ )); QSqlQuery q( db ); if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 ) QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); - q.exec( "drop function " + qTableName( "hello" ) ); + q.exec( "drop function " + hello ); - QVERIFY_SQL( q, exec( "create function " + qTableName( "hello" ) + " (s char(20)) returns varchar(50) return concat('Hello ', s)" ) ); + QVERIFY_SQL( q, exec( "create function " + hello + " (s char(20)) returns varchar(50) return concat('Hello ', s)" ) ); - QVERIFY_SQL( q, exec( "select " + qTableName( "hello" ) + "('world')" ) ); + QVERIFY_SQL( q, exec( "select " + hello + "('world')" ) ); QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 0 ).toString(), QString( "Hello world" ) ); - QVERIFY_SQL( q, prepare( "select " + qTableName( "hello" ) + "('harald')" ) ); + QVERIFY_SQL( q, prepare( "select " + hello + "('harald')" ) ); QVERIFY_SQL( q, exec() ); QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 0 ).toString(), QString( "Hello harald" ) ); - QVERIFY_SQL( q, exec( "drop function " + qTableName( "hello" ) ) ); + QVERIFY_SQL( q, exec( "drop function " + hello ) ); - q.exec( "drop procedure " + qTableName( "qtestproc" ) ); + q.exec( "drop procedure " + qtestproc ); - QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " () " - "BEGIN select * from " + qTableName( "qtest" ) + " order by id; END" ) ); - QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + "()" ) ); + QVERIFY_SQL( q, exec( "create procedure " + qtestproc + " () " + "BEGIN select * from " + qtest + " order by id; END" ) ); + QVERIFY_SQL( q, exec( "call " + qtestproc + "()" ) ); QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 1 ).toString(), QString( "VarChar1" ) ); - QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) ); + QVERIFY_SQL( q, exec( "drop procedure " + qtestproc ) ); - QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " (OUT param1 INT) " + QVERIFY_SQL( q, exec( "create procedure " + qtestproc + " (OUT param1 INT) " "BEGIN set param1 = 42; END" ) ); - QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + " (@out)" ) ); + QVERIFY_SQL( q, exec( "call " + qtestproc + " (@out)" ) ); QVERIFY_SQL( q, exec( "select @out" ) ); QCOMPARE( q.record().fieldName( 0 ), QString( "@out" ) ); QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 0 ).toInt(), 42 ); - QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) ); + QVERIFY_SQL( q, exec( "drop procedure " + qtestproc ) ); } void tst_QSqlQuery::oraOutValues() @@ -555,6 +561,7 @@ void tst_QSqlQuery::oraOutValues() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString tst_outValues(qTableName("tst_outValues", __FILE__)); if ( !db.driver()->hasFeature( QSqlDriver::PreparedQueries ) ) { QSKIP( "Test requires prepared query support", SkipSingle ); @@ -566,11 +573,11 @@ void tst_QSqlQuery::oraOutValues() q.setForwardOnly( true ); /*** outvalue int ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x out int) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x out int) is\n" "begin\n" " x := 42;\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); q.addBindValue( 0, QSql::Out ); QVERIFY_SQL( q, exec() ); QCOMPARE( q.boundValue( 0 ).toInt(), 42 ); @@ -582,11 +589,11 @@ void tst_QSqlQuery::oraOutValues() QVERIFY( !q.boundValue( 0 ).isNull() ); /*** outvalue varchar ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x out varchar) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x out varchar) is\n" "begin\n" " x := 'blah';\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); QString s1( "12345" ); s1.reserve( 512 ); q.addBindValue( s1, QSql::Out ); @@ -594,51 +601,51 @@ void tst_QSqlQuery::oraOutValues() QCOMPARE( q.boundValue( 0 ).toString(), QString( "blah" ) ); /*** in/outvalue numeric ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x in out numeric) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x in out numeric) is\n" "begin\n" " x := x + 10;\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); q.addBindValue( 10, QSql::Out ); QVERIFY_SQL( q, exec() ); QCOMPARE( q.boundValue( 0 ).toInt(), 20 ); /*** in/outvalue varchar ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x in out varchar) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x in out varchar) is\n" "begin\n" " x := 'homer';\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); q.addBindValue( QString( "maggy" ), QSql::Out ); QVERIFY_SQL( q, exec() ); QCOMPARE( q.boundValue( 0 ).toString(), QString( "homer" ) ); /*** in/outvalue varchar ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x in out varchar) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x in out varchar) is\n" "begin\n" " x := NULL;\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); q.addBindValue( QString( "maggy" ), QSql::Out ); QVERIFY_SQL( q, exec() ); QVERIFY( q.boundValue( 0 ).isNull() ); /*** in/outvalue int ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x in out int) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x in out int) is\n" "begin\n" " x := NULL;\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); q.addBindValue( 42, QSql::Out ); QVERIFY_SQL( q, exec() ); QVERIFY( q.boundValue( 0 ).isNull() ); /*** in/outvalue varchar ***/ - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x in varchar, y out varchar) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x in varchar, y out varchar) is\n" "begin\n" " y := x||'bubulalakikikokololo';\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?, ?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?, ?)" ) ); q.addBindValue( QString( "fifi" ), QSql::In ); QString out; out.reserve( 50 ); @@ -652,30 +659,31 @@ void tst_QSqlQuery::oraClob() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString clobby(qTableName("clobby", __FILE__)); QSqlQuery q( db ); // simple short string - QVERIFY_SQL( q, exec( "create table " + qTableName( "clobby" ) + "(id int primary key, cl clob, bl blob)" ) ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "clobby" ) + " (id, cl, bl) values(?, ?, ?)" ) ); + QVERIFY_SQL( q, exec( "create table " + clobby + "(id int primary key, cl clob, bl blob)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + clobby + " (id, cl, bl) values(?, ?, ?)" ) ); q.addBindValue( 1 ); q.addBindValue( "bubu" ); q.addBindValue( QByteArray("bubu") ); QVERIFY_SQL( q, exec() ); - QVERIFY_SQL( q, exec( "select bl, cl from " + qTableName( "clobby" ) + " where id = 1" ) ); + QVERIFY_SQL( q, exec( "select bl, cl from " + clobby + " where id = 1" ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toString(), QString( "bubu" ) ); QCOMPARE( q.value( 1 ).toString(), QString( "bubu" ) ); // simple short string with binding - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "clobby" ) + " (id, cl, bl) values(?, ?, ?)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + clobby + " (id, cl, bl) values(?, ?, ?)" ) ); q.addBindValue( 2 ); q.addBindValue( "lala", QSql::Binary ); q.addBindValue( QByteArray("lala"), QSql::Binary ); QVERIFY_SQL( q, exec() ); - QVERIFY_SQL( q, exec( "select bl, cl from " + qTableName( "clobby" ) + " where id = 2" ) ); + QVERIFY_SQL( q, exec( "select bl, cl from " + clobby + " where id = 2" ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toString(), QString( "lala" ) ); QCOMPARE( q.value( 1 ).toString(), QString( "lala" ) ); @@ -683,13 +691,13 @@ void tst_QSqlQuery::oraClob() // loooong string QString loong; loong.fill( QLatin1Char( 'A' ), 25000 ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "clobby" ) + " (id, cl, bl) values(?, ?, ?)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + clobby + " (id, cl, bl) values(?, ?, ?)" ) ); q.addBindValue( 3 ); q.addBindValue( loong, QSql::Binary ); q.addBindValue( loong.toLatin1(), QSql::Binary ); QVERIFY_SQL( q, exec() ); - QVERIFY_SQL( q, exec( "select bl, cl from " + qTableName( "clobby" ) + " where id = 3" ) ); + QVERIFY_SQL( q, exec( "select bl, cl from " + clobby + " where id = 3" ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toString().count(), loong.count() ); QVERIFY( q.value( 0 ).toString() == loong ); @@ -704,16 +712,16 @@ void tst_QSqlQuery::storedProceduresIBase() CHECK_DATABASE( db ); QSqlQuery q( db ); - q.exec( "drop procedure " + qTableName( "TESTPROC" ) ); + q.exec( "drop procedure " + qTableName( "TESTPROC", __FILE__ ) ); - QVERIFY_SQL( q, exec( "create procedure " + qTableName( "TESTPROC" ) + + QVERIFY_SQL( q, exec( "create procedure " + qTableName( "TESTPROC", __FILE__ ) + " RETURNS (x integer, y varchar(20)) " "AS BEGIN " " x = 42; " " y = 'Hello Anders'; " "END" ) ); - QVERIFY_SQL( q, prepare( "execute procedure " + qTableName( "TestProc" ) ) ); + QVERIFY_SQL( q, prepare( "execute procedure " + qTableName( "TestProc", __FILE__ ) ) ); QVERIFY_SQL( q, exec() ); // check for a valid result set @@ -730,7 +738,7 @@ void tst_QSqlQuery::storedProceduresIBase() // the second next shall fail QVERIFY( !q.next() ); - q.exec( "drop procedure " + qTableName( "TestProc" ) ); + q.exec( "drop procedure " + qTableName( "TestProc", __FILE__ ) ); } void tst_QSqlQuery::outValuesDB2() @@ -748,8 +756,8 @@ void tst_QSqlQuery::outValuesDB2() q.setForwardOnly( true ); - q.exec( "drop procedure " + qTableName( "tst_outValues" ) ); //non-fatal - QVERIFY_SQL( q, exec( "CREATE PROCEDURE " + qTableName( "tst_outValues" ) + + q.exec( "drop procedure " + qTableName( "tst_outValues", __FILE__ ) ); //non-fatal + QVERIFY_SQL( q, exec( "CREATE PROCEDURE " + qTableName( "tst_outValues", __FILE__ ) + " (OUT x int, OUT x2 double, OUT x3 char(20))\n" "LANGUAGE SQL\n" "P1: BEGIN\n" @@ -758,7 +766,7 @@ void tst_QSqlQuery::outValuesDB2() " SET x3 = 'Homer';\n" "END P1" ) ); - QVERIFY_SQL( q, prepare( "call " + qTableName( "tst_outValues" ) + "(?, ?, ?)" ) ); + QVERIFY_SQL( q, prepare( "call " + qTableName( "tst_outValues", __FILE__ ) + "(?, ?, ?)" ) ); q.addBindValue( 0, QSql::Out ); q.addBindValue( 0.0, QSql::Out ); @@ -776,6 +784,7 @@ void tst_QSqlQuery::outValues() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString tst_outValues(qTableName("tst_outValues", __FILE__)); if ( !db.driver()->hasFeature( QSqlDriver::PreparedQueries ) ) { QSKIP( "Test requires prepared query support", SkipSingle ); @@ -787,26 +796,26 @@ void tst_QSqlQuery::outValues() q.setForwardOnly( true ); if ( db.driverName().startsWith( "QOCI" ) ) { - QVERIFY_SQL( q, exec( "create or replace procedure " + qTableName( "tst_outValues" ) + "(x out int) is\n" + QVERIFY_SQL( q, exec( "create or replace procedure " + tst_outValues + "(x out int) is\n" "begin\n" " x := 42;\n" "end;\n" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outvalues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); } else if ( db.driverName().startsWith( "QDB2" ) ) { - q.exec( "drop procedure " + qTableName( "tst_outValues" ) ); //non-fatal - QVERIFY_SQL( q, exec( "CREATE PROCEDURE " + qTableName( "tst_outValues" ) + " (OUT x int)\n" + q.exec( "drop procedure " + tst_outValues ); //non-fatal + QVERIFY_SQL( q, exec( "CREATE PROCEDURE " + tst_outValues + " (OUT x int)\n" "LANGUAGE SQL\n" "P1: BEGIN\n" " SET x = 42;\n" "END P1" ) ); - QVERIFY( q.prepare( "call " + qTableName( "tst_outValues" ) + "(?)" ) ); + QVERIFY( q.prepare( "call " + tst_outValues + "(?)" ) ); } else if ( tst_Databases::isSqlServer( db ) ) { - q.exec( "drop procedure " + qTableName( "tst_outValues" ) ); //non-fatal - QVERIFY_SQL( q, exec( "create procedure " + qTableName( "tst_outValues" ) + " (@x int out) as\n" + q.exec( "drop procedure " + tst_outValues ); //non-fatal + QVERIFY_SQL( q, exec( "create procedure " + tst_outValues + " (@x int out) as\n" "begin\n" " set @x = 42\n" "end\n" ) ); - QVERIFY( q.prepare( "{call " + qTableName( "tst_outvalues" ) + "(?)}" ) ); + QVERIFY( q.prepare( "{call " + tst_outValues + "(?)}" ) ); } else { QSKIP( "Don't know how to create a stored procedure for this database server, please fix this test", SkipSingle ); return; @@ -843,11 +852,11 @@ void tst_QSqlQuery::blob() q.setForwardOnly( true ); - QString queryString = QString( "create table " + qTableName( "qtest_blob" ) + + QString queryString = QString( "create table " + qTableName( "qtest_blob", __FILE__ ) + " (id int not null primary key, t_blob %1)" ).arg( tst_Databases::blobTypeName( db, BLOBSIZE ) ); QVERIFY_SQL( q, exec( queryString ) ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_blob" ) + " (id, t_blob) values (?, ?)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_blob", __FILE__ ) + " (id, t_blob) values (?, ?)" ) ); for ( i = 0; i < BLOBCOUNT; ++i ) { q.addBindValue( i ); @@ -855,7 +864,7 @@ void tst_QSqlQuery::blob() QVERIFY_SQL( q, exec() ); } - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest_blob" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest_blob", __FILE__ ) ) ); for ( i = 0; i < BLOBCOUNT; ++i ) { QVERIFY( q.next() ); @@ -878,7 +887,7 @@ void tst_QSqlQuery::value() CHECK_DATABASE( db ); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "select id, t_varchar, t_char from " + qTableName( "qtest" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "select id, t_varchar, t_char from " + qtest + " order by id" ) ); int i = 1; while ( q.next() ) { @@ -910,7 +919,7 @@ void tst_QSqlQuery::record() QSqlQuery q( db ); QVERIFY( q.record().isEmpty() ); - QVERIFY_SQL( q, exec( "select id, t_varchar, t_char from " + qTableName( "qtest" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "select id, t_varchar, t_char from " + qtest + " order by id" ) ); QSqlRecord rec = q.record(); QCOMPARE( q.record().fieldName( 0 ).toLower(), QString( "id" ) ); QCOMPARE( q.record().fieldName( 1 ).toLower(), QString( "t_varchar" ) ); @@ -934,7 +943,7 @@ void tst_QSqlQuery::isValid() QSqlQuery q( db ); QVERIFY( !q.isValid() ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.first() ); QVERIFY( q.isValid() ); } @@ -947,7 +956,7 @@ void tst_QSqlQuery::isActive() QSqlQuery q( db ); QVERIFY( !q.isActive() ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.isActive() ); QVERIFY( q.last() ); @@ -957,15 +966,15 @@ void tst_QSqlQuery::isActive() QVERIFY( q.isActive() ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (41, 'VarChar41', 'Char41')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (41, 'VarChar41', 'Char41')" ) ); QVERIFY( q.isActive() ); - QVERIFY_SQL( q, exec( "update " + qTableName( "qtest" ) + " set id = 42 where id = 41" ) ); + QVERIFY_SQL( q, exec( "update " + qtest + " set id = 42 where id = 41" ) ); QVERIFY( q.isActive() ); - QVERIFY_SQL( q, exec( "delete from " + qTableName( "qtest" ) + " where id = 42" ) ); + QVERIFY_SQL( q, exec( "delete from " + qtest + " where id = 42" ) ); QVERIFY( q.isActive() ); } @@ -979,7 +988,7 @@ void tst_QSqlQuery::numRowsAffected() QSqlQuery q( db ); QCOMPARE( q.numRowsAffected(), -1 ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); int i = 0; while ( q.next() ) @@ -993,21 +1002,21 @@ void tst_QSqlQuery::numRowsAffected() qDebug( "Expected numRowsAffected to be -1, 0 or %d, got %d", i, q.numRowsAffected() ); } - QVERIFY_SQL( q, exec( "update " + qTableName( "qtest" ) + " set id = 100 where id = 1" ) ); + QVERIFY_SQL( q, exec( "update " + qtest + " set id = 100 where id = 1" ) ); QCOMPARE( q.numRowsAffected(), 1 ); QCOMPARE( q.numRowsAffected(), 1 ); // yes, we check twice - QVERIFY_SQL( q, exec( "update " + qTableName( "qtest" ) + " set id = id + 100" ) ); + QVERIFY_SQL( q, exec( "update " + qtest + " set id = id + 100" ) ); QCOMPARE( q.numRowsAffected(), i ); QCOMPARE( q.numRowsAffected(), i ); // yes, we check twice - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (42000, 'homer', 'marge')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (42000, 'homer', 'marge')" ) ); QCOMPARE( q.numRowsAffected(), 1 ); QCOMPARE( q.numRowsAffected(), 1 ); // yes, we check twice QSqlQuery q2( db ); - QVERIFY_SQL( q2, exec( "insert into " + qTableName( "qtest" ) + " values (42001, 'homer', 'marge')" ) ); + QVERIFY_SQL( q2, exec( "insert into " + qtest + " values (42001, 'homer', 'marge')" ) ); if ( !db.driverName().startsWith( "QSQLITE2" ) ) { // SQLite 2.x accumulates changed rows in nested queries. See task 33794 @@ -1025,7 +1034,7 @@ void tst_QSqlQuery::size() QSqlQuery q( db ); QCOMPARE( q.size(), -1 ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); int i = 0; while ( q.next() ) @@ -1039,7 +1048,7 @@ void tst_QSqlQuery::size() QCOMPARE( q.size(), -1 ); // yes, twice } - QSqlQuery q2( "select * from " + qTableName( "qtest" ), db ); + QSqlQuery q2( "select * from " + qtest, db ); if ( db.driver()->hasFeature( QSqlDriver::QuerySize ) ) QCOMPARE( q.size(), i ); @@ -1048,7 +1057,7 @@ void tst_QSqlQuery::size() q2.clear(); - QVERIFY_SQL( q, exec( "update " + qTableName( "qtest" ) + " set id = 100 where id = 1" ) ); + QVERIFY_SQL( q, exec( "update " + qtest + " set id = 100 where id = 1" ) ); QCOMPARE( q.size(), -1 ); QCOMPARE( q.size(), -1 ); // yes, twice } @@ -1060,10 +1069,10 @@ void tst_QSqlQuery::isSelect() CHECK_DATABASE( db ); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.isSelect() ); - QVERIFY_SQL( q, exec( "update " + qTableName( "qtest" ) + " set id = 1 where id = 1" ) ); + QVERIFY_SQL( q, exec( "update " + qtest + " set id = 1 where id = 1" ) ); QVERIFY( q.isSelect() == false ); } @@ -1075,7 +1084,7 @@ void tst_QSqlQuery::first() QSqlQuery q( db ); QVERIFY( q.at() == QSql::BeforeFirstRow ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.last() ); QVERIFY_SQL( q, first() ); QVERIFY( q.at() == 0 ); @@ -1089,7 +1098,7 @@ void tst_QSqlQuery::next() QSqlQuery q( db ); QVERIFY( q.at() == QSql::BeforeFirstRow ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.first() ); QVERIFY( q.next() ); QVERIFY( q.at() == 1 ); @@ -1103,7 +1112,7 @@ void tst_QSqlQuery::prev() QSqlQuery q( db ); QVERIFY( q.at() == QSql::BeforeFirstRow ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.first() ); QVERIFY( q.next() ); QVERIFY( q.previous() ); @@ -1118,7 +1127,7 @@ void tst_QSqlQuery::last() QSqlQuery q( db ); QCOMPARE( q.at(), int( QSql::BeforeFirstRow ) ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); int i = 0; while ( q.next() ) @@ -1132,7 +1141,7 @@ void tst_QSqlQuery::last() // Access doesn't return the correct position QCOMPARE( q.at(), ( i-1 ) ); - QSqlQuery q2( "select * from " + qTableName( "qtest" ), db ); + QSqlQuery q2( "select * from " + qtest, db ); QVERIFY( q2.last() ); @@ -1148,7 +1157,7 @@ void tst_QSqlQuery::seek() CHECK_DATABASE( db ); QSqlQuery q( db ); QVERIFY( q.at() == QSql::BeforeFirstRow ); - QVERIFY_SQL( q, exec( QString( "select id from %1 order by id" ).arg( qTableName( "qtest" ) ) ) ); + QVERIFY_SQL( q, exec( QString( "select id from %1 order by id" ).arg( qtest ) ) ); // NB! The order of the calls below are important! QVERIFY( q.last() ); @@ -1184,7 +1193,7 @@ void tst_QSqlQuery::seekForwardOnlyQuery() QVERIFY( !q.isForwardOnly() ); QVERIFY( q.at() == QSql::BeforeFirstRow ); - QVERIFY_SQL( q, exec( QString( "select id from %1 order by id" ).arg( qTableName( "qtest" ) ) ) ); + QVERIFY_SQL( q, exec( QString( "select id from %1 order by id" ).arg( qtest ) ) ); QSqlRecord rec; @@ -1223,7 +1232,7 @@ void tst_QSqlQuery::forwardOnly() q.setForwardOnly( true ); QVERIFY( q.isForwardOnly() ); QVERIFY( q.at() == QSql::BeforeFirstRow ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest + " order by id" ) ); QVERIFY( q.at() == QSql::BeforeFirstRow ); QVERIFY( q.first() ); QCOMPARE( q.at(), 0 ); @@ -1248,7 +1257,7 @@ void tst_QSqlQuery::forwardOnly() QCOMPARE( q.at(), 3 ); QCOMPARE( q.value( 0 ).toInt(), 4 ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); int i = 0; while ( q.next() ) @@ -1260,7 +1269,7 @@ void tst_QSqlQuery::forwardOnly() QVERIFY( q2.isForwardOnly() ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest + " order by id" ) ); QVERIFY( q.isForwardOnly() ); @@ -1306,7 +1315,7 @@ void tst_QSqlQuery::query_exec() QSqlQuery q( db ); QVERIFY( !q.isValid() ); QVERIFY( !q.isActive() ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest ) ); QVERIFY( q.isActive() ); QVERIFY( q.next() ); QVERIFY( q.isValid() ); @@ -1319,7 +1328,7 @@ void tst_QSqlQuery::isNull() CHECK_DATABASE( db ); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "select id, t_varchar from " + qTableName( "qtest_null" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "select id, t_varchar from " + qTableName( "qtest_null", __FILE__ ) + " order by id" ) ); QVERIFY( q.next() ); QVERIFY( !q.isNull( 0 ) ); QVERIFY( q.isNull( 1 ) ); @@ -1345,13 +1354,13 @@ void tst_QSqlQuery::bitField() QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_bittest" ) + " (bitty bit)" ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_bittest", __FILE__ ) + " (bitty bit)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_bittest" ) + " values (0)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_bittest", __FILE__ ) + " values (0)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_bittest" ) + " values (1)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_bittest", __FILE__ ) + " values (1)" ) ); - QVERIFY_SQL( q, exec( "select bitty from " + qTableName( "qtest_bittest" ) ) ); + QVERIFY_SQL( q, exec( "select bitty from " + qTableName( "qtest_bittest", __FILE__ ) ) ); QVERIFY( q.next() ); @@ -1369,15 +1378,16 @@ void tst_QSqlQuery::nullBlob() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString qtest_nullblob(qTableName("qtest_nullblob", __FILE__)); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_nullblob" ) + " (id int primary key, bb blob)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_nullblob" ) + " values (0, EMPTY_BLOB())" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_nullblob" ) + " values (1, NULL)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_nullblob" ) + " values (2, 'aabbcc00112233445566')" ) ); + QVERIFY_SQL( q, exec( "create table " + qtest_nullblob + " (id int primary key, bb blob)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_nullblob + " values (0, EMPTY_BLOB())" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_nullblob + " values (1, NULL)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_nullblob + " values (2, 'aabbcc00112233445566')" ) ); // necessary otherwise oracle will bombard you with internal errors q.setForwardOnly( true ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest_nullblob" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest_nullblob + " order by id" ) ); QVERIFY( q.next() ); QCOMPARE(( int )q.value( 1 ).toByteArray().size(), 0 ); @@ -1398,14 +1408,15 @@ void tst_QSqlQuery::rawField() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString qtest_rawtest(qTableName("qtest_rawtest", __FILE__)); QSqlQuery q( db ); q.setForwardOnly( true ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_rawtest" ) + + QVERIFY_SQL( q, exec( "create table " + qtest_rawtest + " (id int, col raw(20))" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_rawtest" ) + " values (0, NULL)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_rawtest" ) + " values (1, '00aa1100ddeeff')" ) ); - QVERIFY_SQL( q, exec( "select col from " + qTableName( "qtest_rawtest" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_rawtest + " values (0, NULL)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_rawtest + " values (1, '00aa1100ddeeff')" ) ); + QVERIFY_SQL( q, exec( "select col from " + qtest_rawtest + " order by id" ) ); QVERIFY( q.next() ); QVERIFY( q.isNull( 0 ) ); QCOMPARE(( int )q.value( 0 ).toByteArray().size(), 0 ); @@ -1422,6 +1433,7 @@ void tst_QSqlQuery::precision() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString qtest_precision(qTableName( "qtest_precision", __FILE__ )); static const char* precStr = "1.2345678901234567891"; @@ -1433,13 +1445,13 @@ void tst_QSqlQuery::precision() QSqlQuery q( db ); if ( tst_Databases::isMSAccess( db ) ) - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_precision" ) + " (col1 number)" ) ); + QVERIFY_SQL( q, exec( "create table " + qtest_precision + " (col1 number)" ) ); else - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_precision" ) + " (col1 numeric(21, 20))" ) ); + QVERIFY_SQL( q, exec( "create table " + qtest_precision + " (col1 numeric(21, 20))" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest_precision" ) + " (col1) values (1.2345678901234567891)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest_precision + " (col1) values (1.2345678901234567891)" ) ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest_precision" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest_precision ) ); QVERIFY( q.next() ); QString val = q.value( 0 ).toString(); @@ -1472,7 +1484,7 @@ void tst_QSqlQuery::nullResult() CHECK_DATABASE( db ); QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest" ) + " where id > 50000" ) ); + QVERIFY_SQL( q, exec( "select * from " + qtest + " where id > 50000" ) ); if ( q.driver()->hasFeature( QSqlDriver::QuerySize ) ) QCOMPARE( q.size(), 0 ); @@ -1513,9 +1525,9 @@ void tst_QSqlQuery::transaction() // test a working transaction q.exec( startTransactionStr ); - QVERIFY_SQL( q, exec( "insert into" + qTableName( "qtest" ) + " values (40, 'VarChar40', 'Char40')" ) ); + QVERIFY_SQL( q, exec( "insert into" + qtest + " values (40, 'VarChar40', 'Char40')" ) ); - QVERIFY_SQL( q, exec( "select * from" + qTableName( "qtest" ) + " where id = 40" ) ); + QVERIFY_SQL( q, exec( "select * from" + qtest + " where id = 40" ) ); QVERIFY( q.next() ); @@ -1523,7 +1535,7 @@ void tst_QSqlQuery::transaction() QVERIFY_SQL( q, exec( "commit" ) ); - QVERIFY_SQL( q, exec( "select * from" + qTableName( "qtest" ) + " where id = 40" ) ); + QVERIFY_SQL( q, exec( "select * from" + qtest + " where id = 40" ) ); QVERIFY( q.next() ); @@ -1532,9 +1544,9 @@ void tst_QSqlQuery::transaction() // test a rollback q.exec( startTransactionStr ); - QVERIFY_SQL( q, exec( "insert into" + qTableName( "qtest" ) + " values (41, 'VarChar41', 'Char41')" ) ); + QVERIFY_SQL( q, exec( "insert into" + qtest + " values (41, 'VarChar41', 'Char41')" ) ); - QVERIFY_SQL( q, exec( "select * from" + qTableName( "qtest" ) + " where id = 41" ) ); + QVERIFY_SQL( q, exec( "select * from" + qtest + " where id = 41" ) ); QVERIFY( q.next() ); @@ -1548,18 +1560,18 @@ void tst_QSqlQuery::transaction() QFAIL( "Could not rollback transaction: " + tst_Databases::printError( q.lastError() ) ); } - QVERIFY_SQL( q, exec( "select * from" + qTableName( "qtest" ) + " where id = 41" ) ); + QVERIFY_SQL( q, exec( "select * from" + qtest + " where id = 41" ) ); QVERIFY( q.next() == false ); // test concurrent access q.exec( startTransactionStr ); - QVERIFY_SQL( q, exec( "insert into" + qTableName( "qtest" ) + " values (42, 'VarChar42', 'Char42')" ) ); - QVERIFY_SQL( q, exec( "select * from" + qTableName( "qtest" ) + " where id = 42" ) ); + QVERIFY_SQL( q, exec( "insert into" + qtest + " values (42, 'VarChar42', 'Char42')" ) ); + QVERIFY_SQL( q, exec( "select * from" + qtest + " where id = 42" ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toInt(), 42 ); - QVERIFY_SQL( q2, exec( "select * from" + qTableName( "qtest" ) + " where id = 42" ) ); + QVERIFY_SQL( q2, exec( "select * from" + qtest + " where id = 42" ) ); if ( q2.next() ) qDebug( QString( "DBMS '%1' doesn't support query based transactions with concurrent access" ).arg( @@ -1567,7 +1579,7 @@ void tst_QSqlQuery::transaction() QVERIFY_SQL( q, exec( "commit" ) ); - QVERIFY_SQL( q2, exec( "select * from" + qTableName( "qtest" ) + " where id = 42" ) ); + QVERIFY_SQL( q2, exec( "select * from" + qtest + " where id = 42" ) ); QVERIFY( q2.next() ); @@ -1579,6 +1591,7 @@ void tst_QSqlQuery::joins() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString qtestj1(qTableName("qtestj1", __FILE__)), qtestj2(qTableName("qtestj2", __FILE__)); if ( db.driverName().startsWith( "QOCI" ) || db.driverName().startsWith( "QTDS" ) @@ -1592,17 +1605,17 @@ void tst_QSqlQuery::joins() QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtestj1" ) + " (id1 int, id2 int)" ) ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtestj2" ) + " (id int, name varchar(20))" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtestj1" ) + " values (1, 1)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtestj1" ) + " values (1, 2)" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtestj2" ) + " values(1, 'trenton')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtestj2" ) + " values(2, 'marius')" ) ); + QVERIFY_SQL( q, exec( "create table " + qtestj1 + " (id1 int, id2 int)" ) ); + QVERIFY_SQL( q, exec( "create table " + qtestj2 + " (id int, name varchar(20))" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtestj1 + " values (1, 1)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtestj1 + " values (1, 2)" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtestj2 + " values(1, 'trenton')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtestj2 + " values(2, 'marius')" ) ); QVERIFY_SQL( q, exec( "select qtestj1.id1, qtestj1.id2, qtestj2.id, qtestj2.name, qtestj3.id, qtestj3.name " - "from " + qTableName( "qtestj1" ) + " qtestj1 left outer join " + qTableName( "qtestj2" ) + + "from " + qtestj1 + " qtestj1 left outer join " + qtestj2 + " qtestj2 on (qtestj1.id1 = qtestj2.id) " - "left outer join " + qTableName( "qtestj2" ) + " as qtestj3 on (qtestj1.id2 = qtestj3.id)" ) ); + "left outer join " + qtestj2 + " as qtestj3 on (qtestj1.id2 = qtestj3.id)" ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toInt(), 1 ); @@ -1628,7 +1641,7 @@ void tst_QSqlQuery::synonyms() CHECK_DATABASE( db ); QSqlQuery q(db); - QVERIFY_SQL( q, exec("select a.id, a.t_char, a.t_varchar from " + qTableName( "qtest" ) + " a where a.id = 1") ); + QVERIFY_SQL( q, exec("select a.id, a.t_char, a.t_varchar from " + qtest + " a where a.id = 1") ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toInt(), 1 ); QCOMPARE( q.value( 1 ).toString().trimmed(), QString( "Char1" ) ); @@ -1647,6 +1660,8 @@ void tst_QSqlQuery::prepare_bind_exec() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString qtest_prepare(qTableName("qtest_prepare", __FILE__)); + if(db.driverName().startsWith("QIBASE") && (db.databaseName() == "silence.nokia.troll.no:c:\\ibase\\testdb_ascii" || db.databaseName() == "/opt/interbase/qttest.gdb")) QSKIP("Can't transliterate extended unicode to ascii", SkipSingle); if(db.driverName().startsWith("QDB2")) @@ -1671,15 +1686,15 @@ void tst_QSqlQuery::prepare_bind_exec() QVERIFY_SQL( q, exec("set client_min_messages='warning'")); if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) ) - createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(200) null)"; + createQuery = "create table " + qtest_prepare + " (id int primary key, name nvarchar(200) null)"; else if ( tst_Databases::isMySQL(db) && useUnicode ) - createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(200) character set utf8)"; + createQuery = "create table " + qtest_prepare + " (id int not null primary key, name varchar(200) character set utf8)"; else - createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(200))"; + createQuery = "create table " + qtest_prepare + " (id int not null primary key, name varchar(200))"; QVERIFY_SQL( q, exec( createQuery ) ); - QVERIFY( q.prepare( "insert into " + qTableName( "qtest_prepare" ) + " (id, name) values (:id, :name)" ) ); + QVERIFY( q.prepare( "insert into " + qtest_prepare + " (id, name) values (:id, :name)" ) ); int i; for ( i = 0; i < 6; ++i ) { @@ -1702,7 +1717,7 @@ void tst_QSqlQuery::prepare_bind_exec() QVERIFY_SQL( q, exec() ); } - QVERIFY_SQL( q, exec( "SELECT * FROM " + qTableName( "qtest_prepare" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "SELECT * FROM " + qtest_prepare + " order by id" ) ); for ( i = 0; i < 6; ++i ) { QVERIFY( q.next() ); @@ -1721,12 +1736,12 @@ void tst_QSqlQuery::prepare_bind_exec() QCOMPARE( q.value( 0 ).toInt(), 8 ); QCOMPARE( q.value( 1 ).toString(), values[5] ); - QVERIFY( q.prepare( "insert into " + qTableName( "qtest_prepare" ) + " (id, name) values (:id, 'Bart')" ) ); + QVERIFY( q.prepare( "insert into " + qtest_prepare + " (id, name) values (:id, 'Bart')" ) ); q.bindValue( ":id", 99 ); QVERIFY_SQL( q, exec() ); q.bindValue( ":id", 100 ); QVERIFY_SQL( q, exec() ); - QVERIFY( q.exec( "select * from " + qTableName( "qtest_prepare" ) + " where id > 98 order by id" ) ); + QVERIFY( q.exec( "select * from " + qtest_prepare + " where id > 98 order by id" ) ); for ( i = 99; i <= 100; ++i ) { QVERIFY( q.next() ); @@ -1735,7 +1750,7 @@ void tst_QSqlQuery::prepare_bind_exec() } /*** SELECT stuff ***/ - QVERIFY( q.prepare( "select * from " + qTableName( "qtest_prepare" ) + " where id = :id" ) ); + QVERIFY( q.prepare( "select * from " + qtest_prepare + " where id = :id" ) ); for ( i = 0; i < 6; ++i ) { q.bindValue( ":id", i ); @@ -1750,9 +1765,9 @@ void tst_QSqlQuery::prepare_bind_exec() QVERIFY( !q.next() ); } - QVERIFY_SQL( q, exec( "DELETE FROM " + qTableName( "qtest_prepare" ) ) ); + QVERIFY_SQL( q, exec( "DELETE FROM " + qtest_prepare ) ); - QVERIFY( q.prepare( "insert into " + qTableName( "qtest_prepare" ) + " (id, name) values (?, ?)" ) ); + QVERIFY( q.prepare( "insert into " + qtest_prepare + " (id, name) values (?, ?)" ) ); q.bindValue( 0, 0 ); q.bindValue( 1, values[ 0 ] ); QVERIFY_SQL( q, exec() ); @@ -1781,7 +1796,7 @@ void tst_QSqlQuery::prepare_bind_exec() QVERIFY_SQL( q, exec() ); } - QVERIFY_SQL( q, exec( "SELECT * FROM " + qTableName( "qtest_prepare" ) + " order by id" ) ); + QVERIFY_SQL( q, exec( "SELECT * FROM " + qtest_prepare + " order by id" ) ); for ( i = 0; i < 6; ++i ) { QVERIFY( q.next() ); @@ -1800,13 +1815,13 @@ void tst_QSqlQuery::prepare_bind_exec() QCOMPARE( q.value( 1 ).toString(), utf8str ); } - QVERIFY( q.prepare( "insert into " + qTableName( "qtest_prepare" ) + " (id, name) values (?, 'Bart')" ) ); + QVERIFY( q.prepare( "insert into " + qtest_prepare + " (id, name) values (?, 'Bart')" ) ); q.bindValue( 0, 99 ); QVERIFY_SQL( q, exec() ); q.addBindValue( 100 ); QVERIFY_SQL( q, exec() ); - QVERIFY( q.exec( "select * from " + qTableName( "qtest_prepare" ) + " where id > 98 order by id" ) ); + QVERIFY( q.exec( "select * from " + qtest_prepare + " where id > 98 order by id" ) ); for ( i = 99; i <= 100; ++i ) { QVERIFY( q.next() ); @@ -1815,7 +1830,7 @@ void tst_QSqlQuery::prepare_bind_exec() } /* insert a duplicate id and make sure the db bails out */ - QVERIFY( q.prepare( "insert into " + qTableName( "qtest_prepare" ) + " (id, name) values (?, ?)" ) ); + QVERIFY( q.prepare( "insert into " + qtest_prepare + " (id, name) values (?, ?)" ) ); q.addBindValue( 99 ); @@ -1837,7 +1852,7 @@ void tst_QSqlQuery::prepared_select() CHECK_DATABASE( db ); QSqlQuery q( db ); - QVERIFY_SQL( q, prepare( "select a.id, a.t_char, a.t_varchar from " + qTableName( "qtest" ) + " a where a.id = ?" ) ); + QVERIFY_SQL( q, prepare( "select a.id, a.t_char, a.t_varchar from " + qtest + " a where a.id = ?" ) ); q.bindValue( 0, 1 ); QVERIFY_SQL( q, exec() ); @@ -1857,7 +1872,7 @@ void tst_QSqlQuery::prepared_select() QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toInt(), 3 ); - QVERIFY_SQL( q, prepare( "select a.id, a.t_char, a.t_varchar from " + qTableName( "qtest" ) + " a where a.id = ?" ) ); + QVERIFY_SQL( q, prepare( "select a.id, a.t_char, a.t_varchar from " + qtest + " a where a.id = ?" ) ); QCOMPARE( q.at(), ( int )QSql::BeforeFirstRow ); QVERIFY( !q.first() ); } @@ -1873,9 +1888,9 @@ void tst_QSqlQuery::sqlServerLongStrings() QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "CREATE TABLE " + qTableName( "qtest_longstr" ) + " (id int primary key, longstring ntext)" ) ); + QVERIFY_SQL( q, exec( "CREATE TABLE " + qTableName( "qtest_longstr", __FILE__ ) + " (id int primary key, longstring ntext)" ) ); - QVERIFY_SQL( q, prepare( "INSERT INTO " + qTableName( "qtest_longstr" ) + " VALUES (?, ?)" ) ); + QVERIFY_SQL( q, prepare( "INSERT INTO " + qTableName( "qtest_longstr", __FILE__ ) + " VALUES (?, ?)" ) ); q.addBindValue( 0 ); @@ -1893,7 +1908,7 @@ void tst_QSqlQuery::sqlServerLongStrings() QVERIFY_SQL( q, exec() ); - QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest_longstr" ) ) ); + QVERIFY_SQL( q, exec( "select * from " + qTableName( "qtest_longstr", __FILE__ ) ) ); QVERIFY_SQL( q, next() ); @@ -1957,7 +1972,7 @@ void tst_QSqlQuery::batchExec() QSKIP( "Database can't do BatchOperations", SkipSingle ); QSqlQuery q( db ); - QString tableName = qTableName( "qtest_batch" ); + const QString tableName = qTableName( "qtest_batch", __FILE__ ); QVERIFY_SQL( q, exec( "create table " + tableName + " (id int, name varchar(20), dt date, num numeric(8, 4))" ) ); QVERIFY_SQL( q, prepare( "insert into " + tableName + " (id, name, dt, num) values (?, ?, ?, ?)" ) ); @@ -2101,9 +2116,9 @@ void tst_QSqlQuery::record_sqlite() QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table "+qTableName( "record_sqlite" )+"(id integer primary key, name varchar, title int)" ) ); + QVERIFY_SQL( q, exec( "create table "+qTableName( "record_sqlite", __FILE__ )+"(id integer primary key, name varchar, title int)" ) ); - QSqlRecord rec = db.record( qTableName( "record_sqlite" ) ); + QSqlRecord rec = db.record( qTableName( "record_sqlite", __FILE__ ) ); QCOMPARE( rec.count(), 3 ); QCOMPARE( rec.field( 0 ).type(), QVariant::Int ); @@ -2111,7 +2126,7 @@ void tst_QSqlQuery::record_sqlite() QCOMPARE( rec.field( 2 ).type(), QVariant::Int ); /* important - select from an empty table */ - QVERIFY_SQL( q, exec( "select id, name, title from "+qTableName( "record_sqlite" ) ) ); + QVERIFY_SQL( q, exec( "select id, name, title from "+qTableName( "record_sqlite", __FILE__ ) ) ); rec = q.record(); QCOMPARE( rec.count(), 3 ); @@ -2130,13 +2145,13 @@ void tst_QSqlQuery::oraLong() QString aLotOfText( 127000, QLatin1Char( 'H' ) ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_longstr" ) + " (id int primary key, astr long)" ) ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_longstr" ) + " (id, astr) values (?, ?)" ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_longstr", __FILE__ ) + " (id int primary key, astr long)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_longstr", __FILE__ ) + " (id, astr) values (?, ?)" ) ); q.addBindValue( 1 ); q.addBindValue( aLotOfText ); QVERIFY_SQL( q, exec() ); - QVERIFY_SQL( q, exec( "select id,astr from " + qTableName( "qtest_longstr" ) ) ); + QVERIFY_SQL( q, exec( "select id,astr from " + qTableName( "qtest_longstr", __FILE__ ) ) ); QVERIFY( q.next() ); QCOMPARE( q.value( 0 ).toInt(), 1 ); @@ -2151,8 +2166,8 @@ void tst_QSqlQuery::execErrorRecovery() QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr" ) + " (id int not null primary key)" ) ); - QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_exerr" ) + " values (?)" ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_exerr", __FILE__ ) + " (id int not null primary key)" ) ); + QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_exerr", __FILE__ ) + " values (?)" ) ); q.addBindValue( 1 ); QVERIFY_SQL( q, exec() ); @@ -2175,7 +2190,7 @@ void tst_QSqlQuery::lastInsertId() QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "qtest" ) + " values (41, 'VarChar41', 'Char41')" ) ); + QVERIFY_SQL( q, exec( "insert into " + qtest + " values (41, 'VarChar41', 'Char41')" ) ); QVariant v = q.lastInsertId(); @@ -2189,7 +2204,7 @@ void tst_QSqlQuery::lastQuery() CHECK_DATABASE( db ); QSqlQuery q( db ); - QString sql = "select * from " + qTableName( "qtest" ); + QString sql = "select * from " + qtest; QVERIFY_SQL( q, exec( sql ) ); QCOMPARE( q.lastQuery(), sql ); QCOMPARE( q.executedQuery(), sql ); @@ -2208,7 +2223,7 @@ void tst_QSqlQuery::bindWithDoubleColonCastOperator() return; } - QString tablename = qTableName( "bindtest" ); + const QString tablename(qTableName( "bindtest", __FILE__ )); QSqlQuery q( db ); @@ -2282,7 +2297,7 @@ void tst_QSqlQuery::createQueryOnClosedDatabase() QSqlQuery q( db ); db.open(); - QVERIFY_SQL( q, exec( QString( "select * from %1 where id = 1" ).arg( qTableName( "qtest" ) ) ) ); + QVERIFY_SQL( q, exec( QString( "select * from %1 where id = 1" ).arg( qtest ) ) ); QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 0 ).toInt(), 1 ); @@ -2290,7 +2305,7 @@ void tst_QSqlQuery::createQueryOnClosedDatabase() QCOMPARE( q.value( 2 ).toString().trimmed(), QLatin1String( "Char1" ) ); db.close(); - QVERIFY2( !q.exec( QString( "select * from %1 where id = 1" ).arg( qTableName( "qtest" ) ) ), + QVERIFY2( !q.exec( QString( "select * from %1 where id = 1" ).arg( qtest ) ), qPrintable( QString( "This can't happen! The query should not have been executed!" ) ) ); } @@ -2303,7 +2318,7 @@ void tst_QSqlQuery::reExecutePreparedForwardOnlyQuery() QSqlQuery q( db ); q.setForwardOnly( true ); - QVERIFY_SQL( q, prepare( QString( "SELECT id, t_varchar, t_char FROM %1 WHERE id = :id" ).arg( qTableName( "qtest" ) ) ) ); + QVERIFY_SQL( q, prepare( QString( "SELECT id, t_varchar, t_char FROM %1 WHERE id = :id" ).arg( qtest ) ) ); q.bindValue( ":id", 1 ); QVERIFY_SQL( q, exec() ); @@ -2328,7 +2343,7 @@ void tst_QSqlQuery::finish() CHECK_DATABASE( db ); QSqlQuery q( db ); - QVERIFY_SQL( q, prepare( "SELECT id FROM " + qTableName( "qtest" ) + " WHERE id = ?" ) ); + QVERIFY_SQL( q, prepare( "SELECT id FROM " + qtest + " WHERE id = ?" ) ); int id = 4; q.bindValue( 0, id ); @@ -2349,7 +2364,7 @@ void tst_QSqlQuery::finish() q.finish(); QVERIFY( !q.isActive() ); - QVERIFY_SQL( q, exec( "SELECT id FROM " + qTableName( "qtest" ) + " WHERE id = 1" ) ); + QVERIFY_SQL( q, exec( "SELECT id FROM " + qtest + " WHERE id = 1" ) ); QVERIFY( q.isActive() ); QVERIFY_SQL( q, next() ); QCOMPARE( q.value( 0 ).toInt(), 1 ); @@ -2374,7 +2389,7 @@ void tst_QSqlQuery::sqlite_finish() db2.setDatabaseName( db.databaseName() ); QVERIFY_SQL( db2, open() ); - QString tableName = qTableName( "qtest_lockedtable" ); + const QString tableName(qTableName( "qtest_lockedtable", __FILE__ )); QSqlQuery q( db ); tst_Databases::safeDropTable( db, tableName ); @@ -2424,7 +2439,7 @@ void tst_QSqlQuery::nextResult() else if ( db.driverName().startsWith( "QDB2" ) ) driverType = DB2; - QString tableName = qTableName( "more_results" ); + const QString tableName(qTableName( "more_results", __FILE__ )); QVERIFY_SQL( q, exec( "CREATE TABLE " + tableName + " (id integer, text varchar(20), num numeric(6, 3), empty varchar(10));" ) ); @@ -2528,7 +2543,7 @@ void tst_QSqlQuery::nextResult() } // Stored procedure with multiple result sets - QString procName = qTableName( "proc_more_res" ); + const QString procName(qTableName( "proc_more_res", __FILE__ )); q.exec( QString( "DROP PROCEDURE %1;" ).arg( procName ) ); @@ -2606,7 +2621,7 @@ void tst_QSqlQuery::blobsPreparedQuery() if ( !db.driver()->hasFeature( QSqlDriver::BLOB ) || !db.driver()->hasFeature( QSqlDriver::PreparedQueries ) ) QSKIP( "DBMS does not support BLOBs or prepared queries", SkipSingle ); - QString tableName = qTableName( "blobstest" ); + const QString tableName(qTableName( "blobstest", __FILE__ )); QSqlQuery q( db ); q.setForwardOnly( true ); // This is needed to make the test work with DB2. @@ -2661,8 +2676,8 @@ void tst_QSqlQuery::emptyTableNavigate() { QSqlQuery q( db ); - QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_empty" ) + " (id char(10))" ) ); - QVERIFY_SQL( q, prepare( "select * from " + qTableName( "qtest_empty" ) ) ); + QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_empty", __FILE__ ) + " (id char(10))" ) ); + QVERIFY_SQL( q, prepare( "select * from " + qTableName( "qtest_empty", __FILE__ ) ) ); QVERIFY_SQL( q, exec() ); QVERIFY( !q.next() ); QCOMPARE( q.lastError().isValid(), false ); @@ -2675,19 +2690,20 @@ void tst_QSqlQuery::task_217003() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); QSqlQuery q( db ); + const QString Planet(qTableName( "Planet", __FILE__)); - QVERIFY_SQL( q, exec( "create table " + qTableName( "Planet" ) + " (Name varchar(20))" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "Planet" ) + " VALUES ('Mercury')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "Planet" ) + " VALUES ('Venus')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "Planet" ) + " VALUES ('Earth')" ) ); - QVERIFY_SQL( q, exec( "insert into " + qTableName( "Planet" ) + " VALUES ('Mars')" ) ); + QVERIFY_SQL( q, exec( "create table " + Planet + " (Name varchar(20))" ) ); + QVERIFY_SQL( q, exec( "insert into " + Planet + " VALUES ('Mercury')" ) ); + QVERIFY_SQL( q, exec( "insert into " + Planet + " VALUES ('Venus')" ) ); + QVERIFY_SQL( q, exec( "insert into " + Planet + " VALUES ('Earth')" ) ); + QVERIFY_SQL( q, exec( "insert into " + Planet + " VALUES ('Mars')" ) ); - QVERIFY_SQL( q, exec( "SELECT Name FROM "+qTableName( "Planet" ) ) ); + QVERIFY_SQL( q, exec( "SELECT Name FROM " + Planet ) ); QVERIFY_SQL( q, seek( 3 ) ); QCOMPARE( q.value( 0 ).toString(), QString( "Mars" ) ); QVERIFY_SQL( q, seek( 1 ) ); QCOMPARE( q.value( 0 ).toString(), QString( "Venus" ) ); - QVERIFY_SQL( q, exec( "SELECT Name FROM "+qTableName( "Planet" ) ) ); + QVERIFY_SQL( q, exec( "SELECT Name FROM " + Planet ) ); QVERIFY_SQL( q, seek( 3 ) ); QCOMPARE( q.value( 0 ).toString(), QString( "Mars" ) ); QVERIFY_SQL( q, seek( 0 ) ); @@ -2704,7 +2720,7 @@ void tst_QSqlQuery::task_250026() CHECK_DATABASE( db ); QSqlQuery q( db ); - QString tableName = qTableName( "task_250026" ); + const QString tableName(qTableName( "task_250026", __FILE__ )); if ( !q.exec( "create table " + tableName + " (longfield varchar(1100))" ) ) { qDebug() << "Error" << q.lastError(); @@ -2752,7 +2768,7 @@ void tst_QSqlQuery::task_229811() QSqlQuery q( db ); - QString tableName = qTableName( "task_229811" ); + const QString tableName(qTableName( "task_229811", __FILE__ )); if ( !q.exec( "CREATE TABLE " + tableName + " (Word varchar(20))" ) ) { qDebug() << "Warning" << q.lastError(); @@ -2799,7 +2815,7 @@ void tst_QSqlQuery::task_234422() m_airlines << "Lufthansa" << "SAS" << "United" << "KLM" << "Aeroflot"; m_countries << "DE" << "SE" << "US" << "NL" << "RU"; - QString tableName = qTableName( "task_234422" ); + const QString tableName(qTableName( "task_234422", __FILE__ )); QVERIFY_SQL(query,exec("CREATE TABLE " + tableName + " (id int primary key, " "name varchar(20), homecountry varchar(2))")); @@ -2831,7 +2847,7 @@ void tst_QSqlQuery::task_233829() CHECK_DATABASE( db ); QSqlQuery q( db ); - QString tableName = qTableName("task_233829"); + const QString tableName(qTableName("task_233829", __FILE__)); QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + "(dbl1 double precision,dbl2 double precision) without oids;")); QString queryString("INSERT INTO " + tableName +"(dbl1, dbl2) VALUES(?,?)"); @@ -2851,7 +2867,7 @@ void tst_QSqlQuery::sqlServerReturn0() if (!tst_Databases::isSqlServer( db )) QSKIP("SQL Server specific test", SkipSingle); - QString tableName(qTableName("test141895")), procName(qTableName("test141895_proc")); + const QString tableName(qTableName("test141895", __FILE__)), procName(qTableName("test141895_proc", __FILE__)); QSqlQuery q( db ); q.exec("DROP TABLE " + tableName); q.exec("DROP PROCEDURE " + procName); @@ -2877,7 +2893,7 @@ void tst_QSqlQuery::QTBUG_551() QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); QSqlQuery q(db); - QString pkgname=qTableName("pkg"); + const QString pkgname(qTableName("pkg", __FILE__)); QVERIFY_SQL(q, exec("CREATE OR REPLACE PACKAGE "+pkgname+" IS \n\ \n\ TYPE IntType IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;\n\ @@ -2923,17 +2939,18 @@ void tst_QSqlQuery::QTBUG_5251() QFETCH( QString, dbName ); QSqlDatabase db = QSqlDatabase::database( dbName ); CHECK_DATABASE( db ); + const QString timetest(qTableName("timetest", __FILE__)); if (!db.driverName().startsWith( "QPSQL" )) return; QSqlQuery q(db); - q.exec("DROP TABLE " + qTableName("timetest")); - QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("timetest") + " (t TIME)")); - QVERIFY_SQL(q, exec("INSERT INTO " + qTableName("timetest") + " VALUES ('1:2:3.666')")); + q.exec("DROP TABLE " + timetest); + QVERIFY_SQL(q, exec("CREATE TABLE " + timetest + " (t TIME)")); + QVERIFY_SQL(q, exec("INSERT INTO " + timetest + " VALUES ('1:2:3.666')")); QSqlTableModel timetestModel(0,db); timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit); - timetestModel.setTable(qTableName("timetest")); + timetestModel.setTable(timetest); QVERIFY_SQL(timetestModel, select()); QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("01:02:03.666")); @@ -2942,7 +2959,7 @@ void tst_QSqlQuery::QTBUG_5251() QVERIFY_SQL(timetestModel, submitAll()); QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:12:34.500")); - QVERIFY_SQL(q, exec("UPDATE " + qTableName("timetest") + " SET t = '0:11:22.33'")); + QVERIFY_SQL(q, exec("UPDATE " + timetest + " SET t = '0:11:22.33'")); QVERIFY_SQL(timetestModel, select()); QCOMPARE(timetestModel.record(0).field(0).value().toTime().toString("HH:mm:ss.zzz"), QString("00:11:22.330")); @@ -2955,7 +2972,7 @@ void tst_QSqlQuery::QTBUG_6421() CHECK_DATABASE( db ); QSqlQuery q(db); - QString tableName=qTableName(QLatin1String("bug6421")).toUpper(); + const QString tableName(qTableName("bug6421", __FILE__).toUpper()); QVERIFY_SQL(q, exec("create table "+tableName+"(COL1 char(10), COL2 char(10), COL3 char(10))")); QVERIFY_SQL(q, exec("create index INDEX1 on "+tableName+" (COL1 desc)")); @@ -2980,16 +2997,16 @@ void tst_QSqlQuery::QTBUG_6618() QSKIP("SQL Server specific test", SkipSingle); QSqlQuery q(db); - q.exec( "drop procedure " + qTableName( "tst_raiseError" ) ); //non-fatal + q.exec( "drop procedure " + qTableName( "tst_raiseError", __FILE__ ) ); //non-fatal QString errorString; for (int i=0;i<110;i++) errorString+="reallylong"; errorString+=" error"; - QVERIFY_SQL( q, exec("create procedure " + qTableName( "tst_raiseError" ) + " as\n" + QVERIFY_SQL( q, exec("create procedure " + qTableName( "tst_raiseError", __FILE__ ) + " as\n" "begin\n" " raiserror('" + errorString + "', 16, 1)\n" "end\n" )); - q.exec( "{call " + qTableName( "tst_raiseError" ) + "}" ); + q.exec( "{call " + qTableName( "tst_raiseError", __FILE__ ) + "}" ); QVERIFY(q.lastError().text().contains(errorString)); } @@ -3002,7 +3019,7 @@ void tst_QSqlQuery::QTBUG_6852() QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); QSqlQuery q(db); - QString tableName(qTableName(QLatin1String("bug6852"))), procName(qTableName(QLatin1String("bug6852_proc"))); + const QString tableName(qTableName("bug6852", __FILE__)), procName(qTableName("bug6852_proc", __FILE__)); QVERIFY_SQL(q, exec("DROP PROCEDURE IF EXISTS "+procName)); QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n" @@ -3036,7 +3053,7 @@ void tst_QSqlQuery::QTBUG_5765() QSKIP( "Test requires MySQL >= 4.1", SkipSingle ); QSqlQuery q(db); - QString tableName(qTableName(QLatin1String("bug5765"))); + const QString tableName(qTableName("bug5765", __FILE__)); QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(testval TINYINT(1) DEFAULT 0)")); q.prepare("INSERT INTO "+tableName+" SET testval = :VALUE"); @@ -3074,7 +3091,7 @@ void tst_QSqlQuery::benchmark() QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); QSqlQuery q(db); - QString tableName(qTableName(QLatin1String("benchmark"))); + const QString tableName(qTableName("benchmark", __FILE__)); tst_Databases::safeDropTable( db, tableName ); diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 7e75d28..b64d599 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -148,10 +148,10 @@ void tst_QSqlQueryModel::cleanupTestCase() void tst_QSqlQueryModel::dropTestTables(QSqlDatabase db) { QStringList tableNames; - tableNames << qTableName("test") - << qTableName("test2") - << qTableName("test3") - << qTableName("many"); + tableNames << qTableName("test", __FILE__) + << qTableName("test2", __FILE__) + << qTableName("test3", __FILE__) + << qTableName("many", __FILE__); tst_Databases::safeDropTables(db, tableNames); } @@ -161,10 +161,10 @@ void tst_QSqlQueryModel::createTestTables(QSqlDatabase db) QSqlQuery q(db); if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - QVERIFY_SQL( q, exec("create table " + qTableName("test") + "(id integer not null, name varchar(20), title integer, primary key (id))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test2") + "(id integer not null, title varchar(20), primary key (id))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id integer not null, primary key (id))")); - QVERIFY_SQL( q, exec("create table " + qTableName("many") + "(id integer not null, name varchar(20), primary key (id))")); + QVERIFY_SQL( q, exec("create table " + qTableName("test", __FILE__) + "(id integer not null, name varchar(20), title integer, primary key (id))")); + QVERIFY_SQL( q, exec("create table " + qTableName("test2", __FILE__) + "(id integer not null, title varchar(20), primary key (id))")); + QVERIFY_SQL( q, exec("create table " + qTableName("test3", __FILE__) + "(id integer not null, primary key (id))")); + QVERIFY_SQL( q, exec("create table " + qTableName("many", __FILE__) + "(id integer not null, name varchar(20), primary key (id))")); } void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) @@ -174,38 +174,38 @@ void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db) QSqlQuery q(db), q2(db); - tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp") << qTableName("test3tmp")); - QVERIFY_SQL(q, exec("create table " + qTableName("manytmp") + "(id integer not null, name varchar(20), primary key (id))")); - QVERIFY_SQL(q, exec("create table " + qTableName("test3tmp") + "(id integer not null, primary key (id))")); + tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp", __FILE__) << qTableName("test3tmp", __FILE__)); + QVERIFY_SQL(q, exec("create table " + qTableName("manytmp", __FILE__) + "(id integer not null, name varchar(20), primary key (id))")); + QVERIFY_SQL(q, exec("create table " + qTableName("test3tmp", __FILE__) + "(id integer not null, primary key (id))")); if (hasTransactions) QVERIFY_SQL(db, transaction()); - QVERIFY_SQL(q, exec("insert into " + qTableName("test") + " values(1, 'harry', 1)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("test") + " values(2, 'trond', 2)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("test2") + " values(1, 'herr')")); - QVERIFY_SQL(q, exec("insert into " + qTableName("test2") + " values(2, 'mister')")); + QVERIFY_SQL(q, exec("insert into " + qTableName("test", __FILE__) + " values(1, 'harry', 1)")); + QVERIFY_SQL(q, exec("insert into " + qTableName("test", __FILE__) + " values(2, 'trond', 2)")); + QVERIFY_SQL(q, exec("insert into " + qTableName("test2", __FILE__) + " values(1, 'herr')")); + QVERIFY_SQL(q, exec("insert into " + qTableName("test2", __FILE__) + " values(2, 'mister')")); - QVERIFY_SQL(q, exec(QString("insert into " + qTableName("test3") + " values(0)"))); - QVERIFY_SQL(q, prepare("insert into "+qTableName("test3")+"(id) select id + ? from "+qTableName("test3tmp"))); + QVERIFY_SQL(q, exec(QString("insert into " + qTableName("test3", __FILE__) + " values(0)"))); + QVERIFY_SQL(q, prepare("insert into "+qTableName("test3", __FILE__)+"(id) select id + ? from "+qTableName("test3tmp", __FILE__))); for (int i=1; i<260; i*=2) { - q2.exec("delete from "+qTableName("test3tmp")); - QVERIFY_SQL(q2, exec("insert into "+qTableName("test3tmp")+"(id) select id from "+qTableName("test3"))); + q2.exec("delete from "+qTableName("test3tmp", __FILE__)); + QVERIFY_SQL(q2, exec("insert into "+qTableName("test3tmp", __FILE__)+"(id) select id from "+qTableName("test3", __FILE__))); q.bindValue(0, i); QVERIFY_SQL(q, exec()); } - QVERIFY_SQL(q, exec(QString("insert into " + qTableName("many") + "(id, name) values (0, \'harry\')"))); - QVERIFY_SQL(q, prepare("insert into "+qTableName("many")+"(id, name) select id + ?, name from "+qTableName("manytmp"))); + QVERIFY_SQL(q, exec(QString("insert into " + qTableName("many", __FILE__) + "(id, name) values (0, \'harry\')"))); + QVERIFY_SQL(q, prepare("insert into "+qTableName("many", __FILE__)+"(id, name) select id + ?, name from "+qTableName("manytmp", __FILE__))); for (int i=1; i < 2048; i*=2) { - q2.exec("delete from "+qTableName("manytmp")); - QVERIFY_SQL(q2, exec("insert into "+qTableName("manytmp")+"(id, name) select id, name from "+qTableName("many"))); + q2.exec("delete from "+qTableName("manytmp", __FILE__)); + QVERIFY_SQL(q2, exec("insert into "+qTableName("manytmp", __FILE__)+"(id, name) select id, name from "+qTableName("many", __FILE__))); q.bindValue(0, i); QVERIFY_SQL(q, exec()); } if (hasTransactions) QVERIFY_SQL(db, commit()); - tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp") << qTableName("test3tmp")); + tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp", __FILE__) << qTableName("test3tmp", __FILE__)); } void tst_QSqlQueryModel::generic_data(const QString& engine) @@ -233,7 +233,7 @@ void tst_QSqlQueryModel::removeColumn() CHECK_DATABASE(db); DBTestModel model; - model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); + model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); model.fetchMore(); QSignalSpy spy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int))); @@ -315,7 +315,7 @@ void tst_QSqlQueryModel::insertColumn() CHECK_DATABASE(db); DBTestModel model; - model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); + model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); model.fetchMore(); // necessary??? QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex, int, int))); @@ -395,7 +395,7 @@ void tst_QSqlQueryModel::record() CHECK_DATABASE(db); QSqlQueryModel model; - model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); + model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); QSqlRecord rec = model.record(); @@ -429,7 +429,7 @@ void tst_QSqlQueryModel::setHeaderData() QVERIFY(!model.setHeaderData(5, Qt::Vertical, "foo")); QVERIFY(model.headerData(5, Qt::Vertical).isValid()); - model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); + model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db)); qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); @@ -459,7 +459,7 @@ void tst_QSqlQueryModel::fetchMore() QSqlQueryModel model; QSignalSpy spy(&model, SIGNAL(rowsInserted(QModelIndex, int, int))); - model.setQuery(QSqlQuery("select * from " + qTableName("many"), db)); + model.setQuery(QSqlQuery("select * from " + qTableName("many", __FILE__), db)); int rowCount = model.rowCount(); QCOMPARE(spy.value(0).value(1).toInt(), 0); @@ -491,7 +491,7 @@ void tst_QSqlQueryModel::withSortFilterProxyModel() QSKIP("Test applies only for drivers not reporting the query size.", SkipSingle); QSqlQueryModel model; - model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3"), db)); + model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__), db)); QSortFilterProxyModel proxy; proxy.setSourceModel(&model); @@ -500,7 +500,7 @@ void tst_QSqlQueryModel::withSortFilterProxyModel() QSignalSpy modelRowsRemovedSpy(&model, SIGNAL(rowsRemoved(const QModelIndex &, int, int))); QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int))); - model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3"), db)); + model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__), db)); view.scrollToBottom(); QTestEventLoop::instance().enterLoop(1); @@ -536,12 +536,12 @@ void tst_QSqlQueryModel::setQuerySignalEmission() QSignalSpy modelRowsRemovedSpy(&model, SIGNAL(rowsRemoved(const QModelIndex &, int, int))); // First select, the model was empty and no rows had to be removed! - model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test"), db)); + model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__), db)); QCOMPARE(modelRowsAboutToBeRemovedSpy.count(), 0); QCOMPARE(modelRowsRemovedSpy.count(), 0); // Second select, the model wasn't empty and two rows had to be removed! - model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test"), db)); + model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__), db)); QCOMPARE(modelRowsAboutToBeRemovedSpy.count(), 1); QCOMPARE(modelRowsAboutToBeRemovedSpy.value(0).value(1).toInt(), 0); QCOMPARE(modelRowsAboutToBeRemovedSpy.value(0).value(2).toInt(), 1); @@ -564,7 +564,7 @@ void tst_QSqlQueryModel::setQueryWithNoRowsInResultSet() // The query's result set will be empty so no signals should be emitted! QSqlQuery query(db); - QVERIFY_SQL(query, exec("SELECT * FROM " + qTableName("test") + " where 0 = 1")); + QVERIFY_SQL(query, exec("SELECT * FROM " + qTableName("test", __FILE__) + " where 0 = 1")); model.setQuery(query); QCOMPARE(modelRowsAboutToBeInsertedSpy.count(), 0); QCOMPARE(modelRowsInsertedSpy.count(), 0); @@ -578,13 +578,14 @@ void tst_QSqlQueryModel::task_180617() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString test3(qTableName("test3", __FILE__)); QTableView view; QCOMPARE(view.columnAt(0), -1); QCOMPARE(view.rowAt(0), -1); QSqlQueryModel model; - model.setQuery( "SELECT TOP 0 * FROM " + qTableName("test3"), db ); + model.setQuery( "SELECT TOP 0 * FROM " + test3, db ); view.setModel(&model); bool error = false; @@ -595,10 +596,10 @@ void tst_QSqlQueryModel::task_180617() QCOMPARE(view.columnAt(0), (error)?-1:0 ); QCOMPARE(view.rowAt(0), -1); - model.setQuery( "SELECT TOP 0 * FROM " + qTableName("test3"), db ); - model.setQuery( "SELECT TOP 0 * FROM " + qTableName("test3"), db ); - model.setQuery( "SELECT TOP 0 * FROM " + qTableName("test3"), db ); - model.setQuery( "SELECT TOP 0 * FROM " + qTableName("test3"), db ); + model.setQuery( "SELECT TOP 0 * FROM " + test3, db ); + model.setQuery( "SELECT TOP 0 * FROM " + test3, db ); + model.setQuery( "SELECT TOP 0 * FROM " + test3, db ); + model.setQuery( "SELECT TOP 0 * FROM " + test3, db ); QCOMPARE(view.columnAt(0), (error)?-1:0 ); QCOMPARE(view.rowAt(0), -1); diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index eab1364..c4bd540 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -45,6 +45,11 @@ #include "../qsqldatabase/tst_databases.h" +const QString reltest1(qTableName("reltest1", __FILE__)), + reltest2(qTableName("reltest2", __FILE__)), + reltest3(qTableName("reltest3", __FILE__)), + reltest4(qTableName("reltest4", __FILE__)), + reltest5(qTableName("reltest5", __FILE__)); //TESTED_CLASS= @@ -107,37 +112,37 @@ void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db) dropTestTables(db); QSqlQuery q(db); - QVERIFY_SQL( q, exec("create table " + qTableName("reltest1") + + QVERIFY_SQL( q, exec("create table " + reltest1 + " (id int not null primary key, name varchar(20), title_key int, another_title_key int)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest1") + " values(1, 'harry', 1, 2)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest1") + " values(2, 'trond', 2, 1)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest1") + " values(3, 'vohi', 1, 2)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest1") + " values(4, 'boris', 2, 2)")); + QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(1, 'harry', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(2, 'trond', 2, 1)")); + QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(3, 'vohi', 1, 2)")); + QVERIFY_SQL( q, exec("insert into " + reltest1 + " values(4, 'boris', 2, 2)")); - QVERIFY_SQL( q, exec("create table " + qTableName("reltest2") + " (tid int not null primary key, title varchar(20))")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest2") + " values(1, 'herr')")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest2") + " values(2, 'mister')")); + QVERIFY_SQL( q, exec("create table " + reltest2 + " (tid int not null primary key, title varchar(20))")); + QVERIFY_SQL( q, exec("insert into " + reltest2 + " values(1, 'herr')")); + QVERIFY_SQL( q, exec("insert into " + reltest2 + " values(2, 'mister')")); - QVERIFY_SQL( q, exec("create table " + qTableName("reltest3") + " (id int not null primary key, name varchar(20), city_key int)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest3") + " values(1, 'Gustav', 1)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest3") + " values(2, 'Heidi', 2)")); + QVERIFY_SQL( q, exec("create table " + reltest3 + " (id int not null primary key, name varchar(20), city_key int)")); + QVERIFY_SQL( q, exec("insert into " + reltest3 + " values(1, 'Gustav', 1)")); + QVERIFY_SQL( q, exec("insert into " + reltest3 + " values(2, 'Heidi', 2)")); - QVERIFY_SQL( q, exec("create table " + qTableName("reltest4") + " (id int not null primary key, name varchar(20))")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest4") + " values(1, 'Oslo')")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest4") + " values(2, 'Trondheim')")); + QVERIFY_SQL( q, exec("create table " + reltest4 + " (id int not null primary key, name varchar(20))")); + QVERIFY_SQL( q, exec("insert into " + reltest4 + " values(1, 'Oslo')")); + QVERIFY_SQL( q, exec("insert into " + reltest4 + " values(2, 'Trondheim')")); - QVERIFY_SQL( q, exec("create table " + qTableName("reltest5") + " (title varchar(20) not null primary key, abbrev varchar(20))")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest5") + " values('herr', 'Hr')")); - QVERIFY_SQL( q, exec("insert into " + qTableName("reltest5") + " values('mister', 'Mr')")); + QVERIFY_SQL( q, exec("create table " + reltest5 + " (title varchar(20) not null primary key, abbrev varchar(20))")); + QVERIFY_SQL( q, exec("insert into " + reltest5 + " values('herr', 'Hr')")); + QVERIFY_SQL( q, exec("insert into " + reltest5 + " values('mister', 'Mr')")); if (testWhiteSpaceNames(db.driverName())) { - QString reltest6 = db.driver()->escapeIdentifier(qTableName("rel test6"), QSqlDriver::TableName); + QString reltest6 = db.driver()->escapeIdentifier(qTableName("rel", __FILE__)+" test6", QSqlDriver::TableName); QVERIFY_SQL( q, exec("create table " + reltest6 + " (id int not null primary key, " + db.driver()->escapeIdentifier("city key", QSqlDriver::FieldName) + " int, " + db.driver()->escapeIdentifier("extra field", QSqlDriver::FieldName) + " int)")); QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(1, 1,9)")); QVERIFY_SQL( q, exec("insert into " + reltest6 + " values(2, 2,8)")); - QString reltest7 = db.driver()->escapeIdentifier(qTableName("rel test7"), QSqlDriver::TableName); + QString reltest7 = db.driver()->escapeIdentifier(qTableName("rel", __FILE__)+" test7", QSqlDriver::TableName); QVERIFY_SQL( q, exec("create table " + reltest7 + " (" + db.driver()->escapeIdentifier("city id", QSqlDriver::TableName) + " int not null primary key, " + db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName) + " varchar(20))")); QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(1, 'New York')")); QVERIFY_SQL( q, exec("insert into " + reltest7 + " values(2, 'Washington')")); @@ -173,19 +178,19 @@ void tst_QSqlRelationalTableModel::cleanupTestCase() void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db ) { QStringList tableNames; - tableNames << qTableName( "reltest1" ) - << qTableName( "reltest2" ) - << qTableName( "reltest3" ) - << qTableName( "reltest4" ) - << qTableName( "reltest5" ) - << qTableName( "rel test6" ) - << qTableName( "rel test7" ) - << qTableName("CASETEST1" ) - << qTableName("casetest1" ); + tableNames << reltest1 + << reltest2 + << reltest3 + << reltest4 + << reltest5 + << (qTableName( "rel", __FILE__)+" test6") + << (qTableName( "rel", __FILE__)+" test7") + << qTableName("CASETEST1", db.driver() ) + << qTableName("casetest1", db.driver() ); tst_Databases::safeDropTables( db, tableNames ); - db.exec("DROP SCHEMA "+qTableName("QTBUG_5373")+" CASCADE"); - db.exec("DROP SCHEMA "+qTableName("QTBUG_5373_s2")+" CASCADE"); + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373", __FILE__)+" CASCADE"); + db.exec("DROP SCHEMA "+qTableName("QTBUG_5373_s2", __FILE__)+" CASCADE"); } void tst_QSqlRelationalTableModel::init() @@ -204,8 +209,8 @@ void tst_QSqlRelationalTableModel::data() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.columnCount(), 4); @@ -219,8 +224,8 @@ void tst_QSqlRelationalTableModel::data() //check data retrieval when relational key is a non-integer type //in this case a string QSqlRelationalTableModel model2(0,db); - model2.setTable(qTableName("reltest2")); - model2.setRelation(1, QSqlRelation(qTableName("reltest5"),"title","abbrev")); + model2.setTable(reltest2); + model2.setRelation(1, QSqlRelation(reltest5,"title","abbrev")); QVERIFY_SQL(model2, select()); QCOMPARE(model2.data(model2.index(0, 1)).toString(), QString("Hr")); @@ -237,9 +242,9 @@ void tst_QSqlRelationalTableModel::setData() { QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); model.setSort(0, Qt::AscendingOrder); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QVERIFY(model.setData(model.index(0, 1), QString("harry2"))); @@ -260,7 +265,7 @@ void tst_QSqlRelationalTableModel::setData() } { //verify values QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -269,7 +274,7 @@ void tst_QSqlRelationalTableModel::setData() QCOMPARE(model.data(model.index(3, 1)).toString(), QString("boris2")); QCOMPARE(model.data(model.index(3, 2)).toInt(), 1); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister")); QCOMPARE(model.data(model.index(3,2)).toString(), QString("herr")); @@ -279,10 +284,10 @@ void tst_QSqlRelationalTableModel::setData() //set the values using OnFieldChange strategy { QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); model.setEditStrategy(QSqlTableModel::OnFieldChange); model.setSort(0, Qt::AscendingOrder); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QVERIFY(model.setData(model.index(1,1), QString("trond2"))); @@ -293,14 +298,14 @@ void tst_QSqlRelationalTableModel::setData() } { //verify values QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond2")); QCOMPARE(model.data(model.index(2, 2)).toInt(), 2); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(2, 2)).toString(), QString("mister")); } @@ -309,13 +314,13 @@ void tst_QSqlRelationalTableModel::setData() { QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); //sybase doesn't allow tables with the same alias used twice as col names //so don't set up an identical relation when using the tds driver if (!db.driverName().startsWith("QTDS")) - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(reltest2, "tid", "title")); model.setEditStrategy(QSqlTableModel::OnManualSubmit); model.setSort(0, Qt::AscendingOrder); @@ -336,7 +341,7 @@ void tst_QSqlRelationalTableModel::setData() } { //verify values QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -344,9 +349,9 @@ void tst_QSqlRelationalTableModel::setData() QCOMPARE(model.data(model.index(3, 2)).toInt(), 1); QCOMPARE(model.data(model.index(0, 3)).toInt(), 1); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); if (!db.driverName().startsWith("QTDS")) - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr")); @@ -361,8 +366,8 @@ void tst_QSqlRelationalTableModel::setData() { QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest2")); - model.setRelation(1, QSqlRelation(qTableName("reltest5"), "title", "abbrev")); + model.setTable(reltest2); + model.setRelation(1, QSqlRelation(reltest5, "title", "abbrev")); model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); @@ -385,9 +390,9 @@ void tst_QSqlRelationalTableModel::multipleRelation() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest4"), "id", "name")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); + model.setRelation(3, QSqlRelation(reltest4, "id", "name")); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -407,8 +412,8 @@ void tst_QSqlRelationalTableModel::insertRecord() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -449,8 +454,8 @@ void tst_QSqlRelationalTableModel::setRecord() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -502,12 +507,12 @@ void tst_QSqlRelationalTableModel::insertWithStrategies() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); model.setSort(0, Qt::AscendingOrder); if (!db.driverName().startsWith("QTDS")) - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(0,0)).toInt(), 1); @@ -608,8 +613,8 @@ void tst_QSqlRelationalTableModel::removeColumn() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QVERIFY_SQL(model, removeColumn(3)); @@ -639,8 +644,8 @@ void tst_QSqlRelationalTableModel::filter() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); model.setFilter("title = 'herr'"); QVERIFY_SQL(model, select()); @@ -657,10 +662,10 @@ void tst_QSqlRelationalTableModel::sort() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); if (!db.driverName().startsWith("QTDS")) - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(reltest2, "tid", "title")); model.setSort(2, Qt::DescendingOrder); QVERIFY_SQL(model, select()); @@ -755,9 +760,9 @@ void tst_QSqlRelationalTableModel::revert() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); - model.setRelation(3, QSqlRelation(qTableName("reltest4"), "id", "name")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); + model.setRelation(3, QSqlRelation(reltest4, "id", "name")); model.setSort(0, Qt::AscendingOrder); @@ -781,11 +786,11 @@ void tst_QSqlRelationalTableModel::clearDisplayValuesCache() QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); if (!db.driverName().startsWith("QTDS")) - model.setRelation(3, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(3, QSqlRelation(reltest2, "tid", "title")); model.setSort(1, Qt::AscendingOrder); model.setEditStrategy(QSqlTableModel::OnManualSubmit); @@ -833,19 +838,19 @@ void tst_QSqlRelationalTableModel::insertRecordDuplicateFieldNames() CHECK_DATABASE(db); QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest3")); + model.setTable(reltest3); model.setEditStrategy(QSqlTableModel::OnManualSubmit); model.setSort(0, Qt::AscendingOrder); // Duplication of "name", used in both reltest3 and reltest4. - model.setRelation(2, QSqlRelation(qTableName("reltest4"), "id", "name")); + model.setRelation(2, QSqlRelation(reltest4, "id", "name")); QVERIFY_SQL(model, select()); if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name_2")).toUpper()).toString(), + QCOMPARE(model.record(1).value((reltest4+QLatin1String("_name_2")).toUpper()).toString(), QString("Trondheim")); } else { - QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name_2"))).toString(), + QCOMPARE(model.record(1).value((reltest4+QLatin1String("_name_2"))).toString(), QString("Trondheim")); } @@ -864,9 +869,9 @@ void tst_QSqlRelationalTableModel::insertRecordDuplicateFieldNames() // The duplicate field names is aliased because it's comes from the relation's display column. if(db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) - QCOMPARE(rec.fieldName(2), (qTableName("reltest4").append(QLatin1String("_name_2"))).toUpper()); + QCOMPARE(rec.fieldName(2), (reltest4+QLatin1String("_name_2")).toUpper()); else - QCOMPARE(rec.fieldName(2), qTableName("reltest4").append(QLatin1String("_name_2"))); + QCOMPARE(rec.fieldName(2), reltest4+QLatin1String("_name_2")); QVERIFY(model.insertRecord(-1, rec)); QCOMPARE(model.data(model.index(2, 2)).toString(), QString("Oslo")); @@ -881,8 +886,8 @@ void tst_QSqlRelationalTableModel::invalidData() CHECK_DATABASE(db); QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); //try set a non-existent relational key @@ -900,8 +905,8 @@ void tst_QSqlRelationalTableModel::relationModel() CHECK_DATABASE(db); QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setTable(reltest1); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QVERIFY(model.relationModel(0) == NULL); @@ -910,7 +915,7 @@ void tst_QSqlRelationalTableModel::relationModel() QVERIFY(model.relationModel(3) == NULL); QVERIFY(model.relationModel(4) == NULL); - model.setRelation(3, QSqlRelation(qTableName("reltest4"), "id", "name")); + model.setRelation(3, QSqlRelation(reltest4, "id", "name")); QVERIFY_SQL(model, select()); QVERIFY(model.relationModel(0) == NULL); @@ -981,7 +986,7 @@ void tst_QSqlRelationalTableModel::casing() QSqlRelationalTableModel model(0, db); model.setTable(qTableName("CASETEST1", db.driver()).toUpper()); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(0, 0)).toInt(), 1); @@ -997,15 +1002,15 @@ void tst_QSqlRelationalTableModel::escapedRelations() recreateTestTables(db); QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); //try with relation table name quoted if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - model.setRelation(2, QSqlRelation(db.driver()->escapeIdentifier(qTableName("reltest2").toUpper(),QSqlDriver::TableName), + model.setRelation(2, QSqlRelation(db.driver()->escapeIdentifier(reltest2.toUpper(),QSqlDriver::TableName), "tid", "title")); } else { - model.setRelation(2, QSqlRelation(db.driver()->escapeIdentifier(qTableName("reltest2"),QSqlDriver::TableName), + model.setRelation(2, QSqlRelation(db.driver()->escapeIdentifier(reltest2,QSqlDriver::TableName), "tid", "title")); @@ -1018,11 +1023,11 @@ void tst_QSqlRelationalTableModel::escapedRelations() //try with index column quoted if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - model.setRelation(2, QSqlRelation(qTableName("reltest2"), + model.setRelation(2, QSqlRelation(reltest2, db.driver()->escapeIdentifier("tid", QSqlDriver::FieldName).toUpper(), "title")); } else { - model.setRelation(2, QSqlRelation(qTableName("reltest2"), + model.setRelation(2, QSqlRelation(reltest2, db.driver()->escapeIdentifier("tid", QSqlDriver::FieldName), "title")); } @@ -1036,11 +1041,11 @@ void tst_QSqlRelationalTableModel::escapedRelations() if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - model.setRelation(2, QSqlRelation(qTableName("reltest2"), + model.setRelation(2, QSqlRelation(reltest2, "tid", db.driver()->escapeIdentifier("title", QSqlDriver::FieldName).toUpper())); } else { - model.setRelation(2, QSqlRelation(qTableName("reltest2"), + model.setRelation(2, QSqlRelation(reltest2, "tid", db.driver()->escapeIdentifier("title", QSqlDriver::FieldName))); } @@ -1054,11 +1059,11 @@ void tst_QSqlRelationalTableModel::escapedRelations() //try with tablename and index and display columns quoted in the relation if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - model.setRelation(2, QSqlRelation(qTableName("reltest2"), + model.setRelation(2, QSqlRelation(reltest2, "tid", db.driver()->escapeIdentifier("title", QSqlDriver::FieldName).toUpper())); } else { - model.setRelation(2, QSqlRelation(qTableName("reltest2"), + model.setRelation(2, QSqlRelation(reltest2, "tid", db.driver()->escapeIdentifier("title", QSqlDriver::FieldName))); } @@ -1080,12 +1085,12 @@ void tst_QSqlRelationalTableModel::escapedTableName() QSqlRelationalTableModel model(0, db); if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - model.setTable(db.driver()->escapeIdentifier(qTableName("reltest1").toUpper(), QSqlDriver::TableName)); + model.setTable(db.driver()->escapeIdentifier(reltest1.toUpper(), QSqlDriver::TableName)); } else { - model.setTable(db.driver()->escapeIdentifier(qTableName("reltest1"), QSqlDriver::TableName)); + model.setTable(db.driver()->escapeIdentifier(reltest1, QSqlDriver::TableName)); } model.setSort(0, Qt::AscendingOrder); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QVERIFY(model.setData(model.index(0, 1), QString("harry2"))); @@ -1106,7 +1111,7 @@ void tst_QSqlRelationalTableModel::escapedTableName() } { //verify values QSqlRelationalTableModel model(0, db); - model.setTable(qTableName("reltest1")); + model.setTable(reltest1); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -1115,7 +1120,7 @@ void tst_QSqlRelationalTableModel::escapedTableName() QCOMPARE(model.data(model.index(3, 1)).toString(), QString("boris2")); QCOMPARE(model.data(model.index(3, 2)).toInt(), 1); - model.setRelation(2, QSqlRelation(qTableName("reltest2"), "tid", "title")); + model.setRelation(2, QSqlRelation(reltest2, "tid", "title")); QVERIFY_SQL(model, select()); QCOMPARE(model.data(model.index(0, 2)).toString(), QString("mister")); QCOMPARE(model.data(model.index(3,2)).toString(), QString("herr")); @@ -1132,9 +1137,9 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers() if (!testWhiteSpaceNames(db.driverName())) QSKIP("White space test irrelevant for driver", SkipAll); QSqlRelationalTableModel model(0, db); - model.setTable(db.driver()->escapeIdentifier(qTableName("rel test6"), QSqlDriver::TableName)); + model.setTable(db.driver()->escapeIdentifier(qTableName("rel", __FILE__)+" test6", QSqlDriver::TableName)); model.setSort(0, Qt::DescendingOrder); - model.setRelation(1, QSqlRelation(db.driver()->escapeIdentifier(qTableName("rel test7"), QSqlDriver::TableName), + model.setRelation(1, QSqlRelation(db.driver()->escapeIdentifier(qTableName("rel", __FILE__)+" test7", QSqlDriver::TableName), db.driver()->escapeIdentifier("city id", QSqlDriver::FieldName), db.driver()->escapeIdentifier("city name", QSqlDriver::FieldName))); QVERIFY_SQL(model, select()); @@ -1210,13 +1215,13 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest() } QSqlRelationalTableModel model(0, db); QSqlQuery q(db); - QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373"))); - QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373_s2"))); - QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373")+"."+qTableName("document")+"(document_id int primary key, relatingid int, userid int)")); - QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2")+"."+qTableName("user")+"(userid int primary key, username char(40))")); - model.setTable(qTableName("QTBUG_5373")+"."+qTableName("document")); - model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user"), "userid", "username")); - model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2")+"."+qTableName("user"), "userid", "username")); + QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373", __FILE__))); + QVERIFY_SQL(q, exec("create schema "+qTableName("QTBUG_5373_s2", __FILE__))); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373", __FILE__)+"."+qTableName("document", __FILE__)+"(document_id int primary key, relatingid int, userid int)")); + QVERIFY_SQL(q, exec("create table "+qTableName("QTBUG_5373_s2", __FILE__)+"."+qTableName("user", __FILE__)+"(userid int primary key, username char(40))")); + model.setTable(qTableName("QTBUG_5373", __FILE__)+"."+qTableName("document", __FILE__)); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__)+"."+qTableName("user", __FILE__), "userid", "username")); + model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__)+"."+qTableName("user", __FILE__), "userid", "username")); QVERIFY_SQL(model, select()); } diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index b295838..8a084bb 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -44,6 +44,10 @@ #include "../qsqldatabase/tst_databases.h" #include <QtSql> +const QString test(qTableName("test", __FILE__)), + test2(qTableName("test2", __FILE__)), + test3(qTableName("test3", __FILE__)); + //TESTED_CLASS= //TESTED_FILES= @@ -147,20 +151,20 @@ void tst_QSqlTableModel::dropTestTables() QVERIFY_SQL( q, exec("set client_min_messages='warning'")); QStringList tableNames; - tableNames << qTableName("test") - << qTableName("test2") - << qTableName("test3") - << qTableName("test4") - << qTableName("emptytable") - << qTableName("bigtable") - << qTableName("foo"); + tableNames << test + << test2 + << test3 + << qTableName("test4", __FILE__) + << qTableName("emptytable", __FILE__) + << qTableName("bigtable", __FILE__) + << qTableName("foo", __FILE__); if (testWhiteSpaceNames(db.driverName())) tableNames << qTableName("qtestw hitespace", db.driver()); tst_Databases::safeDropTables(db, tableNames); if (db.driverName().startsWith("QPSQL")) { - q.exec("DROP SCHEMA " + qTableName("testschema") + " CASCADE"); + q.exec("DROP SCHEMA " + qTableName("testschema", __FILE__) + " CASCADE"); } } } @@ -171,15 +175,15 @@ void tst_QSqlTableModel::createTestTables() QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); - QVERIFY_SQL( q, exec("create table " + qTableName("test") + "(id int, name varchar(20), title int)")); + QVERIFY_SQL( q, exec("create table " + test + "(id int, name varchar(20), title int)")); - QVERIFY_SQL( q, exec("create table " + qTableName("test2") + "(id int, title varchar(20))")); + QVERIFY_SQL( q, exec("create table " + test2 + "(id int, title varchar(20))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id int, random varchar(20), randomtwo varchar(20))")); + QVERIFY_SQL( q, exec("create table " + test3 + "(id int, random varchar(20), randomtwo varchar(20))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test4") + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); - QVERIFY_SQL( q, exec("create table " + qTableName("emptytable") + "(id int)")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable", __FILE__) + "(id int)")); if (testWhiteSpaceNames(db.driverName())) { QString qry = "create table " + qTableName("qtestw hitespace", db.driver()) + " ("+ db.driver()->escapeIdentifier("a field", QSqlDriver::FieldName) + " int)"; @@ -194,18 +198,18 @@ void tst_QSqlTableModel::repopulateTestTables() QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); - q.exec("delete from " + qTableName("test")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(1, 'harry', 1)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(2, 'trond', 2)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(3, 'vohi', 3)")); + q.exec("delete from " + test); + QVERIFY_SQL( q, exec("insert into " + test + " values(1, 'harry', 1)")); + QVERIFY_SQL( q, exec("insert into " + test + " values(2, 'trond', 2)")); + QVERIFY_SQL( q, exec("insert into " + test + " values(3, 'vohi', 3)")); - q.exec("delete from " + qTableName("test2")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(1, 'herr')")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test2") + " values(2, 'mister')")); + q.exec("delete from " + test2); + QVERIFY_SQL( q, exec("insert into " + test2 + " values(1, 'herr')")); + QVERIFY_SQL( q, exec("insert into " + test2 + " values(2, 'mister')")); - q.exec("delete from " + qTableName("test3")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(1, 'foo', 'bar')")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test3") + " values(2, 'baz', 'joe')")); + q.exec("delete from " + test3); + QVERIFY_SQL( q, exec("insert into " + test3 + " values(1, 'foo', 'bar')")); + QVERIFY_SQL( q, exec("insert into " + test3 + " values(2, 'baz', 'joe')")); } } @@ -253,7 +257,7 @@ void tst_QSqlTableModel::select() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -294,7 +298,7 @@ void tst_QSqlTableModel::setRecord() QSqlTableModel model(0, db); model.setEditStrategy((QSqlTableModel::EditStrategy)submitpolicy); - model.setTable(qTableName("test3")); + model.setTable(test3); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -336,7 +340,7 @@ void tst_QSqlTableModel::insertRow() QSqlTableModel model(0, db); model.setEditStrategy(QSqlTableModel::OnRowChange); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -361,7 +365,7 @@ void tst_QSqlTableModel::insertRecord() QSqlTableModel model(0, db); model.setEditStrategy(QSqlTableModel::OnManualSubmit); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -394,7 +398,7 @@ void tst_QSqlTableModel::insertMultiRecords() QSqlTableModel model(0, db); model.setEditStrategy(QSqlTableModel::OnManualSubmit); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -421,7 +425,7 @@ void tst_QSqlTableModel::insertMultiRecords() QVERIFY(model.submitAll()); model.clear(); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); QVERIFY_SQL(model, select()); @@ -442,7 +446,7 @@ void tst_QSqlTableModel::submitAll() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); @@ -477,7 +481,7 @@ void tst_QSqlTableModel::removeRow() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); @@ -502,7 +506,7 @@ void tst_QSqlTableModel::removeRow() recreateTestTables(); - model.setTable(qTableName("test")); + model.setTable(test); model.setEditStrategy(QSqlTableModel::OnRowChange); QVERIFY_SQL(model, select()); QCOMPARE(model.rowCount(), 3); @@ -523,7 +527,7 @@ void tst_QSqlTableModel::removeRows() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); model.setEditStrategy(QSqlTableModel::OnFieldChange); QVERIFY_SQL(model, select()); @@ -539,7 +543,7 @@ void tst_QSqlTableModel::removeRows() model.clear(); recreateTestTables(); - model.setTable(qTableName("test")); + model.setTable(test); model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); QCOMPARE(model.rowCount(), 3); @@ -574,7 +578,7 @@ void tst_QSqlTableModel::removeInsertedRow() for (int i = 0; i <= 1; ++i) { QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setSort(0, Qt::AscendingOrder); model.setEditStrategy(i == 0 @@ -607,7 +611,7 @@ void tst_QSqlTableModel::emptyTable() QCOMPARE(model.rowCount(), 0); QCOMPARE(model.columnCount(), 0); - model.setTable(qTableName("emptytable")); + model.setTable(qTableName("emptytable", __FILE__)); QCOMPARE(model.rowCount(), 0); QCOMPARE(model.columnCount(), 1); @@ -623,9 +627,9 @@ void tst_QSqlTableModel::tablesAndSchemas() CHECK_DATABASE(db); QSqlQuery q(db); - q.exec("DROP SCHEMA " + qTableName("testschema") + " CASCADE"); - QVERIFY_SQL( q, exec("create schema " + qTableName("testschema"))); - QString tableName = qTableName("testschema") + '.' + qTableName("testtable"); + q.exec("DROP SCHEMA " + qTableName("testschema", __FILE__) + " CASCADE"); + QVERIFY_SQL( q, exec("create schema " + qTableName("testschema", __FILE__))); + QString tableName = qTableName("testschema", __FILE__) + '.' + qTableName("testtable", __FILE__); QVERIFY_SQL( q, exec("create table " + tableName + "(id int)")); QVERIFY_SQL( q, exec("insert into " + tableName + " values(1)")); QVERIFY_SQL( q, exec("insert into " + tableName + " values(2)")); @@ -664,10 +668,10 @@ void tst_QSqlTableModel::primaryKeyOrder() if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec("set client_min_messages='warning'")); - QVERIFY_SQL( q, exec("create table "+qTableName("foo")+"(a varchar(20), id int not null primary key, b varchar(20))")); + QVERIFY_SQL( q, exec("create table "+qTableName("foo", __FILE__)+"(a varchar(20), id int not null primary key, b varchar(20))")); QSqlTableModel model(0, db); - model.setTable(qTableName("foo")); + model.setTable(qTableName("foo", __FILE__)); QSqlIndex pk = model.primaryKey(); QCOMPARE(pk.count(), 1); @@ -693,7 +697,7 @@ void tst_QSqlTableModel::setInvalidFilter() // set an invalid filter, make sure it fails QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setFilter("blahfahsel"); QCOMPARE(model.filter(), QString("blahfahsel")); @@ -711,7 +715,7 @@ void tst_QSqlTableModel::setFilter() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setFilter("id = 1"); QCOMPARE(model.filter(), QString("id = 1")); QVERIFY_SQL(model, select()); @@ -762,12 +766,13 @@ void tst_QSqlTableModel::sqlite_bigTable() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + const QString bigtable(qTableName("bigtable", __FILE__)); bool hasTransactions = db.driver()->hasFeature(QSqlDriver::Transactions); if (hasTransactions) QVERIFY(db.transaction()); QSqlQuery q(db); - QVERIFY_SQL( q, exec("create table "+qTableName("bigtable")+"(id int primary key, name varchar)")); - QVERIFY_SQL( q, prepare("insert into "+qTableName("bigtable")+"(id, name) values (?, ?)")); + QVERIFY_SQL( q, exec("create table "+bigtable+"(id int primary key, name varchar)")); + QVERIFY_SQL( q, prepare("insert into "+bigtable+"(id, name) values (?, ?)")); QTime startTime; startTime.start(); for (int i = 0; i < 10000; ++i) { @@ -781,7 +786,7 @@ void tst_QSqlTableModel::sqlite_bigTable() if (hasTransactions) QVERIFY(db.commit()); QSqlTableModel model(0, db); - model.setTable(qTableName("bigtable")); + model.setTable(bigtable); QVERIFY_SQL(model, select()); QSqlRecord rec = model.record(); @@ -801,7 +806,7 @@ void tst_QSqlTableModel::insertRecordBeforeSelect() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); QCOMPARE(model.lastError().type(), QSqlError::NoError); QSqlRecord buffer = model.record(); @@ -820,7 +825,7 @@ void tst_QSqlTableModel::insertRecordBeforeSelect() QCOMPARE(model.rowCount(), 0); QSqlTableModel model2(0, db); - model2.setTable(qTableName("test")); + model2.setTable(test); QVERIFY_SQL(model2, select()); QCOMPARE(model2.rowCount(), rowCount); } @@ -838,7 +843,7 @@ void tst_QSqlTableModel::submitAllOnInvalidTable() // setTable returns a void, so the error can only be caught by // manually checking lastError(). ### Qt5: This should be changed! - model.setTable(qTableName("invalidTable")); + model.setTable(qTableName("invalidTable", __FILE__)); QCOMPARE(model.lastError().type(), QSqlError::StatementError); // This will give us an empty record which is expected behavior @@ -866,7 +871,7 @@ void tst_QSqlTableModel::insertRecordsInLoop() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setEditStrategy(QSqlTableModel::OnManualSubmit); model.select(); @@ -952,7 +957,7 @@ void tst_QSqlTableModel::tableModifyWithBlank() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test4")); + model.setTable(qTableName("test4", __FILE__)); model.select(); //generate a time stamp for the test. Add one second to the current time to make sure @@ -1008,7 +1013,7 @@ void tst_QSqlTableModel::removeColumnAndRow() CHECK_DATABASE(db); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); QCOMPARE(model.rowCount(), 3); @@ -1023,7 +1028,7 @@ void tst_QSqlTableModel::removeColumnAndRow() // check with another table because the model has been modified // but not the sql table QSqlTableModel model2(0, db); - model2.setTable(qTableName("test")); + model2.setTable(test); QVERIFY_SQL(model2, select()); QCOMPARE(model2.rowCount(), 2); QCOMPARE(model2.columnCount(), 3); @@ -1036,11 +1041,11 @@ void tst_QSqlTableModel::insertBeforeDelete() CHECK_DATABASE(db); QSqlQuery q(db); - QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(9, 'andrew', 9)")); - QVERIFY_SQL( q, exec("insert into " + qTableName("test") + " values(10, 'justin', 10)")); + QVERIFY_SQL( q, exec("insert into " + test + " values(9, 'andrew', 9)")); + QVERIFY_SQL( q, exec("insert into " + test + " values(10, 'justin', 10)")); QSqlTableModel model(0, db); - model.setTable(qTableName("test")); + model.setTable(test); model.setEditStrategy(QSqlTableModel::OnManualSubmit); QVERIFY_SQL(model, select()); diff --git a/tests/auto/qsqlthread/tst_qsqlthread.cpp b/tests/auto/qsqlthread/tst_qsqlthread.cpp index 632586a28..791f804 100644 --- a/tests/auto/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/qsqlthread/tst_qsqlthread.cpp @@ -53,6 +53,7 @@ #include <pthread.h> #endif +const QString qtest(qTableName("qtest", __FILE__)); // set this define if Oracle is built with threading support //#define QOCI_THREADED @@ -115,7 +116,7 @@ public: QVERIFY_SQL(db, open()); int sum = 0; - QSqlQuery q("select id from " + qTableName("test"), db); + QSqlQuery q("select id from " + qtest, db); QVERIFY_SQL(q, isActive()); while (q.next()) sum += q.value(0).toInt(); @@ -150,7 +151,7 @@ public: QSqlDatabase db = QSqlDatabase::cloneDatabase(sourceDb, dbName); QVERIFY_SQL(db, open()); QSqlQuery q(db); - QVERIFY_SQL(q, prepare("insert into " + qTableName("test") + " values (?, ?, ?)")); + QVERIFY_SQL(q, prepare("insert into " + qtest + " values (?, ?, ?)")); int id = 10; for (int i = 0; i < ProdConIterations; ++i) { q.bindValue(0, ++id); @@ -187,10 +188,10 @@ public: QSqlDatabase db = QSqlDatabase::cloneDatabase(sourceDb, dbName); QVERIFY_SQL(db, open()); QSqlQuery q1(db), q2(db); - QVERIFY_SQL(q2, prepare("delete from " + qTableName("test") + " where id = :id")); + QVERIFY_SQL(q2, prepare("delete from " + qtest + " where id = :id")); for (int i = 0; i < ProdConIterations; ++i) { - QVERIFY_SQL(q1, exec("select max(id) from " + qTableName("test"))); + QVERIFY_SQL(q1, exec("select max(id) from " + qtest)); q1.first(); q2.bindValue("id", q1.value(0)); q1.clear(); @@ -231,7 +232,7 @@ public: // Executes a Query for reading, iterates over the first 4 results QSqlQuery q(sourceDb); for (int j = 0; j < ProdConIterations; ++j) { - QVERIFY_SQL(q, exec("select id,name from " + qTableName("test") + " order by id")); + QVERIFY_SQL(q, exec("select id,name from " + qtest + " order by id")); for (int i = 1; i < 4; ++i) { QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).toInt(), i); @@ -242,7 +243,7 @@ public: // Executes a query for writing (appends a new row) QSqlQuery q(sourceDb); for (int j = 0; j < ProdConIterations; ++j) { - QVERIFY_SQL(q, exec(QString("insert into " + qTableName("test") + QVERIFY_SQL(q, exec(QString("insert into " + qtest + " (id, name) values(%1, '%2')") .arg(counter.fetchAndAddRelaxed(1)).arg("Robert"))); } @@ -250,7 +251,7 @@ public: case PreparedReading: { // Prepares a query for reading and iterates over the results QSqlQuery q(sourceDb); - QVERIFY_SQL(q, prepare("select id, name from " + qTableName("test") + " where id = ?")); + QVERIFY_SQL(q, prepare("select id, name from " + qtest + " where id = ?")); for (int j = 0; j < ProdConIterations; ++j) { q.addBindValue(j % 3 + 1); QVERIFY_SQL(q, exec()); @@ -260,7 +261,7 @@ public: break; } case PreparedWriting: { QSqlQuery q(sourceDb); - QVERIFY_SQL(q, prepare("insert into " + qTableName("test") + " (id, name) " + QVERIFY_SQL(q, prepare("insert into " + qtest + " (id, name) " "values(?, ?)")); for (int i = 0; i < ProdConIterations; ++i) { q.addBindValue(counter.fetchAndAddRelaxed(1)); @@ -302,7 +303,7 @@ void tst_QSqlThread::dropTestTables() QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); - tst_Databases::safeDropTables(db, QStringList() << qTableName("test") << qTableName("test2") << qTableName("emptytable")); + tst_Databases::safeDropTables(db, QStringList() << qtest << qTableName("qtest2", __FILE__) << qTableName("emptytable", __FILE__)); } } @@ -312,13 +313,13 @@ void tst_QSqlThread::createTestTables() QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); - QVERIFY_SQL(q, exec("create table " + qTableName("test") + QVERIFY_SQL(q, exec("create table " + qtest + "(id int NOT NULL primary key, name varchar(20), title int)")); - QVERIFY_SQL(q, exec("create table " + qTableName("test2") + QVERIFY_SQL(q, exec("create table " + qTableName("qtest2", __FILE__) + "(id int NOT NULL primary key, title varchar(20))")); - QVERIFY_SQL(q, exec("create table " + qTableName("emptytable") + QVERIFY_SQL(q, exec("create table " + qTableName("emptytable", __FILE__) + "(id int NOT NULL primary key)")); } } @@ -329,14 +330,14 @@ void tst_QSqlThread::repopulateTestTables() QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); - QVERIFY_SQL(q, exec("delete from " + qTableName("test"))); - QVERIFY_SQL(q, exec("insert into " + qTableName("test") + " values(1, 'harry', 1)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("test") + " values(2, 'trond', 2)")); - QVERIFY_SQL(q, exec("insert into " + qTableName("test") + " values(3, 'vohi', 3)")); + QVERIFY_SQL(q, exec("delete from " + qtest)); + QVERIFY_SQL(q, exec("insert into " + qtest + " values(1, 'harry', 1)")); + QVERIFY_SQL(q, exec("insert into " + qtest + " values(2, 'trond', 2)")); + QVERIFY_SQL(q, exec("insert into " + qtest + " values(3, 'vohi', 3)")); - QVERIFY_SQL(q, exec("delete from " + qTableName("test2"))); - QVERIFY_SQL(q, exec("insert into " + qTableName("test2") + " values(1, 'herr')")); - QVERIFY_SQL(q, exec("insert into " + qTableName("test2") + " values(2, 'mister')")); + QVERIFY_SQL(q, exec("delete from " + qTableName("qtest2", __FILE__))); + QVERIFY_SQL(q, exec("insert into " + qTableName("qtest2", __FILE__) + " values(1, 'herr')")); + QVERIFY_SQL(q, exec("insert into " + qTableName("qtest2", __FILE__) + " values(2, 'mister')")); } } diff --git a/tests/auto/qsslkey/rsa-with-passphrase.pem b/tests/auto/qsslkey/rsa-with-passphrase.pem new file mode 100644 index 0000000..cb29bec --- /dev/null +++ b/tests/auto/qsslkey/rsa-with-passphrase.pem @@ -0,0 +1,18 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: DES-CBC,36BD1242254C5E1E + +sqt8qlQfkjJiz0djd0WYjhN/IGxA/nU/wVKuf5RWDAghDBrABzJ3dU4Jh1WIsS4+ +f22TBr6fwgjpPxGkt361Z9oxon/QeyBZLFtyUxnFSqZcVMMR3vndtMyYJbVKjRm1 +lvF3BjFWNh6+SZe20cut2GiUJDqhw7RbjaAN6LaCpFqwusY6vbjW6vzB8ezDvLou +5jQAkwArGoI0KqUMwBOYukiWdBA0iERavspKGRnB3mGtgv5ziTEFzx58mn1Lv3Qs +LYQqTYgzpFyAMP9SZaRv4m/y5O9foAXnlh0GhmDWBQ2D5flwZqrIAzoJ5BcZKU6/ +HJCh4snw3kheeE8NhrlzypEONedvu4ifUbqN5idMU7S4t40NAmQ/dF0Z4wDen/M/ +iFbt5tTWh6sXK82XzJtAfprH07odtJHK7CMeurCi5BupmnLtPbUrl6hpKItBzu+g +7MB5AyNk548V9Y8+kKBtEG5EgYZrMYX4yqQ+Z8F1hy0UUMXu9cAnO06OTavxLtWJ +ikmwYJNy421Hj+oZVSagCUILQyUfgx6fXWwDRqy/stlX+hpPPjVmd/A2WBm5x/Sf +5CGfUtddZRuAZpChBXV6a/R+nMzDXhkKl4XTkN8hg3yXLY6xy3CR3RIYDlKkn85y +VziP32V6Bc8ucGifsZLNnvj8CFXTZP+8CWun9yLSkcq+wm4cQOLswztEMA8bbPJQ +g7Gp59BC4ofN5bMZ1R1z+l96x+YMY9btkyjE1uEyRT88dHwxnkhC5AKBx2P6sg0C +doe5Dh8Ny5Ic24ibwyvZbAS46tSVdha7ACGnGXV4Z3iqBfN0b0UNmw== +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/qsslkey/rsa-without-passphrase.pem b/tests/auto/qsslkey/rsa-without-passphrase.pem new file mode 100644 index 0000000..f7c834b --- /dev/null +++ b/tests/auto/qsslkey/rsa-without-passphrase.pem @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC1mZlLC6g8/vaw8XEOQ59gwQ5WxIvcKCSx7B5SHaeN8zzbENpl +32BtyfrCccHF7j6qwfMZ2RwM5RTlFw/eBF4SSXAgp/P5CgcugSs1dOJUfPveos/5 +h3fmnUcKeQIU4m5EGcQicmR8//WUUfdtHDp/fJ0dRXcY2tTOx89vNPEtgwIDAQAB +AoGBAKqE2f4vqf/sYPPxInmEYclWPgKXd8R4JUy0LBxrIAQYXBJPluOFhmRQ/hdK +/eq/NTTd/UlOJhqtmJsstoeAjlsELl2AejX2n1B9aSffQ0WzdB5gVMNotPGRKRIG +eOq2pp2JOFkGps11LUAqDEMNUb3EV6HiBucoGEOUpdITLrRxAkEA4Ul3o44wMvIb +muwp7/erSvDMWRZ1GjksEmBMAHL6y8avZd9UgrjHeCy8uHXrT0id4Cig8FA+nQA5 +UwTr9y5e9wJBAM5bc8xuAuCg4Si3exssFfxQIxFTmPzhkVubglO9IcLqfXLl3k5S +CxgRb/4pBMKVRCMRXAkaZpjJqTIofjp4ptUCQQC4hySnot932zchPi9bjtGPII1A +q1RfllSy+I1IEOW745HnL3ZZXGCF3p71uCB1YFVwNdcc/51Jm9VYWr+sRx8hAkBL +KoTDsk7aA8AAVNVC0Iwxm/8qEIlpk8Ce3cZbOklR9pg7gf+4B6qC2dcxfT9+oWBw +ZaJgrn0wqkQ3QQi5w7kBAkBAR2tKc2OqnljMPnXYEreRyHHjhqCsJYFAE7u16cY/ +NQGJq9jBAD5WANclrYRxKtD6yohi+Y7Vi7+SXve3pGdF +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/qsslkey/tst_qsslkey.cpp b/tests/auto/qsslkey/tst_qsslkey.cpp index d156344..3c8ae11 100644 --- a/tests/auto/qsslkey/tst_qsslkey.cpp +++ b/tests/auto/qsslkey/tst_qsslkey.cpp @@ -99,6 +99,7 @@ private slots: void toEncryptedPemOrDer_data(); void toEncryptedPemOrDer(); + void passphraseChecks(); #endif }; @@ -371,6 +372,77 @@ void tst_QSslKey::toEncryptedPemOrDer() // ### add a test to verify that public keys are _decrypted_ correctly (by the ctor) } +void tst_QSslKey::passphraseChecks() +{ + { + QString fileName(SRCDIR "/rsa-with-passphrase.pem"); + QFile keyFile(fileName); + QVERIFY(keyFile.exists()); + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey); + QVERIFY(key.isNull()); // null passphrase => should not be able to decode key + } + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, ""); + QVERIFY(key.isNull()); // empty passphrase => should not be able to decode key + } + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, "WRONG!"); + QVERIFY(key.isNull()); // wrong passphrase => should not be able to decode key + } + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, "123"); + QVERIFY(!key.isNull()); // correct passphrase + } + } + + { + // be sure and check a key without passphrase too + QString fileName(SRCDIR "/rsa-without-passphrase.pem"); + QFile keyFile(fileName); + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey); + QVERIFY(!key.isNull()); // null passphrase => should be able to decode key + } + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, ""); + QVERIFY(!key.isNull()); // empty passphrase => should be able to decode key + } + { + if (!keyFile.isOpen()) + keyFile.open(QIODevice::ReadOnly); + else + keyFile.reset(); + QSslKey key(&keyFile,QSsl::Rsa,QSsl::Pem, QSsl::PrivateKey, "xxx"); + QVERIFY(!key.isNull()); // passphrase given but key is not encrypted anyway => should work + } + } +} + #endif QTEST_MAIN(tst_QSslKey) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 35fba52..54e32218 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -201,6 +201,7 @@ private slots: void taskQTBUG_5237_wheelEventOnHeader(); void taskQTBUG_8585_crashForNoGoodReason(); void taskQTBUG_7774_RtoLVisualRegionForSelection(); + void taskQTBUG_8777_scrollToSpans(); void mouseWheel_data(); void mouseWheel(); @@ -3994,7 +3995,6 @@ void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason() } } - class TableView7774 : public QTableView { public: @@ -4020,5 +4020,19 @@ void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection() QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight())); } +void tst_QTableView::taskQTBUG_8777_scrollToSpans() +{ + QTableWidget table(75,5); + for (int i=0; i<50; i++) + table.setSpan(2+i, 0, 1, 5); + table.setCurrentCell(0,2); + table.show(); + + for (int i = 0; i < 45; ++i) + QTest::keyClick(&table, Qt::Key_Down); + + QVERIFY(table.verticalScrollBar()->value() > 10); +} + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index 827a486..a3ded8e 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -610,6 +610,11 @@ void tst_QTransform::types() m4.rotate(45); QCOMPARE(m4.type(), QTransform::TxRotate); + + QTransform m5; + m5.scale(5, 5); + m5 = m5.adjoint() / m5.determinant(); + QCOMPARE(m5.type(), QTransform::TxScale); } diff --git a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp index 0fcde21..1c43069 100644 --- a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <qvarlengtharray.h> +#include <qvariant.h> const int N = 1; @@ -61,6 +62,7 @@ private slots: void removeLast(); void oldTests(); void task214223(); + void QTBUG6718_resize(); }; int fooCtor = 0; @@ -71,7 +73,7 @@ struct Foo int *p; Foo() { p = new int; ++fooCtor; } - Foo(const Foo &other) { p = new int; ++fooCtor; } + Foo(const Foo &/*other*/) { p = new int; ++fooCtor; } void operator=(const Foo & /* other */) { } @@ -244,9 +246,50 @@ void tst_QVarLengthArray::task214223() // will make the next call to append(const T&) corrupt the memory // you should get a segfault pretty soon after that :-) QVarLengthArray<float, 1> d(1); - for (int i=0; i<30; i++) + for (int i=0; i<30; i++) d.append(i); } +void tst_QVarLengthArray::QTBUG6718_resize() +{ + //MOVABLE + { + QVarLengthArray<QVariant,1> values(1); + QCOMPARE(values.size(), 1); + values[0] = 1; + values.resize(2); + QCOMPARE(values[1], QVariant()); + QCOMPARE(values[0], QVariant(1)); + values[1] = 2; + QCOMPARE(values[1], QVariant(2)); + QCOMPARE(values.size(), 2); + } + + //POD + { + QVarLengthArray<int,1> values(1); + QCOMPARE(values.size(), 1); + values[0] = 1; + values.resize(2); + QCOMPARE(values[0], 1); + values[1] = 2; + QCOMPARE(values[1], 2); + QCOMPARE(values.size(), 2); + } + + //COMPLEX + { + QVarLengthArray<QVarLengthArray<QString, 15>,1> values(1); + QCOMPARE(values.size(), 1); + values[0].resize(10); + values.resize(2); + QCOMPARE(values[1].size(), 0); + QCOMPARE(values[0].size(), 10); + values[1].resize(20); + QCOMPARE(values[1].size(), 20); + QCOMPARE(values.size(), 2); + } +} + QTEST_APPLESS_MAIN(tst_QVarLengthArray) #include "tst_qvarlengtharray.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index abd9604..76e20b9 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -402,6 +402,7 @@ private slots: void scrollWithoutBackingStore(); void taskQTBUG_7532_tabOrderWithFocusProxy(); + void movedAndResizedAttributes(); private: bool ensureScreenSize(int width, int height); @@ -10040,5 +10041,61 @@ void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy() // No Q_ASSERT, then it's allright. } +void tst_QWidget::movedAndResizedAttributes() +{ +#if defined (Q_OS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) + QEXPECT_FAIL("", "FixMe, QTBUG-8941 and QTBUG-8977", Abort); + QVERIFY(false); +#else + QWidget w; + w.show(); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.setWindowState(Qt::WindowFullScreen); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.setWindowState(Qt::WindowMaximized); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.setWindowState(Qt::WindowMinimized); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.showNormal(); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.showMaximized(); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.showFullScreen(); + + QVERIFY(!w.testAttribute(Qt::WA_Moved)); + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.showNormal(); + w.move(10,10); + QVERIFY(w.testAttribute(Qt::WA_Moved)); +#if defined(Q_OS_WIN) + QEXPECT_FAIL("", "FixMe, QTBUG-8911", Abort); +#endif + QVERIFY(!w.testAttribute(Qt::WA_Resized)); + + w.resize(100, 100); + QVERIFY(w.testAttribute(Qt::WA_Moved)); + QVERIFY(w.testAttribute(Qt::WA_Resized)); +#endif +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd new file mode 100644 index 0000000..60f3e4f --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:simpleType name="testType"> + <xsd:list itemType="xsd:int" /> + </xsd:simpleType> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd new file mode 100644 index 0000000..e6da433 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:import schemaLocation="indirect-import-b.xsd" namespace="http://qt.nokia.com/test2" /> + <xsd:import schemaLocation="indirect-import-c.xsd" namespace="http://qt.nokia.com/test2" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd new file mode 100644 index 0000000..88be377 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test2"> + <xsd:import schemaLocation="indirect-datatype.xsd" namespace="http://qt.nokia.com/test" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd new file mode 100644 index 0000000..88be377 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test2"> + <xsd:import schemaLocation="indirect-datatype.xsd" namespace="http://qt.nokia.com/test" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd new file mode 100644 index 0000000..02ca5c5 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:include schemaLocation="indirect-include-b.xsd" /> + <xsd:include schemaLocation="indirect-include-c.xsd" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd new file mode 100644 index 0000000..efaba74 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:include schemaLocation="indirect-datatype.xsd" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd new file mode 100644 index 0000000..efaba74 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:include schemaLocation="indirect-datatype.xsd" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd new file mode 100644 index 0000000..4f0804c --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:redefine schemaLocation="indirect-redefine-b.xsd" /> + <xsd:redefine schemaLocation="indirect-redefine-c.xsd" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd new file mode 100644 index 0000000..019a127 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:redefine schemaLocation="indirect-datatype.xsd" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd new file mode 100644 index 0000000..019a127 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://qt.nokia.com/test" targetNamespace="http://qt.nokia.com/test"> + <xsd:redefine schemaLocation="indirect-datatype.xsd" /> +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 6d4ed69..7aab47f 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -196,6 +196,21 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << 1 << (QStringList() << QLatin1String("files/instance.xml")) << QString(); + + QTest::newRow("A schema with an indirectly included type") + << 0 + << (QStringList() << QLatin1String("files/indirect-include-a.xsd")) + << QString(); + + QTest::newRow("A schema with an indirectly imported type") + << 0 + << (QStringList() << QLatin1String("files/indirect-import-a.xsd")) + << QString(); + + QTest::newRow("A schema with an indirectly redefined type") + << 0 + << (QStringList() << QLatin1String("files/indirect-redefine-a.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) diff --git a/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro b/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro index 3167f26..23f0e00 100644 --- a/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro +++ b/tests/benchmarks/corelib/codecs/qtextcodec/qtextcodec.pro @@ -1,5 +1,5 @@ load(qttest_p4) -TARGET = tst_qtextcodec +TARGET = tst_bench_qtextcodec QT -= gui SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro index e06d746..320746c 100755 --- a/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro +++ b/tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qdiriterator +TARGET = tst_bench_qdiriterator DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/io/qfile/qfile.pro b/tests/benchmarks/corelib/io/qfile/qfile.pro index 99505c3..8663cab 100644 --- a/tests/benchmarks/corelib/io/qfile/qfile.pro +++ b/tests/benchmarks/corelib/io/qfile/qfile.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qfile +TARGET = tst_bench_qfile QT -= gui win32: DEFINES+= _CRT_SECURE_NO_WARNINGS diff --git a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro index eca619f..3edf6a6 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qfileinfo +TARGET = tst_bench_qfileinfo DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro b/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro index 749a4d6..2e0f6a1 100755 --- a/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro +++ b/tests/benchmarks/corelib/io/qiodevice/qiodevice.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qiodevice +TARGET = tst_bench_qiodevice TARGET.EPOCHEAPSIZE = 0x100000 0x2000000 DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro index c1b04f4..74fd534 100644 --- a/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/benchmarks/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qtemporaryfile +TARGET = tst_bench_qtemporaryfile DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/kernel/events/events.pro b/tests/benchmarks/corelib/kernel/events/events.pro index adf2317..43a7131 100644 --- a/tests/benchmarks/corelib/kernel/events/events.pro +++ b/tests/benchmarks/corelib/kernel/events/events.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_events +TARGET = tst_bench_events DEPENDPATH += . INCLUDEPATH += . # Input diff --git a/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro b/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro index 78300f6..a02273f 100644 --- a/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro +++ b/tests/benchmarks/corelib/kernel/qmetaobject/qmetaobject.pro @@ -1,5 +1,5 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qmetaobject +TARGET = tst_bench_qmetaobject SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/kernel/qobject/qobject.pro b/tests/benchmarks/corelib/kernel/qobject/qobject.pro index 2855de4..1baaf58 100644 --- a/tests/benchmarks/corelib/kernel/qobject/qobject.pro +++ b/tests/benchmarks/corelib/kernel/qobject/qobject.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qobject +TARGET = tst_bench_qobject DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro index 63b5442..f3dd66a 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro +++ b/tests/benchmarks/corelib/kernel/qvariant/qvariant.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qvariant +TARGET = tst_bench_qvariant DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro index f9c1978..654b7b6 100644 --- a/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro +++ b/tests/benchmarks/corelib/thread/qthreadstorage/qthreadstorage.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qthreadstorage +TARGET = tst_bench_qthreadstorage SOURCES += tst_qthreadstorage.cpp diff --git a/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro b/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro index c6f3fa6..3e3bf2b 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro +++ b/tests/benchmarks/corelib/tools/containers-associative/containers-associative.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_containers-associative +TARGET = tst_bench_containers-associative DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro b/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro index bf6db44..4236b35 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro +++ b/tests/benchmarks/corelib/tools/containers-sequential/containers-sequential.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_containers-sequential +TARGET = tst_bench_containers-sequential DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro b/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro index a0bf021..3474dd0 100755 --- a/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/benchmarks/corelib/tools/qbytearray/qbytearray.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qbytearray +TARGET = tst_bench_qbytearray DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/tools/qrect/qrect.pro b/tests/benchmarks/corelib/tools/qrect/qrect.pro index 6e35119..4bd05aa 100644 --- a/tests/benchmarks/corelib/tools/qrect/qrect.pro +++ b/tests/benchmarks/corelib/tools/qrect/qrect.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qrect +TARGET = tst_bench_qrect DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro index 83d723c..e0f47c9 100644 --- a/tests/benchmarks/corelib/tools/qregexp/qregexp.pro +++ b/tests/benchmarks/corelib/tools/qregexp/qregexp.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qregexp +TARGET = tst_bench_qregexp DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/corelib/tools/qstring/qstring.pro b/tests/benchmarks/corelib/tools/qstring/qstring.pro index 2e7c86a..fa4310e 100644 --- a/tests/benchmarks/corelib/tools/qstring/qstring.pro +++ b/tests/benchmarks/corelib/tools/qstring/qstring.pro @@ -1,5 +1,5 @@ load(qttest_p4) -TARGET = tst_qstring +TARGET = tst_bench_qstring QT -= gui SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro b/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro index 79171b4..948657e 100644 --- a/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro +++ b/tests/benchmarks/corelib/tools/qstringbuilder/qstringbuilder.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qstringbuilder +TARGET = tst_bench_qstringbuilder QMAKE_CXXFLAGS += -g QMAKE_CFLAGS += -g diff --git a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro b/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro index 5c64b34..06a5836 100644 --- a/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro +++ b/tests/benchmarks/corelib/tools/qstringlist/qstringlist.pro @@ -1,5 +1,5 @@ load(qttest_p4) -TARGET = tst_qstringlist +TARGET = tst_bench_qstringlist CONFIG -= debug CONFIG += release QT -= gui diff --git a/tests/benchmarks/gui/animation/qanimation/qanimation.pro b/tests/benchmarks/gui/animation/qanimation/qanimation.pro index 55cd75e..53a139a 100644 --- a/tests/benchmarks/gui/animation/qanimation/qanimation.pro +++ b/tests/benchmarks/gui/animation/qanimation/qanimation.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qanimation +TARGET = tst_bench_qanimation DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro index 0d563b9..3ede6e8 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qgraphicsanchorlayout +TARGET = tst_bench_qgraphicsanchorlayout SOURCES += tst_qgraphicsanchorlayout.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro index 726bb96..d4935c0 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -1,5 +1,5 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qgraphicsitem +TARGET = tst_bench_qgraphicsitem SOURCES += tst_qgraphicsitem.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro index b460e2a..1b7a5dc 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qgraphicsscene +TARGET = tst_bench_qgraphicsscene SOURCES += tst_qgraphicsscene.cpp diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro index 927d731..6e044f9 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qgraphicsview +TARGET = tst_bench_qgraphicsview SOURCES += tst_qgraphicsview.cpp RESOURCES += qgraphicsview.qrc diff --git a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro index f1ec54e..ed53237 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro +++ b/tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qgraphicswidget +TARGET = tst_bench_qgraphicswidget TEMPLATE = app # Input SOURCES += tst_qgraphicswidget.cpp diff --git a/tests/benchmarks/gui/image/blendbench/blendbench.pro b/tests/benchmarks/gui/image/blendbench/blendbench.pro index a3228c5..aa6ab95 100644 --- a/tests/benchmarks/gui/image/blendbench/blendbench.pro +++ b/tests/benchmarks/gui/image/blendbench/blendbench.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_blendbench +TARGET = tst_bench_blendbench DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro index 276ac33..d67f4be 100644 --- a/tests/benchmarks/gui/image/qimagereader/qimagereader.pro +++ b/tests/benchmarks/gui/image/qimagereader/qimagereader.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qimagereader +TARGET = tst_bench_qimagereader SOURCES += tst_qimagereader.cpp diff --git a/tests/benchmarks/gui/image/qpixmap/qpixmap.pro b/tests/benchmarks/gui/image/qpixmap/qpixmap.pro index e8330bd..201ac9e 100644 --- a/tests/benchmarks/gui/image/qpixmap/qpixmap.pro +++ b/tests/benchmarks/gui/image/qpixmap/qpixmap.pro @@ -1,5 +1,5 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qpixmap +TARGET = tst_bench_qpixmap SOURCES += tst_qpixmap.cpp diff --git a/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro b/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro index e0d7543..78ac97d 100644 --- a/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro +++ b/tests/benchmarks/gui/image/qpixmapcache/qpixmapcache.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qpixmapcache +TARGET = tst_bench_qpixmapcache TEMPLATE = app # Input SOURCES += tst_qpixmapcache.cpp diff --git a/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro b/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro index 02bc530..3f4d4e1 100644 --- a/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro +++ b/tests/benchmarks/gui/itemviews/qtableview/qtableview.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qtableview +TARGET = tst_bench_qtableview SOURCES += tst_qtableview.cpp diff --git a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro index f8601e4..e12a60c 100644 --- a/tests/benchmarks/gui/kernel/qapplication/qapplication.pro +++ b/tests/benchmarks/gui/kernel/qapplication/qapplication.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qapplication +TARGET = tst_bench_qapplication DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro index ff47445..4c6e5c7 100644 --- a/tests/benchmarks/gui/kernel/qwidget/qwidget.pro +++ b/tests/benchmarks/gui/kernel/qwidget/qwidget.pro @@ -1,4 +1,4 @@ load(qttest_p4) -TARGET = tst_qwidget +TARGET = tst_bench_qwidget SOURCES += tst_qwidget.cpp diff --git a/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro b/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro index e82d9de..b6a2046 100644 --- a/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro +++ b/tests/benchmarks/gui/math3d/qmatrix4x4/qmatrix4x4.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qmatrix4x4 +TARGET = tst_bench_qmatrix4x4 SOURCES += tst_qmatrix4x4.cpp diff --git a/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro b/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro index cd68423..bd6a0d3 100644 --- a/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro +++ b/tests/benchmarks/gui/math3d/qquaternion/qquaternion.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qquaternion +TARGET = tst_bench_qquaternion SOURCES += tst_qquaternion.cpp diff --git a/tests/benchmarks/gui/painting/qpainter/qpainter.pro b/tests/benchmarks/gui/painting/qpainter/qpainter.pro index 5ac8c64..6603aba 100644 --- a/tests/benchmarks/gui/painting/qpainter/qpainter.pro +++ b/tests/benchmarks/gui/painting/qpainter/qpainter.pro @@ -1,5 +1,5 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qpainter +TARGET = tst_bench_qpainter SOURCES += tst_qpainter.cpp diff --git a/tests/benchmarks/gui/painting/qregion/qregion.pro b/tests/benchmarks/gui/painting/qregion/qregion.pro index fc67177..ec93a62 100644 --- a/tests/benchmarks/gui/painting/qregion/qregion.pro +++ b/tests/benchmarks/gui/painting/qregion/qregion.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qregion +TARGET = tst_bench_qregion DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/gui/painting/qtransform/qtransform.pro b/tests/benchmarks/gui/painting/qtransform/qtransform.pro index 8d87656..dc60407 100644 --- a/tests/benchmarks/gui/painting/qtransform/qtransform.pro +++ b/tests/benchmarks/gui/painting/qtransform/qtransform.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qtransform +TARGET = tst_bench_qtransform SOURCES += tst_qtransform.cpp diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro index c097307..f4bf9ab 100644 --- a/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/qstylesheetstyle.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qstylesheetstyle +TARGET = tst_bench_qstylesheetstyle DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro b/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro index b6c7b92..973f881 100644 --- a/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro +++ b/tests/benchmarks/gui/text/qfontmetrics/qfontmetrics.pro @@ -1,5 +1,5 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_QFontMetrics +TARGET = tst_bench_QFontMetrics SOURCES += main.cpp diff --git a/tests/benchmarks/gui/text/qtext/qtext.pro b/tests/benchmarks/gui/text/qtext/qtext.pro index 9e8860f..a1b6a22 100644 --- a/tests/benchmarks/gui/text/qtext/qtext.pro +++ b/tests/benchmarks/gui/text/qtext/qtext.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_QText +TARGET = tst_bench_QText SOURCES += main.cpp diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro index 89f5d31..0949af7 100644 --- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro +++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qfile_vs_qnetworkaccessmanager +TARGET = tst_bench_qfile_vs_qnetworkaccessmanager DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro b/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro index 1e67d81..9d96dc7 100644 --- a/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro +++ b/tests/benchmarks/network/access/qnetworkreply/qnetworkreply.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qnetworkreply +TARGET = tst_bench_qnetworkreply DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro index f18d6d7..e621d50 100755 --- a/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/benchmarks/network/kernel/qhostinfo/qhostinfo.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qhostinfo +TARGET = tst_bench_qhostinfo DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro index e7bf13a..e5b9346 100644 --- a/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro +++ b/tests/benchmarks/network/socket/qtcpserver/qtcpserver.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qtcpserver +TARGET = tst_bench_qtcpserver DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/opengl/opengl.pro b/tests/benchmarks/opengl/opengl.pro index 1458b5e..5c58751 100644 --- a/tests/benchmarks/opengl/opengl.pro +++ b/tests/benchmarks/opengl/opengl.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_opengl +TARGET = tst_bench_opengl DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp new file mode 100644 index 0000000..2cb9421 --- /dev/null +++ b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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$ +** +****************************************************************************/ + +#include <QDebug> +#include <qtest.h> +#include <QtTest/QtTest> +#include <QFile> +#include <QByteArray> +#include <QBuffer> +#include <QImageReader> +#include <QSize> + +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + +class tst_jpeg : public QObject +{ + Q_OBJECT +private slots: + void jpegDecodingQtWebkitStyle(); +}; + +void tst_jpeg::jpegDecodingQtWebkitStyle() +{ + // QtWebkit currently calls size() to get the image size for layouting purposes. + // Then when it is in the viewport (we assume that here) it actually gets decoded. + QFile inputJpeg(SRCDIR "n900.jpeg"); + QVERIFY(inputJpeg.exists()); + inputJpeg.open(QIODevice::ReadOnly); + QByteArray imageData = inputJpeg.readAll(); + QBuffer buffer; + buffer.setData(imageData); + buffer.open(QBuffer::ReadOnly); + QCOMPARE(buffer.size(), qint64(19016)); + + + QBENCHMARK{ + for (int i = 0; i < 50; i++) { + QImageReader reader(&buffer, "jpeg"); + QSize size = reader.size(); + QVERIFY(!size.isNull()); + QByteArray format = reader.format(); + QVERIFY(!format.isEmpty()); + QImage img = reader.read(); + QVERIFY(!img.isNull()); + buffer.reset(); + } + } +} + +QTEST_MAIN(tst_jpeg) + +#include "jpeg.moc" diff --git a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro new file mode 100644 index 0000000..e106f3e --- /dev/null +++ b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = jpeg +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release + +wince*: { + DEFINES += SRCDIR=\\\"\\\" +} else:symbian { + # SRCDIR and SVGFILE defined in code in symbian +}else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + +# Input +SOURCES += jpeg.cpp diff --git a/tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg b/tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg Binary files differnew file mode 100644 index 0000000..681989a --- /dev/null +++ b/tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg diff --git a/tests/benchmarks/script/qscriptclass/qscriptclass.pro b/tests/benchmarks/script/qscriptclass/qscriptclass.pro index f0ffeb7..90c9582 100644 --- a/tests/benchmarks/script/qscriptclass/qscriptclass.pro +++ b/tests/benchmarks/script/qscriptclass/qscriptclass.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qscriptclass +TARGET = tst_bench_qscriptclass SOURCES += tst_qscriptclass.cpp diff --git a/tests/benchmarks/script/qscriptengine/qscriptengine.pro b/tests/benchmarks/script/qscriptengine/qscriptengine.pro index df6dbb3..72a547a 100644 --- a/tests/benchmarks/script/qscriptengine/qscriptengine.pro +++ b/tests/benchmarks/script/qscriptengine/qscriptengine.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qscriptengine +TARGET = tst_bench_qscriptengine SOURCES += tst_qscriptengine.cpp diff --git a/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro b/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro index 04ea324..1c26438 100644 --- a/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro +++ b/tests/benchmarks/script/qscriptvalue/qscriptvalue.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qscriptvalue +TARGET = tst_bench_qscriptvalue SOURCES += tst_qscriptvalue.cpp diff --git a/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro b/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro index 8222a09..9e59eb7 100644 --- a/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro +++ b/tests/benchmarks/svg/qsvgrenderer/qsvgrenderer.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = tst_qsvgrenderer +TARGET = tst_bench_qsvgrenderer SOURCES += tst_qsvgrenderer.cpp RESOURCES += qsvgrenderer.qrc diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 6b7740e..dd68fcd 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1495,6 +1495,7 @@ void Configure::applySpecSpecifics() dictionary[ "QT_INSTALL_PREFIX" ] = ""; dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins"; dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports"; + dictionary[ "QT_INSTALL_TRANSLATIONS" ] = "\\resource\\qt\\translations"; dictionary[ "ARM_FPU_TYPE" ] = "softvfp"; dictionary[ "SQL_SQLITE" ] = "yes"; dictionary[ "SQL_SQLITE_LIB" ] = "system"; diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 6e5c656..321fe8c 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -2370,7 +2370,7 @@ static bool haveMnemonic(const QString &str) // because we get a lot of false positives. if (c != '&' && c != ' ' && QChar(c).isPrint()) { const ushort *pp = p; - for (; ::isalpha(*p); p++) ; + for (; *p < 256 && ::isalpha(*p); p++) ; if (pp == p || *p != ';') return true; // This looks like a HTML &entity;, so ignore it. As a HTML string diff --git a/translations/translations.pro b/translations/translations.pro index f1b9c99..8f37451 100644 --- a/translations/translations.pro +++ b/translations/translations.pro @@ -42,5 +42,6 @@ isEmpty(vcproj) { translations.path = $$[QT_INSTALL_TRANSLATIONS] translations.files = $$TRANSLATIONS translations.files ~= s,\\.ts$,.qm,g +translations.files ~= s,^,$$OUT_PWD/,g translations.CONFIG += no_check_exist INSTALLS += translations |