Commit Graph

1940 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
c005c75080 QRegularExpression: support for QString overloads
Added support for QString overloads taking a QRegularExpression.

Change-Id: I8608ab0b66e5fdd2e966992e1072cf1ef7883c8e
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-15 00:37:56 +01:00
Morten Johan Sorvig
d6311a0651 Cocoa: Improve basic window handling.
Refactor NSWindow creation into createNSWindow and
setNSWindow. This is necessary to support QMacNativeWidget
where we re-use an already created window.

Implement popup window handling. Make sure the window
is displayed correctly and closes when it should.

Take control over window activation in order to prevent
infinite loops involving the QtCreator "cmd-k" window.
Activation events are for now not sent to popup-type
windows.

There is now a different set of test failures: add
and remove some QEXPECT_FAILs.

Change-Id: I229761b59f90c9815b968eacc2cbc9c20cc5047e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-14 23:02:12 +01:00
Thorbjørn Lund Martsum
b64426248d QHeaderView - renaming functions in Qt5
This patch renames the functions in Qt5 according to the
notes. It also renames resizeMode to be consistent.

The old functions are both marked with both QT_DEPRECATED
and '### Qt 6 - remove'

All usage of the function within the qtbase are also
changed to use the new functions.

Change-Id: I9e05fa41d232e9ca43b945fcc949987017f3aedd
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-14 11:37:18 +01:00
Giuseppe D'Angelo
08790636f2 QRegularExpression: QMetaType and QVariant support
Removed the Q_DECLARE_METATYPE in favour of first-class support
inside QMetaType and QVariant.

Change-Id: I904236822bfab967dc0fbd4d4cc2bcb68c741adc
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-14 10:53:24 +01:00
Jędrzej Nowacki
22494ea8e8 Unify QMetaType::TypeFlags detection.
Duplicated code was removed. As an side effect:
- one runtime flag check was replaced by a compile time check.
- is enum flag can be used together with built-in types.

Change-Id: I54173e7b07ce7e487d3cc21ba24dcccd28b5d049
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-14 09:45:07 +01:00
Jason McDonald
f4dfb55243 Uncomment disabled code in QResourceEngine autotest.
Resource files are expected to be readable.

Change-Id: Ife2b624e69b58e2fb996bc3e210a6e6c5c6852fe
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-14 07:51:45 +01:00
Jason McDonald
16045184e3 Tidy the QSettings autotest.
- remove unnecessary includes
- remove undefined private functions
- remove commented-out test function
- fix indentation
- clarify why part of tst_QSettings::setValue() is commented-out

Change-Id: I09e1a33896536e702f7ba65f266415536b4f9e0b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-14 07:51:45 +01:00
Jason McDonald
360e5e0c08 Remove commented code from qtconcurrentmap autotest.
The removed code was already commented out when the test was added to
the Qt repository and does not compile when uncommented as it calls
non-existant overloads of QtConcurrent::FunctionWrapper1::operator().

Change-Id: I5a02efae4b89e2815b077474aa7cd0192dcb2730
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-14 07:51:45 +01:00
João Abecasis
91248b0f3b Silence 'narrowing conversion' warning in test
Seen with gcc 4.6:

tst_qarraydata.cpp: In member function 'void tst_QArrayData::grow()':
tst_qarraydata.cpp:1445:29: error: narrowing conversion of 'i' from
'size_t {aka long unsigned int}' to 'int' inside { } [-fpermissive]

Change-Id: Iad55659554b64ee34655640d606153f058a8cd05
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-13 23:55:30 +01:00
Frederik Gladhorn
2c515ea42c Print all accessibility event strings.
Change-Id: I2488fe86fb2c154a8b7d91c6e4f2cd9c9e7b9ecb
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-13 18:14:25 +01:00
Frederik Gladhorn
6d85d77a5d Clean up test, check radio button and checkbox.
Change-Id: I4dcfa2014256aee10feb08146ae6fc3f402ac8fb
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-13 10:11:22 +01:00
Frederik Gladhorn
76ddc9bc0c Autotest details of QAccessibleEvent.
Change-Id: Ieec33c23e7b18cfedf061088d6561203a5e7ac39
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-13 10:11:22 +01:00
João Abecasis
e104fe7266 Merge "Merge remote-tracking branch 'origin/master' into api_changes" into refs/staging/api_changes 2012-03-12 23:52:36 +01:00
Mark Brand
13c57d0f68 QSqlTableModel::isDirty(): new overloaded method
Checks if model has any changes to submit.

Includes new test covering isDirty(index) as well the new
overloaded function.

Task-number: QTBUG-3108
Change-Id: I0ccbda45d5d9f06434cf1e1c037a9efb76d0cc37
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-12 23:29:37 +01:00
Alexei Rousskikh
612040a0cd Trailing comma should result in an error during JSON parsing
1. QJsonParseError::MissingObject defined
2. QJsonDocument::fromJson() will result in defined error after parsing
of something like "{ 'key':1 , }" or "[ {'key':1}, ]"

Change-Id: I8e6234a03b8aca4e5ad6180f273f91066b86d7a1
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-12 21:38:51 +01:00
Debao Zhang
df19bffbd9 Move tst_qshortcut.cpp to QtWidgets
QShortcut belongs to QtWidgets instead of QtGui.

Change-Id: I9715399bb372a6ea4bd76109f87ba31a1e30a7e6
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-12 21:38:51 +01:00
Lars Knoll
d5098f2802 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

Change-Id: I884afc3b6d65c6411733a897a1949e19393573a7
2012-03-12 21:03:49 +01:00
João Abecasis
e57e2f3e32 Fix QString:mid and midRef, again
In commit 75286739 it was assumed that negative positions shouldn't
influence the size of the returned substring. That however changes
behaviour that was depended on even inside Qt.

With this change, the old behaviour is reestablished.

A negative value of n is still taken to mean "all the way to the end",
regardless of position, and overflows are still avoided.

Change-Id: I7d6ed17cc5e274c7c7ddf0eb0c3238e1159ec4f6
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-12 19:53:59 +01:00
Friedemann Kleint
6e278b8688 Implement QSystemTrayIcon for Windows.
No longer base the implementation on a QWidget which is not
necessary when all that is required is a message window listening
to task-tray messages. Export a service function creating a message
window from the Windows native interface and use that.

Task-number: QTBUG-20978

Change-Id: I01d0faeac777df4eee802c51d2bc722fce814080
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-12 17:33:15 +01:00
Debao Zhang
db390d46c3 Move the auto test of QPixmap::grabWidget() from QPixmap to QWidget
Change-Id: Id565fa1eb8fe13c62a93a5afa39a5701ce7b20ea
QPixmap::grabWidget is deprecated, which calls QWidget::grab() at present.
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-12 17:33:15 +01:00
Marc Mutz
edea0e1917 tst_exceptionsafety_objects: add virtual ~AbstractTester
GCC complained about undefined behaviour when
deleting subclasses of AbstractTester through
pointers to AbstractTester, and it's doing so
correctly...

Change-Id: Ie641281d8aafe32c5c9784e8aa39672ff0b699c7
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-12 15:37:40 +01:00
Frederik Gladhorn
ca737f566b Use QAccessibleEvent in test.
Change-Id: I4f9c0f503543caa5704a29c8ccd7c4134b455625
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-12 15:34:06 +01:00
Marc Mutz
6c2695d677 QtDBus: make some constructors explicit
This is a semi-automatic search, so I'm
reasonably sure that all the exported ones
have been caught.

