summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-09-29 10:56:05 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-09-29 10:56:05 (GMT)
commit17c17adbd706d32723ecedeb207c7e467f9fa8eb (patch)
tree22d6d314dc7320d0b728578a734d636a1d74d9ae /tests
parent1ff83d2b44fe07d1bc6b243fad270dfa7d860dc7 (diff)
parentdcd185e58face87105f484e98ecb195af0790a22 (diff)
downloadQt-17c17adbd706d32723ecedeb207c7e467f9fa8eb.zip
Qt-17c17adbd706d32723ecedeb207c7e467f9fa8eb.tar.gz
Qt-17c17adbd706d32723ecedeb207c7e467f9fa8eb.tar.bz2
Merge commit 'qt/4.6' into mmfphonon
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro26
-rw-r--r--tests/auto/networkselftest/networkselftest.pro15
-rw-r--r--tests/auto/networkselftest/rfc3252.txt899
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp34
-rw-r--r--tests/auto/q3popupmenu/tst_q3popupmenu.cpp4
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp2
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp34
-rw-r--r--tests/auto/qaudiooutput/tst_qaudiooutput.cpp34
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp10
-rw-r--r--tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp22
-rw-r--r--tests/auto/qdom/tst_qdom.cpp15
-rw-r--r--tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp42
-rw-r--r--tests/auto/qeasingcurve/tst_qeasingcurve.cpp12
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp8
-rw-r--r--tests/auto/qfilesystemmodel/qfilesystemmodel.pro1
-rw-r--r--tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp12
-rw-r--r--tests/auto/qfocusevent/tst_qfocusevent.cpp10
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp47
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp6
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp79
-rw-r--r--tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp12
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp126
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp4
-rw-r--r--tests/auto/qlabel/tst_qlabel.cpp15
-rw-r--r--tests/auto/qmdiarea/tst_qmdiarea.cpp30
-rw-r--r--tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp6
-rw-r--r--tests/auto/qmessagebox/tst_qmessagebox.cpp11
-rw-r--r--tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp4
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp22
-rw-r--r--tests/auto/qprocess/qprocess.pro3
-rw-r--r--tests/auto/qprocess/test/test.pro100
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp23
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp6
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp101
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp11
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp6
-rw-r--r--tests/auto/qsharedmemory/lackey/lackey.pro2
-rw-r--r--tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro6
-rw-r--r--tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp26
-rw-r--r--tests/auto/qsharedmemory/src/qsystemlock_p.h2
-rw-r--r--tests/auto/qsharedmemory/test/test.pro2
-rw-r--r--tests/auto/qsharedmemory/tst_qsharedmemory.cpp10
-rw-r--r--tests/auto/qsharedpointer/externaltests.pri2
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp3
-rw-r--r--tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp54
-rw-r--r--tests/auto/qspinbox/tst_qspinbox.cpp8
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp8
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp4
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp114
-rw-r--r--tests/auto/qsystemsemaphore/test/test.pro2
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp1
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp10
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp103
-rw-r--r--tests/auto/qwindowsurface/tst_qwindowsurface.cpp2
-rw-r--r--tests/auto/windowsmobile/test/testQMenuBar_current.pngbin23702 -> 22964 bytes
-rw-r--r--tests/auto/windowsmobile/test/testSimpleWidget_current.pngbin22034 -> 23841 bytes
-rw-r--r--tests/auto/windowsmobile/test/tst_windowsmobile.cpp17
-rw-r--r--tests/benchmarks/qanimation/rectanimation.cpp4
-rw-r--r--tests/benchmarks/qanimation/rectanimation.h2
59 files changed, 1902 insertions, 272 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index a2e1407..9321e19 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -11,14 +11,7 @@ TEMPLATE = subdirs
moc \
uic \
uic3
-
-SUBDIRS += \
- collections \
- exceptionsafety \
- mediaobject \
-# mediaobject_wince_ds9 \ This is Windows CE only (we test the second phonon backend ds9 here)
- modeltest \
- networkselftest \
+Q3SUBDIRS += \
q3accel \
q3action \
q3actiongroup \
@@ -38,6 +31,7 @@ SUBDIRS += \
q3hbox \
q3header \
q3iconview \
+ q3listbox \
q3listview \
q3listviewitemiterator \
q3mainwindow \
@@ -64,7 +58,15 @@ SUBDIRS += \
q3toolbar \
q3urloperator \
q3valuelist \
- q3valuevector \
+ q3valuevector
+
+SUBDIRS += \
+ collections \
+ exceptionsafety \
+ mediaobject \
+# mediaobject_wince_ds9 \ This is Windows CE only (we test the second phonon backend ds9 here)
+ modeltest \
+ networkselftest \
qabstractbutton \
qabstractitemmodel \
qabstractitemview \
@@ -195,7 +197,6 @@ SUBDIRS += \
qline \
qlineedit \
qlist \
- q3listbox \
qlistview \
qlistwidget \
qlocale \
@@ -397,6 +398,8 @@ SUBDIRS += \
symbols \
qrand \
utf8
+
+!wince*:SUBDIRS += $$Q3SUBDIRS
contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
mac: {
@@ -404,7 +407,8 @@ mac: {
macplist \
qaccessibility_mac
}
-embedded: {
+
+embedded:!wince* {
SUBDIRS += qcopchannel \
qdirectpainter \
qmultiscreen
diff --git a/tests/auto/networkselftest/networkselftest.pro b/tests/auto/networkselftest/networkselftest.pro
index ac610de..b0d537a 100644
--- a/tests/auto/networkselftest/networkselftest.pro
+++ b/tests/auto/networkselftest/networkselftest.pro
@@ -3,3 +3,18 @@ load(qttest_p4)
SOURCES += tst_networkselftest.cpp
QT = core network
+wince*: {
+ addFiles.sources = rfc3252.txt
+ addFiles.path = .
+ DEPLOYMENT = addFiles
+ DEFINES += SRCDIR=\\\"\\\"
+} else:symbian* {
+ addFiles.sources = rfc3252.txt
+ addFiles.path = .
+ DEPLOYMENT = addFiles
+} else:vxworks*: {
+ DEFINES += SRCDIR=\\\"\\\"
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
+
diff --git a/tests/auto/networkselftest/rfc3252.txt b/tests/auto/networkselftest/rfc3252.txt
new file mode 100644
index 0000000..b80c61b
--- /dev/null
+++ b/tests/auto/networkselftest/rfc3252.txt
@@ -0,0 +1,899 @@
+
+
+
+
+
+
+Network Working Group H. Kennedy
+Request for Comments: 3252 Mimezine
+Category: Informational 1 April 2002
+
+
+ Binary Lexical Octet Ad-hoc Transport
+
+Status of this Memo
+
+ This memo provides information for the Internet community. It does
+ not specify an Internet standard of any kind. Distribution of this
+ memo is unlimited.
+
+Copyright Notice
+
+ Copyright (C) The Internet Society (2002). All Rights Reserved.
+
+Abstract
+
+ This document defines a reformulation of IP and two transport layer
+ protocols (TCP and UDP) as XML applications.
+
+1. Introduction
+
+1.1. Overview
+
+ This document describes the Binary Lexical Octet Ad-hoc Transport
+ (BLOAT): a reformulation of a widely-deployed network-layer protocol
+ (IP [RFC791]), and two associated transport layer protocols (TCP
+ [RFC793] and UDP [RFC768]) as XML [XML] applications. It also
+ describes methods for transporting BLOAT over Ethernet and IEEE 802
+ networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
+ across the public Internet.
+
+1.2. Motivation
+
+ The wild popularity of XML as a basis for application-level protocols
+ such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
+ Object Access Protocol [SOAP], and Jabber [JABBER] prompted
+ investigation into the possibility of extending the use of XML in the
+ protocol stack. Using XML at both the transport and network layer in
+ addition to the application layer would provide for an amazing amount
+ of power and flexibility while removing dependencies on proprietary
+ and hard-to-understand binary protocols. This protocol unification
+ would also allow applications to use a single XML parser for all
+ aspects of their operation, eliminating developer time spent figuring
+ out the intricacies of each new protocol, and moving the hard work of
+
+
+
+
+Kennedy Informational [Page 1]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ parsing to the XML toolset. The use of XML also mitigates concerns
+ over "network vs. host" byte ordering which is at the root of many
+ network application bugs.
+
+1.3. Relation to Existing Protocols
+
+ The reformulations specified in this RFC follow as closely as
+ possible the spirit of the RFCs on which they are based, and so MAY
+ contain elements or attributes that would not be needed in a pure
+ reworking (e.g. length attributes, which are implicit in XML.)
+
+ The layering of network and transport protocols are maintained in
+ this RFC despite the optimizations that could be made if the line
+ were somewhat blurred (i.e. merging TCP and IP into a single, larger
+ element in the DTD) in order to foster future use of this protocol as
+ a basis for reformulating other protocols (such as ICMP.)
+
+ Other than the encoding, the behavioral aspects of each of the
+ existing protocols remain unchanged. Routing, address spaces, TCP
+ congestion control, etc. behave as specified in the extant standards.
+ Adapting to new standards and experimental algorithm heuristics for
+ improving performance will become much easier once the move to BLOAT
+ has been completed.
+
+1.4. Requirement Levels
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
+ document are to be interpreted as described in BCP 14, RFC 2119
+ [RFC2119].
+
+2. IPoXML
+
+ This protocol MUST be implemented to be compliant with this RFC.
+ IPoXML is the root protocol REQUIRED for effective use of TCPoXML
+ (section 3.) and higher-level application protocols.
+
+ The DTD for this document type can be found in section 7.1.
+
+ The routing of IPoXML can be easily implemented on hosts with an XML
+ parser, as the regular structure lends itself handily to parsing and
+ validation of the document/datagram and then processing the
+ destination address, TTL, and checksum before sending it on to its
+ next-hop.
+
+ The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
+ wider deployment of IPv4 and the fact that implementing IPv6 as XML
+ would have exceeded the 1500 byte Ethernet MTU.
+
+
+
+Kennedy Informational [Page 2]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ All BLOAT implementations MUST use - and specify - the UTF-8 encoding
+ of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
+ formed and include the XMLDecl.
+
+2.1. IP Description
+
+ A number of items have changed (for the better) from the original IP
+ specification. Bit-masks, where present have been converted into
+ human-readable values. IP addresses are listed in their dotted-
+ decimal notation [RFC1123]. Length and checksum values are present
+ as decimal integers.
+
+ To calculate the length and checksum fields of the IP element, a
+ canonicalized form of the element MUST be used. The canonical form
+ SHALL have no whitespace (including newline characters) between
+ elements and only one space character between attributes. There
+ SHALL NOT be a space following the last attribute in an element.
+
+ An iterative method SHOULD be used to calculate checksums, as the
+ length field will vary based on the size of the checksum.
+
+ The payload element bears special attention. Due to the character
+ set restrictions of XML, the payload of IP datagrams (which MAY
+ contain arbitrary data) MUST be encoded for transport. This RFC
+ REQUIRES the contents of the payload to be encoded in the base-64
+ encoding of RFC 2045 [RFC2045], but removes the requirement that the
+ encoded output MUST be wrapped on 76-character lines.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Kennedy Informational [Page 3]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+2.2. Example Datagram
+
+ The following is an example IPoXML datagram with an empty payload:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
+ <ip>
+ <header length="474">
+ <version value="4"/>
+ <tos precedence="Routine" delay="Normal" throughput="Normal"
+ relibility="Normal" reserved="0"/>
+ <total.length value="461"/>
+ <id value="1"/>
+ <flags reserved="0" df="dont" mf="last"/>
+ <offset value="0"/>
+ <ttl value="255"/>
+ <protocol value="6"/>
+ <checksum value="8707"/>
+ <source address="10.0.0.22"/>
+ <destination address="10.0.0.1"/>
+ <options>
+ <end copied="0" class="0" number="0"/>
+ </options>
+ <padding pad="0"/>
+ </header>
+ <payload>
+ </payload>
+ </ip>
+
+3. TCPoXML
+
+ This protocol MUST be implemented to be compliant with this RFC. The
+ DTD for this document type can be found in section 7.2.
+
+3.1. TCP Description
+
+ A number of items have changed from the original TCP specification.
+ Bit-masks, where present have been converted into human-readable
+ values. Length and checksum and port values are present as decimal
+ integers.
+
+ To calculate the length and checksum fields of the TCP element, a
+ canonicalized form of the element MUST be used as in section 2.1.
+
+ An iterative method SHOULD be used to calculate checksums as in
+ section 2.1.
+
+ The payload element MUST be encoded as in section 2.1.
+
+
+
+Kennedy Informational [Page 4]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ The TCP offset element was expanded to a maximum of 255 from 16 to
+ allow for the increased size of the header in XML.
+
+ TCPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
+ as well as the <!DOCTYPE> declaration.
+
+3.2. Example Datagram
+
+ The following is an example TCPoXML datagram with an empty payload:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
+ <tcp>
+ <tcp.header>
+ <src port="31415"/>
+ <dest port="42424"/>
+ <sequence number="322622954"/>
+ <acknowledgement number="689715995"/>
+ <offset number=""/>
+ <reserved value="0"/>
+ <control syn="1" ack="1"/>
+ <window size="1"/>
+ <urgent pointer="0"/>
+ <checksum value="2988"/>
+ <tcp.options>
+ <tcp.end kind="0"/>
+ </tcp.options>
+ <padding pad="0"/>
+ </tcp.header>
+ <payload>
+ </payload>
+ </tcp>
+
+4. UDPoXML
+
+ This protocol MUST be implemented to be compliant with this RFC. The
+ DTD for this document type can be found in section 7.3.
+
+4.1. UDP Description
+
+ A number of items have changed from the original UDP specification.
+ Bit-masks, where present have been converted into human-readable
+ values. Length and checksum and port values are present as decimal
+ integers.
+
+
+
+
+
+
+
+Kennedy Informational [Page 5]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ To calculate the length and checksum fields of the UDP element, a
+ canonicalized form of the element MUST be used as in section 2.1. An
+ iterative method SHOULD be used to calculate checksums as in section
+ 2.1.
+
+ The payload element MUST be encoded as in section 2.1.
+
+ UDPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
+ as well as the <!DOCTYPE> declaration.
+
+4.2. Example Datagram
+
+ The following is an example UDPoXML datagram with an empty payload:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
+ <udp>
+ <udp.header>
+ <src port="31415"/>
+ <dest port="42424"/>
+ <udp.length value="143"/>
+ <checksum value="2988"/>
+ </udp.header>
+ <payload>
+ </payload>
+ </udp>
+
+5. Network Transport
+
+ This document provides for the transmission of BLOAT datagrams over
+ two common families of physical layer transport. Future RFCs will
+ address additional transports as routing vendors catch up to the
+ specification, and we begin to see BLOAT routed across the Internet
+ backbone.
+
+5.1. Ethernet
+
+ BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
+ exception that the type field of the Ethernet frame MUST contain the
+ value 0xBEEF. The first 5 octets of the Ethernet frame payload will
+ be 0x3c 3f 78 6d 6c ("<?xml".)
+
+5.2. IEEE 802
+
+ BLOAT is encapsulated in IEEE 802 Networks as in [RFC1042] except
+ that the protocol type code for IPoXML is 0xBEEF.
+
+
+
+
+
+Kennedy Informational [Page 6]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+6. Gatewaying over IP
+
+ In order to facilitate the gradual introduction of BLOAT into the
+ public Internet, BLOAT MAY be encapsulated in IP as in [RFC2003] to
+ gateway between networks that run BLOAT natively on their LANs.
+
+7. DTDs
+
+ The Transport DTDs (7.2. and 7.3.) build on the definitions in the
+ Network DTD (7.1.)
+
+ The DTDs are referenced by their PubidLiteral and SystemLiteral (from
+ [XML]) although it is understood that most IPoXML implementations
+ will not need to pull down the DTD, as it will normally be embedded
+ in the implementation, and presents something of a catch-22 if you
+ need to load part of your network protocol over the network.
+
+7.1. IPoXML DTD
+
+ <!--
+ DTD for IP over XML.
+ Refer to this DTD as:
+
+ <!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
+ -->
+ <!--
+ DTD data types:
+
+ Digits [0..9]+
+
+ Precedence "NetworkControl | InternetworkControl |
+ CRITIC | FlashOverride | Flash | Immediate |
+ Priority | Routine"
+
+ IP4Addr "dotted-decimal" notation of [RFC1123]
+
+ Class [0..3]
+
+ Sec "Unclassified | Confidential | EFTO | MMMM | PROG |
+ Restricted | Secret | Top Secret | Reserved"
+
+ Compartments [0..65535]
+
+ Handling [0..65535]
+
+ TCC [0..16777216]
+
+ -->
+
+
+
+Kennedy Informational [Page 7]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ENTITY % Digits "CDATA">
+ <!ENTITY % Precedence "CDATA">
+ <!ENTITY % IP4Addr "CDATA">
+ <!ENTITY % Class "CDATA">
+ <!ENTITY % Sec "CDATA">
+ <!ENTITY % Compartments "CDATA">
+ <!ENTITY % Handling "CDATA">
+ <!ENTITY % TCC "CDATA">
+
+ <!ELEMENT ip (header, payload)>
+
+ <!ELEMENT header (version, tos, total.length, id, flags, offset, ttl,
+ protocol, checksum, source, destination, options,
+ padding)>
+ <!-- length of header in 32-bit words -->
+ <!ATTLIST header
+ length %Digits; #REQUIRED>
+
+ <!ELEMENT version EMPTY>
+ <!-- ip version. SHOULD be "4" -->
+ <!ATTLIST version
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT tos EMPTY>
+ <!ATTLIST tos
+ precedence %Precedence; #REQUIRED
+ delay (normal | low) #REQUIRED
+ throughput (normal | high) #REQUIRED
+ relibility (normal | high) #REQUIRED
+ reserved CDATA #FIXED "0">
+
+ <!ELEMENT total.length EMPTY>
+ <!--
+ total length of datagram (header and payload) in octets, MUST be
+ less than 65,535 (and SHOULD be less than 1024 for IPoXML on local
+ ethernets).
+ -->
+ <!ATTLIST total.length
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT id EMPTY>
+ <!-- 0 <= id <= 65,535 -->
+ <!ATTLIST id
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT flags EMPTY>
+ <!-- df = don't fragment, mf = more fragments -->
+ <!ATTLIST flags
+
+
+
+Kennedy Informational [Page 8]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ reserved CDATA #FIXED "0"
+ df (may|dont) #REQUIRED
+ mf (last|more) #REQUIRED>
+
+ <!ELEMENT offset EMPTY>
+ <!-- 0 <= offset <= 8192 measured in 8 octet (64-bit) chunks -->
+ <!ATTLIST offset
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT ttl EMPTY>
+ <!-- 0 <= ttl <= 255 -->
+ <!ATTLIST ttl
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT protocol EMPTY>
+ <!-- 0 <= protocol <= 255 (per IANA) -->
+ <!ATTLIST protocol
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT checksum EMPTY>
+ <!-- 0 <= checksum <= 65535 (over header only) -->
+ <!ATTLIST checksum
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT source EMPTY>
+ <!ATTLIST source
+ address %IP4Addr; #REQUIRED>
+
+ <!ELEMENT destination EMPTY>
+ <!ATTLIST destination
+ address %IP4Addr; #REQUIRED>
+
+ <!ELEMENT options ( end | noop | security | loose | strict | record
+ | stream | timestamp )*>
+
+ <!ELEMENT end EMPTY>
+ <!ATTLIST end
+ copied (0|1) #REQUIRED
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "0">
+
+ <!ELEMENT noop EMPTY>
+ <!ATTLIST noop
+ copied (0|1) #REQUIRED
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "1">
+
+ <!ELEMENT security EMPTY>
+
+
+
+Kennedy Informational [Page 9]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ATTLIST security
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "2"
+ length CDATA #FIXED "11"
+ security %Sec; #REQUIRED
+ compartments %Compartments; #REQUIRED
+ handling %Handling; #REQUIRED
+ tcc %TCC; #REQUIRED>
+ <!ELEMENT loose (hop)+>
+ <!ATTLIST loose
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "3"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT hop EMPTY>
+ <!ATTLIST hop
+ address %IP4Addr; #REQUIRED>
+
+ <!ELEMENT strict (hop)+>
+ <!ATTLIST strict
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "9"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT record (hop)+>
+ <!ATTLIST record
+ copied CDATA #FIXED "0"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "7"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT stream EMPTY>
+ <!-- 0 <= id <= 65,535 -->
+ <!ATTLIST stream
+ copied CDATA #FIXED "1"
+ class CDATA #FIXED "0"
+ number CDATA #FIXED "8"
+ length CDATA #FIXED "4"
+ id %Digits; #REQUIRED>
+
+ <!ELEMENT timestamp (tstamp)+>
+ <!-- 0 <= oflw <=15 -->
+
+
+
+Kennedy Informational [Page 10]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ATTLIST timestamp
+ copied CDATA #FIXED "0"
+ class CDATA #FIXED "2"
+ number CDATA #FIXED "4"
+ length %Digits; #REQUIRED
+ pointer %Digits; #REQUIRED
+ oflw %Digits; #REQUIRED
+ flag (0 | 1 | 3) #REQUIRED>
+
+ <!ELEMENT tstamp EMPTY>
+ <!ATTLIST tstamp
+ time %Digits; #REQUIRED
+ address %IP4Addr; #IMPLIED>
+ <!--
+ padding to bring header to 32-bit boundary.
+ pad MUST be "0"*
+ -->
+ <!ELEMENT padding EMPTY>
+ <!ATTLIST padding
+ pad CDATA #REQUIRED>
+
+ <!-- payload MUST be encoded as base-64 [RFC2045], as modified
+ by section 2.1 of this RFC -->
+ <!ELEMENT payload (CDATA)>
+
+7.2. TCPoXML DTD
+
+ <!--
+ DTD for TCP over XML.
+ Refer to this DTD as:
+
+ <!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
+ -->
+
+ <!-- the pseudoheader is only included for checksum calculations -->
+ <!ELEMENT tcp (tcp.pseudoheader?, tcp.header, payload)>
+
+ <!ELEMENT tcp.header (src, dest, sequence, acknowledgement, offset,
+ reserved, control, window, checksum, urgent,
+ tcp.options, padding)>
+
+ <!ELEMENT src EMPTY>
+ <!-- 0 <= port <= 65,535 -->
+ <!ATTLIST src
+ port %Digits; #REQUIRED>
+
+ <!ELEMENT dest EMPTY>
+ <!-- 0 <= port <= 65,535 -->
+
+
+
+Kennedy Informational [Page 11]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ATTLIST dest
+ port %Digits; #REQUIRED>
+
+ <!ELEMENT sequence EMPTY>
+ <!-- 0 <= number <= 4294967295 -->
+ <!ATTLIST sequence
+ number %Digits; #REQUIRED>
+
+ <!ELEMENT acknowledgement EMPTY>
+ <!-- 0 <= number <= 4294967295 -->
+ <!ATTLIST acknowledgement
+ number %Digits; #REQUIRED>
+
+ <!ELEMENT offset EMPTY>
+ <!-- 0 <= number <= 255 -->
+ <!ATTLIST offset
+ number %Digits; #REQUIRED>
+
+ <!ELEMENT reserved EMPTY>
+ <!ATTLIST reserved
+ value CDATA #FIXED "0">
+
+ <!ELEMENT control EMPTY>
+ <!ATTLIST control
+ urg (0|1) #IMPLIED
+ ack (0|1) #IMPLIED
+ psh (0|1) #IMPLIED
+ rst (0|1) #IMPLIED
+ syn (0|1) #IMPLIED
+ fin (0|1) #IMPLIED>
+
+ <!ELEMENT window EMPTY>
+ <!-- 0 <= size <= 65,535 -->
+ <!ATTLIST window
+ size %Digits; #REQUIRED>
+
+ <!--
+ checksum as in ip, but with
+ the following pseudo-header added into the tcp element:
+ -->
+ <!ELEMENT tcp.pseudoheader (source, destination, protocol,
+ tcp.length)>
+
+ <!--
+ tcp header + data length in octets. does not include the size of
+
+ the pseudoheader.
+ -->
+
+
+
+Kennedy Informational [Page 12]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ <!ELEMENT tcp.length EMPTY>
+ <!ATTLIST tcp.length
+ value %Digits; #REQUIRED>
+
+ <!ELEMENT urgent EMPTY>
+ <!-- 0 <= pointer <= 65,535 -->
+ <!ATTLIST urgent
+ pointer %Digits; #REQUIRED>
+
+ <!ELEMENT tcp.options (tcp.end | tcp.noop | tcp.mss)+>
+
+ <!ELEMENT tcp.end EMPTY>
+ <!ATTLIST tcp.end
+ kind CDATA #FIXED "0">
+
+ <!ELEMENT tcp.noop EMPTY>
+ <!ATTLIST tcp.noop
+ kind CDATA #FIXED "1">
+
+ <!ELEMENT tcp.mss EMPTY>
+ <!ATTLIST tcp.mss
+ kind CDATA #FIXED "2"
+ length CDATA #FIXED "4"
+ size %Digits; #REQUIRED>
+
+7.3. UDPoXML DTD
+
+ <!--
+ DTD for UDP over XML.
+ Refer to this DTD as:
+
+ <!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
+ -->
+
+ <!ELEMENT udp (udp.pseudoheader?, udp.header, payload)>
+
+ <!ELEMENT udp.header (src, dest, udp.length, checksum)>
+
+ <!ELEMENT udp.pseudoheader (source, destination, protocol,
+ udp.length)>
+
+ <!--
+ udp header + data length in octets. does not include the size of
+ the pseudoheader.
+ -->
+ <!ELEMENT udp.length EMPTY>
+ <!ATTLIST udp.length
+ value %Digits; #REQUIRED>
+
+
+
+Kennedy Informational [Page 13]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+8. Security Considerations
+
+ XML, as a subset of SGML, has the same security considerations as
+ specified in SGML Media Types [RFC1874]. Security considerations
+ that apply to IP, TCP and UDP also likely apply to BLOAT as it does
+ not attempt to correct for issues not related to message format.
+
+9. References
+
+ [JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
+ February 2002. (Work in Progress)
+
+ [RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
+ August 1980.
+
+ [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
+ September 1981.
+
+ [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
+ 793, September 1981.
+
+ [RFC894] Hornig, C., "Standard for the Transmission of IP
+ Datagrams over Ethernet Networks.", RFC 894, April 1984.
+
+ [RFC1042] Postel, J. and J. Reynolds, "Standard for the
+ Transmission of IP Datagrams Over IEEE 802 Networks", STD
+ 43, RFC 1042, February 1988.
+
+ [RFC1123] Braden, R., "Requirements for Internet Hosts -
+ Application and Support", RFC 1123, October 1989.
+
+ [RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
+ 1995.
+
+ [RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
+ October 1996.
+
+ [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
+ Extensions (MIME) Part One: Format of Internet Message
+ Bodies", RFC 2045, November 1996.
+
+ [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
+ Requirement Levels", BCP 14, RFC 2119, March 1997.
+
+ [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
+ 10646", RFC 2279, January 1998.
+
+
+
+
+
+Kennedy Informational [Page 14]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+ [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
+ (IPv6) Specification", RFC 2460, December 1998.
+
+ [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
+ RFC 3080, March 2001.
+
+ [SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
+ Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
+ "Simple Object Access Protocol (SOAP) 1.1" World Wide Web
+ Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
+
+ [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
+ Markup Language (XML)" World Wide Web Consortium
+ Recommendation REC- xml-19980210.
+ http://www.w3.org/TR/1998/REC-xml-19980210
+
+10. Author's Address
+
+ Hugh Kennedy
+ Mimezine
+ 1060 West Addison
+ Chicago, IL 60613
+ USA
+
+ EMail: kennedyh@engin.umich.edu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Kennedy Informational [Page 15]
+
+RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
+
+
+11. Full Copyright Statement
+
+ Copyright (C) The Internet Society (2002). All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that the above copyright notice and this paragraph are
+ included on all such copies and derivative works. However, this
+ document itself may not be modified in any way, such as by removing
+ the copyright notice or references to the Internet Society or other
+ Internet organizations, except as needed for the purpose of
+ developing Internet standards in which case the procedures for
+ copyrights defined in the Internet Standards process must be
+ followed, or as required to translate it into languages other than
+ English.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked by the Internet Society or its successors or assigns.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+ TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+ BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+ HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+Acknowledgement
+
+ Funding for the RFC Editor function is currently provided by the
+ Internet Society.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Kennedy Informational [Page 16]
+
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index 00ccadb..4e60101 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -41,6 +41,14 @@
#include <QtTest/QtTest>
#include <QtNetwork/QtNetwork>
+
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Current path (C:\private\<UID>) contains only ascii chars
+//#define SRCDIR QDir::currentPath()
+#define SRCDIR "."
+#endif
+
#include "../network-settings.h"
class tst_NetworkSelfTest: public QObject
@@ -57,6 +65,7 @@ private slots:
void serverReachability();
void remotePortsOpen_data();
void remotePortsOpen();
+ void fileLineEndingTest();
// specific protocol tests
void ftpServer();
@@ -392,6 +401,31 @@ void tst_NetworkSelfTest::remotePortsOpen()
QVERIFY(socket.state() == QAbstractSocket::ConnectedState);
}
+
+void tst_NetworkSelfTest::fileLineEndingTest()
+{
+ QString referenceName = SRCDIR "/rfc3252.txt";
+ long long expectedReferenceSize = 25962;
+
+ QString lineEndingType("LF");
+
+ QFile reference(referenceName);
+ QVERIFY(reference.open(QIODevice::ReadOnly));
+ QByteArray byteLine = reference.readLine();
+ if(byteLine.endsWith("\r\n"))
+ lineEndingType = "CRLF";
+ else if(byteLine.endsWith("\r"))
+ lineEndingType = "CR";
+
+ QString referenceAsTextData;
+ QFile referenceAsText(referenceName);
+ QVERIFY(referenceAsText.open(QIODevice::ReadOnly));
+ referenceAsTextData = referenceAsText.readAll();
+
+ QVERIFY2(expectedReferenceSize == referenceAsTextData.length(), QString("Reference file %1 has %2 as line ending and file size not matching - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit());
+ QVERIFY2(!lineEndingType.compare("LF"), QString("Reference file %1 has %2 as line ending - Git checkout issue !?!").arg(referenceName, lineEndingType).toLocal8Bit());
+}
+
static QList<Chat> ftpChat()
{
return QList<Chat>() << Chat::expect("220")
diff --git a/tests/auto/q3popupmenu/tst_q3popupmenu.cpp b/tests/auto/q3popupmenu/tst_q3popupmenu.cpp
index 5585c3a..df8573d 100644
--- a/tests/auto/q3popupmenu/tst_q3popupmenu.cpp
+++ b/tests/auto/q3popupmenu/tst_q3popupmenu.cpp
@@ -135,11 +135,11 @@ void tst_Q3PopupMenu::task177490_highlighted()
QTest::mouseMove(&menu1, QPoint(x, y1));
QTest::mouseMove(&menu1, QPoint(x, y1 + 1));
- QTest::qWait(100);
+ QTest::qWait(1000);
QTest::mouseMove(&menu1, QPoint(x, y2));
QTest::mouseMove(&menu1, QPoint(x, y2 + 1));
- QTest::qWait(100);
+ QTest::qWait(1000);
QCOMPARE(spy.count(), 2); // one per menu item
}
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index cbbab41..6b580df 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -646,7 +646,7 @@ void tst_Q3SqlCursor::select()
}
#ifdef QT_DEBUG
- // for people too stupid to read docs we had to insert this debugging message.
+ // Ignore debugging message advising users of a potential pitfall.
QTest::ignoreMessage(QtDebugMsg, "Q3SqlCursor::setValue(): This will not affect actual database values. Use primeInsert(), primeUpdate() or primeDelete().");
#endif
cur4.setValue( "id", 1 );
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
index 7331072..69b507d 100644
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -56,6 +56,7 @@ public:
private slots:
void initTestCase();
void settings();
+ void buffers();
void notifyInterval();
void pullFile();
@@ -90,6 +91,7 @@ void tst_QAudioInput::initTestCase()
void tst_QAudioInput::settings()
{
if(available) {
+ // Confirm the setting we added in the init function.
QAudioFormat f = audio->format();
QVERIFY(format.channels() == f.channels());
@@ -101,6 +103,18 @@ void tst_QAudioInput::settings()
}
}
+void tst_QAudioInput::buffers()
+{
+ if(available) {
+ // Should always have a buffer size greater than zero.
+ int store = audio->bufferSize();
+ audio->setBufferSize(4096);
+ QVERIFY(audio->bufferSize() > 0);
+ audio->setBufferSize(store);
+ QVERIFY(audio->bufferSize() == store);
+ }
+}
+
void tst_QAudioInput::notifyInterval()
{
if(available) {
@@ -120,14 +134,32 @@ void tst_QAudioInput::pullFile()
filename.open( QIODevice::WriteOnly | QIODevice::Truncate );
QSignalSpy readSignal(audio, SIGNAL(notify()));
- audio->start(&filename);
+ QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State)));
+
+ // Always have default states, before start
+ QVERIFY(audio->state() == QAudio::StopState);
+ QVERIFY(audio->error() == QAudio::NoError);
+ audio->start(&filename);
+ QTest::qWait(20);
+ // Check state and periodSize() are valid non-zero values.
+ QVERIFY(audio->state() == QAudio::ActiveState);
+ QVERIFY(audio->error() == QAudio::NoError);
+ QVERIFY(audio->periodSize() > 0);
+ QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
+
+ // Wait until finished...
QTest::qWait(5000);
QVERIFY(readSignal.count() > 0);
QVERIFY(audio->totalTime() > 0);
audio->stop();
+ QTest::qWait(20);
+ QVERIFY(audio->state() == QAudio::StopState);
+ // Can only check to make sure we got at least 1 more signal, but can be more.
+ QVERIFY(stateSignal.count() > 1);
+
filename.close();
}
}
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
index b45a57e..f1c75dc 100644
--- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
+++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
@@ -58,6 +58,7 @@ public:
private slots:
void initTestCase();
void settings();
+ void buffers();
void notifyInterval();
void pullFile();
void pushFile();
@@ -91,6 +92,7 @@ void tst_QAudioOutput::initTestCase()
void tst_QAudioOutput::settings()
{
if(available) {
+ // Confirm the setting we added in the init function.
QAudioFormat f = audio->format();
QVERIFY(format.channels() == f.channels());
@@ -102,6 +104,18 @@ void tst_QAudioOutput::settings()
}
}
+void tst_QAudioOutput::buffers()
+{
+ if(available) {
+ // Should always have a buffer size greater than zero.
+ int store = audio->bufferSize();
+ audio->setBufferSize(4096);
+ QVERIFY(audio->bufferSize() > 0);
+ audio->setBufferSize(store);
+ QVERIFY(audio->bufferSize() == store);
+ }
+}
+
void tst_QAudioOutput::notifyInterval()
{
if(available) {
@@ -122,15 +136,33 @@ void tst_QAudioOutput::pullFile()
file.open(QIODevice::ReadOnly);
QSignalSpy readSignal(audio, SIGNAL(notify()));
+ QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State)));
audio->setNotifyInterval(100);
- audio->start(&file);
+ // Always have default states, before start
+ QVERIFY(audio->state() == QAudio::StopState);
+ QVERIFY(audio->error() == QAudio::NoError);
+
+ audio->start(&file);
+ QTest::qWait(20); // wait 20ms
+ // Check state, bytesFree() and periodSize() are valid non-zero values.
+ QVERIFY(audio->state() == QAudio::ActiveState);
+ QVERIFY(audio->error() == QAudio::NoError);
+ QVERIFY(audio->periodSize() > 0);
+ QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
+
+ // Wait until finished...
QTestEventLoop::instance().enterLoop(1);
QCOMPARE(audio->totalTime(), qint64(692250));
// 4.wav is a little less than 700ms, so notify should fire 6 times!
QVERIFY(readSignal.count() >= 6);
audio->stop();
+ QTest::qWait(20); // wait 20ms
+ QVERIFY(audio->state() == QAudio::StopState);
+ // Can only check to make sure we got at least 1 more signal, but can be more.
+ QVERIFY(stateSignal.count() > 1);
+
file.close();
}
}
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 8dfe836..6984a88 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -2118,20 +2118,24 @@ void tst_QComboBox::task248169_popupWithMinimalSize()
QComboBox comboBox;
comboBox.addItems(initialContent);
- comboBox.view()->setMinimumWidth(500);
QDesktopWidget desktop;
- comboBox.setGeometry(desktop.availableGeometry().width() - 200, 100, 200, 100);
+ QRect desktopSize = desktop.availableGeometry();
+ comboBox.view()->setMinimumWidth(desktopSize.width() / 2);
+
+ comboBox.setGeometry(desktopSize.width() - (desktopSize.width() / 4), (desktopSize.width() / 4), (desktopSize.width() / 2), (desktopSize.width() / 4));
comboBox.show();
+ QTest::qWaitForWindowShown(&comboBox);
QTRY_VERIFY(comboBox.isVisible());
comboBox.showPopup();
QTRY_VERIFY(comboBox.view());
+ QTest::qWaitForWindowShown(comboBox.view());
QTRY_VERIFY(comboBox.view()->isVisible());
#ifdef QT_BUILD_INTERNAL
QFrame *container = qFindChild<QComboBoxPrivateContainer *>(&comboBox);
QVERIFY(container);
- QVERIFY(desktop.screenGeometry(container).contains(container->geometry()));
+ QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry()));
#endif
}
diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index e8fc1f3..936ebf7 100644
--- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -43,6 +43,7 @@
#include <QtGui/QStyle>
#include <QtGui/QLayout>
#include <QtGui/QDialog>
+#include <QtGui/QAction>
#include <qdialogbuttonbox.h>
#include <limits.h>
@@ -721,15 +722,28 @@ void tst_QDialogButtonBox::testS60SoftKeys()
QDialogButtonBox buttonBox(&dialog);
buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog.show();
- QList<QAction*> softKeys = dialog.softKeys();
- QCOMPARE( softKeys.count(), 2);
+
+ int softkeyCount = 0;
+ QList<QAction *> actions = dialog.actions();
+ foreach (QAction *action, actions) {
+ if (action->softKeyRole() != QAction::NoSoftKey)
+ softkeyCount++;
+ }
+ QCOMPARE( softkeyCount, 2);
QDialog dialog2(0);
QDialogButtonBox buttonBox2(&dialog2);
buttonBox2.setStandardButtons(QDialogButtonBox::Cancel);
dialog2.show();
- softKeys = dialog2.softKeys();
- QCOMPARE( softKeys.count(), 1);
+
+ int softkeyCount2 = 0;
+ QList<QAction *> actions2 = dialog2.actions();
+ foreach (QAction *action, actions2) {
+ if (action->softKeyRole() != QAction::NoSoftKey)
+ softkeyCount2++;
+ }
+ QCOMPARE( softkeyCount2, 1);
+
#else
QSKIP("S60-specific test", SkipAll );
#endif
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index 79c0cef..6637202 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -130,6 +130,8 @@ private slots:
void setContentWhitespace() const;
void setContentWhitespace_data() const;
+ void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const;
+
void cleanupTestCase() const;
private:
@@ -1897,5 +1899,18 @@ void tst_QDom::setContentWhitespace_data() const
QTest::newRow("") << QString::fromLatin1("\t\t\t\t<?xml version='1.0' ?><e/>") << false;
}
+void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const
+{
+ QString xmlWithUnknownEncoding("<?xml version='1.0' encoding='unknown-encoding'?>"
+ "<foo>"
+ " <bar>How will this sentence be handled?</bar>"
+ "</foo>");
+ QDomDocument d;
+ QVERIFY(d.setContent(xmlWithUnknownEncoding));
+
+ QString dontAssert = d.toString(); // this should not assert
+ QVERIFY(true);
+}
+
QTEST_MAIN(tst_QDom)
#include "tst_qdom.moc"
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
index 502e983..f4ea985 100644
--- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -145,6 +145,7 @@ private slots:
void task224497_fltMax();
void task221221();
+ void task255471_decimalsValidation();
public slots:
void valueChangedHelper(const QString &);
@@ -668,7 +669,7 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data()
QTest::addColumn<int>("language");
QTest::addColumn<QString>("expectedText"); // if empty we don't check
- QTest::newRow("data0") << QString("2.2") << Invalid << 3.0 << 5.0 << (int)QLocale::C << QString();
+ QTest::newRow("data0") << QString("2.2") << Intermediate << 3.0 << 5.0 << (int)QLocale::C << QString();
QTest::newRow("data1") << QString() << Intermediate << 0.0 << 100.0 << (int)QLocale::C << QString();
QTest::newRow("data2") << QString("asd") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString();
QTest::newRow("data3") << QString("2.2") << Acceptable << 0.0 << 100.0 << (int)QLocale::C << QString();
@@ -685,20 +686,20 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data()
QTest::newRow("data14") << QString("1, ") << Acceptable << 0.0 << 100.0 << (int)QLocale::Norwegian << QString("1,");
QTest::newRow("data15") << QString("1, ") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString();
QTest::newRow("data16") << QString("2") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString();
- QTest::newRow("data17") << QString("22.0") << Invalid << 100.0 << 102.0 << (int)QLocale::C << QString();
+ QTest::newRow("data17") << QString("22.0") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString();
QTest::newRow("data18") << QString("12.0") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString();
- QTest::newRow("data19") << QString("12.2") << Invalid << 100. << 102.0 << (int)QLocale::C << QString();
- QTest::newRow("data20") << QString("21.") << Invalid << 100.0 << 102.0 << (int)QLocale::C << QString();
- QTest::newRow("data21") << QString("-21.") << Invalid << -102.0 << -100.0 << (int)QLocale::C << QString();
+ QTest::newRow("data19") << QString("12.2") << Intermediate << 100. << 102.0 << (int)QLocale::C << QString();
+ QTest::newRow("data20") << QString("21.") << Intermediate << 100.0 << 102.0 << (int)QLocale::C << QString();
+ QTest::newRow("data21") << QString("-21.") << Intermediate << -102.0 << -100.0 << (int)QLocale::C << QString();
QTest::newRow("data22") << QString("-12.") << Intermediate << -102.0 << -100.0 << (int)QLocale::C << QString();
- QTest::newRow("data23") << QString("-11.11") << Invalid << -102.0 << -101.2 << (int)QLocale::C << QString();
+ QTest::newRow("data23") << QString("-11.11") << Intermediate << -102.0 << -101.2 << (int)QLocale::C << QString();
QTest::newRow("data24") << QString("-11.4") << Intermediate << -102.0 << -101.3 << (int)QLocale::C << QString();
QTest::newRow("data25") << QString("11.400") << Invalid << 0.0 << 100.0 << (int)QLocale::C << QString();
QTest::newRow("data26") << QString(".4") << Intermediate << 0.45 << 0.5 << (int)QLocale::C << QString();
QTest::newRow("data27") << QString("+.4") << Intermediate << 0.45 << 0.5 << (int)QLocale::C << QString();
QTest::newRow("data28") << QString("-.4") << Intermediate << -0.5 << -0.45 << (int)QLocale::C << QString();
QTest::newRow("data29") << QString(".4") << Intermediate << 1.0 << 2.4 << (int)QLocale::C << QString();
- QTest::newRow("data30") << QString("-.4") << Invalid << -2.3 << -1.9 << (int)QLocale::C << QString();
+ QTest::newRow("data30") << QString("-.4") << Intermediate << -2.3 << -1.9 << (int)QLocale::C << QString();
QTest::newRow("data31") << QString("-42") << Invalid << -2.43 << -1.0 << (int)QLocale::C << QString();
QTest::newRow("data32") << QString("-4") << Invalid << -1.4 << -1.0 << (int)QLocale::C << QString();
QTest::newRow("data33") << QString("-42") << Invalid << -1.4 << -1.0 << (int)QLocale::C << QString();
@@ -712,7 +713,7 @@ void tst_QDoubleSpinBox::valueFromTextAndValidate_data()
QTest::newRow("data41") << QString("103.") << Invalid << -102.0 << 11.0 << (int)QLocale::C << QString();
QTest::newRow("data42") << QString("122") << Invalid << 10.0 << 12.2 << (int)QLocale::C << QString();
QTest::newRow("data43") << QString("-2.2") << Intermediate << -12.2 << -3.2 << (int)QLocale::C << QString();
- QTest::newRow("data44") << QString("-2.20") << Invalid << -12.1 << -3.2 << (int)QLocale::C << QString();
+ QTest::newRow("data44") << QString("-2.20") << Intermediate << -12.1 << -3.2 << (int)QLocale::C << QString();
QTest::newRow("data45") << QString("200,2") << Invalid << 0.0 << 1000.0 << (int)QLocale::C << QString();
QTest::newRow("data46") << QString("200,2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::German << QString();
QTest::newRow("data47") << QString("2.2") << Acceptable << 0.0 << 1000.0 << (int)QLocale::C << QString();
@@ -1008,6 +1009,31 @@ void tst_QDoubleSpinBox::task221221()
QCOMPARE(spin.text(), QLatin1String("1"));
}
+void tst_QDoubleSpinBox::task255471_decimalsValidation()
+{
+ // QDoubleSpinBox shouldn't crash with large numbers of decimals. Even if
+ // the results are useless ;-)
+ for (int i = 0; i < 32; ++i)
+ {
+ QDoubleSpinBox spinBox;
+ spinBox.setDecimals(i);
+ spinBox.setMinimum(0.3);
+ spinBox.setMaximum(12);
+
+ spinBox.show();
+ QTRY_VERIFY(spinBox.isVisible());
+ spinBox.setFocus();
+ QTRY_VERIFY(spinBox.hasFocus());
+
+ QTest::keyPress(&spinBox, Qt::Key_Right);
+ QTest::keyPress(&spinBox, Qt::Key_Right);
+ QTest::keyPress(&spinBox, Qt::Key_Delete);
+
+ // Don't crash!
+ QTest::keyPress(&spinBox, Qt::Key_2);
+ }
+}
+
QTEST_MAIN(tst_QDoubleSpinBox)
#include "tst_qdoublespinbox.moc"
diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
index 8d4a5ed..8cf686e 100644
--- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
@@ -417,8 +417,18 @@ void tst_QEasingCurve::valueForProgress()
// the least significant digit it is still subject to rounding errors
qreal error = easeConv - ex;
+ qreal errorbound = 0.00001;
+#if defined( Q_OS_WINCE ) || defined( Q_OS_SYMBIAN )
+ // exception values for WINCE(this test should be rewritten, as it only freezes the status quo of QEasingCurve
+ // The failing (2) values are explicitly excepted here:
+ // The source values for the comparison table should remain untruncated double and the
+ // error bound checking function dynamic. Also the source values should come from a "trusted" source and not
+ // from QEasingCurve itself.
+ if ((type == int(QEasingCurve::InOutBounce) && (i == 8 || i == 6) ) || (type == int(QEasingCurve::OutExpo) && i == 2))
+ errorbound = 0.0002;
+#endif
// accept the potential rounding error in the least significant digit
- QVERIFY(error <= 0.00001 );
+ QVERIFY(error <= errorbound );
}
#endif
}
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index d6225cd..1aa5ee1 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -70,6 +70,12 @@
//TESTED_CLASS=
//TESTED_FILES=
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#endif
+
class QNonNativeFileDialog : public QFileDialog
{
Q_OBJECT
@@ -1042,7 +1048,7 @@ void tst_QFiledialog::focus()
QApplication::setActiveWindow(&fd);
QTest::qWaitForWindowShown(&fd);
QTRY_COMPARE(fd.isVisible(), true);
- QTRY_COMPARE(QApplication::activeWindow(), &fd);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
qApp->processEvents();
// make sure the tests work with focus follows mouse
diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
index eac16ee..070eb6a 100644
--- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro
@@ -12,4 +12,5 @@ symbian: {
dummyDeploy.sources = tst_qfilesystemmodel.cpp
dummyDeploy.path = .
DEPLOYMENT += dummyDeploy
+ LIBS += -lefsrv
}
diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
index 32cbed3..7735f30 100644
--- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
+++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp
@@ -318,9 +318,6 @@ void tst_QFileSystemWatcher::watchDirectory()
#ifdef Q_OS_WINCE
QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
-#elif defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)
- // Since native watcher is always used in real devices, this poller issue is irrelevant
- QEXPECT_FAIL("poller", "Poller doesn't detect directory removal in RVCT builds", Abort);
#endif
QCOMPARE(changedSpy.count(), 2);
QCOMPARE(changedSpy.at(0).count(), 1);
@@ -490,11 +487,6 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
#ifdef Q_OS_WINCE
QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort);
#endif
-#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)
- // Since native watcher is always used in real devices, this poller issue is irrelevant
- // Symbian file system does not change modification time on a directory when a file inside is changed
- QEXPECT_FAIL("poller", "Poller doesn't detect directory changes in RVCT builds", Abort);
-#endif
QCOMPARE(dirChangedSpy.count(), 1);
dirChangedSpy.clear();
@@ -515,7 +507,9 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
timer.start(3000);
eventLoop.exec();
QCOMPARE(fileChangedSpy.count(), 0);
- QCOMPARE(dirChangedSpy.count(), 1);
+ // polling watcher has generated separate events for content and time change
+ // on Symbian emulator, so allow possibility of 2 events
+ QVERIFY(dirChangedSpy.count() == 1 || dirChangedSpy.count() == 2);
QVERIFY(QDir().rmdir("testDir"));
}
diff --git a/tests/auto/qfocusevent/tst_qfocusevent.cpp b/tests/auto/qfocusevent/tst_qfocusevent.cpp
index 6c47530..121bd41 100644
--- a/tests/auto/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/qfocusevent/tst_qfocusevent.cpp
@@ -399,10 +399,10 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
QDialog* d = new QDialog( testFocusWidget );
d->show();
d->activateWindow(); // ### CDE
- // wait 1 secs to give some visible feedback
- QTest::qWait(1000);
+ QApplication::setActiveWindow(d);
+ QTest::qWaitForWindowShown(d);
- QVERIFY(childFocusWidgetOne->focusOutEventRecieved);
+ QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved);
QVERIFY(childFocusWidgetOne->focusOutEventLostFocus);
QVERIFY( !childFocusWidgetOne->focusInEventRecieved );
@@ -411,12 +411,12 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
QVERIFY( !childFocusWidgetOne->hasFocus() );
d->hide();
- QTest::qWait(1000);
+ QTest::qWait(100);
#if defined(Q_OS_IRIX)
QEXPECT_FAIL("", "IRIX requires explicit activateWindow(), so this test does not make any sense.", Abort);
#endif
- QVERIFY(childFocusWidgetOne->focusInEventRecieved);
+ QTRY_VERIFY(childFocusWidgetOne->focusInEventRecieved);
QVERIFY(childFocusWidgetOne->focusInEventGotFocus);
QVERIFY( childFocusWidgetOne->hasFocus() );
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 2c4a253..2fee98d 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -154,6 +154,8 @@ void tst_QGraphicsAnchorLayout::simple()
QGraphicsWidget p;
p.setLayout(l);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 2);
}
@@ -183,6 +185,8 @@ void tst_QGraphicsAnchorLayout::simple_center()
setAnchor(l, b, Qt::AnchorBottom, c, Qt::AnchorTop, 0);
setAnchor(l, c, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 3);
QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window);
@@ -193,6 +197,8 @@ void tst_QGraphicsAnchorLayout::simple_center()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+
+ delete p;
}
void tst_QGraphicsAnchorLayout::simple_semifloat()
@@ -228,6 +234,8 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
setAnchor(l, a, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 4);
QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window);
@@ -240,6 +248,8 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+
+ delete p;
}
void tst_QGraphicsAnchorLayout::layoutDirection()
@@ -286,6 +296,10 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
view->show();
QCOMPARE(checkReverseDirection(p), true);
+ QVERIFY(l->hasConflicts() == false);
+
+ delete p;
+ delete view;
}
void tst_QGraphicsAnchorLayout::diagonal()
@@ -326,6 +340,8 @@ void tst_QGraphicsAnchorLayout::diagonal()
l->addAnchor(e, Qt::AnchorRight, l, Qt::AnchorRight);
l->addAnchor(d, Qt::AnchorRight, e, Qt::AnchorLeft);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 5);
QGraphicsWidget p;
@@ -373,6 +389,9 @@ void tst_QGraphicsAnchorLayout::diagonal()
QCOMPARE(p.size(), testA);
QCOMPARE(checkReverseDirection(&p), true);
+
+ c->setMinimumWidth(300);
+ QVERIFY(l->hasConflicts());
}
void tst_QGraphicsAnchorLayout::parallel()
@@ -465,6 +484,8 @@ void tst_QGraphicsAnchorLayout::parallel()
QCOMPARE(e->geometry(), QRectF(375, 400, 175, 100));
QCOMPARE(f->geometry(), QRectF(550, 500, 200, 100));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::parallel2()
@@ -489,6 +510,7 @@ void tst_QGraphicsAnchorLayout::parallel2()
l->addAnchor(l, Qt::AnchorLeft, b, Qt::AnchorLeft);
l->addAnchor(b, Qt::AnchorRight, a, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 2);
QGraphicsWidget p;
@@ -570,6 +592,8 @@ void tst_QGraphicsAnchorLayout::snake()
QCOMPARE(b->geometry(), QRectF(90.0, 100.0, 10.0, 100.0));
QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
@@ -603,6 +627,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
l->addAnchor(c, Qt::AnchorRight, l, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 3);
QGraphicsWidget p;
@@ -706,6 +731,8 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(c->geometry(), QRectF(200.0, 200.0, 100.0, 100.0));
QCOMPARE(d->geometry(), QRectF(0.0, 300.0, 300.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
@@ -782,6 +809,8 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
QCOMPARE(a->size(), d->size());
QCOMPARE(e->size().width(), 4 * a->size().width());
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::proportionalPreferred()
@@ -844,6 +873,8 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred()
QCOMPARE(a->size().width(), 10 * factor);
QCOMPARE(c->size().width(), 14 * factor);
QCOMPARE(p.size(), QSizeF(12, 400));
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::example()
@@ -897,6 +928,7 @@ void tst_QGraphicsAnchorLayout::example()
l->addAnchor(l, Qt::AnchorLeft, g, Qt::AnchorLeft);
l->addAnchor(f, Qt::AnchorRight, g, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 7);
QGraphicsWidget p;
@@ -985,6 +1017,10 @@ void tst_QGraphicsAnchorLayout::setSpacing()
QCOMPARE(b->geometry(), QRectF(24, 0, 20, 20));
QCOMPARE(c->geometry(), QRectF(0, 20, 44, 20));
+ QVERIFY(l->hasConflicts() == false);
+
+ delete p;
+ delete view;
}
/*!
@@ -1067,6 +1103,8 @@ void tst_QGraphicsAnchorLayout::hardComplexS60()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(240, 40));
+ QVERIFY(l->hasConflicts() == false);
+ delete p;
}
void tst_QGraphicsAnchorLayout::stability()
@@ -1128,6 +1166,7 @@ void tst_QGraphicsAnchorLayout::delete_anchor()
QGraphicsWidget *p = new QGraphicsWidget;
p->setLayout(l);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 3);
scene.addItem(p);
@@ -1277,10 +1316,10 @@ void tst_QGraphicsAnchorLayout::conflicts()
a->setMinimumSize(QSizeF(29,10));
QCOMPARE(l->hasConflicts(), false);
- // It will currently fail if we uncomment this:
- //QEXPECT_FAIL("", "The constraints are just within their bounds in order to be feasible", Continue);
- //a->setMinimumSize(QSizeF(30,10));
- //QCOMPARE(l->hasConflicts(), false);
+ a->setMinimumSize(QSizeF(30,10));
+ QCOMPARE(l->hasConflicts(), false);
+
+ delete p;
}
QTEST_MAIN(tst_QGraphicsAnchorLayout)
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 8228ab9..a6746db 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -58,10 +58,9 @@ public:
setSpacing( 0 );
}
- // ###: Remove me when isValid() is supported
bool isValid()
{
- return true;
+ return !hasConflicts();
}
void setAnchor(
@@ -463,9 +462,6 @@ void tst_QGraphicsAnchorLayout1::testAddAndRemoveAnchor()
void tst_QGraphicsAnchorLayout1::testIsValid()
{
- // ###: REMOVE ME
- return;
-
// Empty, valid
{
QGraphicsWidget *widget = new QGraphicsWidget;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index b0e4b9d..956faa1 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -296,6 +296,7 @@ private slots:
void moveWhileDeleting();
void ensureDirtySceneTransform();
void focusScope();
+ void stackBefore();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -8384,5 +8385,83 @@ void tst_QGraphicsItem::focusScope()
QCOMPARE(scopeB->focusItem(), (QGraphicsItem *)scopeB);
}
+void tst_QGraphicsItem::stackBefore()
+{
+ QGraphicsRectItem parent;
+ QGraphicsRectItem *child1 = new QGraphicsRectItem(QRectF(0, 0, 5, 5), &parent);
+ QGraphicsRectItem *child2 = new QGraphicsRectItem(QRectF(0, 0, 5, 5), &parent);
+ QGraphicsRectItem *child3 = new QGraphicsRectItem(QRectF(0, 0, 5, 5), &parent);
+ QGraphicsRectItem *child4 = new QGraphicsRectItem(QRectF(0, 0, 5, 5), &parent);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child1 << child2 << child3 << child4));
+ child1->setData(0, "child1");
+ child2->setData(0, "child2");
+ child3->setData(0, "child3");
+ child4->setData(0, "child4");
+
+ // Remove and append
+ child2->setParentItem(0);
+ child2->setParentItem(&parent);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child1 << child3 << child4 << child2));
+
+ // Move child2 before child1
+ child2->stackBefore(child1);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child2->stackBefore(child2);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child1->setZValue(1);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child3 << child4 << child1));
+ child1->stackBefore(child2); // no effect
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child3 << child4 << child1));
+ child1->setZValue(0);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child4->stackBefore(child1);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child4 << child1 << child3));
+ child4->setZValue(1);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child3->stackBefore(child1);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child3 << child1 << child4));
+ child4->setZValue(0);
+ QCOMPARE(parent.childItems(), (QList<QGraphicsItem *>() << child2 << child4 << child3 << child1));
+
+ // Make them all toplevels
+ child1->setParentItem(0);
+ child2->setParentItem(0);
+ child3->setParentItem(0);
+ child4->setParentItem(0);
+
+ QGraphicsScene scene;
+ scene.addItem(child1);
+ scene.addItem(child2);
+ scene.addItem(child3);
+ scene.addItem(child4);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder),
+ (QList<QGraphicsItem *>() << child1 << child2 << child3 << child4));
+
+ // Remove and append
+ scene.removeItem(child2);
+ scene.addItem(child2);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child1 << child3 << child4 << child2));
+
+ // Move child2 before child1
+ child2->stackBefore(child1);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child2->stackBefore(child2);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child1->setZValue(1);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child3 << child4 << child1));
+ child1->stackBefore(child2); // no effect
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child3 << child4 << child1));
+ child1->setZValue(0);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child4->stackBefore(child1);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child4 << child1 << child3));
+ child4->setZValue(1);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child1 << child3 << child4));
+ child3->stackBefore(child1);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child3 << child1 << child4));
+ child4->setZValue(0);
+ QCOMPARE(scene.items(QPointF(2, 2), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder), (QList<QGraphicsItem *>() << child2 << child4 << child3 << child1));
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index a5d79de..4e46819 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -145,7 +145,11 @@ void tst_QGraphicsLinearLayout::initTestCase()
{
// since the style will influence the results, we have to ensure
// that the tests are run using the same style on all platforms
+#ifdef Q_WS_S60
+ QApplication::setStyle(new QWindowsStyle);
+#else
QApplication::setStyle(new QPlastiqueStyle);
+#endif
}
// This will be called after the last test function is executed.
@@ -708,10 +712,10 @@ void tst_QGraphicsLinearLayout::itemAt_visualOrder()
QGraphicsWidget *w2 = new QGraphicsWidget;
l->insertItem(2, w2);
- QCOMPARE(l->itemAt(0), w0);
- QCOMPARE(l->itemAt(1), w1);
- QCOMPARE(l->itemAt(2), w2);
- QCOMPARE(l->itemAt(3), w3);
+ QCOMPARE(l->itemAt(0), static_cast<QGraphicsLayoutItem*>(w0));
+ QCOMPARE(l->itemAt(1), static_cast<QGraphicsLayoutItem*>(w1));
+ QCOMPARE(l->itemAt(2), static_cast<QGraphicsLayoutItem*>(w2));
+ QCOMPARE(l->itemAt(3), static_cast<QGraphicsLayoutItem*>(w3));
}
void tst_QGraphicsLinearLayout::orientation_data()
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 9d23096..95a038b 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -224,6 +224,8 @@ private slots:
void task253415_reconnectUpdateSceneOnSceneChanged();
void task255529_transformationAnchorMouseAndViewportMargins();
void task259503_scrollingArtifacts();
+ void QTBUG_4151_clipAndIgnore_data();
+ void QTBUG_4151_clipAndIgnore();
};
void tst_QGraphicsView::initTestCase()
@@ -311,15 +313,13 @@ void tst_QGraphicsView::renderHints()
view.show();
QTest::qWaitForWindowShown(&view);
view.repaint();
- QTest::qWait(125);
- QCOMPARE(item->hints, view.renderHints());
+ QTRY_COMPARE(item->hints, view.renderHints());
view.setRenderHints(QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
QCOMPARE(view.renderHints(), QPainter::Antialiasing | QPainter::NonCosmeticDefaultPen);
view.repaint();
- QTest::qWait(125);
- QCOMPARE(item->hints, view.renderHints());
+ QTRY_COMPARE(item->hints, view.renderHints());
}
void tst_QGraphicsView::alignment()
@@ -384,7 +384,7 @@ void tst_QGraphicsView::interactive()
view.show();
QTest::qWaitForWindowShown(&view);
- QTestEventLoop::instance().enterLoop(1);
+ QApplication::processEvents();
QTRY_COMPARE(item->events.size(), 1); // activate
QPoint itemPoint = view.mapFromScene(item->scenePos());
@@ -935,11 +935,13 @@ void tst_QGraphicsView::foregroundBrush()
view.setSceneRect(-1000, -1000, 2000, 2000);
for (int i = -500; i < 500; i += 10) {
view.centerOn(i, 0);
- QTest::qWait(10);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
for (int i = -500; i < 500; i += 10) {
view.centerOn(0, i);
- QTest::qWait(10);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
}
@@ -965,7 +967,8 @@ void tst_QGraphicsView::matrix()
gradient2.setColorAt(1, Qt::transparent);
gradient2.setSpread(QGradient::RepeatSpread);
scene.setBackgroundBrush(gradient2);
- QTest::qWait(10);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
}
@@ -978,7 +981,8 @@ void tst_QGraphicsView::matrix()
view.show();
for (int i = 0; i < 160; ++i) {
view.rotate(18);
- QTest::qWait(5);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
/*
// These cause a crash
@@ -993,11 +997,13 @@ void tst_QGraphicsView::matrix()
*/
for (int i = 0; i < 20; ++i) {
view.scale(1.2, 1.2);
- QTest::qWait(20);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
for (int i = 0; i < 20; ++i) {
view.scale(0.6, 0.6);
- QTest::qWait(20);
+ QApplication::processEvents();
+ QApplication::processEvents();
}
}
}
@@ -1093,10 +1099,12 @@ void tst_QGraphicsView::centerOnItem()
QGraphicsView view(&scene);
view.setSceneRect(-1000, -1000, 2000, 2000);
view.show();
+ QTest::qWaitForWindowShown(&view);
int tolerance = 7;
for (int x = 0; x < 3; ++x) {
for (int i = 0; i < 4; ++i) {
+ QApplication::processEvents();
view.centerOn(items[i]);
QPoint viewCenter = view.mapToScene(view.viewport()->rect().center()).toPoint();
@@ -1111,7 +1119,7 @@ void tst_QGraphicsView::centerOnItem()
QFAIL(qPrintable(error));
}
- QTest::qWait(250);
+ QApplication::processEvents();
}
view.rotate(13);
@@ -1141,6 +1149,7 @@ void tst_QGraphicsView::ensureVisibleRect()
view.setSceneRect(-500, -500, 1000, 1000);
view.setFixedSize(250, 250);
view.show();
+ QTest::qWaitForWindowShown(&view);
for (int y = -100; y < 100; y += 25) {
for (int x = -100; x < 100; x += 13) {
@@ -1177,7 +1186,7 @@ void tst_QGraphicsView::ensureVisibleRect()
QVERIFY(qAbs(viewPoint.y() - viewRect.top()) >= margin -1);
QVERIFY(qAbs(viewPoint.y() - viewRect.bottom()) >= margin -1);
- QTest::qWait(10);
+ QApplication::processEvents();
}
}
view.rotate(5);
@@ -1381,10 +1390,8 @@ void tst_QGraphicsView::itemsInRect_cosmeticAdjust()
view.setFrameStyle(0);
view.resize(300, 300);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(125);
+ QTest::qWaitForWindowShown(&view) ;
+ QTRY_VERIFY(rect->numPaints > 0);
rect->numPaints = 0;
if (updateRect.isNull())
@@ -1521,8 +1528,8 @@ void tst_QGraphicsView::itemAt2()
view.setTransformationAnchor(QGraphicsView::NoAnchor);
view.setRenderHint(QPainter::Antialiasing);
view.show();
-
- QTestEventLoop::instance().enterLoop(1);
+ QTest::qWaitForWindowShown(&view);
+ QApplication::processEvents();
QPoint itemViewPoint = view.mapFromScene(item->scenePos());
@@ -2135,17 +2142,17 @@ void tst_QGraphicsView::resizeAnchor()
for (int size = 200; size <= 400; size += 25) {
view.resize(size, size);
if (i == 0) {
- QCOMPARE(view.mapToScene(50, 50), f);
- QVERIFY(view.mapToScene(view.viewport()->rect().center()) != center);
+ QTRY_COMPARE(view.mapToScene(50, 50), f);
+ QTRY_VERIFY(view.mapToScene(view.viewport()->rect().center()) != center);
} else {
- QVERIFY(view.mapToScene(50, 50) != f);
+ QTRY_VERIFY(view.mapToScene(50, 50) != f);
QPointF newCenter = view.mapToScene(view.viewport()->rect().center());
int slack = 3;
QVERIFY(qAbs(newCenter.x() - center.x()) < slack);
QVERIFY(qAbs(newCenter.y() - center.y()) < slack);
}
- QTest::qWait(250);
+ QTest::qWait(20);
}
}
}
@@ -2154,12 +2161,15 @@ class CustomView : public QGraphicsView
{
Q_OBJECT
public:
+ CustomView(QGraphicsScene *s = 0) : QGraphicsView(s) {}
QList<QRegion> lastUpdateRegions;
+ bool painted;
protected:
void paintEvent(QPaintEvent *event)
{
lastUpdateRegions << event->region();
+ painted = true;
QGraphicsView::paintEvent(event);
}
};
@@ -2247,6 +2257,7 @@ void tst_QGraphicsView::viewportUpdateMode2()
// Create a view with viewport rect equal to QRect(0, 0, 200, 200).
QGraphicsScene dummyScene;
CustomView view;
+ view.painted = false;
view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
view.setScene(&dummyScene);
int left, top, right, bottom;
@@ -2255,6 +2266,7 @@ void tst_QGraphicsView::viewportUpdateMode2()
view.show();
QTest::qWaitForWindowShown(&view);
QTest::qWait(50);
+ QTRY_VERIFY(view.painted);
const QRect viewportRect = view.viewport()->rect();
QCOMPARE(viewportRect, QRect(0, 0, 200, 200));
@@ -2921,10 +2933,10 @@ void tst_QGraphicsView::task239729_noViewUpdate()
EventSpy spy(view->viewport(), QEvent::Paint);
QCOMPARE(spy.count(), 0);
- QTest::qWait(150);
+ QTest::qWait(100);
QCOMPARE(spy.count(), 0);
scene.update();
- QTest::qWait(150);
+ QApplication::processEvents();
QTRY_COMPARE(spy.count(), 1);
delete view;
@@ -3159,7 +3171,6 @@ void tst_QGraphicsView::moveItemWhileScrolling()
int a = adjustForAntialiasing ? 2 : 1;
expectedRegion += QRect(40, 50, 10, 10).adjusted(-a, -a, a, a);
expectedRegion += QRect(40, 60, 10, 10).adjusted(-a, -a, a, a);
-
QCOMPARE(view.lastPaintedRegion, expectedRegion);
}
@@ -3343,11 +3354,13 @@ void tst_QGraphicsView::render()
{
// ### This test can be much more thorough - see QGraphicsScene::render.
QGraphicsScene scene;
- QGraphicsView view(&scene);
+ CustomView view(&scene);
view.setFrameStyle(0);
view.resize(200, 200);
+ view.painted = false;
view.show();
QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.painted > 0);
RenderTester *r1 = new RenderTester(QRectF(0, 0, 50, 50));
RenderTester *r2 = new RenderTester(QRectF(50, 50, 50, 50));
@@ -3383,10 +3396,12 @@ void tst_QGraphicsView::exposeRegion()
QGraphicsScene scene;
scene.addItem(item);
+ item->paints = 0;
CustomView view;
view.setScene(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(item->paints > 0);
item->paints = 0;
view.lastUpdateRegions.clear();
@@ -3449,7 +3464,7 @@ void tst_QGraphicsView::update()
QTest::qWaitForWindowShown(&view);
QApplication::setActiveWindow(&view);
- QTest::qWait(50);
+ QApplication::processEvents();
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
const QRect viewportRect = view.viewport()->rect();
@@ -3465,15 +3480,15 @@ void tst_QGraphicsView::update()
viewPrivate->processPendingUpdates();
QVERIFY(viewPrivate->dirtyRegion.isEmpty());
QVERIFY(viewPrivate->dirtyBoundingRect.isEmpty());
- QTest::qWait(150);
+ QApplication::processEvents();
if (!intersects) {
- QVERIFY(view.lastUpdateRegions.isEmpty());
+ QTRY_VERIFY(view.lastUpdateRegions.isEmpty());
} else {
- QCOMPARE(view.lastUpdateRegions.size(), 1);
+ QTRY_COMPARE(view.lastUpdateRegions.size(), 1);
// Note that we adjust by 2 for antialiasing.
- QCOMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect.adjusted(-2, -2, 2, 2) & viewportRect));
+ QTRY_COMPARE(view.lastUpdateRegions.at(0), QRegion(updateRect.adjusted(-2, -2, 2, 2) & viewportRect));
}
- QVERIFY(!viewPrivate->fullUpdatePending);
+ QTRY_VERIFY(!viewPrivate->fullUpdatePending);
#endif
}
@@ -3720,5 +3735,50 @@ void tst_QGraphicsView::task259503_scrollingArtifacts()
QTest::qWait(10);
}
+void tst_QGraphicsView::QTBUG_4151_clipAndIgnore_data()
+{
+ QTest::addColumn<bool>("clip");
+ QTest::addColumn<bool>("ignoreTransformations");
+ QTest::addColumn<int>("numItems");
+
+ QTest::newRow("none") << false << false << 3;
+ QTest::newRow("clip") << true << false << 3;
+ QTest::newRow("ignore") << false << true << 3;
+ QTest::newRow("clip+ignore") << true << true << 3;
+}
+
+void tst_QGraphicsView::QTBUG_4151_clipAndIgnore()
+{
+ QFETCH(bool, clip);
+ QFETCH(bool, ignoreTransformations);
+ QFETCH(int, numItems);
+
+ QGraphicsScene scene;
+
+ QGraphicsRectItem *parent = new QGraphicsRectItem(QRectF(0, 0, 50, 50), 0);
+ QGraphicsRectItem *child = new QGraphicsRectItem(QRectF(-10, -10, 40, 40), parent);
+ QGraphicsRectItem *ignore = new QGraphicsRectItem(QRectF(60, 60, 50, 50), 0);
+
+ if (clip)
+ parent->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
+ if (ignoreTransformations)
+ ignore->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+
+ parent->setBrush(Qt::red);
+ child->setBrush(QColor(0, 0, 255, 128));
+ ignore->setBrush(Qt::green);
+
+ scene.addItem(parent);
+ scene.addItem(ignore);
+
+ QGraphicsView view(&scene);
+ view.setFrameStyle(0);
+ view.resize(75, 75);
+ view.show();
+ QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view);
+
+ QCOMPARE(view.items(view.rect()).size(), numItems);
+}
+
QTEST_MAIN(tst_QGraphicsView)
#include "tst_qgraphicsview.moc"
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index c0d5051..05b506c 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -816,9 +816,7 @@ void tst_QImageReader::readFromDevice()
{
QFETCH(QString, fileName);
QFETCH(QByteArray, format);
- #ifdef Q_OS_SYMBIAN
- QSKIP("Symbian local sockets are not working", SkipAll);
- #endif
+
QImage expectedImage(prefix + fileName, format);
QFile file(prefix + fileName);
diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp
index 8a5e344..dd03ef3 100644
--- a/tests/auto/qlabel/tst_qlabel.cpp
+++ b/tests/auto/qlabel/tst_qlabel.cpp
@@ -57,6 +57,8 @@
# define SRCDIR ""
#endif
+#include "../../shared/util.h"
+
class Widget : public QWidget
{
public:
@@ -102,11 +104,11 @@ private slots:
void eventPropagation_data();
void eventPropagation();
void focusPolicy();
-
+
void task190318_sizes();
void sizeHint();
-
+
void task226479_movieResize();
void emptyPixmap();
@@ -413,16 +415,17 @@ void tst_QLabel::task226479_movieResize()
paintedRegion += e->region();
QLabel::paintEvent(e);
}
-
+
public:
QRegion paintedRegion;
};
-
+
Label label;
label.resize(350,350);
label.show();
QMovie *movie = new QMovie( &label );
label.setMovie(movie);
+ QTest::qWaitForWindowShown(&label);
movie->setFileName(SRCDIR "red.png");
movie->start();
QTest::qWait(50);
@@ -431,8 +434,8 @@ void tst_QLabel::task226479_movieResize()
movie->setFileName(SRCDIR "green.png");
movie->start();
QTest::qWait(50);
-
- QCOMPARE(label.paintedRegion , QRegion(label.rect()) );
+
+ QTRY_COMPARE(label.paintedRegion , QRegion(label.rect()) );
}
void tst_QLabel::emptyPixmap()
diff --git a/tests/auto/qmdiarea/tst_qmdiarea.cpp b/tests/auto/qmdiarea/tst_qmdiarea.cpp
index 65f1937..b110114 100644
--- a/tests/auto/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/qmdiarea/tst_qmdiarea.cpp
@@ -639,9 +639,7 @@ void tst_QMdiArea::changeWindowTitle()
mw->setCentralWidget( ws );
mw->menuBar();
mw->show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(mw);
-#endif
+ QTest::qWaitForWindowShown(mw);
QWidget *widget = new QWidget( ws );
widget->setWindowTitle( wc );
@@ -655,22 +653,17 @@ void tst_QMdiArea::changeWindowTitle()
widget->setWindowState(Qt::WindowMaximized);
#endif
#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
- QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
+ QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
#endif
mw->hide();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(mw);
-#endif
qApp->processEvents();
mw->show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(mw);
-#endif
qApp->processEvents();
+ QTest::qWaitForWindowShown(mw);
#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
- QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
+ QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
#endif
#ifdef USE_SHOW
@@ -688,7 +681,7 @@ void tst_QMdiArea::changeWindowTitle()
#endif
qApp->processEvents();
#if !defined(Q_WS_MAC) && !defined(Q_OS_WINCE)
- QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
+ QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) );
widget->setWindowTitle( wc2 );
QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) );
mw->setWindowTitle( mwc2 );
@@ -1697,11 +1690,8 @@ void tst_QMdiArea::tileSubWindows()
workspace.setActiveSubWindow(windows.at(5));
workspace.resize(workspace.size() - QSize(10, 10));
workspace.setActiveSubWindow(0);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&workspace);
-#endif
QTest::qWait(250); // delayed re-arrange of minimized windows
- QCOMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect());
+ QTRY_COMPARE(workspace.viewport()->childrenRect(), workspace.viewport()->rect());
// Add another window and verify that the views are not tiled anymore.
workspace.addSubWindow(new QPushButton(QLatin1String("I'd like to mess up tiled views")))->show();
@@ -1732,9 +1722,6 @@ void tst_QMdiArea::tileSubWindows()
// Verify that we try to resize the area such that all sub-windows are visible.
// It's important that tiled windows are NOT overlapping.
workspace.resize(350, 150);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&workspace);
-#endif
qApp->processEvents();
QTRY_COMPARE(workspace.size(), QSize(350, 150));
@@ -1761,13 +1748,10 @@ void tst_QMdiArea::tileSubWindows()
#ifdef Q_OS_WINCE
QSKIP("Not fixed yet! See task 197453", SkipAll);
#endif
- QCOMPARE(workspace.viewport()->rect().size(), expectedViewportSize);
+ QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize);
// Not enough space for all sub-windows to be visible -> provide scroll bars.
workspace.resize(150, 150);
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&workspace);
-#endif
qApp->processEvents();
QTRY_COMPARE(workspace.size(), QSize(150, 150));
diff --git a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp
index d5d125a..b897d8f 100644
--- a/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp
+++ b/tests/auto/qmdisubwindow/tst_qmdisubwindow.cpp
@@ -1648,9 +1648,9 @@ void tst_QMdiSubWindow::resizeTimer()
QMdiArea mdiArea;
QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget);
mdiArea.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&mdiArea);
-#endif
+ QTest::qWaitForWindowShown(&mdiArea);
+ QTest::qWait(250);
+
EventSpy timerEventSpy(subWindow, QEvent::Timer);
QCOMPARE(timerEventSpy.count(), 0);
diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp
index 64e5a9c..5607fbd 100644
--- a/tests/auto/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp
@@ -130,7 +130,7 @@ private slots:
void testSymbols();
void incorrectDefaultButton();
void updateSize();
-
+
void setInformativeText();
void iconPixmap();
@@ -683,7 +683,13 @@ void tst_QMessageBox::incorrectDefaultButton()
void tst_QMessageBox::updateSize()
{
QMessageBox box;
+#ifdef Q_WS_S60
+ // In S60 messagebox is always occupies maximum width, i.e. screen width
+ // so we need to have long enough text to split over several line
+ box.setText("This is awesome long text");
+#else
box.setText("This is awesome");
+#endif
box.show();
QSize oldSize = box.size();
QString longText;
@@ -693,9 +699,12 @@ void tst_QMessageBox::updateSize()
QVERIFY(box.size() != oldSize); // should have grown
QVERIFY(box.width() > oldSize.width() || box.height() > oldSize.height());
oldSize = box.size();
+#ifndef Q_WS_S60
+ // In S60 dialogs buttons are in softkey area -> message box size does not change
box.setStandardButtons(QMessageBox::StandardButtons(0xFFFF));
QVERIFY(box.size() != oldSize); // should have grown
QVERIFY(box.width() > oldSize.width() || box.height() > oldSize.height());
+#endif
}
void tst_QMessageBox::setInformativeText()
diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index a129f7f..acd23b0 100644
--- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -379,6 +379,10 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup()
{
+#if defined(Q_OS_SYMBIAN)
+ // give the Symbian app start event queue time to clear
+ QTest::qWait(1000);
+#endif
// test if children can be activated when their group is stopped
QParallelAnimationGroup group;
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index 6d262ba..b487d74 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -171,7 +171,7 @@ void tst_QPixmapCache::setCacheLimit()
QPixmapCache::setCacheLimit(0);
QPixmapCache::setCacheLimit(1000);
QPixmapCache::Key key2 = QPixmapCache::insert(*p1);
- QCOMPARE(getPrivate(key2)->key, 2);
+ QCOMPARE(getPrivate(key2)->key, 1);
QVERIFY(QPixmapCache::find(key, &p2) == 0);
QVERIFY(QPixmapCache::find(key2, &p2) != 0);
QCOMPARE(p2, *p1);
@@ -200,7 +200,7 @@ void tst_QPixmapCache::find()
{
QPixmap p1(10, 10);
p1.fill(Qt::red);
- QPixmapCache::insert("P1", p1);
+ QVERIFY(QPixmapCache::insert("P1", p1));
QPixmap p2;
QVERIFY(QPixmapCache::find("P1", p2));
@@ -222,13 +222,13 @@ void tst_QPixmapCache::find()
QCOMPARE(p1, p2);
QPixmapCache::clear();
+ QPixmapCache::setCacheLimit(128);
key = QPixmapCache::insert(p1);
//The int part of the API
- // make sure it doesn't explode
QList<QPixmapCache::Key> keys;
- for (int i = 0; i < 40000; ++i)
+ for (int i = 0; i < 4000; ++i)
QPixmapCache::insert(p1);
//at that time the first key has been erase because no more place in the cache
@@ -293,8 +293,6 @@ void tst_QPixmapCache::insert()
estimatedNum = (1024 * QPixmapCache::cacheLimit())
/ ((p1.width() * p1.height() * p1.depth()) / 8);
QVERIFY(num <= estimatedNum);
- QPixmapCache::insert(p3);
-
}
void tst_QPixmapCache::replace()
@@ -307,13 +305,16 @@ void tst_QPixmapCache::replace()
p2.fill(Qt::yellow);
QPixmapCache::Key key = QPixmapCache::insert(p1);
+ QCOMPARE(getPrivate(key)->isValid, true);
QPixmap p3;
QVERIFY(QPixmapCache::find(key, &p3) == 1);
- QPixmapCache::replace(key,p2);
+ QPixmapCache::replace(key, p2);
QVERIFY(QPixmapCache::find(key, &p3) == 1);
+ QCOMPARE(getPrivate(key)->isValid, true);
+ QCOMPARE(getPrivate(key)->key, 1);
QCOMPARE(p3.width(), 10);
QCOMPARE(p3.height(), 10);
@@ -392,11 +393,8 @@ void tst_QPixmapCache::clear()
QPixmap p1(10, 10);
p1.fill(Qt::red);
-#ifdef Q_OS_WINCE
- const int numberOfKeys = 10000;
-#else
- const int numberOfKeys = 20000;
-#endif
+ const int numberOfKeys = 40000;
+
for (int i = 0; i < numberOfKeys; ++i)
QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0);
diff --git a/tests/auto/qprocess/qprocess.pro b/tests/auto/qprocess/qprocess.pro
index 047828a..77cfc82 100644
--- a/tests/auto/qprocess/qprocess.pro
+++ b/tests/auto/qprocess/qprocess.pro
@@ -1,6 +1,7 @@
TEMPLATE = subdirs
-SUBDIRS = testProcessCrash \
+SUBDIRS = \
+ testProcessCrash \
testProcessEcho \
testProcessEcho2 \
testProcessEcho3 \
diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/qprocess/test/test.pro
index 82f91f8..e1afd22 100644
--- a/tests/auto/qprocess/test/test.pro
+++ b/tests/auto/qprocess/test/test.pro
@@ -26,29 +26,85 @@ QT = core
embedded: QT += gui
wince*: {
- addFiles.sources = \
- ../fileWriterProcess \
- "../test Space In Name" \
- ../testBatFiles \
- ../testDetached \
- ../testExitCodes \
- ../testGuiProcess \
- ../testProcessCrash \
- ../testProcessDeadWhileReading \
- ../testProcessEcho \
- ../testProcessEcho2 \
- ../testProcessEcho3 \
- ../testProcessEchoGui \
- ../testProcessEOF \
- ../testProcessLoopback \
- ../testProcessNormal \
- ../testProcessOutput \
- ../testProcessSpacesArgs \
- ../testSoftExit \
- ../testSpaceInName
+
+ addFile_fileWriterProcess.sources = $$OUT_PWD/../fileWriterProcess/fileWriterProcess.exe
+ addFile_fileWriterProcess.path = fileWriterProcess
+
+ addFile_testBatFiles.sources = $$PWD/../testBatFiles/*
+ addFile_testBatFiles.path = testBatFiles
+
+ addFile_testDetached.sources = $$OUT_PWD/../testDetached/testDetached.exe
+ addFile_testDetached.path = testDetached
+
+ addFile_testExitCodes.sources = $$OUT_PWD/../testExitCodes/testExitCodes.exe
+ addFile_testExitCodes.path = testExitCodes
+
+ addFile_testGuiProcess.sources = $$OUT_PWD/../testGuiProcess/testGuiProcess.exe
+ addFile_testGuiProcess.path = testGuiProcess
- addFiles.path = \Program Files\tst_qprocess
- DEPLOYMENT += addFiles
+ addFile_testProcessCrash.sources = $$OUT_PWD/../testProcessCrash/testProcessCrash.exe
+ addFile_testProcessCrash.path = testProcessCrash
+
+ addFile_testProcessDeadWhileReading.sources = $$OUT_PWD/../testProcessDeadWhileReading/testProcessDeadWhileReading.exe
+ addFile_testProcessDeadWhileReading.path = testProcessDeadWhileReading
+
+ addFile_testProcessEcho.sources = $$OUT_PWD/../testProcessEcho/testProcessEcho.exe
+ addFile_testProcessEcho.path = testProcessEcho
+
+ addFile_testProcessEcho2.sources = $$OUT_PWD/../testProcessEcho2/testProcessEcho2.exe
+ addFile_testProcessEcho2.path = testProcessEcho2
+
+ addFile_testProcessEcho3.sources = $$OUT_PWD/../testProcessEcho3/testProcessEcho3.exe
+ addFile_testProcessEcho3.path = testProcessEcho3
+
+ addFile_testProcessEOF.sources = $$OUT_PWD/../testProcessEOF/testProcessEOF.exe
+ addFile_testProcessEOF.path = testProcessEOF
+
+ addFile_testProcessLoopback.sources = $$OUT_PWD/../testProcessLoopback/testProcessLoopback.exe
+ addFile_testProcessLoopback.path = testProcessLoopback
+
+ addFile_testProcessNormal.sources = $$OUT_PWD/../testProcessNormal/testProcessNormal.exe
+ addFile_testProcessNormal.path = testProcessNormal
+
+ addFile_testProcessOutput.sources = $$OUT_PWD/../testProcessOutput/testProcessOutput.exe
+ addFile_testProcessOutput.path = testProcessOutput
+
+ addFile_testProcessNoSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/nospace.exe
+ addFile_testProcessNoSpacesArgs.path = testProcessSpacesArgs
+
+ addFile_testProcessOneSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/"one space".exe
+ addFile_testProcessOneSpacesArgs.path = testProcessSpacesArgs
+
+ addFile_testProcessTwoSpacesArgs.sources = $$OUT_PWD/../testProcessSpacesArgs/"two space s".exe
+ addFile_testProcessTwoSpacesArgs.path = testProcessSpacesArgs
+
+ addFile_testSoftExit.sources = $$OUT_PWD/../testSoftExit/testSoftExit.exe
+ addFile_testSoftExit.path = testSoftExit
+
+ addFile_testSpaceInName.sources = $$OUT_PWD/../"test Space In Name"/testSpaceInName.exe
+ addFile_testSpaceInName.path = "test Space In Name"
+
+
+ DEPLOYMENT += addFile_fileWriterProcess \
+ addFile_testBatFiles \
+ addFile_testDetached \
+ addFile_testExitCodes \
+ addFile_testGuiProcess \
+ addFile_testProcessCrash \
+ addFile_testProcessDeadWhileReading \
+ addFile_testProcessEcho \
+ addFile_testProcessEcho2 \
+ addFile_testProcessEcho3 \
+ addFile_testProcessEchoGui \
+ addFile_testProcessEOF \
+ addFile_testProcessLoopback \
+ addFile_testProcessNormal \
+ addFile_testProcessOutput \
+ addFile_testProcessNoSpacesArgs \
+ addFile_testProcessOneSpacesArgs \
+ addFile_testProcessTwoSpacesArgs \
+ addFile_testSoftExit \
+ addFile_testSpaceInName
}
symbian: {
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index cff6487..d5bc0bd 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -1318,15 +1318,6 @@ protected slots:
private:
int exitCode;
-#ifdef Q_OS_SYMBIAN
- enum
- {
- /**
- * The maximum stack size.
- */
- SymbianStackSize = 0x14000
- };
-#endif
};
//-----------------------------------------------------------------------------
@@ -1334,9 +1325,6 @@ void tst_QProcess::processInAThread()
{
for (int i = 0; i < 10; ++i) {
TestThread thread;
-#if defined(Q_OS_SYMBIAN)
- thread.setStackSize(SymbianStackSize);
-#endif
thread.start();
QVERIFY(thread.wait(10000));
QCOMPARE(thread.code(), 0);
@@ -1359,10 +1347,6 @@ void tst_QProcess::processesInMultipleThreads()
thread1.serial = serialCounter++;
thread2.serial = serialCounter++;
thread3.serial = serialCounter++;
-
- thread1.setStackSize(SymbianStackSize);
- thread2.setStackSize(SymbianStackSize);
- thread3.setStackSize(SymbianStackSize);
#endif
thread1.start();
thread2.start();
@@ -1874,7 +1858,6 @@ void tst_QProcess::setEnvironment()
QCOMPARE(process.readAll(), value.toLocal8Bit());
}
-#endif
}
//-----------------------------------------------------------------------------
@@ -1885,8 +1868,9 @@ void tst_QProcess::setProcessEnvironment_data()
void tst_QProcess::setProcessEnvironment()
{
-#if !defined (Q_OS_WINCE)
- // there is no concept of system variables on Windows CE as there is no console
+#if defined (Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+ QSKIP("OS doesn't support environment variables", SkipAll);
+#endif
// make sure our environment variables are correct
QVERIFY(qgetenv("tst_QProcess").isEmpty());
@@ -2388,3 +2372,4 @@ void tst_QProcess::invalidProgramString()
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"
#endif
+
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index f86e81d..51ef2da 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -55,10 +55,10 @@ public:
int duration() const { return -1; /* not time driven */ }
protected:
- void updateCurrentTime()
+ void updateCurrentTime(int currentTime)
{
- QPropertyAnimation::updateCurrentTime();
- if (currentTime() >= QPropertyAnimation::duration() || currentLoop() >= 1)
+ QPropertyAnimation::updateCurrentTime(currentTime);
+ if (currentTime >= QPropertyAnimation::duration() || currentLoop() >= 1)
stop();
}
};
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index dc7184c..b193d67 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -568,6 +568,19 @@ static QScriptValue custom_call(QScriptContext *ctx, QScriptEngine *)
return ctx->argumentsObject().property(0).call(QScriptValue(), QScriptValueList() << ctx->argumentsObject().property(1));
}
+static QScriptValue native_recurse(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QScriptValue func = ctx->argumentsObject().property(0);
+ QScriptValue n = ctx->argumentsObject().property(1);
+
+ if(n.toUInt32() <= 1) {
+ return func.call(QScriptValue(), QScriptValueList());
+ } else {
+ return eng->evaluate("native_recurse").call(QScriptValue(),
+ QScriptValueList() << func << QScriptValue(n.toUInt32() - 1));
+ }
+}
+
void tst_QScriptContext::backtrace_data()
{
QTest::addColumn<QString>("code");
@@ -724,6 +737,83 @@ void tst_QScriptContext::backtrace_data()
QTest::newRow("call native") << source << expected;
}
+
+ {
+ QLatin1String func( "function f1() {\n"
+ " eval('var q = 4');\n"
+ " return custom_call(bt, 22);\n"
+ "}");
+
+ QString source = QString::fromLatin1("\n"
+ "function f2() {\n"
+ " func = %1\n"
+ " return custom_call(func, 12);\n"
+ "}\n"
+ "f2();\n").arg(func);
+
+ QStringList expected;
+ expected << "<native>(22) at -1"
+ << "<native>(function () {\n [native code]\n}, 22) at -1"
+ << "f1(12) at testfile:5"
+ << QString::fromLatin1("<native>(%1, 12) at -1").arg(func)
+ << "f2() at testfile:7"
+ << "<global>() at testfile:9";
+
+
+ QTest::newRow("calls with closures") << source << expected;
+ }
+
+ {
+ QLatin1String func( "function js_bt() {\n"
+ " return bt();\n"
+ "}");
+
+ QString source = QString::fromLatin1("\n"
+ "%1\n"
+ "function f() {\n"
+ " return native_recurse(js_bt, 12);\n"
+ "}\n"
+ "f();\n").arg(func);
+
+ QStringList expected;
+ expected << "<native>() at -1" << "js_bt() at testfile:3";
+ for(int n = 1; n <= 12; n++) {
+ expected << QString::fromLatin1("<native>(%1, %2) at -1")
+ .arg(func).arg(n);
+ }
+ expected << "f() at testfile:6";
+ expected << "<global>() at testfile:8";
+
+ QTest::newRow("native recursive") << source << expected;
+ }
+
+ {
+ QString source = QString::fromLatin1("\n"
+ "function finish() {\n"
+ " return bt();\n"
+ "}\n"
+ "function rec(n) {\n"
+ " if(n <= 1)\n"
+ " return finish();\n"
+ " else\n"
+ " return rec (n - 1);\n"
+ "}\n"
+ "function f() {\n"
+ " return rec(12);\n"
+ "}\n"
+ "f();\n");
+
+ QStringList expected;
+ expected << "<native>() at -1" << "finish() at testfile:3";
+ for(int n = 1; n <= 12; n++) {
+ expected << QString::fromLatin1("rec(n = %1) at testfile:%2")
+ .arg(n).arg((n==1) ? 7 : 9);
+ }
+ expected << "f() at testfile:12";
+ expected << "<global>() at testfile:14";
+
+ QTest::newRow("js recursive") << source << expected;
+ }
}
@@ -736,6 +826,7 @@ void tst_QScriptContext::backtrace()
eng.globalObject().setProperty("bt", eng.newFunction(getBacktrace));
eng.globalObject().setProperty("custom_eval", eng.newFunction(custom_eval));
eng.globalObject().setProperty("custom_call", eng.newFunction(custom_call));
+ eng.globalObject().setProperty("native_recurse", eng.newFunction(native_recurse));
QString fileName = "testfile";
QScriptValue ret = eng.evaluate(code, fileName);
@@ -944,6 +1035,16 @@ void tst_QScriptContext::inheritActivationAndThisObject()
QVERIFY(ret.isNumber());
QCOMPARE(ret.toInt32(), 123);
}
+
+ // QT-2219
+ {
+ eng.globalObject().setProperty("a", 123);
+ QScriptValue ret = eng.evaluate("(function() { myEval('var a = 456'); return a; })()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 456);
+ QEXPECT_FAIL("", "QT-2219: Wrong activation object is returned from native function's parent context", Continue);
+ QVERIFY(eng.globalObject().property("a").strictlyEquals(123));
+ }
}
static QScriptValue parentContextToString(QScriptContext *ctx, QScriptEngine *)
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 4d693af..183aa3f 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -95,6 +95,7 @@ private slots:
void evaluate();
void nestedEvaluate();
void uncaughtException();
+ void errorMessage_QT679();
void valueConversion();
void importExtension();
void infiniteRecursion();
@@ -1625,6 +1626,16 @@ void tst_QScriptEngine::uncaughtException()
}
}
+void tst_QScriptEngine::errorMessage_QT679()
+{
+ QScriptEngine engine;
+ engine.globalObject().setProperty("foo", 15);
+ QScriptValue error = engine.evaluate("'hello world';\nfoo.bar.blah");
+ QVERIFY(error.isError());
+ QEXPECT_FAIL("", "Task QT-679: the error message always contains the first line of the script, even if the error was on a different line", Continue);
+ QCOMPARE(error.toString(), QString::fromLatin1("TypeError: Result of expression 'foo.bar' [undefined] is not an object."));
+}
+
struct Foo {
public:
int x, y;
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index b14d6f8..aa6801a 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -169,10 +169,10 @@ public:
int duration() const { return -1; /* not time driven */ }
protected:
- void updateCurrentTime()
+ void updateCurrentTime(int currentTime)
{
- QPropertyAnimation::updateCurrentTime();
- if (currentTime() >= QPropertyAnimation::duration())
+ QPropertyAnimation::updateCurrentTime(currentTime);
+ if (currentTime >= QPropertyAnimation::duration())
stop();
}
};
diff --git a/tests/auto/qsharedmemory/lackey/lackey.pro b/tests/auto/qsharedmemory/lackey/lackey.pro
index 9d2fcad..d25a50a 100644
--- a/tests/auto/qsharedmemory/lackey/lackey.pro
+++ b/tests/auto/qsharedmemory/lackey/lackey.pro
@@ -9,6 +9,8 @@ DESTDIR = ./
win32: CONFIG += console
mac:CONFIG -= app_bundle
+requires(contains(QT_CONFIG,script))
+
DEFINES += QSHAREDMEMORY_DEBUG
DEFINES += QSYSTEMSEMAPHORE_DEBUG
diff --git a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro b/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro
index 042ab3f..e232443 100644
--- a/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro
+++ b/tests/auto/qsharedmemory/qsystemlock/qsystemlock.pro
@@ -5,6 +5,12 @@ include(../src/src.pri)
win32: CONFIG += console
mac:CONFIG -= app_bundle
+wince* {
+ DEFINES += SRCDIR=\\\"\\\"
+} else:!symbian {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
DESTDIR = ./
DEFINES += QSHAREDMEMORY_DEBUG
diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
index b6355fe..35f05d1 100644
--- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
+++ b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
@@ -46,6 +46,13 @@
//TESTED_CLASS=
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// And underlying Open C have application private dir in default search path
+#define SRCDIR ""
+#endif
+
+
#define EXISTING_SHARE "existing"
class tst_QSystemLock : public QObject
@@ -195,26 +202,35 @@ void tst_QSystemLock::processes()
QStringList scripts;
for (int i = 0; i < readOnly; ++i)
- scripts.append("../lackey/scripts/systemlock_read.js");
+ scripts.append(QFileInfo(SRCDIR "lackey/scripts/ systemlock_read.js").absoluteFilePath() );
for (int i = 0; i < readWrite; ++i)
- scripts.append("../lackey/scripts/systemlock_readwrite.js");
+ scripts.append(QFileInfo(SRCDIR "lackey/scripts/systemlock_readwrite.js").absoluteFilePath());
QList<QProcess*> consumers;
+ unsigned int failedProcesses = 0;
for (int i = 0; i < scripts.count(); ++i) {
+
QStringList arguments = QStringList() << scripts.at(i);
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
- consumers.append(p);
- p->start("../lackey/lackey", arguments);
+
+ p->start(QFileInfo(SRCDIR "lackey/lackey").absoluteFilePath(), arguments);
+ // test, if the process could be started.
+
+ if (p->waitForStarted(2000))
+ consumers.append(p);
+ else
+ ++failedProcesses;
}
while (!consumers.isEmpty()) {
consumers.first()->waitForFinished(3000);
- consumers.first()->kill();
+ consumers.first()->kill();
QCOMPARE(consumers.first()->exitStatus(), QProcess::NormalExit);
QCOMPARE(consumers.first()->exitCode(), 0);
delete consumers.takeFirst();
}
+ QCOMPARE(failedProcesses, (unsigned int)(0));
}
QTEST_MAIN(tst_QSystemLock)
diff --git a/tests/auto/qsharedmemory/src/qsystemlock_p.h b/tests/auto/qsharedmemory/src/qsystemlock_p.h
index 2ff1a79..2d44051 100644
--- a/tests/auto/qsharedmemory/src/qsystemlock_p.h
+++ b/tests/auto/qsharedmemory/src/qsystemlock_p.h
@@ -47,7 +47,9 @@
#include "qsystemlock.h"
#include "private/qsharedmemory_p.h"
+#ifndef Q_OS_WINCE
#include <sys/types.h>
+#endif
#define MAX_LOCKS 64
diff --git a/tests/auto/qsharedmemory/test/test.pro b/tests/auto/qsharedmemory/test/test.pro
index 779a942..c9f4fec 100644
--- a/tests/auto/qsharedmemory/test/test.pro
+++ b/tests/auto/qsharedmemory/test/test.pro
@@ -18,12 +18,14 @@ TARGET = ../tst_qsharedmemory
}
wince*:{
+requires(contains(QT_CONFIG,script))
QT += gui script
addFiles.sources = ../lackey/lackey.exe ../lackey/scripts
addFiles.path = lackey
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
}else:symbian*{
+requires(contains(QT_CONFIG,script))
QT += gui script
addFiles.sources = ../lackey/scripts
addFiles.path = /data/qsharedmemorytemp/lackey
diff --git a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
index c0a1c2b..c4ff76c 100644
--- a/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
+++ b/tests/auto/qsharedmemory/tst_qsharedmemory.cpp
@@ -737,11 +737,12 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
#endif
QProcess producer;
producer.setProcessChannelMode(QProcess::ForwardedChannels);
- producer.start("./lackey/lackey", arguments);
+ producer.start( QFileInfo("./lackey/lackey.exe").absoluteFilePath(), arguments);
producer.waitForStarted();
QVERIFY(producer.error() != QProcess::FailedToStart);
QList<QProcess*> consumers;
+ unsigned int failedProcesses = 0;
for (int i = 0; i < processes; ++i) {
#ifndef Q_OS_WINCE
QStringList arguments = QStringList() << SRCDIR "lackey/scripts/consumer.js";
@@ -750,8 +751,12 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
#endif
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
- consumers.append(p);
p->start("./lackey/lackey", arguments);
+
+ if (p->waitForStarted(2000))
+ consumers.append(p);
+ else
+ ++failedProcesses;
}
producer.waitForFinished(5000);
@@ -768,6 +773,7 @@ void tst_QSharedMemory::simpleProcessProducerConsumer()
delete consumers.takeFirst();
}
QCOMPARE(consumerFailed, false);
+ QCOMPARE(failedProcesses, unsigned int (0));
}
QTEST_MAIN(tst_QSharedMemory)
diff --git a/tests/auto/qsharedpointer/externaltests.pri b/tests/auto/qsharedpointer/externaltests.pri
index 627af87..c8a3676 100644
--- a/tests/auto/qsharedpointer/externaltests.pri
+++ b/tests/auto/qsharedpointer/externaltests.pri
@@ -4,5 +4,5 @@ cleanedQMAKESPEC = $$replace(QMAKESPEC, \\\\, /)
!symbian:DEFINES += DEFAULT_MAKESPEC=\\\"$$cleanedQMAKESPEC\\\"
embedded:DEFINES += QTEST_NO_RTTI QTEST_CROSS_COMPILED
-wince*:DEFINES += QTEST_CROSS_COMPILED
+wince*:DEFINES += QTEST_CROSS_COMPILED QTEST_NO_RTTI
symbian: DEFINES += QTEST_CROSS_COMPILED
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 0d6e24c..fa63c4b 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -1061,7 +1061,10 @@ void tst_QSharedPointer::constCorrectness()
ptr = cptr;
QSharedPointer<Data> other = qSharedPointerCast<Data>(cptr);
+
+#ifndef QT_NO_DYNAMIC_CAST
other = qSharedPointerDynamicCast<Data>(cptr);
+#endif
QCOMPARE(cptr.data(), aData);
QCOMPARE(cptr.operator->(), aData);
diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
index 81ef498..832605e 100644
--- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
+++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
@@ -42,6 +42,8 @@
#include <QtTest/QtTest>
#include "qevent.h"
+#include "qdialog.h"
+#include "qdialogbuttonbox.h"
#include "private/qsoftkeymanager_p.h"
class tst_QSoftKeyManager : public QObject
@@ -59,6 +61,8 @@ public slots:
void cleanup();
private slots:
void updateSoftKeysCompressed();
+ void handleCommand();
+ void checkSoftkeyEnableStates();
};
class EventListener : public QObject
@@ -133,6 +137,56 @@ void tst_QSoftKeyManager::updateSoftKeysCompressed()
QVERIFY(listener.numUpdateSoftKeys == 1);
}
+/*
+ This tests that when the S60 environment sends us a command
+ that it actually gets mapped to the correct action.
+*/
+void tst_QSoftKeyManager::handleCommand()
+{
+ QDialog w;
+ QDialogButtonBox *buttons = new QDialogButtonBox(
+ QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+ Qt::Horizontal,
+ &w);
+
+ w.show();
+ QApplication::processEvents();
+
+ QCOMPARE(w.actions().count(), 2);
+
+ QSignalSpy spy0(w.actions()[0], SIGNAL(triggered()));
+ QSignalSpy spy1(w.actions()[1], SIGNAL(triggered()));
+
+ // These should work eventually, but do not yet
+// QTest::keyPress(&w, Qt::Key_Context1);
+// QTest::keyPress(&w, Qt::Key_Context2);
+
+ qApp->symbianHandleCommand(6000);
+ qApp->symbianHandleCommand(6001);
+
+ QApplication::processEvents();
+
+ QCOMPARE(spy0.count(), 1);
+ QCOMPARE(spy1.count(), 1);
+}
+
+/*
+ This tests that softkey enable state follows the state of widget that owns the action
+ to which the softkey is related to.
+*/
+void tst_QSoftKeyManager::checkSoftkeyEnableStates()
+{
+ QWidget w1, w2;
+ w1.setEnabled(false);
+ w2.setEnabled(true);
+
+ QAction *disabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w1);
+ QAction *enabledAction = QSoftKeyManager::createAction(QSoftKeyManager::OkSoftKey, &w2);
+
+ QVERIFY(disabledAction->isEnabled()==false);
+ QVERIFY(enabledAction->isEnabled()==true);
+}
+
QTEST_MAIN(tst_QSoftKeyManager)
#include "tst_qsoftkeymanager.moc"
diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp
index 69347c4..4829b6b 100644
--- a/tests/auto/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/qspinbox/tst_qspinbox.cpp
@@ -653,21 +653,21 @@ void tst_QSpinBox::valueFromTextAndValidate_data()
QTest::addColumn<int>("maxi");
QTest::addColumn<QString>("expectedText"); // if empty we don't check
- QTest::newRow("data0") << QString("2") << Invalid << 3 << 5 << QString();
+ QTest::newRow("data0") << QString("2") << Intermediate << 3 << 5 << QString();
QTest::newRow("data1") << QString() << Intermediate << 0 << 100 << QString();
QTest::newRow("data2") << QString("asd") << Invalid << 0 << 100 << QString();
QTest::newRow("data3") << QString("2") << Acceptable << 0 << 100 << QString();
QTest::newRow("data4") << QString() << Intermediate << 0 << 1 << QString();
QTest::newRow("data5") << QString() << Invalid << 0 << 0 << QString();
QTest::newRow("data5") << QString("5") << Intermediate << 2004 << 2005 << QString();
- QTest::newRow("data6") << QString("50") << Invalid << 2004 << 2005 << QString();
+ QTest::newRow("data6") << QString("50") << Intermediate << 2004 << 2005 << QString();
QTest::newRow("data7") << QString("205") << Intermediate << 2004 << 2005 << QString();
QTest::newRow("data8") << QString("2005") << Acceptable << 2004 << 2005 << QString();
- QTest::newRow("data9") << QString("3") << Invalid << 2004 << 2005 << QString();
+ QTest::newRow("data9") << QString("3") << Intermediate << 2004 << 2005 << QString();
QTest::newRow("data10") << QString("-") << Intermediate << -20 << -10 << QString();
QTest::newRow("data11") << QString("-1") << Intermediate << -20 << -10 << QString();
QTest::newRow("data12") << QString("-5") << Intermediate << -20 << -10 << QString();
- QTest::newRow("data13") << QString("-5") << Invalid << -20 << -16 << QString();
+ QTest::newRow("data13") << QString("-5") << Intermediate << -20 << -16 << QString();
QTest::newRow("data14") << QString("-2") << Intermediate << -20 << -16 << QString();
QTest::newRow("data15") << QString("2") << Invalid << -20 << -16 << QString();
QTest::newRow("data16") << QString() << Intermediate << -20 << -16 << QString();
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 4198bfc..4175bef 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -1705,8 +1705,6 @@ void tst_QSqlDatabase::precisionPolicy()
QEXPECT_FAIL("QOCI", "Oracle fails here, to retrieve next", Continue);
QVERIFY_SQL(q, exec(query));
QVERIFY_SQL(q, next());
- if(db.driverName().startsWith("QSQLITE"))
- QEXPECT_FAIL("", "SQLite returns this value as determined by contents of the field, not the declaration", Continue);
QCOMPARE(q.value(0).type(), QVariant::LongLong);
QSql::NumericalPrecisionPolicy oldPrecision= db.numericalPrecisionPolicy();
@@ -1715,8 +1713,6 @@ void tst_QSqlDatabase::precisionPolicy()
q2.exec(QString("SELECT num FROM %1 WHERE id = 2").arg(tableName));
QVERIFY_SQL(q2, exec(query));
QVERIFY_SQL(q2, next());
- if(db.driverName().startsWith("QSQLITE"))
- QEXPECT_FAIL("", "SQLite returns this value as determined by contents of the field, not the declaration", Continue);
QCOMPARE(q2.value(0).type(), QVariant::LongLong);
db.setNumericalPrecisionPolicy(oldPrecision);
}
@@ -2005,6 +2001,10 @@ void tst_QSqlDatabase::odbc_bindBoolean()
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
+ if (tst_Databases::isMySQL(db)) {
+ QSKIP("MySql has inconsistent behaviour of bit field type across versions.", SkipSingle);
+ return;
+ }
QSqlQuery q(db);
QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool") + "(id int, boolvalue bit)"));
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index eb95d611c..5ed9cfa 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -2352,7 +2352,7 @@ void tst_QSqlQuery::sqlite_finish()
QString tableName = qTableName( "qtest_lockedtable" );
QSqlQuery q( db );
- tst_Databases::safeDropTable( db2, tableName );
+ tst_Databases::safeDropTable( db, tableName );
q.exec( "CREATE TABLE " + tableName + " (pk_id INTEGER PRIMARY KEY, whatever TEXT)" );
q.exec( "INSERT INTO " + tableName + " values(1, 'whatever')" );
q.exec( "INSERT INTO " + tableName + " values(2, 'whatever more')" );
@@ -2371,7 +2371,7 @@ void tst_QSqlQuery::sqlite_finish()
QVERIFY_SQL( q2, exec( "DELETE FROM " + tableName + " WHERE pk_id=2" ) );
QCOMPARE( q2.numRowsAffected(), 1 );
- tst_Databases::safeDropTable( db2, tableName );
+ tst_Databases::safeDropTable( db, tableName );
}
QSqlDatabase::removeDatabase( "sqlite_finish_sqlite" );
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index a3f2f54..37b34bf 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -176,6 +176,7 @@ private slots:
void twoAnimatedTransitions();
void playAnimationTwice();
void nestedTargetStateForAnimation();
+ void polishedSignalTransitionsReuseAnimationGroup();
void animatedGlobalRestoreProperty();
void specificTargetValueOfAnimation();
@@ -1742,11 +1743,18 @@ class TestSignalTransition : public QSignalTransition
{
public:
TestSignalTransition(QState *sourceState = 0)
- : QSignalTransition(sourceState) {}
+ : QSignalTransition(sourceState), m_sender(0)
+ {}
TestSignalTransition(QObject *sender, const char *signal,
QAbstractState *target)
- : QSignalTransition(sender, signal)
+ : QSignalTransition(sender, signal), m_sender(0)
{ setTargetState(target); }
+ QObject *senderReceived() const {
+ return m_sender;
+ }
+ int signalIndexReceived() const {
+ return m_signalIndex;
+ }
QVariantList argumentsReceived() const {
return m_args;
}
@@ -1754,11 +1762,15 @@ protected:
bool eventTest(QEvent *e) {
if (!QSignalTransition::eventTest(e))
return false;
- QSignalEvent *se = static_cast<QSignalEvent*>(e);
- const_cast<TestSignalTransition*>(this)->m_args = se->arguments();
+ QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
+ m_sender = se->sender();
+ m_signalIndex = se->signalIndex();
+ m_args = se->arguments();
return true;
}
private:
+ QObject *m_sender;
+ int m_signalIndex;
QVariantList m_args;
};
@@ -1870,6 +1882,8 @@ void tst_QStateMachine::signalTransitions()
emitter.emitSignalWithIntArg(123);
QTRY_COMPARE(finishedSpy.count(), 1);
+ QCOMPARE(trans->senderReceived(), (QObject*)&emitter);
+ QCOMPARE(trans->signalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithIntArg(int)"));
QCOMPARE(trans->argumentsReceived().size(), 1);
QCOMPARE(trans->argumentsReceived().at(0).toInt(), 123);
}
@@ -1890,6 +1904,8 @@ void tst_QStateMachine::signalTransitions()
emitter.emitSignalWithStringArg(testString);
QTRY_COMPARE(finishedSpy.count(), 1);
+ QCOMPARE(trans->senderReceived(), (QObject*)&emitter);
+ QCOMPARE(trans->signalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithStringArg(QString)"));
QCOMPARE(trans->argumentsReceived().size(), 1);
QCOMPARE(trans->argumentsReceived().at(0).toString(), testString);
}
@@ -2028,6 +2044,38 @@ void tst_QStateMachine::signalTransitions()
}
}
+class TestEventTransition : public QEventTransition
+{
+public:
+ TestEventTransition(QState *sourceState = 0)
+ : QEventTransition(sourceState),
+ m_eventSource(0), m_eventType(QEvent::None)
+ {}
+ TestEventTransition(QObject *object, QEvent::Type type,
+ QAbstractState *target)
+ : QEventTransition(object, type),
+ m_eventSource(0), m_eventType(QEvent::None)
+ { setTargetState(target); }
+ QObject *eventSourceReceived() const {
+ return m_eventSource;
+ }
+ QEvent::Type eventTypeReceived() const {
+ return m_eventType;
+ }
+protected:
+ bool eventTest(QEvent *e) {
+ if (!QEventTransition::eventTest(e))
+ return false;
+ QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(e);
+ m_eventSource = we->object();
+ m_eventType = we->event()->type();
+ return true;
+ }
+private:
+ QObject *m_eventSource;
+ QEvent::Type m_eventType;
+};
+
void tst_QStateMachine::eventTransitions()
{
QPushButton button;
@@ -2274,6 +2322,30 @@ void tst_QStateMachine::eventTransitions()
QTest::ignoreMessage(QtWarningMsg, "QObject event transitions are not supported for custom types");
QTRY_COMPARE(startedSpy.count(), 1);
}
+ // custom transition
+ {
+ QStateMachine machine;
+ QState *s0 = new QState(&machine);
+ QFinalState *s1 = new QFinalState(&machine);
+
+ TestEventTransition *trans = new TestEventTransition(&button, QEvent::MouseButtonPress, s1);
+ s0->addTransition(trans);
+ QCOMPARE(trans->eventSourceReceived(), (QObject*)0);
+ QCOMPARE(trans->eventTypeReceived(), QEvent::None);
+
+ QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
+ machine.setInitialState(s0);
+ machine.start();
+ QCoreApplication::processEvents();
+
+ QTest::mousePress(&button, Qt::LeftButton);
+ QCoreApplication::processEvents();
+
+ QTRY_COMPARE(finishedSpy.count(), 1);
+
+ QCOMPARE(trans->eventSourceReceived(), (QObject*)&button);
+ QCOMPARE(trans->eventTypeReceived(), QEvent::MouseButtonPress);
+ }
}
void tst_QStateMachine::historyStates()
@@ -3044,6 +3116,38 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
QCOMPARE(counter.counter, 2);
}
+void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup()
+{
+ QStateMachine machine;
+ QObject *object = new QObject(&machine);
+ object->setProperty("foo", 0);
+
+ QState *s1 = new QState(&machine);
+ s1->assignProperty(object, "foo", 123);
+ QState *s2 = new QState(&machine);
+ s2->assignProperty(object, "foo", 456);
+ QState *s3 = new QState(&machine);
+ s3->assignProperty(object, "foo", 789);
+ QFinalState *s4 = new QFinalState(&machine);
+
+ QParallelAnimationGroup animationGroup;
+ animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
+ QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
+ s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup);
+ s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup);
+ s3->addTransition(s3, SIGNAL(polished()), s4);
+
+ machine.setInitialState(s1);
+ QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
+ machine.start();
+ QTRY_COMPARE(machineFinishedSpy.count(), 1);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s4));
+ QCOMPARE(object->property("foo").toInt(), 789);
+
+ QCOMPARE(animationFinishedSpy.count(), 2);
+}
+
void tst_QStateMachine::animatedGlobalRestoreProperty()
{
QStateMachine machine;
@@ -3954,7 +4058,7 @@ public:
void onTransition(QEvent *e)
{
QSignalTransition::onTransition(e);
- QSignalEvent *se = static_cast<QSignalEvent*>(e);
+ QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
eventSignalIndex = se->signalIndex();
}
diff --git a/tests/auto/qsystemsemaphore/test/test.pro b/tests/auto/qsystemsemaphore/test/test.pro
index b8d3a4a..ed7898c 100644
--- a/tests/auto/qsystemsemaphore/test/test.pro
+++ b/tests/auto/qsystemsemaphore/test/test.pro
@@ -18,6 +18,7 @@ win32 {
RESOURCES += ../files.qrc
wince*: {
+requires(contains(QT_CONFIG,script))
# this test calls lackey, which then again depends on QtScript.
# let's add it here so that it gets deployed easily
QT += script
@@ -28,6 +29,7 @@ DEPLOYMENT += lackey
}
symbian: {
+requires(contains(QT_CONFIG,script))
# this test calls lackey, which then again depends on QtScript.
# let's add it here so that it gets deployed easily
QT += script
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index f5d5040..71218a3 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -2339,6 +2339,7 @@ void tst_QTableView::scrollTo()
// resizing to this size will ensure that there can ONLY_BE_ONE_CELL inside the view.
QSize forcedSize(columnWidth * 2, rowHeight * 2);
view.resize(forcedSize);
+ QTest::qWaitForWindowShown(&view);
QTest::qWait(0);
QTRY_COMPARE(view.size(), forcedSize);
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index c0d7ed3..f393393 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -1787,21 +1787,17 @@ void tst_QTextDocument::cursorPositionChangedOnSetText()
{
CursorPosSignalSpy spy(doc);
- cursor = QTextCursor();
+ // doc has one QTextCursor stored in the
+ // cursor member variable, thus the signal
+ // gets emitted once.
doc->setPlainText("Foo\nBar\nBaz\nBlub\nBlah");
- // the signal should still be emitted once for the QTextCursor that
- // QTextDocument::setPlainText creates temporarily. But the signal
- // should not be emitted more often.
QCOMPARE(spy.calls, 1);
spy.calls = 0;
doc->setHtml("<p>Foo<p>Bar<p>Baz<p>Blah");
- // the signal should still be emitted once for the QTextCursor that
- // QTextDocument::setPlainText creates temporarily. But the signal
- // should not be emitted more often.
QCOMPARE(spy.calls, 1);
}
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 31c102e..ab7ea78 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -1756,11 +1756,11 @@ void tst_QWidget::setTabOrder()
container.show();
container.activateWindow();
+ qApp->setActiveWindow(&container);
#ifdef Q_WS_X11
QTest::qWaitForWindowShown(&container);
QTest::qWait(50);
#endif
- qApp->setActiveWindow(&container);
QTest::qWait(100);
@@ -2316,8 +2316,9 @@ void tst_QWidget::showMinimizedKeepsFocus()
QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(0));
window.showNormal();
- QTest::qWait(30);
qApp->setActiveWindow(&window);
+ QTest::qWaitForWindowShown(&window);
+ QTest::qWait(30);
#ifdef Q_WS_MAC
if (!macHasAccessToWindowsServer())
QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue);
@@ -3116,7 +3117,7 @@ void tst_QWidget::saveRestoreGeometry()
widget.resize(size);
widget.show();
QTest::qWaitForWindowShown(&widget);
- QTest::qWait(100);
+ QTest::qWait(200);
QTRY_COMPARE(widget.geometry().size(), size);
QRect geom;
@@ -3126,15 +3127,15 @@ void tst_QWidget::saveRestoreGeometry()
geom = widget.geometry();
widget.setWindowState(widget.windowState() | Qt::WindowFullScreen);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
- QTest::qWait(100);
+ QTest::qWait(200);
QVERIFY(widget.restoreGeometry(savedGeometry));
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY(!(widget.windowState() & Qt::WindowFullScreen));
QTRY_COMPARE(widget.geometry(), geom);
//Restore to full screen
widget.setWindowState(widget.windowState() | Qt::WindowFullScreen);
- QTest::qWait(20);
+ QTest::qWait(120);
QTRY_VERIFY((widget.windowState() & Qt::WindowFullScreen));
QTest::qWait(200);
savedGeometry = widget.saveGeometry();
@@ -3165,7 +3166,7 @@ void tst_QWidget::saveRestoreGeometry()
QTest::qWait(20);
QTRY_VERIFY((widget.windowState() & Qt::WindowMaximized));
QTRY_VERIFY(widget.geometry() != geom);
- QTest::qWait(100);
+ QTest::qWait(200);
QVERIFY(widget.restoreGeometry(savedGeometry));
QTest::qWait(20);
QTRY_COMPARE(widget.geometry(), geom);
@@ -5274,24 +5275,26 @@ public:
QRegion r;
};
-#define VERIFY_COLOR(region, color) { \
- const QRegion r = QRegion(region); \
- for (int i = 0; i < r.rects().size(); ++i) { \
- const QRect rect = r.rects().at(i); \
- for (int t = 0; t < 5; t++) { \
- const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(), \
- rect.left(), rect.top(), \
- rect.width(), rect.height()); \
- QCOMPARE(pixmap.size(), rect.size()); \
- QPixmap expectedPixmap(pixmap); /* ensure equal formats */ \
- expectedPixmap.fill(color); \
- if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 ) \
- { QTest::qWait(200); continue; } \
- QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb()); \
- QCOMPARE(pixmap, expectedPixmap); \
- break; \
- } \
- } \
+template<typename R, typename C>
+void verifyColor(R const& region, C const& color)
+{
+ const QRegion r = QRegion(region);
+ for (int i = 0; i < r.rects().size(); ++i) {
+ const QRect rect = r.rects().at(i);
+ for (int t = 0; t < 5; t++) {
+ const QPixmap pixmap = QPixmap::grabWindow(QDesktopWidget().winId(),
+ rect.left(), rect.top(),
+ rect.width(), rect.height());
+ QCOMPARE(pixmap.size(), rect.size());
+ QPixmap expectedPixmap(pixmap); /* ensure equal formats */
+ expectedPixmap.fill(color);
+ if (pixmap.toImage().pixel(0,0) != QColor(color).rgb() && t < 4 )
+ { QTest::qWait(200); continue; }
+ QCOMPARE(pixmap.toImage().pixel(0,0), QColor(color).rgb());
+ QCOMPARE(pixmap, expectedPixmap);
+ break;
+ }
+ }
}
void tst_QWidget::moveChild_data()
@@ -5332,9 +5335,9 @@ void tst_QWidget::moveChild()
#endif
QTRY_COMPARE(parent.r, QRegion(parent.rect()) - child.geometry());
QTRY_COMPARE(child.r, QRegion(child.rect()));
- VERIFY_COLOR(child.geometry().translated(tlwOffset),
+ verifyColor(child.geometry().translated(tlwOffset),
child.color);
- VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset),
+ verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset),
parent.color);
parent.reset();
child.reset();
@@ -5353,10 +5356,10 @@ void tst_QWidget::moveChild()
// should be scrolled in backingstore
QCOMPARE(child.r, QRegion());
#endif
- VERIFY_COLOR(child.geometry().translated(tlwOffset),
- child.color);
- VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset),
- parent.color);
+ verifyColor(child.geometry().translated(tlwOffset),
+ child.color);
+ verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset),
+ parent.color);
}
void tst_QWidget::showAndMoveChild()
@@ -5364,7 +5367,11 @@ void tst_QWidget::showAndMoveChild()
QWidget parent(0, Qt::FramelessWindowHint);
// prevent custom styles
parent.setStyle(new QWindowsStyle);
- parent.resize(300, 300);
+
+ QDesktopWidget desktop;
+ QRect desktopDimensions = desktop.availableGeometry(&parent);
+
+ parent.setGeometry(desktopDimensions);
parent.setPalette(Qt::red);
parent.show();
QTest::qWaitForWindowShown(&parent);
@@ -5372,18 +5379,18 @@ void tst_QWidget::showAndMoveChild()
const QPoint tlwOffset = parent.geometry().topLeft();
QWidget child(&parent);
- child.resize(100, 100);
+ child.resize(desktopDimensions.width()/2, desktopDimensions.height()/2);
child.setPalette(Qt::blue);
child.setAutoFillBackground(true);
// Ensure that the child is repainted correctly when moved right after show.
// NB! Do NOT processEvents() (or qWait()) in between show() and move().
child.show();
- child.move(150, 150);
+ child.move(desktopDimensions.width()/2, desktopDimensions.height()/2);
qApp->processEvents();
- VERIFY_COLOR(child.geometry().translated(tlwOffset), Qt::blue);
- VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red);
+ verifyColor(child.geometry().translated(tlwOffset), Qt::blue);
+ verifyColor(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red);
}
void tst_QWidget::subtractOpaqueSiblings()
@@ -6402,7 +6409,7 @@ void tst_QWidget::render()
qApp->processEvents();
qApp->sendPostedEvents();
- QTest::qWait(100);
+ QTest::qWait(250);
QImage sourceImage = QPixmap::grabWidget(&source).toImage();
qApp->processEvents();
@@ -6508,6 +6515,7 @@ void tst_QWidget::renderInvisible()
dummyFocusWidget.show();
QTest::qWaitForWindowShown(&dummyFocusWidget);
qApp->processEvents();
+ QTest::qWait(100);
// Create normal reference image.
const QSize calendarSize = calendar->size();
@@ -9147,35 +9155,38 @@ void tst_QWidget::destroyBackingStore()
void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
{
- QWidget main;
+ QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs
+ QWidget main(0,0,Qt::FramelessWindowHint); //don't get confused by the size of the window frame
QPalette palette;
palette.setColor(QPalette::Window, Qt::red);
main.setPalette(palette);
- main.resize(400, 400);
+
+ QDesktopWidget desktop;
+ QRect desktopDimensions = desktop.availableGeometry(&main);
+ QSize mainSize(400, 400);
+ mainSize = mainSize.boundedTo(desktopDimensions.size());
+ main.resize(mainSize);
QWidget *offsetWidget = new QWidget(&main);
- offsetWidget->setGeometry(0, -14600, 400, 15000);
+ offsetWidget->setGeometry(0, -(15000 - mainSize.height()), mainSize.width(), 15000);
// big widget is too big for the coordinates, it must be limited by wrect
// if wrect is not at the right position because of offsetWidget, bigwidget
// is not painted correctly
QWidget *bigWidget = new QWidget(offsetWidget);
- bigWidget->setGeometry(0, 0, 400, 50000);
+ bigWidget->setGeometry(0, 0, mainSize.width(), 50000);
palette.setColor(QPalette::Window, Qt::green);
bigWidget->setPalette(palette);
bigWidget->setAutoFillBackground(true);
main.show();
QTest::qWaitForWindowShown(&main);
- QTest::qWait(50);
- QCursor::setPos(main.pos()); //get the cursor out of the picture
- QTest::qWait(50);
QPixmap correct(main.size());
correct.fill(Qt::green);
- QRect center(100, 100, 200, 200); // to avoid the decorations
- QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage().copy(center), correct.toImage().copy(center));
+ QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage(), correct.toImage());
+ QApplication::restoreOverrideCursor();
}
void tst_QWidget::inputFocus_task257832()
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
index 2c5ba72..0a6b7ad 100644
--- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
+++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
@@ -230,7 +230,7 @@ void tst_QWindowSurface::grabWidget()
parentWidget.show();
QTest::qWaitForWindowShown(&parentWidget);
- QTest::qWait(20);
+ QTest::qWait(120);
QPixmap parentPixmap = parentWidget.windowSurface()->grabWidget(&parentWidget);
QPixmap childPixmap = childWidget.windowSurface()->grabWidget(&childWidget);
diff --git a/tests/auto/windowsmobile/test/testQMenuBar_current.png b/tests/auto/windowsmobile/test/testQMenuBar_current.png
index d03e69a..f0042b8 100644
--- a/tests/auto/windowsmobile/test/testQMenuBar_current.png
+++ b/tests/auto/windowsmobile/test/testQMenuBar_current.png
Binary files differ
diff --git a/tests/auto/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/windowsmobile/test/testSimpleWidget_current.png
index 09a10a3..8086c41 100644
--- a/tests/auto/windowsmobile/test/testSimpleWidget_current.png
+++ b/tests/auto/windowsmobile/test/testSimpleWidget_current.png
Binary files differ
diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
index 2d7c9ea..7a86a51 100644
--- a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
+++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
@@ -57,6 +57,8 @@ class tst_WindowsMobile : public QObject
public:
tst_WindowsMobile()
{
+ qApp->setCursorFlashTime (24 * 3600 * 1000); // once a day
+ // qApp->setCursorFlashTime (INT_MAX);
#ifdef Q_OS_WINCE_WM
q_initDD();
#endif
@@ -123,11 +125,20 @@ void compareScreenshots(const QString &image1, const QString &image2)
QImage screenShot(image1);
QImage original(image2);
- //ignore the clock
+ // cut away the title bar before comparing
+ QDesktopWidget desktop;
+ QRect desktopFrameRect = desktop.frameGeometry();
+ QRect desktopClientRect = desktop.availableGeometry();
+
QPainter p1(&screenShot);
QPainter p2(&original);
- p1.fillRect(310, 6, 400, 34, Qt::black);
- p2.fillRect(310, 6, 400, 34, Qt::black);
+
+ //screenShot.save("scr1.png", "PNG");
+ p1.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black);
+ p2.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black);
+
+ //screenShot.save("scr2.png", "PNG");
+ //original.save("orig1.png", "PNG");
QVERIFY(original == screenShot);
}
diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp
index 5522847..ab381f4 100644
--- a/tests/benchmarks/qanimation/rectanimation.cpp
+++ b/tests/benchmarks/qanimation/rectanimation.cpp
@@ -73,9 +73,9 @@ int RectAnimation::duration() const
}
-void RectAnimation::updateCurrentTime()
+void RectAnimation::updateCurrentTime(int currentTime)
{
- qreal progress = m_easing.valueForProgress( currentTime() / qreal(m_dura) );
+ qreal progress = m_easing.valueForProgress( currentTime / qreal(m_dura) );
QRect now;
now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress),
interpolateInteger(m_start.top(), m_end.top(), progress),
diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h
index 995becb..ea1f804 100644
--- a/tests/benchmarks/qanimation/rectanimation.h
+++ b/tests/benchmarks/qanimation/rectanimation.h
@@ -58,7 +58,7 @@ public:
void setDuration(int d);
int duration() const;
- virtual void updateCurrentTime();
+ virtual void updateCurrentTime(int currentTime);
virtual void updateState(QAbstractAnimation::State state);
private: