Commit Graph

1973 Commits

Author SHA1 Message Date
Kent Hansen
83e055424a Add QtJson types to meta-type system
Make QJsonValue, QJsonObject, QJsonArray and QJsonDocument
first-class meta-types.
This is an enabler for a lightweight integration with QML.

Change-Id: I4725efdd2746cf97fd26d3632a99e8eee849f834
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-20 22:22:41 +01:00
Marius Storm-Olsen
e67066eff6 Remove old bic test data
We will not be testing BIC of Qt5 against Qt4

Change-Id: I6f0eea3dd60eea1535749240a178a19605c981d0
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-20 15:24:48 +01:00
Thorbjørn Lund Martsum
fcc01e6c37 QHeaderView - minor fix to setDefaultSectionSize
This fixes a situation where we (wrongly) assume that
a section with size 0 is hidden. However a hidden
section should be one that we have called hideSection
(or setSectionHidden) on.

Change-Id: Ic14eded2666022f27434dc55927323a74910549c
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-20 11:44:09 +01:00
aavit
6c98fd2e6c Fix raster autotest: consistently assume scripts in UTF8, not latin1
The Lancelot raster painting autotest assumed latin1 encoding of the
QPS scripts files, while the script engine would import subscripts
as UTF8. This fix standardizes on UTF8.

Change-Id: I9e7c1ee7b6ffe77ff68edc8423f00dfb9ab3e95b
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
2012-03-20 11:44:09 +01:00
Frederik Gladhorn
c2e8db5841 Remove QAccessibleEvent child parameter.
This makes the api cleaner and generally the child should not be there.
It is only sometimes more convenient not to create a QAccessibleInterface
instance, so the functionallity is kept.

Change-Id: I26018a6d3e0549f4d79856775b4167c5660e229d
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-19 23:00:10 +01:00
Jędrzej Nowacki
10df7967d9 Disable some tests and examples when --no-widgets is specified
There are many tests, examples that depends on widgets. This patch
disables some of them if Qt is configured without widgets.

Change-Id: I5460dadca736c54221874adcd518a7021725d90a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-19 20:16:04 +01:00
Frederik Gladhorn
477c43260e Accessibility: add text update events
Change-Id: Iece9d100b3f5a379d7d8e29dea67a10d0c918c06
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-19 18:07:30 +01:00
Miikka Heikkinen
4bcd8fc2de Fix infinite recursion crash in QPrinterInfo::supportedPaperSizes()
This function calls platform specific function
QWindowsPrinterSupport::supportedPaperSizes(), which then called back
to QPrinterInfo::supportedPaperSizes(), causing infinite recursion.

Fixed by providing a proper implementation for querying supported
paper sizes in QWin32PrintEngine - the same implementation was used in
Qt 4.8.

Task-number: QTBUG-24190
Change-Id: I64a2773d83596df19818bf2636f1255943d7851d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-19 18:02:39 +01:00
Kent Hansen
95d6f8a4cf Merge master into api_changes
Conflicts:
	src/corelib/tools/qvector.h
	tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp

Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
2012-03-19 10:03:48 +01:00
Kurt Korbatits
0f929bfa9a Fixed benchmarks to work from install directory
- Changed benchmarks to use TESTDATA and QFINDTESTDATA
- Fixed up targets all use tst_bench_ syntax

Change-Id: I5c2936702e248478f5df225ce38893158ee22d7f
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-19 01:18:20 +01:00
Frederik Gladhorn
36513264da Make copy and assign private for QAccessibleEvent.
Also make the handling of events in the test pointer
based since mac-g++ doesn't seem to like const
references the way they were before.

Change-Id: I7fe39978d4729b8e586be30978b74aa51ca7cfe6
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-18 21:42:38 +01:00
Kent Hansen
3f64a7b67b Add autotests for QMetaType::load() and save()
These were not covered at all by tst_qmetatype.

Change-Id: Ic957470ac78b2c15fe449efe17e1f178a41c3690
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-18 21:06:57 +01:00
Stephen Kelly
b20cbf7102 Move CMake macros and tests for dbus tools from qttools.
Change-Id: I9d589a2d33eb8fcac63443565bb3e2319be3e04f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-18 14:14:57 +01:00
Stephen Kelly
72367b1679 Bootstrap qdbuscpp2xml.
This involves invoking the Moc classes directly and using the data
structures it provides instead of invoking the moc exectutable and
parsing the generated code.