Change-Id: I314d341ad0db4e9d4bbf353a9537c9422ad8a54b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-12 15:22:30 +01:00
Jason McDonald
c4342ddea0 Fix indentation of QWaitCondition autotest.
No functional changes - cosmetic change only.

Change-Id: I7332eaab31720776c70a7ef813d55db44bab83f7
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-12 13:14:05 +01:00
Jason McDonald
074508c2ca Remove gcc 3.x-specific code from QtConcurrent and its tests.
Change-Id: I4dd0ce50b70a47a0a00f4c7ec18077a1bcbe5705
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-12 13:14:05 +01:00
Debao Zhang
4eeb07d886 Move tst_qprinter.cpp to QtPrintSupport
QPrinter and QPrinterInfo belong to QtPrintSupport.

Change-Id: I0c146e0c717be365e752c1eaf7dbe6765fb72da2
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-12 13:14:05 +01:00
Debao Zhang
57cf7c8a1b Clean up some auto tests of gui
These unit tests do not depent on QtWidget.

Change-Id: I95526125c563885c0531da7ebfee06bca9a87b1c
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-12 13:14:05 +01:00
Frederik Gladhorn
eb57da5b3f Update accessibility StateChange by custom event.
Subclass QAccessibleEvent to give details what changed in the
state change.

Change-Id: I9005d311e85a3c8bfa6e062833fa6a8a7dc6a4a4
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-12 13:14:05 +01:00
Debao Zhang
2e886cfbcb Move tst_qicon.cpp and tst_qpixmapfilter.cpp to QtWidgets
QIcon and QPixmapFilter belong to QtWidgets instead of QtGui.

Change-Id: I6d82811e04046edb0cc67c55970c161612e86d3f
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-12 10:48:40 +01:00
Jason McDonald
0e905e9138 Remove outdated assumption from QVariant autotest.
The test was assuming that "data()" is a special function in autotests,
but that hasn't been the case since early prototypes of testlib.

Change-Id: Ic24cf5dc539b55d12eba0a6ab17173e2ed698f21
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-12 05:26:21 +01:00
Jason McDonald
16a1d5c81b Fix compile warnings in QCoreApplication autotest.
- Use const_cast to avoid "deprecated conversion from string constant to
  'char*'" warning when building argv arrays from string literals.
- Use Q_UNUSED to avoid warnings on unused local variables.

Change-Id: Idd2c8279adc102b6ebc6af7486ba26fe9ed4e7c1
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-12 05:26:21 +01:00
Jason McDonald
a71e12b170 Remove redundant and incorrect comment from QList autotest.
Change-Id: I3187d0d8ace120181a4c49bbc68f421ddf5acbe0
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-12 01:50:20 +01:00
Jason McDonald
a4c0109e01 testlib: Improve formatting of QCOMPARE failure messages.
Make the various versions of the failure message align consistently so
that it's a little easier to compare the actual and expected values.  Of
course, the value won't align nicely unless the "actual" and "expected"
strings are the same length, but at least this commit makes that
consistent across all versions of the message.

Change-Id: If9ce231df3b5d279a06f6458fdb5da0aa4586068
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-12 01:50:20 +01:00
Glenn Watson
15c13b91e6 Add Q_IS_ENUM(), and provide as flag in QMetaType::typeFlags()
Add Q_IS_ENUM() macro to determine if a given type is an
enumeration. Use information from that in QMetaType::registerType()
to store whether custom registered metatypes are enums or not.
This information can then be accessed by calling
QMetaType::typeFlags(int type). This is used by the declarative
code to determine whether a custom type in a variant can be safely
cast to an integer, which is required to allow passing non-local
enums as signal/slot params.

Change-Id: I9733837f56af201fa3017b4a22b761437a3c0de4
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-11 23:58:39 +01:00
Jędrzej Nowacki
e3429f764b Crash fix in QMetaType::typeFlags.
The function is public, so it should validate input instead of crashing

Change-Id: Id67463b0b61ab74a76c1ede7f052bdbed37822b6
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-11 22:04:21 +01:00
Debao Zhang
e9ed5853f4 Make tst_qsql.cpp independent of QtWidgets
Change-Id: I032902bea6fe2c7d9eb0491886fded7602ae2bcc
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-03-11 00:08:33 +01:00
Kevin Krammer
53d24330f7 Make tst_qapplication build when QT_NO_SHAREDMEMORY is defined
Change-Id: I8cfd0ff2e17e6d5c04b81a042c665bcbbca36256
Reviewed-by: David Faure <faure@kde.org>
2012-03-09 16:54:27 +01:00
Miikka Heikkinen
7c89d44d95 Windows: Fix QStyleSheetStyle autotest antialiasing issues
Antialiasing of fonts was causing two tests that relied on finding
at least a certain number of pixels of certain color to find one or two
too few pixels of that color and thus fail.
Fixed by increasing the amount of text displayed to make sure enough
pixels of correct color would be present.

Also removing the test insignification, as the test will now
pass completely when run under Windows Classic theme, which CI uses.

Task-number: QTBUG-24323
Change-Id: Ic0b614d33e4e4f5df18d53cb72a05db5d8b6b5e7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-09 16:54:27 +01:00
Sergio Ahumada
865fbbddc9 Mark tst_qtimeline as insignificant on Windows
Change-Id: If8f699f867d3950cced17b150cb5f02fddd1f9a8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-03-09 12:32:30 +01:00
Friedemann Kleint
152eec7aa4 Merge "Merge remote-tracking branch 'origin/containers' into api_changes" into refs/staging/api_changes 2012-03-09 12:32:30 +01:00
Debao Zhang
38224d8d00 Make tst_qmouseevent.cpp independent of QtWidgets
Change-Id: I6759c7be44c2d890c1a745effdd70faa3467fe5b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-09 11:05:29 +01:00
Debao Zhang
37c46fee30 Clean up for some auto tests of the gui/kernel.
They are not dependent on QtWidgets.

Change-Id: Icbc0b0b6f0b72537fd3058cc038a1f5c4bf2aba7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-09 11:05:18 +01:00
Debao Zhang
9f86923b5c tst_qimagereader: does not depend on QtWidgets
Both tst_qimagereader.cpp and tst_qimagewriter.cpp do not depend on
QtWidgets.

Change-Id: I7e8b31c23db203c44ccb4cd4e8e747d18c5d7ed7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-09 11:05:04 +01:00
Marc Mutz
86abc87883 {QTouchEvent,QWindowSystemInterface}::TouchPoint: replace QList<QPointF> with QVector
QPointF is in the category of types for which QList
is needlessly inefficient (elements are copy-constructed
onto the heap and held through pointers). Use a vector
instead. This is consistent with the QPainter API.

Change-Id: Ie3d6647e05b40a33a7bb0598cbbcde4676e00836
Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-09 10:29:23 +01:00
Giuseppe D'Angelo
824cc94921 QRegularExpression: minor fix to captureIndexForName
Although passing a null pointer to pcre16_get_stringnumber for
the compiled pattern should simply make it error out, it's actually
an undocumented behaviour, so let's stay safe and add an explicit
check.

Tests for this codepath are added.

Change-Id: Ifd9c87874f6812ba487104ec1a5bbc83c3b16761
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-08 22:00:53 +01:00
Giuseppe D'Angelo
b543141992 QRegularExpression: improve JIT memory handling
PCRE's JIT uses by default 32K on the pcre_exec caller's stack. This
is fine for most situations, but in some cases (esp. patterns with
lot of recursion) more memory is required.

Therefore, if a match execution fails due to exhausting JIT memory,
we let PCRE allocate up to 512KB to be used for the JIT's stack.

The pointer to the allocated memory is put in thread local storage
(so it can be reused from the same thread, if needed, and automatically
goes away when the thread dies).

Change-Id: Ica5fb7d517068befff88ebb198a603a26ec5d8a7
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-08 22:00:47 +01:00
Oswald Buddenhagen
59ae59977b use $$QT_BUILD_TREE instead of $$(QTDIR)
it's a "tad" more reliable

Change-Id: I7207daa6869d1682719cc357794cf6efff496225
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-08 18:55:24 +01:00
Oswald Buddenhagen
5f9d126ca8 remove strange .qmake.cache hacks
they are obsolete (qmake knows the qt build configuration anyway), and
messing with QTDIR is a recipe for disaster.

Change-Id: Ib3594f38ec3192a5f70771f8bc5d8fd435bbbd15
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-08 18:54:46 +01:00
Miikka Heikkinen
f5b2a09467 Windows: Removing insignification from QTextEdit test
The commit 660af10dee seems to have fixed
the test, so removing the insignification from it.

Task-number: QTBUG-24348
Change-Id: I564e90db53d10b54e22342a1cdbef6826929c63a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-08 16:06:56 +01:00
Lars Knoll
763790bb5c Fix a bug in the assignment operators for QJsonObject and Array
When objects or arrays where being used read only, several objects
can share the same d pointer, but will have different pointers into
the binary data. Correctly change the pointer into the binary
data even if the d-pointer is the same.

Change-Id: Ife0ea5ac5daf46586f855dccdf35b51ec696a623
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-08 16:06:48 +01:00
Jędrzej Nowacki
cf6dd5baca Crash fix in QMetaType::typeName.
The function is public, so it should validate input instead of crashing

Change-Id: Ifd9f1110f8631f942929d85db6a57eee7afffb6a
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-08 16:04:02 +01:00
Jędrzej Nowacki
f71487da3a Fix crash in QVariant::canConvert.
The function was crashing when an unsupported type id was given
as an input argument.

Change-Id: I2b0e3e6d43f6f248dc71532f8e6485efe68e8120
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-08 16:03:52 +01:00
João Abecasis
8141e34280 Skip test when implicit move operators not available
Besides rvalue-references, this test depends on the compiler to generate
implicit move operators on a derived class, based on the ones available
on its base class.

At least Visual Studio 2010 and some variations of clang 3.0 are known
not to generate implicit move constructors and assignment operators. Gcc
4.6 and up seem to support the feature.

Change-Id: Ied464ef678f517321b19f8a7bacddb6cd6665585
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-03-08 12:10:29 +01:00
João Abecasis
79f2480c86 Merge remote-tracking branch 'origin/api_changes' into containters
Conflicts:
	src/corelib/kernel/qmetaobject.cpp
	src/corelib/kernel/qvariant.cpp
	src/tools/moc/moc.h

Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
2012-03-08 12:02:41 +01:00
Debao Zhang
779b3188a9 Windows: Make QMenuBar autotest significant again
The bug has been fix by 7bc576771d .

Task-number: QTBUG-24326
Change-Id: Ifd37e9fe76cb24e49132f22909c95a55a230b1ed
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-08 10:10:30 +01:00
Giuseppe D'Angelo
84984af0e1 Remove usage of QtXml from rcc, add test
Ported from QDom to QXmlStreamReader. This enables removal of QtXml
classes from bootstrap.

A new rcc test was added, copying the data from the
QResourceFileEngine test. The new test runs rcc to create binary
resources, dynamically loads them under various locales and checks
that they do contain the expected files.

Change-Id: I15d23dfda45de851a421156951ce2a60af4c1f7f
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-03-08 09:59:31 +01:00
Frederik Gladhorn
b55ed97e79 Call updateAccessibility with the right index.
In Qt 4 index 0 was the widget itself.
With the cleanup of child index this now changed.
The default constructor uses -1 as parameter to signify that
the widget is the cause, not a child.

Change-Id: I329a1cc91bf2d1d1d8534739acbddfe107f40364
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-08 07:28:21 +01:00
Jason McDonald
8854b74cf4 selftests: Improve reporting of problems with loading expected output
If the expected output file was missing (e.g. not included in
selftests.qrc), tst_selftests would trigger an assert inside QList by
calling QList::at() on an empty list.  Make tst_selftests detect this
error instead and give a meaningful error message.

When loading expected output for the crashes selftest, where there are
several alternative versions of the expected output, the code reused the
"exp" variable when loading the alternative test output files.  This
caused the last file loaded to be used unintentionally if none of the
alternative files had the correct number of lines.  Use a different
variable so that exp remains empty if none of the alternatives are
valid and a failure can be reported.

Change-Id: I35b2a3d905d069d3ee8dcb1447836eb68d5c8612
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-08 05:31:40 +01:00
Jason McDonald
d81b065bb3 testlib: Improve verbose and XPASS output
Previously, verbose (-v2) and XPASS test output showed all QCOMPAREs as
"COMPARE()", making it impossible to see what was compared and difficult
to match the output to the source of a test containing many calls to
QCOMPARE.

This commit changes testlib's internal compare_helper API so that string
representations of the compared expressions are always passed to
QTestResult::compare() when available, and can thus be shown in the
verbose and XPASS output.  The XPASS output has also been changed to
state explicitly that the comparison succeeded unexpectedly, bringing it
in line with the XPASS output resulting from a call to QVERIFY.

This commit also changes all calls to compare_helper() to call the
eight-argument version of the function, which simplifies much of the
calling code.  The now obsolete four-argument version of
compare_helper() has been changed to output a warning that it is
obsolete.  It will be removed once other modules have had some time to
catch up.

The improved XPASS and verbose output is demonstrated by the expectfail
and verbose2 selftests.

Change-Id: I8baa46d5dd30e6c43b26f366c34dc5b64aab5f7c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-08 05:31:40 +01:00
Shane Kearns
4bdc7e6f8b Mark unstable windows network tests
This is unfortunately still "most of them", because of QTBUG-24451
however some of the unit tests are still possible to test stably.

Also skipped test cases which would hang forever due to QTBUG-24451.

Bearer tests are not run, because they pass when test machine has no
wireless LAN, but fail or hang if it does (QTBUG-24503)

Change-Id: Icf99d45707102d2ef9219ed0b5ad521605716219
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-08 05:31:40 +01:00
Shane Kearns
3c52993361 Rework QNetworkProxyFactory::systemProxyForQuery autotest
Rather than requiring specific hardcoded proxies in the system,
it now checks the proxies returned by the system have the required
capabilities for the request.

Note the test will pass if no proxy is configured (as
QNetworkProxy::NoProxy has all required capabilities)

The test prints the returned proxy lists and elapsed time
diagnostic for manual comparison and debugging.

