Commit Graph

1951 Commits

Author SHA1 Message Date
Thiago Macieira
1aeb180386 Long live QUrlQuery
This class is meant to replace the QUrl functionality that handled
key-value pairs in the query part of an URL. We therefore split the
URL parsing code from the code dealing with the pairs: QUrl now only
needs to deal with one encoded string, without knowing what it is.

Since it doesn't know how to decode the query, QUrl also becomes
limited in what it can decode. Following the letter of the RFC,
queries will not encode "gen-delims" nor "sub-delims" nor the plus
sign (+), thus allowing the most common delimiters options to remain
unchanged.

QUrlQuery has some undefined behaviour when it comes to empty query
keys. It may drop them or keep them; it may merge them, etc.

Change-Id: Ia61096fe5060b486196ffb8532e7494eff58fec1
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-30 01:19:59 +02:00
Thiago Macieira
b75aa795fe Refactor the URL recoder a little
Change it to operate on QChar pointers, which gains a little in
performance. This also avoids unnecessary detaching in the QString
source.

In addition, make the output be appended to an existing QString. This
will be useful later when we're reconstructing a URL from its
components.

Change-Id: I7e2f64028277637bd329af5f98001ace253a50c7
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-30 01:19:59 +02:00
Thiago Macieira
73e16b15a6 Remove the tolerant parsing function and make the recoder tolerant
The reason for this change is that the strict parser made little sense
to exist. What would the recoder do if it was passed an invalid
string?

