Commit Graph

4607 Commits

Author SHA1 Message Date
Marc Mutz
8b4635d895 Clean up tst_QPalette
Remove ctor, dtor, and empty test functions.

Change-Id: I0cf60732258c4470f40ddb258d87f0ac2de64edf
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-07-26 21:13:48 +02:00
David Faure
fd331a5b3a QUrl: fromLocalFile(QString()) should lead to an empty URL.
This is much more useful than the URL "file:", it allows to use
"empty path" and "empty URL" for the same meaning (e.g. not set).

QFileDialog actually uses "file:" though, as the URL for the
"My Computer" item in the sidebar. This patch preserves that.

[ChangeLog][QtCore][QUrl] QUrl::fromLocalFile now returns an empty URL
if the input string is empty.

Change-Id: Ib5ce1a3cdf5f229368e5bcd83c62c1d1ac9f8a17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-07-26 09:49:33 +02:00
Friedemann Kleint
5c275b2751 tst_qgraphicsproxywidget: Fix widget leaks.
Change-Id: I953e308e2380c87a69ca1d22e6ac036c57deccda
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-07-25 15:37:10 +02:00
Friedemann Kleint
2bf4c3db31 tst_qmdiarea: Fix widget leaks.
Change-Id: If2ecf2c080f9eb8416b9a3d4104584681862c266
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-07-25 15:37:03 +02:00
Jędrzej Nowacki
364cf0bf20 Fix QJsonValue comparison.
QJsonValue, while comparing two QJsonArrays, should consult also length
of the arrays, because a different than null base pointer doesn't mean
that an array is not empty.

Change-Id: If76739355a4e74b842e836289565f98d95c006d5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-07-25 15:25:43 +02:00
Jędrzej Nowacki
77d7348be2 Fix QJsonValue comparison.
QJsonValue, while comparing two QJsonObjects, should consult also length
of the objects, because a different than null base pointer doesn't mean
that an object is not empty.

Change-Id: Ibee1849ef9fed15d32f2c8f2aad9b053846e46b7
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-07-25 15:25:29 +02:00
Jędrzej Nowacki
20cf632ad5 Reading QJsonObject property should not modify the object itself.
Before this change such code:

    QJsonObject o;
    o["blah"];

would create property "blah" and assign null value to it, while
this code:

    const QJsonObject o;
    o["blah"];

would not. The change unifies the confusing behavior. Now reading
a non-existing property, is not causing a property to be added
in any visible way.

Internally QJsonObject stores a special hash of undefined, but
referenced values. Such reference is supposed to not live long,
only to the first compacting or assignment.

Change-Id: Ib022acf74ff49bad88d45d65d7093c4281d468f1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-07-25 15:25:17 +02:00
Jędrzej Nowacki
c8edde3b83 Fix QJsonObject const index operator
The operator should always return an undefined values for an empty
object

Change-Id: Ic38f7660d77c64b2d001967bc5109df4185db74a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-07-25 15:25:05 +02:00
Friedemann Kleint
03ff5b35a5 tst_qwidget: Fix top level widget leaks.
Fix tests widgets leaking widgets and ensure it stays
that way by adding a check to cleanup().

Task-number: QTBUG-38858
Change-Id: I77a81d823c68cf0b4e51c2da55b1c473d6e4170b
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-07-25 15:14:27 +02:00
Friedemann Kleint
63da7db055 QLineEdit: Emit textEdited() when the clear button is clicked.
[ChangeLog][QtWidgets][QLineEdit] The signal textEdited() is now
emitted when the user clicks the clear button created by
setClearButtonEnabled() as well.