Change-Id: I621ef4d1d7264a98c3e8bd485c30bc1166fcbdf0
Task-number: QTBUG-19454
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-08 05:31:40 +01:00
Shane Kearns
75ab89d4d6 Mark tst_QNetworkReply::getThenDeleteObject as unstable
It's unstable on all platforms, because the reply can be finished
due to a race with the http thread. It isn't crashing (which the
test was trying to test for), but rather the QVERIFY(!reply->isFinished())
fails, which is an inconclusive verdict.

Change-Id: Ib815a7cedd220544a0c9cb83023e3334df4a0fb3
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-03-08 05:31:40 +01:00
Shane Kearns
fbd45a9311 tst_qnetworkreply - remove qRegisterMetaType duplicates
The metatypes are registered in the constructor, don't need to
register them in test cases as well.
Registering in a test case is bad practice, as it could result
in tests failing when run individually due to unknown metatype.

Change-Id: Ic4d65d0f5fe3cdd3ab57cf2512a4906d71205a05
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-03-08 05:31:40 +01:00
Shane Kearns
69c428a810 Add windows XFAIL to qnetworkreply autotest
The test case that depends on QLocalSocket consistently fails due
to bugs in QLocalSocket windows implementation

Change-Id: Ibfe9eb3590be4f72b52f14cd4fbe5be61f6cf70e
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-08 05:31:40 +01:00
Marc Mutz
278ddc9d5e chiptester benchmark: compile
The implementation uses QScrollBar, which is no longer
included by <QtGui>.

Change-Id: I2422cfccc427179ca71e9a3195f16bd637925fb3
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-08 05:31:40 +01:00
Marc Mutz
a03a71e332 examples: use QVector<QPointF> instead of QList<QPointF>
QPointF is in the category of types for which QList
is needlessly inefficient (elements are copy-constructed
onto the heap and held through pointers). Use a vector
instead. This is consistent with the QPainter API.

Change-Id: Id0e910c067a60d12fbc175e7ee7da824834be374
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-08 05:31:40 +01:00
João Abecasis
12f221410f Merge remote-tracking branch 'origin/master' into api_changes
Change-Id: I89dc2e193bd01624c1fb50484610d516e39b1538
2012-03-08 01:27:39 +01:00
Friedemann Kleint
b319d44798 QCursor: Associate cursor with screen.
- Introduce cursor() accessor to QPlatformScreen.
- Remove screen member of QPlatformCursor (a
  cursor can be shared by multiple screens
  of a virtual desktop).
- Add QCursor::pos()/ QCursor::setPos() taking
  a QScreen-parameter, use primaryScreen() for
  old overloads.  QCursor::pos() can then query
  the platform cursor for the position and return
  the position even if the mouse position is outside
  the windows owned by the Qt application.
- Fix tests

Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>

Task-number: QTBUG-22457
Task-number: QTBUG-22565
Task-number: QTBUG-20753
Change-Id: Ia69f37343f95772e934eab1cd806bd54cbdbbe51
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-07 22:43:43 +01:00
Debao Zhang
b7915a4d0d Fix dockwidgets behavior when window resized or central widgets is set.
When adding and showing a central widget in a QMainWindow then the
layout does not respect the size policy of the central widget.

This is a side effect of 059be19781a22d2e41f22072152589857d0fabf9

After the layout of QMainWindow is restored or the separator between central
widget and dock widgets is moved by user, dock widgets should keep their
size when the window if resized.

Task-number: QTBUG-15689
Change-Id: Idfccb7b4ae057a99f431c2ed54e3b9fcfb6ef54c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-07 19:52:27 +01:00
Giuseppe D'Angelo
eb70933398 QRegularExpression: add optimizations autotest
Exporting the counter that controls the optimization of a compiled
pattern lets us to forcibly optimize all patterns. Therefore,
two tests are now run: one with default optimization values
and another one which always optimizes the pattern.

The counter itself was renamed with a qt_ prefix and put
inside the Qt compilation namespace
(thanks to rohanpm for pointing it out).

Change-Id: I56602433d37adc127772b2d0d2cdaf2e49d43c71
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-07 19:18:22 +01:00
David Faure
a6a7cabcd3 Add QUrl formatting option "PreferLocalFile".
For the readonly case (e.g. progress dialogs), where local file paths
look much nicer to end users than file:/// URLs.

Change-Id: I899fed27cfb73ebf565389cfd489d2d2fcbeac7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-07 16:13:44 +01:00
Olivier Goffart
5713dde8a1 Fix deadlock in QPropertyAnimation
Commit 1e6514a714 changed the mutex from
recursive to non-recursive, which could introduce dead lock if the
animation starts other animation (This is the case in QMainWindow
layouts)

Change-Id: I1b149b78a802748eb24b5700fffeca0b8555f005
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-07 12:48:49 +01:00
Friedemann Kleint
83cabda862 Add fonts to QPlatformTheme.
- Remove QPlatformFontDatabase::defaultFonts() returning
  a hash containing widget name ->font and the Windows
  implementation.
- Add enumeration and font accessor to QPlatformTheme. The value
  returned for the enumeration value overwrites the default font
  of the font database.
- Implement for Windows, Mac and KDE.
- Add more Windows palettes.

Task-number: QTBUG-23686

Change-Id: I8a2abdfd216df23daa7c9630c54264cdf61295db
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-07 12:43:32 +01:00
Miikka Heikkinen
f72cbc7ce4 Make QCursor manual tests compile on Qt5
These tests were not aware widgets had been split to different lib.

Change-Id: I58bde1304c876319a3cbb50f4d6a66e9f24b2886
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-07 10:08:37 +01:00
Jędrzej Nowacki
7df2422fa4 Remove abuse of QMetaTypeId from tst_qshortcut test.
Q_DECLARE_METATYPE macro is much better for a custom type registration
then a handwritten template specialization.

Change-Id: Ia15688d89f708fbff0c1da93e08052d31f3b3fc0
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-07 09:44:01 +01:00
Andy Shaw
678ab52ccb Improve type detection for query results
When an aggregate function is used for a column in a SQL resultset then
it should ensure that the right data type is reported for that column.
This also concerns expressions when the returned column does not map
directly to a table column.

Test included for this.

Task-number: QTBUG-22038
Change-Id: I07487694c0ed393d46af06e232914fe923356a99
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-07 07:26:37 +01:00
Rohan McGovern
dd7a06d0c9 Refactor headersclean for usage from modules other than qtbase
headersclean enforces various rules which all Qt headers are supposed to
abide by.  It fails compilation if these rules are broken.

These rules should be followed also by modules hosted outside of
qtbase.  Split the test up so that it can be easily reused by other
modules.

Change-Id: Icf09cbfde411c926ed87914dc821e6dfc569b0de
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-03-07 03:49:59 +01:00
Jędrzej Nowacki
393356f5f6 Add benchmark for QMetaType::create().
A case of a custom type creation was not covered before.

Change-Id: Icd2a7d63633f8e40d9d4a8a26e0eb0896fc85ec8
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-03-07 00:10:15 +01:00
Lars Knoll
53bbea2328 Fix parsing of unicode escape sequences
Change-Id: I63a7cd3a571fb47c97157bcb2ca29c4239c600ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-07 00:03:07 +01:00
Giuseppe D'Angelo
6b78980593 QRegularExpression: fix autotest
Some minor fixes: obviously, a valid match always come from a
valid regular expression, but a valid regular expression can create
an invalid match (internal error during matching).

Also, testing an invalid iterator should silence the emitted
warnings.