Change-Id: Ia5c654e8ef58d52d0d3376252c13e13885f80da3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-18 14:14:42 +01:00
Jędrzej Nowacki
5e497111db Add new test cases to tst_QMetaType.
Change-Id: I405ab5df9d9de3a0a0a71276b172a27ee01392e3
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-18 12:35:09 +01:00
Marc Mutz
d823646db3 containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()
C++11 adds cbegin()/cend() functions for the same reason Qt has
constBegin()/constEnd(). This patch adds these functions to the
Qt containers with the same implementation as constBegin()/constEnd().

It also fixes the return types in the documentation of existing
constFind() functions (documentation only).

C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have).
In particular, it doesn't add cfind(), so I didn't supply these, even though
Qt comes with constFind().

This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365.

Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-17 09:10:57 +01:00
Olivier Goffart
0731c90eec moc: test signature with (void)
Change-Id: Id63ed21e9f5e7447ced877ec19a2786d20f439f0
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-03-16 17:37:18 +01:00
Miikka Heikkinen
2ea976c3a7 Fix font cache check in QFontEngineFT::recalcAdvances()
Cached font was used regardless of the format, resulting in incorrect
advance in some cases when default format differed from the cached
format.

Task-number: QTBUG-24188
Change-Id: I39e4156bd9ba743afa7e106e934c90227fbf2b8b
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
2012-03-16 11:02:03 +01:00
Kent Hansen
440f452aa3 Merge master into api_changes
Conflicts:
	src/corelib/kernel/qmetatype.cpp
	src/gui/kernel/qplatformsurface_qpa.cpp
	tests/auto/corelib/tools/qtimeline/qtimeline.pro

Change-Id: Iff3fff34eeeb06f02369767ddfce44cfde505178
2012-03-16 10:01:29 +01:00
João Abecasis
c67efb6506 Fix invalid read, detected by valgrind
Commit 3fe1eed0 changed the QVERIFY in line 1354 to QCOMPARE. This was
done to work around a (not yet understood) compiler issue. That however
was wrong, as char pointers in QCOMPARE are assumed to point to
'\0'-terminated strings and will get dereferenced.

In this case the intent was to compare the actual pointer values, as the
pointers point past the end of the array and should not be dereferenced.

Explicitly casting to (void *) and using QCOMPARE will not only keep the
intent, it will hopefully also provide meaningful output on failures. As
such the fix was applied throughout the test.

Change-Id: Ib0968df492ccc11d7c391bb69037cd7241e55493
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-03-15 23:01:13 +01:00
Shane Kearns
1e4f035158 Revert "Disable 'check' target generation for network autotests for Windows."
Too broad disabling, will disable more selectively

This reverts commit 3efb0d50e5.

Change-Id: I29e25816646194b6a4b7d8ff69e0c0d074ac2a19
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-15 18:05:05 +01:00
Shane Kearns
8a811865ab Fix QDnsLookup autotest failure in CI environment
The DNS server can legitimately include NS and A records for
the authoritative name server in addition to the DNS records
that were requested.
These are now ignored when checking the reply (we only check
results that match the query, rather than failing if a result
is for a different host name than the query).

Task-number: QTBUG-24698
Change-Id: I327f31d58cdca50c7df6b32b275d7f28b56405f0
Reviewed-by: Jeremy Lainé <jeremy.laine@m4x.org>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-03-15 18:05:05 +01:00
Mark Brand
26450fe6a6 QSqlTableModel::removeRows() enforce edit strategy
For OnFieldChange and OnRowChange, we don't want more than one row in
the cache with uncommitted changes. This could happen if deletion in
the database fails while other changes are pending.

Chosen solution is to return false if other rows have pending changes.
Also, we only allow 1 row removed at a time.

Updated test, changes and documentation.

Change-Id: I68baf6d221789b4754e891535070011c759a2155
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-15 15:35:43 +01:00
Mark Brand
108748404b QSqlTableModel::setData(): no longer autosubmit for OnRowChange
The model can never do a good job of knowing when user moves to a
new row in the view. Faking it by detecting when another row
is changed was not a good solution because it cannot detect
when the last edited row is left.

Either the view should automatically submit when the user leaves
a row or the application should provide a way to submit.

This change made it possible to reuse the logic of flags() in
setData().