Task-number: QTBUG-40287
Change-Id: Iacd303ffd1533f27cfa68a6120cdd370e3d31ddc
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-07-24 22:12:29 +02:00
Frederik Gladhorn
a1d2bf257e Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev 2014-07-24 22:37:52 +02:00
Friedemann Kleint
f70031c17b Add checks for widget/window leaks to kernel tests.
Change-Id: I52af87279e37e49ce2206c5c823fe8fb4caef338
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-07-24 19:39:40 +02:00
Olivier Goffart
8d15068911 QSettings: use QSaveFile and QLockFile to write the settings
The old unix locking code is no longer working on unix since it locks on
a file descriptor, but QSaveFile creates a new file, and as a result we
get the lock on the wrong file. Also there is no need to keep the lock
held only for reading as QSaveFile is atomic. It just needs to be held
when doing a read before writing.

As a result, since we don't hold the same lock, there could be a race
with an application running an older version of Qt if they are writing
on the same configuration file.

[ChangeLog][QtCore][QSettings] Fixed data loss while writing the config
to the disk fails.

[ChangeLog][Important behavior changes] The locking mechanism inside
QSettings has changed and is no longer compatible with the one of
previous versions of Qt. There might be corruption if two applications
running different versions of Qt are writing to the same config file
at the same time. You must also now have write permissions in the
directory containing the settings file in order to write settings

Task-number: QTBUG-21739
Change-Id: I0844a5e96c8bc1e1222a3dac6cc48170ca77fe1b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-07-24 18:50:40 +02:00
Alex Trotsenko
df4f334ad0 Rewrite QRingBuffer
QRingBuffer is a fully inlined class used in many I/O classes.
So, it must be as fast and small as possible. To this end, a lot of
unnecessary special cases were replaced by generic structures.

Change-Id: Ic189ced3b200924da158ce511d69d324337d01b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-24 17:31:20 +02:00
Thiago Macieira
4fcd5a3da9 Make QTextStream respect QLocale with OmitGroupSeparators
The default in QTextStream is to use the C locale, so default
QTextStream are not affected. When you set a QLocale on it, the default
was to use group separators (which is the QLocale default too). This
commit makes QTextStream respect a QLocale in which the
OmitGroupSeparators option had been set.

Task-number: QTBUG-39956
Change-Id: I00fbe12fca7f0287c7217deb487ded6582a03b52
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-07-24 01:57:32 +02:00
David Faure
c2cc74f862 tst_qfiledialog: use QStandardPaths test mode
Otherwise, when interrupting the test half-way (e.g. in gdb),
the user's ~/.config/QtProject.conf would be modified.

Change-Id: Id582c4a3fbf0acbed460126fccf0d39b3a09758a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-07-23 20:05:32 +02:00
Thiago Macieira
f07c27eec1 Don't store QLibraryPrivate with empty file names in the global store
They shouldn't exist in the first place. They exist in two cases only:
1) mistake by the user in the QLibrary or QPluginLoader constructors or
setFileName