Change-Id: I585bb99a81e22f108601fd66bf30b56e0229d68b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-07 00:02:39 +01:00
Mark Brand
888fed8065 QSqlTableModel: use selectRow() for field and row edit strategies
Calling select refreshes the query data but disrupts view
navigation.

For OnFieldChange and OnRecordChange it makes sense to only
select the row in question. This does not disturb view navigation.

Assume disruption of view navigation is not a problem
for OnManualSubmit because the user or application decides
when submitAll is called.

Task-number: QTBUG-2875
Change-Id: I1e5f68668fb9102f6296d67d543e80daa403f1c4
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
2012-03-07 00:01:32 +01:00
Mark Brand
b979956ec4 QSqlTableModel: handle changes between submit and select
Once an insert has been submitted, the cached record behaves like an
update. For row bookkeeping, we still have to remember that it was
originally inserted and is not in the query rows.

Between submitting a delete and selecting, we remove the values
from the deleted record. This causes a blank row to be displayed.
Read-only flag is set for cells in deleted row.

Reverting between submit and select means going back to the last
submitted values.

When removing rows, it's better to process from highest row numbers
to lowest. This avoids complications with higher rows shifting down
when lower rows are removed.

Change-Id: I8752fa11f7a1b88f2a71b9e03a020ac37e62487f
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-07 00:01:07 +01:00
Giuseppe D'Angelo
efcd4d9470 QRegularExpression: add captureCount()
QRegularExpression::captureCount() returns the number of
capturing groups inside the regular expression pattern.

Change-Id: Ib90ce67c67d06ab2966f0c98bd91da21defc156d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-06 23:56:14 +01:00
Giuseppe D'Angelo
bd30234b59 QRegularExpression: improve operator==, add dedicated autotest
Trivial change: compare dpointers first, then the data.
Added test function for operator==.

Change-Id: I33ac64a59db4ccad56c30be17622187e42415f38
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 21:54:17 +01:00
Giuseppe D'Angelo
c7cb455a47 QRegularExpression: add QRegularExpression* set of classes
Added QRegularExpression, QRegularExpressionMatch and
QRegularExpressionMatchIterator as PCRE-enabled, regexp classes.
Documentation is included, as well as a first round of autotests.

