diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-11-23 15:14:07 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-02 14:18:20 +0100 |
commit | 6c8378eaf1edbbefe6aaa3672b0127816a004fd7 (patch) | |
tree | 8ee08fb447e052f7a7a685fbeaaa04f04ea60126 /tests/auto/declarative/qquickcanvasitem/data/tst_arc.qml | |
parent | e01219b77b1e889e70437635905d7ff820568e23 (diff) |
Say hello to QtQuick module
This change moves the QtQuick 2 types and C++ API (including
SceneGraph) to a new module (AKA library), QtQuick.
99% of this change is moving files from src/declarative to
src/quick, and from tests/auto/declarative to
tests/auto/qtquick2.
The loading of QtQuick 2 ("import QtQuick 2.0") is now delegated to
a plugin, src/imports/qtquick2, just like it's done for QtQuick 1.
All tools, examples, and tests that use QtQuick C++ API have gotten
"QT += quick" or "QT += quick-private" added to their .pro file.
A few additional internal QtDeclarative classes had to be exported
(via Q_DECLARATIVE_PRIVATE_EXPORT) since they're needed by the
QtQuick 2 implementation.
The old header locations (e.g. QtDeclarative/qquickitem.h) will
still be supported for some time, but will produce compile-time
warnings. (To avoid the QtQuick implementation using the
compatibility headers (since QtDeclarative's includepath comes
first), a few include statements were modified, e.g. from
"#include <qsgnode.h>" to "#include <QtQuick/qsgnode.h>".)
There's a change in qtbase that automatically adds QtQuick to the
module list if QtDeclarative is used. Together with the compatibility
headers, this should help reduce the migration pain for existing
projects.
In theory, simply getting an existing QtDeclarative-based project
to compile and link shouldn't require any changes for now -- but
porting to the new scheme is of course recommended, and will
eventually become mandatory.
Task-number: QTBUG-22889
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Change-Id: Ia52be9373172ba2f37e7623231ecb060316c96a7
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qquickcanvasitem/data/tst_arc.qml')
-rw-r--r-- | tests/auto/declarative/qquickcanvasitem/data/tst_arc.qml | 487 |
1 files changed, 0 insertions, 487 deletions
diff --git a/tests/auto/declarative/qquickcanvasitem/data/tst_arc.qml b/tests/auto/declarative/qquickcanvasitem/data/tst_arc.qml deleted file mode 100644 index 6006a5a4c0..0000000000 --- a/tests/auto/declarative/qquickcanvasitem/data/tst_arc.qml +++ /dev/null @@ -1,487 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import "testhelper.js" as Helper - -Canvas { - id:canvas; width:100;height:50; renderTarget: Canvas.Image - TestCase { - name: "arc"; when: windowShown - function test_angle_1() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, Math.PI/2, -Math.PI, true); - ctx.fill(); - verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - function test_angle_2() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, -3*Math.PI/2, -Math.PI, true); - ctx.fill(); - verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - function test_angle_3() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, (512+1/2)*Math.PI, (1024-1)*Math.PI, true); - ctx.fill(); - //verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - function test_angle_4() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.arc(50, 25, 60, (512+1/2)*Math.PI, (1024-1)*Math.PI, false); - ctx.fill(); - verify(Helper.comparePixel(ctx,1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx,98,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx,1,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx,98,48, 0,255,0,255)); - } - function test_angle_5() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(100, 0); - ctx.arc(100, 0, 150, (1024-1)*Math.PI, (512+1/2)*Math.PI, false); - ctx.fill(); - /*FIXME: - actual :[255,0,0,255] - expected:[0,255,0,255] +/- 0 - */ - //verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - - function test_angle_6() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(50, 25); - ctx.arc(50, 25, 60, (1024-1)*Math.PI, (512+1/2)*Math.PI, true); - ctx.fill(); - - verify(Helper.comparePixel(ctx,1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx,98,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx,1,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx,98,48, 0,255,0,255)); - } - - function test_empty() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(200, 25, 5, 0, 2*Math.PI, true); - ctx.stroke(); - /*FIXME: - actual :[255,0,0,255] - expected:[0,255,0,255] +/- 0 - */ - //verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - function test_nonempty() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arc(200, 25, 5, 0, 2*Math.PI, true); - ctx.stroke(); - verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - function test_nonfinite() { - skip("FIXME"); - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.moveTo(0, 0); - ctx.lineTo(100, 0); - ctx.arc(Infinity, 0, 50, 0, 2*Math.PI, true); - ctx.arc(-Infinity, 0, 50, 0, 2*Math.PI, true); - ctx.arc(NaN, 0, 50, 0, 2*Math.PI, true); - ctx.arc(0, Infinity, 50, 0, 2*Math.PI, true); - ctx.arc(0, -Infinity, 50, 0, 2*Math.PI, true); - ctx.arc(0, NaN, 50, 0, 2*Math.PI, true); - ctx.arc(0, 0, Infinity, 0, 2*Math.PI, true); - ctx.arc(0, 0, -Infinity, 0, 2*Math.PI, true); - ctx.arc(0, 0, NaN, 0, 2*Math.PI, true); - ctx.arc(0, 0, 50, Infinity, 2*Math.PI, true); - ctx.arc(0, 0, 50, -Infinity, 2*Math.PI, true); - ctx.arc(0, 0, 50, NaN, 2*Math.PI, true); - ctx.arc(0, 0, 50, 0, Infinity, true); - ctx.arc(0, 0, 50, 0, -Infinity, true); - ctx.arc(0, 0, 50, 0, NaN, true); - ctx.arc(Infinity, Infinity, 50, 0, 2*Math.PI, true); - ctx.arc(Infinity, Infinity, Infinity, 0, 2*Math.PI, true); - ctx.arc(Infinity, Infinity, Infinity, Infinity, 2*Math.PI, true); - ctx.arc(Infinity, Infinity, Infinity, Infinity, Infinity, true); - ctx.arc(Infinity, Infinity, Infinity, 0, Infinity, true); - ctx.arc(Infinity, Infinity, 50, Infinity, 2*Math.PI, true); - ctx.arc(Infinity, Infinity, 50, Infinity, Infinity, true); - ctx.arc(Infinity, Infinity, 50, 0, Infinity, true); - ctx.arc(Infinity, 0, Infinity, 0, 2*Math.PI, true); - ctx.arc(Infinity, 0, Infinity, Infinity, 2*Math.PI, true); - ctx.arc(Infinity, 0, Infinity, Infinity, Infinity, true); - ctx.arc(Infinity, 0, Infinity, 0, Infinity, true); - ctx.arc(Infinity, 0, 50, Infinity, 2*Math.PI, true); - ctx.arc(Infinity, 0, 50, Infinity, Infinity, true); - ctx.arc(Infinity, 0, 50, 0, Infinity, true); - ctx.arc(0, Infinity, Infinity, 0, 2*Math.PI, true); - ctx.arc(0, Infinity, Infinity, Infinity, 2*Math.PI, true); - ctx.arc(0, Infinity, Infinity, Infinity, Infinity, true); - ctx.arc(0, Infinity, Infinity, 0, Infinity, true); - ctx.arc(0, Infinity, 50, Infinity, 2*Math.PI, true); - ctx.arc(0, Infinity, 50, Infinity, Infinity, true); - ctx.arc(0, Infinity, 50, 0, Infinity, true); - ctx.arc(0, 0, Infinity, Infinity, 2*Math.PI, true); - ctx.arc(0, 0, Infinity, Infinity, Infinity, true); - ctx.arc(0, 0, Infinity, 0, Infinity, true); - ctx.arc(0, 0, 50, Infinity, Infinity, true); - ctx.lineTo(100, 50); - ctx.lineTo(0, 50); - ctx.fillStyle = '#0f0'; - ctx.fill(); - verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx,90,45, 0,255,0,255)); - } - function test_end() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(-100, 0); - ctx.arc(-100, 0, 25, -Math.PI/2, Math.PI/2, true); - ctx.lineTo(100, 25); - ctx.stroke(); - verify(Helper.comparePixel(ctx,50,25, 0,255,0,255)); - } - function test_negative() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - try { var err = false; - ctx.arc(0, 0, -1, 0, 0, true); - } catch (e) { - if (e.code != DOMException.INDEX_SIZE_ERR) - fail("expected exception of type INDEX_SIZE_ERR, got: "+e.message); - err = true; - } finally { - verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.arc(0, 0, -1, 0, 0, true)"); - } - - } - - function test_scale_1() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.scale(2, 0.5); - ctx.fillStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(25, 50, 56, 0, 2*Math.PI, false); - ctx.fill(); - ctx.fillStyle = '#f00'; - ctx.beginPath(); - ctx.moveTo(-25, 50); - ctx.arc(-25, 50, 24, 0, 2*Math.PI, false); - ctx.moveTo(75, 50); - ctx.arc(75, 50, 24, 0, 2*Math.PI, false); - ctx.moveTo(25, -25); - ctx.arc(25, -25, 24, 0, 2*Math.PI, false); - ctx.moveTo(25, 125); - ctx.arc(25, 125, 24, 0, 2*Math.PI, false); - ctx.fill(); - - verify(Helper.comparePixel(ctx, 0,0, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 50,0, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 99,0, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 0,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 99,25, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 0,49, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 50,49, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 99,49, 0,255,0,255)); - } - - function test_scale_2() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.scale(100, 100); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 1.2; - ctx.beginPath(); - ctx.arc(0, 0, 0.6, 0, Math.PI/2, false); - ctx.stroke(); - - verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 50,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 50,48, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255)); - } - - function test_selfintersect_1() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 200; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(100, 50, 25, 0, -Math.PI/2, true); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(0, 0, 25, 0, -Math.PI/2, true); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - } - - function test_selfintersect_2() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 180; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(-50, 50, 25, 0, -Math.PI/2, true); - ctx.stroke(); - ctx.beginPath(); - ctx.arc(100, 0, 25, 0, -Math.PI/2, true); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 90,10, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 97,1, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 97,2, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 97,3, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 2,48, 0,255,0,255)); - } - - function test_shape_1() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(50, 50, 50, 0, Math.PI, false); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 20,48, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255)); - } - - function test_shape_2() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 100; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(50, 50, 50, 0, Math.PI, true); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 20,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255)); - } - function test_shape_3() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 100; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(0, 50, 50, 0, -Math.PI/2, false); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255)); - } - - function test_shape_4() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 150; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.arc(-50, 50, 100, 0, -Math.PI/2, true); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255)); - verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255)); - } - - function test_shape_5() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 200; - ctx.strokeStyle = '#f00'; - ctx.beginPath(); - ctx.arc(300, 0, 100, 0, 5*Math.PI, false); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 1,1, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 98,1, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 1,48, 0,255,0,255)); - //verify(Helper.comparePixel(ctx, 98,48, 0,255,0,255)); - } - - function test_twopie() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, true); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 50,20, 0,255,0,255)); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI - 1e-4, false); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,20, 0,255,0,255)); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, true); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,20, 0,255,0,255)); - ctx.reset(); - - ctx.fillStyle = '#f00'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#0f0'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 2*Math.PI + 1e-4, false); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,20, 0,255,0,255)); - } - - function test_zero() { - var ctx = canvas.getContext('2d'); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 0, true); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 50,20, 0,255,0,255)); - ctx.reset(); - - ctx.fillStyle = '#0f0'; - ctx.fillRect(0, 0, 100, 50); - ctx.strokeStyle = '#f00'; - ctx.lineWidth = 100; - ctx.beginPath(); - ctx.arc(50, 25, 50, 0, 0, false); - ctx.stroke(); - //verify(Helper.comparePixel(ctx, 50,20, 0,255,0,255)); - ctx.reset(); - - ctx.fillStyle = '#f00' - ctx.fillRect(0, 0, 100, 50); - ctx.lineWidth = 50; - ctx.strokeStyle = '#0f0'; - ctx.beginPath(); - ctx.moveTo(0, 25); - ctx.arc(200, 25, 0, 0, Math.PI, true); - ctx.stroke(); - verify(Helper.comparePixel(ctx, 50,25, 0,255,0,255)); - - } - } -} |