2) as a kludge for setLoadHints before a file name is set (we need to
store the user's requested hints somewhere)

This is important for the second case, as otherwise all QLibrary and
QPluginLoader objects without a file name would share the setting.

Task-number: QTBUG-39642
Change-Id: Iebff0252fd4d95a1d54caf338d4e2fff4de3b189
Reviewed-by: David Faure <david.faure@kdab.com>
2014-07-23 17:50:31 +02:00
Thiago Macieira
cfaf851e26 Fix a few more race conditions with QLibrary::LoadHints
This commit makes replaces the loadHints member with a setter, a getter
and an atomic variable. The setter will not set anything if the library
has already been loaded.

Task-number: QTBUG-39642
Change-Id: Ibb7692f16d80211b52aaf4dc88db1a989738a24d
Reviewed-by: David Faure <david.faure@kdab.com>
2014-07-23 17:50:23 +02:00
Kai Koehne
ea34893b8f Support setting a default severity level for QLoggingCategory
Allow to alter the default configuration for categories by passing a
message type: All message types with lower severity are disabled in this
category.

This is useful for libraries, which shouldn't mess with the category
registry itself: Setting rules, a category filter ... might cause
conflicts and ordering problems, so this API should be reserved to the
specific application.

For the Qt categories, we have code in the default category filter that
disables the 'debug' category. However, this is hardcoded, and there's no
way so far for other libraries to get the same behavior. With this patch
one can get the same behavior:

Q_LOGGING_CATEGORY(DRIVER_USB_EVENTS, "driver.usb.events", QtWarningMsg);

[ChangeLog][QtCore][Logging] Added QtMsgType argument to QLoggingCategory
constructor and Q_LOGGING_CATEGORY macro that controls the default
category configuration.

Change-Id: Ib2902f755f9f7285d79888ec30e8f3cef95ae628
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
2014-07-23 15:38:10 +02:00
Kai Koehne
e668837b9c QDebugStateSaver: Fix trailing space issues
~QDebug() removes any trailing space if autoInsertSpaces() is true.
However, if one uses QDebugStateSaver the global autoInsertSpaces might
be false, but a space was added by a custom operator<<.

Explicitly check for this in QDebugStateSaverPrivate::restoreState. Remove
any trailing space if the local state asks for adding trailing spaces, but
the original one doesn't. Add a trailing space if the local state doesn't
ask for one, but the global state does.

Change-Id: I243b5c76d5ed2c1ec4820da35ab6e254da1551d9
Reviewed-by: David Faure <david.faure@kdab.com>
2014-07-23 13:33:25 +02:00
Alex Trotsenko
edfac1a9ed Make QRingBuffer::append() not leave empty arrays in buffer list
Change-Id: I4c5af33488a70996299289ec2b953b7bf3b2c428
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-23 07:31:09 +02:00
Simon Sasburg
3905c6f00d Add QFileDevice::MemoryMapFlags::MapPrivateOption flag.
Passing this flag to QFileDevice::map() will allow writes to the mapped memory
without modifying the file that was mapped. These writes will be lost when the
memory is unmapped.

Change-Id: I7d46b044fc370585de8c06fdb4059f1f1be12d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-23 07:20:40 +02:00
Frederik Gladhorn
abd3b8030c Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
	src/widgets/kernel/qwidget_qpa.cpp
	src/widgets/widgets.pro

Change-Id: I697eec936c4e1a6c360edc8f0b472e23c0461ecb
2014-07-22 20:21:19 +02:00
David Faure
6f3bb0aafa tst_qurl: add tests for mailto parsing and toString. No bug.
This was prompted by https://git.reviewboard.kde.org/r/119221

Change-Id: Ia148f07f6d711df533693918bbedfa5e7dc02cd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-07-22 11:01:52 +02:00
BogDan Vatra
b379161565 Android: Add uninstall option.
Uninstall option will uninstall the test afer has been executed.
It is useful when you are using your own phone to execute the tests.

Change-Id: I2a3f6c3a93099d70c98f9ce059da22c409b55843
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2014-07-21 20:38:00 +02:00
BogDan Vatra
e8a97d8743 Android: Use androiddeployqt from qt path.
Change-Id: I085f2b20d1f53e3f5caf0b208f64a75c26a89219
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2014-07-21 20:37:51 +02:00
Eskil Abrahamsen Blomfeldt
e746e2a11a Android: Fix tests in gui/text requiring test data
Several tests require test data to be deployed with the
application. The easiest way to achieve this on Android
is to add them to a qrc file and use the QFINDTESTDATA macro
to look up the files. This fixes several test failures
in the gui/text subdirectory for Android.

Change-Id: If944bb1fc93434a1b2d6487da829d21bd6b84e87
Reviewed-by: BogDan Vatra <bogdan@kde.org>
2014-07-21 09:49:09 +02:00
Friedemann Kleint
a71e285133 Ensure transient parents are top level widgets.
When a dialog was parented on a native child widget,
its window handle was used as a transient parent.
This confused QPlatformWindow::initialGeometry() among
other things. Use top level window as is in Qt 4.

Task-number: QTBUG-40195
Change-Id: Ic82adc276175f92adde825fb2551274351e41f30
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-07-18 09:25:05 +02:00
Nikita Krupenko
feb1afc782 Added stream version into network cache file format
At the moment, there is no stream information in the cache file. This
can lead to a problem when current stream version differs from version
cache file written with.

As an example, if file written with Qt 5.1.1, QTimeDate in the metadata
stored as 13-bytes value, but Qt 5.2 and later can read additional 4
bytes which breaks following data, leading to network request just hangs
forever.

Adding stream version fixes this problem.

As cache format changed, cache version bumped.

Task-number: QTBUG-36219
Change-Id: I467d8c9fda82bcf9302192f51e7a00d2f6a9ff66
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-07-17 11:28:18 +02:00
hjk
c87a894927 RCC: Use macros not defined in qglobal.h
This prevents conflicts in case of link time optimizations or
precompiled headers are used since we don't include qglobal.h
in the generated code.

Change-Id: I4266c8ae38e6eafefd28b3bde5cb725a24d67ea0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-16 17:40:14 +02:00
Kai Koehne
87aceebf42 QDebug: Add resetFormat()
Similar to QTextStream::reset(), this resets the stream format to the
defaults. Its primary use is inside custom operator<< implementations,
where you'd want to have a fixed format regardless of the current
stream state.

Change-Id: I421d76c61f164579bb90cf4195cc5376e2dcf0f3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-15 13:06:38 +02:00
Friedemann Kleint
45854c75aa QGroupBox: Exclude top level widgets from child event handling.
Prevent the QGroupBox from changing the enabled state of
dialogs parented on it.

Task-number: QTBUG-40132
Change-Id: I91cc6ccf5ade0b3a491020ed947d4aceca62d7b6
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2014-07-15 11:24:47 +02:00
Friedemann Kleint
cdba2439f9 QSplitter: Exclude top level widgets from child event handling.
Prevent the splitter from adding them to the layout or showing
them.

Task-number: QTBUG-40132
Change-Id: Ife2be0bbd7e489570ef41f6f72a034b356c65f18
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
2014-07-15 11:24:38 +02:00
Shawn Rutledge
3f47becec0 Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev 2014-07-14 16:44:12 +02:00
David Faure
439ee03fc5 tst_qfiledialog: ease debugging of "directoryEntered not emitted".
It can happen when the sidebar only has only one item, due to
"My Computer" being missing.

Change-Id: I2b38fef45139f1dfa20d88059e56185c3163a833
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-07-14 12:02:34 +02:00
David Faure
564eaa6640 tst_qfiledialog: extend reject-test to test getOpenFileNames etc.
So that this method is at least called once in the test :)