Task-number: QTBUG-23489
Change-Id: Id47031b80602c913ccd2fd740070e3024ea06abc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 21:53:39 +01:00
David Faure
676304e706 Add test for QUrl::isLocalFile (there weren't any).
Change-Id: I839d2eee7b0651700516d6140635151a52a9fa40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-06 21:00:31 +01:00
Shane Kearns
c93f7b6948 Fix tst_QNetworkReply::httpWithNoCredentialUsage autotest
The test was testing the wrong thing, and passing even though
QNetworkRequest::AuthenticationReuseAttribute was not being
respected, until recently when I fixed username/password in URLs

Now the cache is properly bypassed when this attribute is set to
manual, and the autotest is updated to check this.

Change-Id: I87943515562d0b16b03504f0758ba265758d1c22
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-03-06 18:24:09 +01:00
Shane Kearns
299e7ffd6a Fix QNetworkReply ioGetFromHttpWithCache test case
Expiration date is calculated from max-age header when a response is
inserted into the cache. Because the test case is prepopulating the
cache outside of QNAM's control, the expiration date was uninitialised,
causing the test to fail.

This is due to a 2 year old change in QNAM, where max age calculation was
removed from cache retrieval, and more recent changes to QDateTime
where secsTo() returns 0 if one of the arguments is invalid.

Change-Id: Ieecd46123dde4ca0fd0be3ae79e70e1528ec02bc
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-03-06 18:24:01 +01:00
Stephen Kelly
eb24dfcccb Add template specialization of QMetaType for QObject derived pointers.
This makes it possible to do things like

QVariant::fromValue(new SomeObject);

without first using Q_DECLARE_METATYPE(Something*)

This functionality was originally part of
http://codereview.qt-project.org/#change,11710 but was rejected
because the functionality was based on specialization of
QVariant::fromValue which could be dangerous.

This new implementation doesn't have such danger.

Change-Id: I83fe941b6984be54469bc6b9191f6eacaceaa036
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-06 13:37:17 +01:00
Shane Kearns
00821ec710 QSslCertificate - make lazy initialisation thread safe
QSslCertificate can be copied around into multiple threads,
without detaching. For example, the https worker threads inside
QNetworkAccessManager.
There are const methods, which lazily initialise members of
the private class without detaching (i.e. caching results of
expensive function calls)
These functions now lock the d pointer using QMutexPool to
avoid concurrency related crashes.

autotest crashes 20% of the time in release builds without
the fix, passes 100 times in a row with the fix.

Task-number: QTBUG-20452
Change-Id: I64a01af8159216f2dd6215a08669890f6c029ca8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-03-06 12:25:22 +01:00
David Faure
c78957766a QMimeDatabase: Fix crash on empty filename
This is due to the search in the suffix tree starting at position
fileName.length() - 1.

Change-Id: I98501c1724c7dde2626351ace8ba19faa0d2e1e1
Reviewed-by: Ivan Komissarov <ABBAPOH@nextmail.ru>
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
2012-03-06 12:10:42 +01:00
Rohan McGovern
7206f9c539 Stabilize tst_QCalendarWidget::buttonClickCheck
The window should be shown and activated before sending user input.

Task-number: QTBUG-23615
Change-Id: I2fc1738d9dc4ee7f03c81b040eed6389910a9d3c
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-03-06 01:34:55 +01:00
Rohan McGovern
443fd332f9 Stabilize tst_QShortcut
show() on a window is asynchronous.  Wait for it to complete before
continuing with the test.

Note the test already contained code for this, but it was inside of
a Q_WS_X11 block, making it dead code in Qt 5.

Change-Id: I06f892eea86278c56b1773a7e968bbe065f86260
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-03-06 01:34:53 +01:00
Rohan McGovern
961c3f958f Stabilize tst_QAccessibility::actionTest
show() on a window is asynchronous.  Wait for it to complete before
continuing with the test.

Change-Id: Icd0daa0c0e8f287171c57708bb2fce0b6cf0906a
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-03-06 01:34:50 +01:00
Frederik Gladhorn
f449cefc27 Remove AccessibilityPrepare event.
This event was completely unused.
In addition it leads to crashes on linux when
sending the Destroy accessibility update.

The Destroy event on linux would still query an accessible interface.
That in turn would trigger the event to be sent.

Change-Id: I8915527de067b8b70ba41b1361e3ef5d12866d7d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-05 18:46:43 +01:00
Miikka Heikkinen
82fd18fe36 Windows: Make QSettings autotest significant again
The latest windows run of CI has QSettings test passing, so remove the
CONFIG += insignificant_test from it.

Task-number: QTBUG-24145
Change-Id: I35c0d8d4f72ad49f9f21dcd486ab33a37ab95e15
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2012-03-05 16:37:16 +01:00
João Abecasis
7e4f329934 Base QList::setSharable on RefCount::setSharable
Change-Id: I2acccdf9ee595a0eee33c9f7ddded9cc121412c1
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-05 15:15:44 +01:00
Oswald Buddenhagen
deb3c134b5 remove injection of default_pre in infile()/$$fromfile()
this is a hack from the times when these functions were (ab)used to
inspect proper project files, but the inclusion was done with a clean
project, so that the included files did not have any functions to work
with.

Change-Id: I19925e8ead597ca38df040000c183e368b32c06d
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-05 14:46:12 +01:00
Robin Burchell
d94165ab32 Fix tst_QStyleSheetStyle::qproperty to not implicitly rely on QHash ordering.
Changing qHash() for string data affected the order of properties to be set,
causing 'checkable' to be set after 'checked'.

As 'checkable' state affects 'checked' as well (setting it to false), this means
that the test was unreliable, a bug, which was exposed by the qHash change.

Change-Id: I03a8dd7d07609683d99f0b2a40012a147d409c6e
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-05 14:09:24 +01:00
Jason McDonald
0862d7f78a testlib: Make verbose2 selftest use QCOMPARE as well as QVERIFY.
The verbose output for QCOMPARE is not very helpful.  Make the verbose2
selftest (which reuses the counting selftest) demonstrate this, so that
a future commit can demonstrate improvement.

Change-Id: I6b3bc8f5199e984aa11d0a67b76a8c916be86380
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-05 05:32:03 +01:00
Rohan McGovern
33f82d5b4e Merge "Merge remote-tracking branch 'origin/api_changes'" into refs/staging/master 2012-03-05 05:31:06 +01:00
Jason McDonald
d423fd0975 Avoid using internal testlib API in QDbusConnection autotest.
QCOMPARE should only be used in a test function because it makes the
test function return if the compare fails.  The test wants to compare
without returning on failure because the compare is inside a helper
function called by many test functions, so the test was calling
testlib's internal QTest::compare_helper() functions instead of
QCOMPARE.

This commit makes this code slightly less objectionable by calling the
public QTest::qCompare() instead.

Change-Id: Ida17a641e89f8a297d6a036449f44b33aa266368
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-05 03:44:01 +01:00
Lars Knoll
96232be146 Merge remote-tracking branch 'origin/api_changes'
Conflicts:
	dist/changes-5.0.0
	mkspecs/features/qt_module_config.prf
	qmake/project.cpp
	qmake/property.cpp

Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
2012-03-04 21:45:05 +01:00
Thorbjørn Lund Martsum
87975f88ce QAbstractSlider - adding setRange as a slot
In many situations it would be very nice to have setRange
as a slot. It fits good with the rangeChanged signal -
and in some situations it does make sense to synchronize
scrollbars ranges.

Change-Id: I6bcb41ed6e009e5822b56b621e4e187fe52502a6
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-03-02 23:16:25 +01:00
Sergio Ahumada
db1abf9f76 Change bugreports.qt.nokia.com -> bugreports.qt-project.org
Change-Id: Ia795098f24cf358b15067f54cd08dff0bd792bc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-02 23:16:25 +01:00
Jonathan Liu
b2fb578a11 Fix sizing in QGraphicsView itemsAtPosition auto test
The auto test may fail incorrectly depending on the width of the
QGraphicsView frame. To ensure more consistent test results, the frame is
disabled.

Change-Id: I8d70fb07e45803230954f776947d525e4cf9050f
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-03-02 15:33:11 +01:00
Jonathan Liu
81dcb377e5 Add additional QGraphicsView tests for regression
Add additional tests for graphics view tooltip regression introduced by
7c0d15a22266a425c9e9ac0120d6774e120fe01e.

Task-number: QTBUG-17517
Task-number: QTBUG-22663
Change-Id: I5e0d0e19504730a3e14ac84712a366dbebe688e6
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
(cherry picked from commit aaa46755dcc15b8baaa0d1b928828eb60e0babbc)
2012-03-02 15:33:06 +01:00
Miikka Heikkinen
62a654cc90 Fix QApplication autotest crash when running on multiple screens
Screens need to be destroyed in reverse order to ensure the primary
screen stays valid when other screens are destroyed.

Task-number: QTBUG-24300
Change-Id: I9d9d710aa67ec045baa8bf292833ffe7d9eea935
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-02 14:45:23 +01:00
David Faure
53229ec8f7 Add note about failing test when using shared-mime-info < 1.0
Change-Id: I3ba9d14d915a579b9e102114866f6c9e0344ba16
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-02 14:44:44 +01:00
Friedemann Kleint
099029a342 Fix QPixmap::grabWidget() on Windows.
Do not draw on the backingstore DC when drawing
to a pixmap. Access the paintdevice for checking via
the QPaintEngine since QPainter returns the clipdevice,
which is a widget.
Fix warning about accessing handle of 0-window in the
test.

Task-number: QTBUG-24183

Change-Id: Ie91ea6ab9d09528c7ec1d35633f9a0ee667719b1
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-02 14:44:00 +01:00
Stephen Kelly
fb8c95bac0 Automatic metatype registration of two-template-argument types.
This commit is complimentary to the commit which introduced a similar
partial specialization for single template argument types:
6b4f8a68c8

If T and U are available as metatypes, then QHash<T, U> is too.

Change-Id: I09097b954666418b424c8c23577032beb814343a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-02 13:22:54 +01:00
Jędrzej Nowacki
362bde8e8e Introduce QMetaType::UnknownType.
QMetaType::Void was ambiguous, it was pointing to a valid type (void)
and in the same time it was signaling errors in QMetaType. There was
no clean way to check if returned type was valid void or some
unregistered type.

This feature will be used by new QMetaObject revision which will
store type ids instead of type names. So it will be easy to
distinguish between:
 void mySlot();
 MyUnregisteredType mySlot();

Change-Id: I73ff097f75585a95e12df74d50c6f3141153e771
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-02 12:57:29 +01:00
Jason McDonald
123eb803ef testlib: Add selftests for -v1 and -v2 command-line switches.
These tests don't have their own source code but rather reuse the
counting selftest with additional command-line options.

Note that currently the -v1 switch only changes the plain text output,
and the expected xml output is identical to that of the counting test.
This may change in the future however.

This commit also restores a couple of lists to alphabetical order, where
the findtestdata selftest was not sorted into the list correctly.

Change-Id: Ie38e255f8029157b34162b3864b5fa66e137d74a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-02 01:06:22 +01:00
Jan Arne Petersen
022ff04a6b Unset _NET_WM_USER_TIME_WINDOW before destroying the window
Otherwise metacity was crashing when a QWindow was destroyed immediately
after being activated, because metacity was trying to select events
(XSelectInput) for the already destroyed m_netWmUserTimeWindow.

Task-number: QTBUG-24492
Change-Id: Iedbe7bdd6b26110ca8bec6f33525209ae551ffd5
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-01 19:00:15 +01:00
Olivier Goffart
2658a52017 Fix tst_qregexp with QStringBuilder
Change-Id: I1ac2a5c9ea5657ad2916465b77271e3d53c67cde
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-03-01 16:58:33 +01:00
Bradley T. Hughes
d964981252 Remove ARMFPA support and Q_DOUBLE_FORMAT detection
Remove the -armfpa option the config.tests/unix/doubleformat*
detection. The places where we used QT_ARMFPA and Q_DOUBLE_FORMAT
has been removed as well.

Rationale: ARM FPA with GCC does not work with EABI. Qt currently
does not support compiling without EABI, making ARM FPA an
impossibility. It is unknown whether other compilers provide ARM FPA
support with EABI. Support for ARM FPA can be re-added in the future
should the need arise, but since ARM VFP is available for ARMv5 and up,
we should encourage implementors to instead use soft-floats or VFP.

Change-Id: I3671aba575118ae3e3e6d769759301c8f2f496f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-01 16:26:55 +01:00
Marc Mutz
15c141511f QPair: specialise QTypeInfo based on the typeinfos of its arguments
Specialise QTypeInfo<QPair<T1,T2>> based on the properties of
T1 and T2:

- If either T1 or T2 is Q_COMPLEX_TYPE, so is QPair<T1,T2>.
- Otherwise, if either T1 or T2 is Q_MOVABLE_TYPE, so is QPair<T1,T2>.
- Otherwise, QPair<T1,T2> is Q_PRIMITIVE_TYPE.

Change-Id: I8aecbd37e3b7924f77f38967498deabf1a19ca24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-01 14:26:06 +01:00
Morten Johan Sorvig
30974151c1 Cocoa: Implement QPlatformTheme:palette()
Causes a new test failure in QGraphicsProxyWidget::updateAndDelete,
expand the EXPECT_FAIL to cover that one as well.

Change-Id: If9da757206445d17510c4fac82a559de7b8c0563
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-01 13:55:49 +01:00
Shane Kearns
d19d25a68b Use QSystemError for QDnsLookup windows backend
The OS provides the error string in this case.
This gives more information to the developer seeing a generic
error.

Change-Id: Ia03642982f3513ee5a8a9fa98d918e948f8d97a5
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-03-01 13:55:49 +01:00
Friedemann Kleint
5cd56df0f2 qmake-test: Fix jom/nmake handling on Windows.
The test fails if MAKEFLAGS is set up for jom since the test
always uses nmake. Remove MAKEFLAGS from the process environment.

Change-Id: Idaed3cc964832b83c282a59fc5257572c520b882
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2012-03-01 12:16:57 +01:00
Stephen Kelly
e174405862 Make some tests and benchmarks pass with QT_NO_QSTRINGBUILDER
Change-Id: I6c91a613007043d0f26ac11e98353a0b9ce646ae
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-01 11:02:28 +01:00
Friedemann Kleint
9e893f6810 Skip the network SSL test on Windows.
For SSL, this would require an OpenSSL library to be installed.

Change-Id: I2a320e7faf40ef925c90dbe539f912e4a8fc13fc
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2012-03-01 10:40:08 +01:00
Marc Mutz
1cd4d6b181 QEvent (and subclasses): make ctors explicit
Do this regardless of whether the event subclass
is public API or only used in examples. Examples
are examples, used by others as templates or even
copied verbatim, so they should also follow sound
engineering rules.

Anyway, there's only one in examples/...

Change-Id: I586ff16407a956c9e89288fdd4377eed73f45c0f
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-01 08:44:34 +01:00
Kurt Korbatits
95c5be8bc1 Changed qchar unittest to check return from QFINDTESTDATA
- Changed qchar unittest to check string QFINDTESTDATA
  returns is not empty.

Change-Id: Idb3997aaa5d5220272915c1e2538175205b3d6e8
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-01 05:43:39 +01:00
Kurt Korbatits
c5b928207e Fixed qlocale unittest to install subprogram syslocaleapp correctly
- It was trying to install syslocaleapp sub program as TESTDATA
  instead of an application.

Change-Id: I2117d11335bc2fd37a8ccc9a03b0337382f0177f
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-01 05:43:19 +01:00
Kurt Korbatits
41b2992422 Changed qdir unittest remove() to check actual file removed
- Changed remove() test to check the file just removed is gone.

Change-Id: I0b6c176e624134402b5547866064f436ce063f16
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-01 05:43:17 +01:00
Kurt Korbatits
bc323b6fd3 Changed qlogging unittest to install subprogram
- Added install of app sub program so it works from install directory

Change-Id: Ia83643519752a3cbb59d6da2aed132d683a94bee
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-01 05:43:15 +01:00
Kurt Korbatits
5dd470aca6 Fixed qdir unittest rename() test to skip if run as root
- subtest not valid if run as root so added a check and skip

Change-Id: Iae993e20f272f9303a75062ef00d22b49df5e84a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-01 05:43:12 +01:00
Stephen Kelly
fb4dccee9a Fix build of QNetworkReply benchmark with QT_USE_QSTRINGBUILDER.
Change-Id: Ie46126aed0d2e83dc7784c027066c789d3fd7652
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-01 01:13:22 +01:00
Giuseppe D'Angelo
eafc667136 QRegExp: fix \i \I \c \C \p \P escape sequences
Those escape sequences have a special meaning in the XML Schema 1.1
regular expressions, but not in Perl-compatible ones.

An escape sequence that has no special meaning should match the
escaped character itself; this patch fixes QRegExp's behaviour in
that regard (previously, it added a character class matching
nothing).

Change-Id: I983f923baa7c2ec19938b96353f3a205e6c06d58
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-01 00:09:57 +01:00
Shane Kearns
46e4a9d523 Windows - fix getsockopt calls for narrower than int options
Windows unhelpfully writes to only one byte of the output buffer
when getsockopt is called for a boolean option. Therefore we have
to zero initialise the int rather than initialising to -1 as was
done before.
This in general only works for little endian architecture, because
the word would look like 0x01000000 on big endian. So I have added
some compile time asserts in the assumption that windows is always
little endian. This is ok for comparisons with 0/false, but not
comparisons with true or nonzero values.
In the case of IPV6_V6ONLY, it is documented as DWORD (unsigned int)
but on some windows versions it is returned as a boolean triggering
the warning. I removed the warning, as the conversion to int works on
both LE and BE since it is only compared with zero.

Task-number: QTBUG-23488
Change-Id: I3c586d1ada76465fc045a82661f289920c657a4c
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
2012-03-01 00:09:57 +01:00
Marc Mutz
ff004175bc QFlags: mark as Q_PRIMITIVE_TYPE
I originally tried to put Q_DECLARE_TYPEINFOs into
Q_DECLARE_OPERATORS_FOR_FLAGS, to declare not only
the flags type, but also the underlying enum as
primitive, but too many users (arguably correctly)
used Q_DECLARE_OPERATORS_FOR_FLAGS at (non-global)
namespace scope where QTypeInfo would have been
specialised in the wrong namespace.

So specialise QTypeInfo for QFlags<T> only.

Change-Id: I4af6e29aefbd9460a3d2bc6405f03cdf6b1096bc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-02-29 23:36:47 +01:00
Robin Burchell
b147da00c5 Remove qhash_faster.
It's not faster under _any_ metric than the new algorithm, and it loses a lot of
spread which is a bad thing.

Change-Id: Ic87258f1c887822ffea1cb1517355564fabc3c26
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-29 22:39:00 +01:00
Robin Burchell
1f4804452c Copy Qt 4's QString hash algorithm.
We must do this the same way we do all other hash algorithms for fair
comparison, as otherwise, the call to the PLT unfairly penalises
QHash<QString>'s results, as it's in a different shared object.

Change-Id: I69c891f5a97dcccdfcfbdbf32796f86242a42963
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-29 22:39:00 +01:00
Robin Burchell
57004b7fda Move data generation to initTestCase() method and store the results.
Per the comments on Ie4100a1ca4dbe7bf1cd73de883a9854377ac2f5e, having Q_ASSERT
was not a good idea, and data functions can't really handle
QVERIFY/QCOMPARE/etc, so do this in initTestCase instead.

Change-Id: I19e61dec7fe415bb1fa0f53a2920d99b8c7c8ea7
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-29 22:39:00 +01:00
Robin Burchell
0f3d9b1d84 Add test data for string forms of numbers.
Similar to the UUID benchmark, but won't have any non-numerical characters.

Change-Id: I7487c97cab96fd53c180fe12061e7be3ca96e883
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-29 22:39:00 +01:00
Robin Burchell
693a286600 Add a test using lots of similar strings.
This attempts to emulate a dictionary usecase of sorts, done in code to avoid
bloating the git repository by adding an actual word list.

Change-Id: I878bc4af8877ba780ee699932f240c0d9c8ff12c
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-29 22:39:00 +01:00
Miikka Heikkinen
70784b9069 QFileSystemModel autotest fixes
For some reason, hiding files via executing "attrib +h filename"
process didn't work realiably, so changed the file hiding to be done
via Windows native API.

Also changed the test to use QTemporaryDir to simplify temporary
directory handling a bit.

Task-number: QTBUG-24291
Change-Id: I4f02b16e2f9105bcf5e6c5bf136f55434a26e2f4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-02-29 20:10:21 +01:00
Shane Kearns
7d5b0e2b04 network cookies: check "example.com" != "example.com."
Only test code change, we already have the correct behaviour

Task-number: QTBUG-20001
Change-Id: I2296f405f47f9c8d15796e69f9d1854063e38d6a
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-02-29 17:46:06 +01:00
Laszlo Agocs
d87edf4e3e Remove internal class QVolatileImage.
This made sense only for Symbian where there was a special
CFbsBitmap-based backend present and it was used from the
Symbian-specific VG and GL pixmap implementations.

The generic version is merely a useless wrapper over QImage and is not
in use anywhere in the codebase.

Change-Id: I1dabe22dfb8cbbc35dce8e22703a3aff810fb5f9
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-02-29 17:39:01 +01:00
Friedemann Kleint
bcb0f28a4d Fix tests of QMimeDatabase.
- Use temporary directories to avoid instabilities
  due to remains of previous failed tests and locked
  directories.
- Replace SRCDIR by QFINDTESTDATA(), reference only
  the freedesktop.org.xml contained in the Qt source
  tree by $$QT.corelib.sources.
- Improve some error messages, test suite instructions
  for Windows.

Change-Id: Idee8e3767ef0a8299df3bdaaac20334164878db0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: David Faure <faure@kde.org>
2012-02-29 16:52:19 +01:00
Friedemann Kleint
9b5cdccc02 Skip test tst_QTextScriptEngine::thaiWithZWJ on Windows.
Change-Id: I9286ae8b1200b2d6638d1257a872450a9886fce0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2012-02-29 16:52:02 +01:00
Stephen Kelly
98ecbf1f50 Fix build of QImageReader tests with QT_USE_QSTRINGBUILDER.
Change-Id: I789d99d0741bc178d2d7fd82558edc684eb6daf8
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-02-29 16:51:17 +01:00
Stephen Kelly
e28be90dea Fix build of QWizard tests with QT_USE_QSTRINGBUILDER
Change-Id: Id276cdb9b84c61bf75a5bde149142f39f52f563e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-02-29 16:51:07 +01:00
João Abecasis
7919c0529e Add AllocationOption::Grow
This is meant to reduce the number of allocations on growing containers.
It serves the same purpose as the existing qAllocMore which is currently
used by container classes.

While only a container knows when it is growing, it doesn't need to care
how that information is used. qAllocMore is currently treated as a
black-box and its result is (basically) forwarded blindly to an allocate
function. In that respect, container code using qAllocMore acts as an
intermediary.

By merging that functionality in the allocate function itself we offer
the same benefits without the intermediaries, allowing for simpler code
and centralized decisions on memory allocation.

Once all users of qAllocMore get ported to QArrayData and
QArrayData::allocate, qAllocMore can be moved or more closely integrated
into qarraydata.cpp and qtools_p.h can be dropped.

Change-Id: I4c09bf7df274b45c399082fc7113a18e4641c5f0
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-02-29 14:31:15 +01:00
João Abecasis
f947093662 Test setSharable with "raw data"
Change-Id: I91774685e84416407aa1fa136f27fedb82545a12
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-29 14:31:03 +01:00
Stephen Kelly
e1cc0d6bbc Allow QChar::SpecialCharacter with QStringBuilder.
Change-Id: I3c91fd516bb13e5534aa6f26ee9df745c990dfb5
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-02-29 14:08:43 +01:00
Kent Hansen
3b844c16e0 Port QDBusMetaObject to Qt5 meta-property/method descriptor format
Adapts QDBusMetaObject to be in sync with the moc/meta-object
changes for property and method descriptors (storing the name and
argument count of methods, and more elaborate type information).

Now that the method name is stored in the standard method
descriptor, QtDBus doesn't need to store it separately anymore,
and the QMetaObjectPrivate::rawStringData() function can be
removed.

Change-Id: I04efdbe05b52bbd85405e1713509e55308ac42da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-02-29 12:50:14 +01:00
Kent Hansen
69e3e54486 Add QMetaMethodBuilder::parameterTypes() function
This function matches QMetaMethod::parameterTypes().
The implementation of QMetaMethod::parameterTypes() was moved to a
helper function in QMetaObjectPrivate, so that it can be shared with
QMetaMethodBuilder.

Change-Id: I4361713996dc4ea31a79c2fc74c813ee5e9c3069
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-02-29 12:50:14 +01:00
Kent Hansen
f95181c7bb Long live Qt5 meta-object method/property descriptors
This commit introduces two significant changes to the meta-object
data format:

1) Meta-type information (QMetaType type/name) information is
stored directly in the meta-data for both properties and methods;
2) The original signature (string) of a method is no longer stored
in the meta-data, since it can be reconstructed from the method
name and parameter type info.