Change-Id: I2550e5b113bceba1a852fc21203babeca07c5748
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-15 15:35:32 +01:00
Mark Brand
3d7cec6577 QSqlTableModel: disallow insert if changes are pending
For OnFieldChange and OnRowChange, inserting rows should not be
allowed if there are pending changes in cache.

Change-Id: Ia794332959a35a1de87e798ba1a74ace3dfae68f
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-15 15:35:22 +01:00
Mark Brand
f6ca63f896 QSqlTableModel::setData()/setRecord(): fix incorrect row
For OnFieldChange and OnRowChange, before submitting new changes,
setData() and setRecord() attempt to submit pending changes and
revert them upon failure. However, they fail to consider that
reverting pending insertions removes rows from the model. As a
result, the new change can be applied to a row higher than intended.

One possible solution would be to adjust the targetted index for the
removed rows, so that the intended row is affected by the new change.
But this still causes the strange editing experience as rows jump
up just as they are being edited.

It does not seem right in the first place for the model to initiate
reverting changes. It should be up to the application to decide what
to do when data cannot be committed. In particular, setData() and
setRecord() should not have the side effect of reverting already
pending changes.

The chosen solution is simply to refuse new changes that don't make
sense for the edit strategy. For OnFieldChange, flag() will
indicate read-only when editing is blocked by a pending change.

Since setData() and setRecord() submit data immediately for
OnFieldChange, it no longer makes sense to resubmit changes
automatically before a new change.

For OnRowChange, setData() keeps the behavior of automatically
submitting a pending row before starting on a new row. This is
historical behavior and is probably motivated by the fact that
QTableView does not automatically call submit() when editing leaves a
row. The obvious shortcoming of this is that the last row to be edited
will not be submitted automatically. It also prevents us from flagging
rows other than the pending row as read-only.

For OnRowChange, setRecord(), being row-oriented by nature, should
submit the change immediately rather than waiting for the next call
to setRecord(). This makes setRecord() consistent with insertRecord().

Change-Id: Icb4019d8b7c53a7ee48f8121a7a525e8bc35d523
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-15 15:35:17 +01:00
Friedemann Kleint
1741f6890c UTF8-Codec test: Fix compilation with g++/C++0X.
Change-Id: I704f8d1b07ca371c36e4eecc52c80ac783e3da3c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-15 14:51:50 +01:00
Debao Zhang
65a2613e3e tst_qsharedpointer: Fix auto test fail under Windows 7
The tst_QSharedPointer generate another Process to test some invalid
codes, and it expect that the prcoess will crash and return a non-zero
value.

The process which is a console application was linked to windows
subsystem, and QProcess seems can not get its return value. This
cause the unit test fail.

In addition, when the process crash under debug mode, a debug error
report-dialog will appear, which is very annoying, so I suppress it too.

Task-number: QTBUG-24160
Change-Id: Ia1c872d4515c83b0aa516bcfe3783f59797d2d49
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-15 11:40:50 +01:00
Jason McDonald
07764b9c15 Verify expected warnings in QSettings autotest.
Use QTest::ignoreMessage() so that the warnings don't appear in the test
output and so that the test will fail if the warnings are not produced.

Change-Id: I418d78819fc9dbfd7da2a8b6c0a1ebfa967347e2
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-15 06:00:52 +01:00
Johannes Zellner
8a79e8b645 Remove unmaintained and broken VNC platform plugin
Change-Id: Ie0a07c3a6822870b095a20d997b63fb1635f20be
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Robert Griebl <robert.griebl@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
2012-03-15 02:45:31 +01:00
Rohan McGovern
329469d5a1 headersclean: omit -Wcast-align also on MIPS
These issues are permitted to go unfixed for ARM and MIPS, for the time
being.

Change-Id: Ibdf33dc42e3de19ef20e9dc50f12f451ea6dbf23
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-15 00:50:47 +01:00
Rohan McGovern
aac68052af Mark tst_qtimeline as insignificant on Windows
This test has been repeatedly unstable.

Task-number: QTBUG-24796
Change-Id: I603965c0189ad6da0cdf48527c4919c55e1918b4
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-03-15 00:50:47 +01:00
Mark Brand
9e87104295 QTableView: call model->submit() on row change
QTreeView already does this in the exact same way. It's necessary to
call submit() so edit strategy OnRowChange in QSqlTableModel will
work as expected.

Change-Id: Ib430143e8a71f3b0bcd842fcc772cc7ee4525f0a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-15 00:50:47 +01:00
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