Change-Id: I3b5fc6b7c464d9e56264c709cfa313d475004207
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-07-14 12:02:20 +02:00
Frederik Gladhorn
7c495cfea9 Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
	src/gui/text/qfontengine_qpf2.cpp

Change-Id: Ib04f92c41d0edd55d3aef8fb1708d917fba0f2a8
2014-07-14 10:35:51 +02:00
Friedemann Kleint
a55b01e038 Stabilize tst_QMenu::statusTip().
Instantiate the timer on the stack to prevent it from
interfering with other tests.

Change-Id: I91ffe23b502fcddaeb6d6d3f89ea3d27b083cdb0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-07-14 10:30:48 +02:00
Jędrzej Nowacki
607462019a Speedup qDebug() << QDate(...)
We really do not need to do string parsing there.

Change-Id: Ie2277d9ff0d0445285b7108023941af111d9baca
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-07-14 00:11:35 +02:00
Olivier Goffart
b6bce68a64 Logging: fix support for %{time format} in QT_MESSAGE_PATTERN
This revert commit de1d5815c1 which
wrongly fixed a typo. There is no typo because we use startsWith
with that constant.

Also added a test because the %{time} support was added in commit
93563952d0 but the test was missing

Change-Id: Ic96e6f21f989ca3a2905ec6c89b93d2627b77b40
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2014-07-13 18:20:42 +02:00
Olivier Goffart
9bb493e724 tst_qlogging: put the test for QT_MESSAGE_PATTERN in a data function
Change-Id: I9130b91dfe6bf1ee22431a423ec2d2f9ad62144a
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2014-07-13 18:20:38 +02:00
Olivier Goffart
12a4db710e Revert "Session management for OS X"
Broke tst_QMenu::statusTip by closing the menu while it should not. (and therefore, a QTimer::singleShot that fires while following test are running is making the test fail)