The motivation for this change is to enable direct access to method
names and type information (avoiding string-based lookup for types
if possible), since that's typically the information language
bindings (e.g. QML) need. (moc already had all the desired
information about methods, but it threw it away!)

This change keeps support for the older (6 and below) meta-object
revisions, but the support will be removed after a short grace
period.

The following public QMetaMethod functions have been added:

name() : QByteArray
returnType() : int
parameterCount() : int
parameterType(int index) : int

The following internal QMetaMethod function has been added:

getParameterTypes(int *types) : void

This commit extends the meta-method data to include explicit
type/name data for methods. The new data follows the existing
(5-word) method descriptors in the meta-data. The method descriptor
format was modified to enable this. First, the descriptor now
contains the meta-data index where the method's type/name information
can be found. Second, the descriptor contains the number of
parameters. Third, the descriptor has a reference to the name of the
method, not the full signature.

Each entry of a method's type/name array contains either the type id
(if it could be determined at meta-object definition time), or a
reference to the name of the type (so that the type id can be
resolved at runtime).

Lastly, instead of storing the method parameter names as a
comma-separated list that needs to be parsed at runtime (which was
how it was done prior to this commit), the names are now stored as
separate entries in the meta-object string table, and their indexes
are stored immediately after the method type info array. Hence,
parameter names can be queried through the public API without
parsing/allocating/copying, too.

Task-number: QTBUG-24154
Change-Id: Idb7ab81f12d4bfd658b74e18a0fce594f580cba3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-02-29 12:50:14 +01:00