I believe that the tolerant recoder is more efficient than the
correcting code followed by the strict recoder. This makes the recoder
more complex and probably a little less efficient, but it's better in
the common case (tolerant that doesn't need fixes) and in the worst
case (needs fixes).

Change-Id: I68a0c9fda6765de05914cbd6ba7d3cea560a7cd6
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-30 01:19:59 +02:00
Thiago Macieira
6028efa3ff Add the code that recodes URLs.
This one function is an all-in-one:
 - UTF-8 encoder
 - UTF-8 decoder
 - percent encoder
 - percent decoder

The next step is add the ability to modify the behaviour, by telling
the function what else it must encode or decode and what it should
leave untouched.

Change-Id: I997eccfd2f9ad8487305670b18d6c806f4cf6717
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-30 01:19:59 +02:00
Thiago Macieira
4c7e950aad Mark QUrl::{to,from}Punycode as deprecated since 5.0
These functions are now aliases to {to,from}Ace, which are usually
what you want. The original functions from Qt 4.0 had the wrong
semantics and wrong name. The new ones from Qt 4.2 execute the ACE
processing from IDNA (specifically, the ToASCII and ToUnicode
operations described in the RFC).

But so as not to be without tests, export the tests in unit testing
environment and test the punycode roundtrip. Note that the
tst_QUrl::idna_test_suite test tests *only* the Punycode roundtrip,
not the nameprepping.

Change-Id: I9b95b4bd07b4425344a5c6ef5cce7cfcb9846d3e
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: David Faure <faure@kde.org>
2012-03-30 01:19:59 +02:00
Thiago Macieira
8fa2a41bd5 Move the QByteArray-based percent-encoding activities to QByteArray
Copy the unit tests that related to percent-encoding to
tst_qbytearray.cpp and use public functions to execute
QUrl::fromPercentEncoded and QUrl::toPercentEncoded.

Change-Id: I6639ea566d82dabeb91280177a854e89e18f6f8d
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: David Faure <faure@kde.org>
2012-03-30 01:19:59 +02:00
Jędrzej Nowacki
d78fe5f8d3 Make QArrayData::shared_null zero terminated.
This is expected by QByteArray and QString

Change-Id: Ib668b144bdc0d2c793018c8f8d794f249eaf935c
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-29 23:26:34 +02:00
Thiago Macieira
4fc7474805 Port QHostAddress to use the new IP utilities in QtCore
The new code now generates lowercase hex instead of uppercase, so
adapt the unit tests to pass.

Also, "123.0.0" is now considered valid (compatibility with inet_aton).

Change-Id: I07b5125abf60106dc5e706033d60836fb690a41f
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-03-28 16:31:34 +02:00
Thiago Macieira
826c0723c1 Add support for IPv6 parsing and reconstructing the address
Similarly, only test against the libc function on Linux, as other OS
sometimes have different behaviour.

Change-Id: I9b8ef9a3d660a59882396d695202865ca307e528
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-03-28 16:31:34 +02:00
Thiago Macieira
70db6233e7 Add a function to parse IPv4 addresses in QtCore
In the unit test, check against inet_aton on Linux with GLIBC
only. Other platforms have this function too, but they sometimes have
different behaviour, so don't try to test them equally.

Change-Id: I1a77e405ac7e713d4cf1cee03ea5ce17fb47feef
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-03-28 16:31:34 +02:00
Debao Zhang
d2b1c2ef1f Remove WA_PaintOutsidePaintEvent
WA_PaintOutsidePaintEvent is only suggested to be used when porting Qt3 code
to Qt 4 under X11 platform. and it has been broken now.

Change-Id: Ie4297b2a449f1055ca10ada9efb930e6018b1efb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-28 11:22:11 +02:00
David Faure
a5a80da223 Allow auto tests to stay away from the user's configuration.
QStandardPaths now knows a "test mode" which changes writable locations
to point to test directories, in order to prevent auto tests from reading from
or writing to the current user's configuration.

This affects the locations into which test programs might write files:
GenericDataLocation, DataLocation, ConfigLocation,
GenericCacheLocation, CacheLocation.
Other locations are not affected.

Change-Id: I29606c2e74714360edd871a8c387a5c1ef7d1f54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-03-28 11:22:11 +02:00
João Abecasis
7c9e345551 Improve output on test failures
This adds checks to ensure Q_ALIGNOF is returning the desired alignment
for explicitly-aligned types.

The alignment check is now inlined in the test inside QCOMPARE so we get
slightly more informative errors:

FAIL!  : tst_Collections::alignment() Compared values are not the same
   Actual   (quintptr(&it.value()) % Value::PreferredAlignment): 64
   Expected (quintptr(0)): 0
   Loc: [tst_collections.cpp(3384)]

In this case, this is enough to notice "non-native" alignments are being
requested. Having test parameters otherwise hidden in template arguments
doesn't help the situation.

Change-Id: I05267fd25b71f183cfb98fb5b0a7dfd6c28da816
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-28 09:36:52 +02:00
João Abecasis
049157f4f1 Silence unused comparison result warnings (clang)
The intent is to force instantiation of template container classes and
semantics or behaviour are otherwise irrelevant in this context.

tst_collections.cpp:3036:15: warning: inequality comparison result unused
tst_collections.cpp:3037:15: warning: equality comparison result unused
tst_collections.cpp:3100:15: warning: inequality comparison result unused
tst_collections.cpp:3101:15: warning: equality comparison result unused

Change-Id: I70ad38b18dcbc43879e36a34b1da460aee5f7b07
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-28 09:36:43 +02:00
João Abecasis
9596f591b6 Fix loop conditions, after warnings from clang
tst_qmap.cpp:697:43: warning: inequality comparison result unused
tst_qmap.cpp:717:50: warning: inequality comparison result unused

Change-Id: I300f9e10b7748306b99c3c8c38f3cc2661a569ad
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-28 09:36:33 +02:00
Thiago Macieira
bc4f74f586 Don't hardcode the order of elements in QHashes
Instead use QMap if we want a stable order.

Task-number: QTBUG-24995
Change-Id: I93f643df236f5078768f539615fa47163e5262e8
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-28 04:07:16 +02:00
Thiago Macieira
2cf466312b Unit-test the additional QBasicAtomicXXX expansions
Test that they do expand properly and don't produce errors. This is
templated code, so it doesn't get tested fully unless we instantiate
them.

Also check that the alignments are correct.

Change-Id: I2a8ee2165167f54b652b4227411e209850974b8e
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-28 02:16:39 +02:00
Stephen Kelly
dc6a1d186e Remove workaround for QComboBox not having a USER property.
QComboBox does in fact have a user property
since b1b87a73012342dc1619a8e907ea9954d59ca564.

Change-Id: I24eb2ef267cec5d8a9f7348954b703fa6df04fa5
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: David Faure <faure@kde.org>
2012-03-28 02:02:07 +02:00
Stephen Kelly
c3e1abad4e Add USER properties to QDateEdit and QTimeEdit.
Both classes had such components before, but there were issues with
the NOTIFY signal not being in the same class as the Q_PROPERTY.

This patch solves that problem by using a signal of a different name.

Task-number: QTBUG-15731
Change-Id: Ibc7ce4dba8a6b88c05d62a90e14d0101c5cd3082
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2012-03-28 02:01:49 +02:00
João Abecasis
2e92714090 Make QTranslator testcase independent of Widgets
There isn't really a need for the dependency as LanguageChange events can be
caught in QObject::eventFilter, directly.

Change-Id: I39778fbe1663924d97705b514ae399cfd3749776
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-28 00:44:16 +02:00
Kent Hansen
d236fe2214 Merge master into api_changes
Conflicts:
	src/corelib/global/qisenum.h
	src/dbus/qdbusconnection_p.h
	src/widgets/kernel/qwidget.cpp
	tests/auto/other/qaccessibility/tst_qaccessibility.cpp

Change-Id: I85102515d5fec835832cc20ffdc5c1ba578bd01d
2012-03-27 19:22:48 +02:00
Rohan McGovern
4c655bef5e Mark tst_qdialog as insignificant on mac.
This autotest gives different results on consecutive runs, and is
therefore insignificant for the purpose of detecting regressions.

Task-number: QTBUG-24977
Change-Id: I5c4dfd663ce5df6b60ae47a29d332c06e3c0585f
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-03-27 03:36:33 +02:00
Bradley T. Hughes
9581e5895a Cocoa: don't show window when calling raise()
Calling raise() on a hidden window should not show it. The setVisible()
function will ensure that the window is raised (since we use orderFront
or makeKeyAndOrderFront). This fixes the failing
tst_QDockWidget::task169808_setFloating() test as well.

Task-number: QTBUG-24774
Change-Id: If34472ebbcd615c10654efafd54c84c03d10bc8c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-26 11:41:07 +02:00
Lars Knoll
8660f6e385 Fix measurement system for the UK
THe UK still uses the Imperial system at least for distances
and many other things.

Change-Id: I99379de35620114328ad6a7fc9b226a46692bedd
Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
2012-03-26 11:41:07 +02:00
Pekka Vuorela
bc0b37d6b6 Password editor mask delay stylable by platform plugin
Replaced hard coding as QT_GUI_PASSWORD_ECHO_DELAY with
a style hint.

Change-Id: I0b78ebad723dbe19d9b9496583203e31545874e2
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-26 11:41:07 +02:00
Laszlo Agocs
083052933f Test mouse events more thoroughly in QWindow autotest
Apparently there are still issues here and there (e.g. in declarative)
with properly recognizing more complex event sequences (like triple
clicks). The behavior of qtbase is correct but we need a test case
that makes sure the functionality will not regress.

Change-Id: I08c558fcfdde0dd06e194b4f0affc6f6896573bf
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-26 11:41:07 +02:00
Bradley T. Hughes
b2363a935c Fix QGuiApplication::keyboardModifiers()
Make sure that the keybaord modifiers are maintained properly when
handling window system events.

Change-Id: Ie75cbe5eb509c29e3d2291694f2de509fbf3098a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-26 08:47:48 +02:00
Kurt Korbatits
1dc7aed0e9 Fixed qthreadstorage unittest to work from install directory
- Added install of crashonexit sub program

Change-Id: I2cc3043d5c1b879665930552487b4fe54407fd25
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2012-03-26 03:42:10 +02:00
Thiago Macieira
1904970dad Work around what apparently is a GCC 4.6.0 bug
The QFlags::operator int() isn't being called, so GCC complains that
this isn't an integer expression.

Change-Id: I537d06fd4a52ecbcddf0ef67807b298c42d3e911
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-03-25 15:09:52 +02:00
João Abecasis
fe778b94bd Enable endianness conversions on q(u)int8
Lack of support for these types is not a real issue as endian
conversions on byte-sized types are no-ops. Still, the conversions are
useful as they facilitate writing of generic code. They can also be used
explicitly as a way to document in code an endian-specific binary
format:

     uchar *data;
     quint8 tag = qFromLittleEndian<quint8>(data++);
     quint32 size = qFromLittleEndian<quint32>(data);

This commit also adds a test for functions documented in the QtEndian
header.

Change-Id: I2f6c876ce89d2adb8c03a1c8a25921d225bf6f92
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-25 13:12:24 +02:00
Frederik Gladhorn
b4ec690bbd Improve accessibility test to handle more text events.
Change-Id: I67ece6c9bb755e84c786b32e8e3396eaf634fda1
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-25 08:27:53 +02:00
David Faure
518a4cb5ab Restore Qt4 compat in QDesktopServices::DataLocation
"/data/" was appended to the base directory.

Change-Id: I220f2ce74c36b795bc49c7c84106feb0709d1547
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-24 19:07:22 +01:00
Jędrzej Nowacki
552e162a67 Update QLocale data from CLDR v1.8.1 to CLDR v1.9.1
Change-Id: Ic84bbc82b364b92605c1bba64b6ec815bff970cb
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-24 18:32:16 +01:00
Thiago Macieira
7e1aec215d QPrinterInfo: remove a test that is too early
If we want to have any chance of getting the missing printers
reported, we cannot check the size beforehand.

Change-Id: I450897fe53c04aeb1a4b217bd0c1f548c455a428
Reviewed-by: John Layt <jlayt@kde.org>
2012-03-24 17:07:52 +01:00
Thiago Macieira
387ec9c2a3 Fix compilation of tst_QSqlThread: no need to use QBasicAtomicInt here
Change-Id: Ib474fe62501ee1ee5e3d7008c3b561f8db79265c
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-24 17:07:52 +01:00
Frederik Gladhorn
cea1a6bcd5 Make sure windows send accessibility activated updates.
Both QWindow and QWidgetWindow should update with the
active state signal.

Change-Id: I0219f803aa0fb109765f0faa0aedb120c2a439f0
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-24 17:07:52 +01:00
Frederik Gladhorn
f195a8e2b6 Added QAccessibleGroupBox
Added a new accessible interface for QGroupBox, as QAccessibleDisplay
is not good enough when the QGroupBox is checkable.
AccessibleFactory was modified to return a QAccessibleGroupBox when
the accessible interface of a QGroupBox is requested.

Created tst_QAccessibility::groupBoxTest

Port to Qt5 of the patch by José Millán Soto <fid@gpul.org>

Change-Id: I6c23dcf5562b3ea269b04102e78463b65827188a
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
(cherry picked from commit c03ceb203c65d9e3485fad848bfc0c4b6ee3e9aa)
2012-03-24 15:10:00 +01:00
Jan-Arve Saether
015bc43da0 API cleanup: remove CoordinateType enum
The bridge can do the mapping to and from screen position.
This is now done in the windows bridge.

Change-Id: I5ca5df0fbeeb58202539f55a0f62717fb1685092
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
2012-03-24 11:53:49 +01:00
Thiago Macieira
d8ddc8ae89 Add the Q_CORE_EXPORT macros to unit-test-exported code
Change-Id: If21658bd5e4af0fdcc403b054fc1b8f46b5fcfb0
Reviewed-by: David Faure <faure@kde.org>
2012-03-23 19:43:00 +01:00
João Abecasis
accfdc85e5 Fallback implementation of Q_ALIGNOF
For all practical purposes, the fallback introduced here returns the
desired value. Having a fallback enables unconditional use of Q_ALIGNOF.

For compilers that provide native support for it, Q_ALIGNOF is otherwise
 #defined in qcompilerdetection.h.

Change-Id: Ie148ca8936cbbf8b80fe87771a14797c39a9d30c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-23 19:43:00 +01:00
Jędrzej Nowacki
98c3b8a442 Add test cases to tst_QByteArray
Internally we construct QByteArrays from QStaticByteArrays. For example
moc is generating QStaticByteArray structure for every string it saves.
New test cases check if a QByteArray constructed from a QStaticByteArray
behaves as a not statically constructed one.

Change-Id: Ia4aa9a1a5bc0209507636c683a782dda00eae85c
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-23 16:43:43 +01:00
Kent Hansen
425b38ef95 Merge "Merge master into api_changes" into refs/staging/api_changes 2012-03-23 14:31:28 +01:00
Kent Hansen
3b512ae142 Merge master into api_changes
Change-Id: I93551e4d13a1b0815b359b9415060e9089477db1
2012-03-23 14:10:58 +01:00
Debao Zhang
2f2b783214 Remove QWorkspace.
QWorkspace had been called Q3Workspace before Qt4.0 finally released.
In a sense, it is a Qt3 support Widget. And QWorkspace has been
deprecated and replaced by QMdiArea at Qt4.3.

Change-Id: Iea1bf831c9960c23c2b21d51fdc7c13b303642ea
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-23 13:22:10 +01:00
Debao Zhang
f31e614245 Cleanup Q3* items
Cleanup Q3* items from QtCore and QtGui modules.

Change-Id: Id214a077a50e99d820c84e96e34866492a0130d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-23 13:21:57 +01:00
Friedemann Kleint
3b69fa6bc7 Implement QSystemTrayIcon for X11.
Reimplement using a QWidget. Use X

Change-Id: I7f8326598fb7210d59bc1d682cdada4526d5b6dd
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-23 11:45:25 +01:00
Giuseppe D'Angelo
1fe7e557d7 Remove #if 0 sections from QRegExp autotest
Use QEXPECT_FAIL instead (QRegExp is bugged w.r.t. the specific
test data).

Task-number: QTBUG-22466
Change-Id: Id5af01fa0d5c0536845fd4db19d4264498a8675b
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-03-23 11:45:25 +01:00
Thiago Macieira
e20c473019 Move the UTF-8 data into a separate .cpp so I can use later
This allows me to keep the UTF-8 invalid data in one safe place. I
won't need to copy & paste it.

Change-Id: Icb909d08b7f8d0e1ffbc28e01a0ba0c1fa9dccf0
Reviewed-by: David Faure <faure@kde.org>
2012-03-23 11:22:40 +01:00
Marc Mutz
0defa2782f tst_qsslsocket*: don't inherit from QSharedPointer
QSharedPointer is about to become final.

Instead of inheriting from it to add implicit
conversions to and from QSslSocket*, make
QSslSocketPtr a typedef, and make the
conversions explicit.

Change-Id: I4eebb262ab5aef348f4d676f9e839325d4ed13da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-23 11:22:40 +01:00
Marc Mutz
e5ef496b5b tst_qsharedpointer: don't inherit from QSharedPointer
QSharedPointer is about to be made final. Instead
of inheriting from it to gain access to the
d-pointer, cast it to a layout-compatible struct
and access the pointer from there.

Assert liberally to ensure layout compatibility.

Change-Id: Ifc0fa6a6608e861469286673844325663f4f7fcc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-23 11:22:40 +01:00