This reverts commit 50c04d6318.

Change-Id: Ib4ef8190f945b915fe268745cc64d471994c5e2d
Reviewed-by: Richard J. Moore <rich@kde.org>
2014-07-13 13:48:19 +02:00
Samuel Gaist
50c04d6318 Session management for OS X
This patch aims to implement the session management available on OS X.
Currently applicationShouldTerminate is just a go through that closes
everything and ends the application. The new implementation calls
first appCommitData and cancels the termination properly if required.
This means that if a user wishes to logout, Qt applications can now
cancel that like e.g. answering to Safari asking whether it is ok to
close because of a number of opened tab/window.

Task-number: QTBUG-33034
Change-Id: Icedc8590a1c0934d9bc87d3a43d6702a9903bfb8
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
2014-07-10 21:54:19 +02:00
Eskil Abrahamsen Blomfeldt
0cbebb21cc Android: Prefer "Droid Serif" as default serif font
I've also updated the qfont test so it passes on Android now. Note that
there are no suitable cursive/fantasy fonts on Android, so the regular
default "Roboto" (or "Droid Sans" on older devices) will be picked here
instead.

[ChangeLog][Android] Fixed font selection to prefer "Droid Serif" when
Serif style hint is set on QFont.

Change-Id: I294eebcc4d79410e435bdddce552acc6044753b2
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
2014-07-10 16:23:50 +02:00
Aleix Pol
52eccc6cfa Introduce a new warning in moc, to notify about duplicated properties
At the moment, it's possible to have 2 properties with the same name,
which doesn't make much sense. Notify the user about that so she can
react on it.

Change-Id: I4865b71730921b79ce9dd8abb0cc760b3f1dbfd8
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
2014-07-10 16:10:59 +02:00
Jędrzej Nowacki
c587e5a4da Improve QString::arg test
The function gives a warning if an argument doesn't exist.

Change-Id: I6a4bbbaf2fd241ced06dc71edfe4ef69732606d1
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
2014-07-10 13:14:51 +02:00
Jędrzej Nowacki
3746eedeab Update QVariant tests
Remove old message handler hack as we have a new and better api to
ignore warning messages.

Change-Id: Id967b2672fe3e3638db9977500118a19c2afb730
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-07-10 13:14:40 +02:00
Frederik Gladhorn
776ddcab2c Merge "Merge remote-tracking branch 'origin/5.3' into dev" into refs/staging/dev 2014-07-10 13:13:55 +02:00
Frederik Gladhorn
f035786021 Merge remote-tracking branch 'origin/5.3' into dev
Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
2014-07-10 10:11:11 +02:00
Eskil Abrahamsen Blomfeldt
1dd9a0af4f Fix fallbacks for adapted common script
When the platform plugin gives us specific fallbacks for a
specific script, we need to respect this, and load the correct
font family regardless of which writing systems it supports.

This is especially important since the common script is adapted
to match surrounding, proper scripts, so characters such as
digits next to e.g. Hebrew text will be marked as Hebrew. On
stock Android, there is a single Hebrew font, and this would
previously be put in all fallback slots for Hebrew regardless of
what fallback fonts were dictated by the platform plugin. Since
this font does not support the digits, they would show up as boxes.

[ChangeLog][Android] Fixed common characters like digits and
punctuation showing as boxes when positioned next to non-latin
scripts.

Task-number: QTBUG-39377
Change-Id: I1555e208a8ddc587c0bbdbfff1600cafdd9442e9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2014-07-10 10:01:49 +02:00