Update contrib.
1 // Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\buffer\t_graph.cpp
16 // Test the TPoint, TSize, TRect class.
18 // TPoint, TSize, TRect.
20 // - Initialize some two-dimensional points in Cartesian co-ordinates with various
21 // positive, negative values. Add and subtract different initialized points and
22 // check that results are as expected.
23 // - Create some two-dimensional sizes, set with various positive, negative values.
24 // Add and subtract different initialized sizes and check that results are as expected.
25 // - Initialize some rectangles in different positions, set various widths, heights and
26 // sizes and verify that values are assigned as specified.
27 // - Move the rectangle by adding two-dimensional point offset, some x, y offset and check
28 // that it is as expected.
29 // - Resize, shrink, grow, rectangles by adding, subtracting some horizontal, vertical
30 // offset and verify that it is as expected.
31 // - Get the minimal rectangles which bounds one rectangle and the specified rectangles,
32 // assign it to the rectangles and check that it is as expected.
33 // - Assign some rectangles with different positions and test whether the rectangle is
34 // empty, overlaps as expected.
35 // - Get the area of intersection between one rectangle and the specified rectangle,
36 // assign it to the rectangle and verify that the assigned rectangle is not empty.
37 // - Create some rectangles, check that the rectangle's width and height have positive
38 // values, the rectangle is normalized, whether a point is located within the rectangle
40 // - Create some rectangles, get the points at the centre of the rectangles and check that
42 // - Create some three-dimensional points in Cartesian co-ordinates with various
43 // positive, negative values. Add and subtract different initialized points and
44 // check that results are as expected.
45 // Platforms/Drives/Compatibility:
47 // Assumptions/Requirement/Pre-requisites:
48 // Failures and causes:
49 // Base Port information:
55 LOCAL_D RTest test(_L("T_GRAPH"));
60 TestTPoint(TInt x1,TInt y1,TInt x2,TInt y2,TInt x3,TInt y3,TInt x4,TInt y4);
64 void TestUnaryMinus();
79 TestTSize(TInt wid1,TInt hgt1,TInt wid2,TInt hgt2,TInt wid3,TInt hgt3,TInt wid4,TInt hgt4);
83 void TestUnaryMinus();
98 TestTRect(TInt tlx1,TInt tly1,TInt brx1,TInt bry1,
99 TInt tlx2,TInt tly2,TInt brx2,TInt bry2,
100 TInt tlx3,TInt tly3,TInt brx3,TInt bry3);
106 void TestBoundingRect();
108 void TestIntersects();
109 void TestIntersection();
110 void TestNormalize();
131 TestTPoint3D(TInt x1,TInt y1,TInt z1,TInt x2,TInt y2,TInt z2,TInt x3,TInt y3,TInt z3,TInt x4,TInt y4,TInt z4);
135 void TestUnaryMinus();
152 //////////////////////////////////////////////////////////////////////////////
153 // Point test code //
154 //////////////////////////////////////////////////////////////////////////////
156 TestTPoint::TestTPoint(TInt x1,TInt y1,TInt x2,TInt y2,TInt x3,TInt y3,TInt x4,TInt y4)
168 void TestTPoint::TestSet()
176 test(p1.iX==iX1 && p1.iY==iY1);
177 test(p2.iX==iX2 && p2.iY==iY2);
178 test(p4.iX==0 && p4.iY==0);
182 test(p3.iX==iX3 && p3.iY==iY3);
183 test(p3.AsSize()==s1);
186 test(p4.iX==iX4 && p4.iY==iY4);
190 test(p1.iX==p4.iX && p1.iY==p4.iY);
194 test(p3.iX==p2.iX && p3.iY==p2.iY);
204 void TestTPoint::TestAdd()
214 test(p1.iX==(p2.iX+iX1) && p1.iY==(p2.iY+iY1));
216 test(p3.iX==(p1.iX+p2.iX) && p3.iY==(p1.iY+p2.iY));
220 test(p4.iX==(p1.iX+iX4) && p4.iY==(p1.iY+iY4));
225 test(p1.iX==(px.iX+s1.iWidth) && p1.iY==(px.iY+s1.iHeight));
230 void TestTPoint::TestSub()
240 test(p1.iX==(iX1-p2.iX) && p1.iY==(iY1-p2.iY));
242 test(p3.iX==(p1.iX-p2.iX) && p3.iY==(p1.iY-p2.iY));
246 test(p4.iX==(iX4-p1.iX) && p4.iY==(iY4-p1.iY));
251 test(p1.iX==(px.iX-s1.iWidth) && p1.iY==(px.iY-s1.iHeight));
256 void TestTPoint::TestUnaryMinus()
264 test (p==TPoint(-iX1,-iY1));
266 test (p==TPoint(-iX2,-iY2));
268 test (p==TPoint(-iX3,-iY3));
270 test (p==TPoint(-iX4,-iY4));
273 //////////////////////////////////////////////////////////////////////////////
275 //////////////////////////////////////////////////////////////////////////////
277 TestTSize::TestTSize(TInt x1,TInt y1,TInt x2,TInt y2,TInt x3,TInt y3,TInt x4,TInt y4)
289 void TestTSize::TestSet()
291 TPoint p1(iWidth3,iHeight3);
292 TSize s1(iWidth1,iHeight1);
293 TSize s2(iWidth2,iHeight2);
297 test(s1.iWidth==iWidth1 && s1.iHeight==iHeight1);
298 test(s2.iWidth==iWidth2 && s2.iHeight==iHeight2);
299 test(s4.iWidth==0 && s4.iHeight==0);
303 test(s3.iWidth==iWidth3 && s3.iHeight==iHeight3);
304 test(s3.AsPoint()==p1);
306 s4.SetSize(iWidth4,iHeight4);
307 test(s4.iWidth==iWidth4 && s4.iHeight==iHeight4);
311 test(s1.iWidth==s4.iWidth && s1.iHeight==s4.iHeight);
314 test(s3.iWidth==s2.iWidth && s3.iHeight==s2.iHeight);
324 void TestTSize::TestAdd()
326 TPoint p1(iWidth3,iHeight3);
327 TSize s1(iWidth1,iHeight1);
328 TSize s2(iWidth2,iHeight2);
329 TSize s3(iWidth3,iHeight3);
330 TSize s4(iWidth4,iHeight4);
334 test(s1.iWidth==(s2.iWidth+iWidth1) && s1.iHeight==(s2.iHeight+iHeight1));
336 test(s3.iWidth==(s1.iWidth+s2.iWidth) && s3.iHeight==(s1.iHeight+s2.iHeight));
340 test(s4.iWidth==(s1.iWidth+iWidth4) && s4.iHeight==(s1.iHeight+iHeight4));
345 test(s1.iWidth==(sx.iWidth+p1.iX) && s1.iHeight==(sx.iHeight+p1.iY));
350 void TestTSize::TestSub()
352 TPoint p1(iWidth3,iHeight3);
353 TSize s1(iWidth1,iHeight1);
354 TSize s2(iWidth2,iHeight2);
355 TSize s3(iWidth3,iHeight3);
356 TSize s4(iWidth4,iHeight4);
360 test(s1.iWidth==(iWidth1-s2.iWidth) && s1.iHeight==(iHeight1-s2.iHeight));
362 test(s3.iWidth==(s1.iWidth-s2.iWidth) && s3.iHeight==(s1.iHeight-s2.iHeight));
366 test(s4.iWidth==(iWidth4-s1.iWidth) && s4.iHeight==(iHeight4-s1.iHeight));
371 test(s1.iWidth==(sx.iWidth-p1.iX) && s1.iHeight==(sx.iHeight-p1.iY));
376 void TestTSize::TestUnaryMinus()
378 TSize s1(iWidth1,iHeight1);
379 TSize s2(iWidth2,iHeight2);
380 TSize s3(iWidth3,iHeight3);
381 TSize s4(iWidth4,iHeight4);
384 test (s==TSize(-iWidth1,-iHeight1));
386 test (s==TSize(-iWidth2,-iHeight2));
388 test (s==TSize(-iWidth3,-iHeight3));
390 test (s==TSize(-iWidth4,-iHeight4));
393 //////////////////////////////////////////////////////////////////////////////
394 // Rectangle test code //
395 //////////////////////////////////////////////////////////////////////////////
397 TestTRect::TestTRect(TInt tlx1,TInt tly1,TInt brx1,TInt bry1,
398 TInt tlx2,TInt tly2,TInt brx2,TInt bry2,
399 TInt tlx3,TInt tly3,TInt brx3,TInt bry3)
415 void TestTRect::TestSet()
417 TSize s1(iTlx3,iTly3);
418 TPoint pTl(iTlx2,iTly2);
419 TPoint pBr(iBrx2,iBry2);
420 TRect r1(iTlx1,iTly1,iBrx1,iBry1);
425 test(r1.iTl.iX==iTlx1 && r1.iTl.iY==iTly1 && r1.iBr.iX==iBrx1 && r1.iBr.iY==iBry1);
426 test(r2.iTl.iX==iTlx2 && r2.iTl.iY==iTly2 && r2.iBr.iX==iBrx2 && r2.iBr.iY==iBry2);
427 test(r2.iTl==pTl && r2.iBr==pBr);
428 test(r3.iTl.iX==0 && r3.iTl.iY==0 && r3.iBr.iX==0 && r3.iBr.iY==0);
429 test(r4.iTl==pTl && r4.iBr.iX==(pTl.iX+s1.iWidth) && r4.iBr.iY==(pTl.iY+s1.iHeight));
435 test(r3.iTl.iX==iTlx3 && r3.iTl.iY==iTly3 && r3.iBr.iX==iBrx3 && r3.iBr.iY==iBry3);
437 r1.SetRect(iTlx2,iTly2,iBrx2,iBry2);
443 pTl.SetXY(iTlx3,iTly3);
444 pBr.SetXY(iBrx3,iBry3);
446 test(r1.iTl.iX==iTlx3 && r1.iTl.iY==iTly3 && r1.iBr.iX==iBrx3 && r1.iBr.iY==iBry3);
447 pTl.SetXY(iTlx2,iTly2);
466 r4.SetWidth(r1.Size().iWidth);
467 test(r1.Size().iWidth==r4.Size().iWidth);
468 test(r4.Size().iHeight==0);
470 r4.SetHeight(r1.Size().iHeight);
471 test(r1.Size().iHeight==r4.Size().iHeight);
472 test(r1.Size().iWidth==r4.Size().iWidth);
475 r4.SetSize(r1.Size());
476 test(r1.Size()==r4.Size());
479 void TestTRect::TestMove()
481 TPoint offs(iTlx2,iTly2);
482 TRect r1(iTlx1,iTly1,iBrx1,iBry1);
494 rTest.Move(offs.iX,offs.iY);
498 void TestTRect::TestResize()
500 TSize resize(iTlx1,iTly1);
501 TRect rTest(iTlx2,iTly2,iBrx2,iBry2);
505 rTest.Resize(resize);
510 void TestTRect::TestShrink()
512 TSize shrink(iTlx3,iTly3);
513 TRect r2(iTlx2,iTly2,iBrx2,iBry2);
521 rTest.Shrink(shrink);
525 rTest.Shrink(shrink.iWidth,shrink.iHeight);
529 void TestTRect::TestGrow()
531 TSize grow(iTlx3,iTly3);
532 TRect r2(iTlx2,iTly2,iBrx2,iBry2);
540 rTest.Grow(grow.iWidth,grow.iHeight);
548 void TestTRect::TestBoundingRect()
550 TRect r1(iTlx1,iTly1,iBrx1,iBry1);
551 TRect r2(iTlx2,iTly2,iBrx2,iBry2);
552 TRect r3(iTlx3,iTly3,iBrx3,iBry3);
556 rCheck.iTl.iX=Min(r1.iTl.iX,r2.iTl.iX);
557 rCheck.iTl.iY=Min(r1.iTl.iY,r2.iTl.iY);
558 rCheck.iBr.iX=Max(r1.iBr.iX,r2.iBr.iX);
559 rCheck.iBr.iY=Max(r1.iBr.iY,r2.iBr.iY);
561 rTest.BoundingRect(r2);
565 rCheck.iTl.iX=Min(r1.iTl.iX,r3.iTl.iX);
566 rCheck.iTl.iY=Min(r1.iTl.iY,r3.iTl.iY);
567 rCheck.iBr.iX=Max(r1.iBr.iX,r3.iBr.iX);
568 rCheck.iBr.iY=Max(r1.iBr.iY,r3.iBr.iY);
570 rTest.BoundingRect(r3);
574 void TestTRect::TestIsEmpty()
576 TRect f1(0,0,1,1); // f? should return false
578 TRect f3(-2,-2,-1,-1);
579 TRect t1(0,0,1,0); // t? should return true
583 TRect t5(-2,-2,-1,-3);
584 TRect t6(-2,-2,-3,-1);
586 test(f1.IsEmpty()==FALSE);
587 test(f2.IsEmpty()==FALSE);
588 test(f3.IsEmpty()==FALSE);
589 test(t1.IsEmpty()==TRUE);
590 test(t2.IsEmpty()==TRUE);
591 test(t3.IsEmpty()==TRUE);
592 test(t4.IsEmpty()==TRUE);
593 test(t5.IsEmpty()==TRUE);
594 test(t6.IsEmpty()==TRUE);
597 void TestTRect::TestIntersects()
599 test(TRect(-5,-10,5,10).Intersects(TRect(4,-10,10,10))==TRUE);
600 test(TRect(-5,-10,5,10).Intersects(TRect(5,-10,10,10))==FALSE);
601 test(TRect(-5,-10,5,10).Intersects(TRect(6,-10,10,10))==FALSE);
602 test(TRect(-5,-10,5,10).Intersects(TRect(-5, 9, 5,20))==TRUE);
603 test(TRect(-5,-10,5,10).Intersects(TRect(-5,10, 5,20))==FALSE);
604 test(TRect(-5,-10,5,10).Intersects(TRect(-5,11, 5,20))==FALSE);
606 test(TRect(4,-10,10,10).Intersects(TRect(-5,-10,5,10))==TRUE);
607 test(TRect(5,-10,10,10).Intersects(TRect(-5,-10,5,10))==FALSE);
608 test(TRect(6,-10,10,10).Intersects(TRect(-5,-10,5,10))==FALSE);
609 test(TRect(-5, 9, 5,20).Intersects(TRect(-5,-10,5,10))==TRUE);
610 test(TRect(-5,10, 5,20).Intersects(TRect(-5,-10,5,10))==FALSE);
611 test(TRect(-5,11, 5,20).Intersects(TRect(-5,-10,5,10))==FALSE);
612 // Empty rects, should all return FALSE
613 test(TRect(0,11, 5,11).Intersects(TRect(0,0,5,20))==FALSE);
614 test(TRect(1,10, 1,11).Intersects(TRect(0,0,5,20))==FALSE);
615 test(TRect(5,11, 5,11).Intersects(TRect(0,0,5,20))==FALSE);
618 void TestTRect::TestIntersection()
620 TRect r1(iTlx1,iTly1,iBrx1,iBry1);
621 TRect r2(iTlx2,iTly2,iBrx2,iBry2);
622 TRect r3(iTlx3,iTly3,iBrx3,iBry3);
626 rCheck.iTl.iX=Max(r1.iTl.iX,r2.iTl.iX);
627 rCheck.iTl.iY=Max(r1.iTl.iY,r2.iTl.iY);
628 rCheck.iBr.iX=Min(r1.iBr.iX,r2.iBr.iX);
629 rCheck.iBr.iY=Min(r1.iBr.iY,r2.iBr.iY);
631 rTest.Intersection(r2);
632 if (!rCheck.IsEmpty())
636 rCheck.iTl.iX=Max(r1.iTl.iX,r3.iTl.iX);
637 rCheck.iTl.iY=Max(r1.iTl.iY,r3.iTl.iY);
638 rCheck.iBr.iX=Min(r1.iBr.iX,r3.iBr.iX);
639 rCheck.iBr.iY=Min(r1.iBr.iY,r3.iBr.iY);
641 rTest.Intersection(r3);
642 if (!rCheck.IsEmpty())
646 rCheck.iTl.iX=Max(r3.iTl.iX,r2.iTl.iX);
647 rCheck.iTl.iY=Max(r3.iTl.iY,r2.iTl.iY);
648 rCheck.iBr.iX=Min(r3.iBr.iX,r2.iBr.iX);
649 rCheck.iBr.iY=Min(r3.iBr.iY,r2.iBr.iY);
651 rTest.Intersection(r2);
652 if (!rCheck.IsEmpty())
656 void TestTRect::TestNormalize()
660 TRect a[]={TRect(0,0,1,1),TRect(-1,0,0,-1),TRect(-2,2,-1,1),TRect(10,2,1,0),
661 TRect(-10,-20,-2,-1),TRect(0,0,10,0),TRect(20,1,20,2),TRect(10,10,10,10)};
662 TBool aIsNormalized[]={TRUE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE,TRUE};
665 for(i=0;i<(sizeof(a)/sizeof(a[0]));i++)
668 if (check.iTl.iX>check.iBr.iX)
671 check.iBr.iX=check.iTl.iX;
674 if (check.iTl.iY>check.iBr.iY)
677 check.iBr.iY=check.iTl.iY;
680 test(tst.IsNormalized()==aIsNormalized[i]);
682 test(tst.IsNormalized()==TRUE);
687 void TestTRect::TestContains()
689 TPoint tl1(iTlx1,iTly1);
690 TPoint br1(iBrx1,iBry1);
691 TPoint tl2(iTlx2,iTly2);
692 TPoint br2(iBrx2,iBry2);
693 TPoint tl3(iTlx3,iTly3);
694 TPoint br3(iBrx3,iBry3);
695 TRect rect1(tl1,br1);
696 TRect rect2(tl2,br2);
697 TRect rect3(tl3,br3);
702 test(rect1.IsEmpty() || rect1.Contains(rect1.iTl));
703 test(rect2.IsEmpty() || rect2.Contains(rect2.iTl));
704 test(rect3.IsEmpty() || rect3.Contains(rect3.iTl));
705 test(!rect1.Contains(rect1.iBr));
706 test(!rect2.Contains(rect2.iBr));
707 test(!rect3.Contains(rect3.iBr));
709 pnt.SetXY(rect1.iTl.iX,rect1.iBr.iY);
710 test(!rect1.Contains(pnt));
711 pnt.SetXY(rect1.iBr.iX,rect1.iTl.iY);
712 test(!rect1.Contains(pnt));
714 if (rect2.iBr.iX>(rect2.iTl.iX+1) && rect2.iBr.iY>(rect2.iTl.iY+1))
716 test(rect2.Contains(pnt));
719 void TestTRect::TestCenter()
721 TRect rect[]={TRect(iTlx1,iTly1,iBrx1,iBry1),TRect(iTlx2,iTly2,iBrx2,iBry2),TRect(iTlx3,iTly3,iBrx3,iBry3)};
723 for(TUint i=0;i<(sizeof(rect)/sizeof(rect[0]));i++)
726 TPoint center((r.iBr.iX+r.iTl.iX)/2,(r.iBr.iY+r.iTl.iY)/2);
727 test(center==r.Center());
731 //////////////////////////////////////////////////////////////////////////////
732 // 3DPoint test code //
733 //////////////////////////////////////////////////////////////////////////////
734 TestTPoint3D::TestTPoint3D(TInt x1,TInt y1,TInt z1,TInt x2,TInt y2,TInt z2,TInt x3,TInt y3,TInt z3,TInt x4,TInt y4,TInt z4)
751 void TestTPoint3D::TestSet()
754 TPoint aPoint(iX3,iY3);
755 TPoint3D p3D1(iX1,iY1,iZ1);
756 TPoint3D p3D2(iX2,iY2,iZ2);
759 TPoint3D p3D5(aPoint);
761 test(p3D1.iX==iX1 && p3D1.iY==iY1 && p3D1.iZ==iZ1);
762 test(p3D2.iX==iX2 && p3D2.iY==iY2 && p3D2.iZ==iZ2);
763 test(p3D4.iX==0 && p3D4.iY==0 && p3D4.iZ==0);
768 test(p3D3.iX==iX3 && p3D3.iY==iY3&& p3D3.iZ==iZ3);
769 test(p3D3.AsPoint()==aPoint);
770 test(p3D5.AsPoint()==p3D3.AsPoint());
773 p3D4.SetXYZ(iX4,iY4,iZ4);
774 test(p3D4.iX==iX4 && p3D4.iY==iY4);
778 test(p3D1.iX==p3D4.iX && p3D1.iY==p3D4.iY && p3D1.iZ==p3D4.iZ);
782 test(p3D3.iX==p3D2.iX && p3D3.iY==p3D2.iY && p3D3.iZ==p3D2.iZ);
793 void TestTPoint3D::TestAdd()
795 TPoint apoint(iX3,iY3);
796 TPoint3D p1(iX1,iY1,iZ1);
797 TPoint3D p2(iX2,iY2,iZ2);
798 TPoint3D p3(iX3,iY3,iZ3);
799 TPoint3D p4(iX4,iY4,iZ4);
803 test(p1.iX==(p2.iX+iX1) && p1.iY==(p2.iY+iY1)&& p1.iZ==(p2.iZ+iZ1));
805 test(p3.iX==(p1.iX+p2.iX) && p3.iY==(p1.iY+p2.iY)&& p3.iZ==(p1.iZ+p2.iZ));
809 test(p4.iX==(p1.iX+iX4) && p4.iY==(p1.iY+iY4)&& p4.iZ==(p1.iZ+iZ4));
813 //TPoint has no Z co-ordinate
814 test(p1.iX==(px.iX+apoint.iX) && p1.iY==(px.iY+apoint.iY) &&p1.iZ==px.iZ);
819 void TestTPoint3D::TestSub()
821 TPoint apoint(iX3,iY3);
822 TPoint3D p1(iX1,iY1,iZ1);
823 TPoint3D p2(iX2,iY2,iZ2);
824 TPoint3D p3(iX3,iY3,iZ3);
825 TPoint3D p4(iX4,iY4,iZ4);
829 test(p1.iX==(iX1-p2.iX) && p1.iY==(iY1-p2.iY)&& p1.iZ==(iZ1-p2.iZ));
831 test(p3.iX==(p1.iX-p2.iX) && p3.iY==(p1.iY-p2.iY)&& p3.iZ==(p1.iZ-p2.iZ));
835 test(p4.iX==(iX4-p1.iX) && p4.iY==(iY4-p1.iY)&& p4.iZ==(iZ4-p1.iZ));
840 //TPoint has no Z co-ordinate
841 test(p1.iX==(px.iX-apoint.iX) && p1.iY==(px.iY-apoint.iY)&&p1.iZ==px.iZ);
846 void TestTPoint3D::TestUnaryMinus()
848 TPoint3D p1(iX1,iY1,iZ1);
849 TPoint3D p2(iX2,iY2,iZ2);
850 TPoint3D p3(iX3,iY3,iZ3);
851 TPoint3D p4(iX4,iY4,iZ4);
853 test (p==TPoint3D(-iX1,-iY1,-iZ1));
855 test (p==TPoint3D(-iX2,-iY2,-iZ2));
857 test (p==TPoint3D(-iX3,-iY3,-iZ3));
859 test (p==TPoint3D(-iX4,-iY4,-iZ4));
862 //////////////////////////////////////////////////////////////////////////////
863 // Top level test code //
864 //////////////////////////////////////////////////////////////////////////////
866 LOCAL_C void test_point(TestTPoint t)
868 test.Start(_L("Setting values"));
870 test.Next(_L("Addition"));
872 test.Next(_L("Subtraction"));
874 test.Next(_L("Unary minus"));
879 LOCAL_C void test_size(TestTSize t)
881 test.Start(_L("Setting values"));
883 test.Next(_L("Addition"));
885 test.Next(_L("Subtraction"));
887 test.Next(_L("Unary minus"));
892 LOCAL_C void test_rect(TestTRect t)
894 test.Start(_L("Setting values"));
896 test.Next(_L("Offset"));
898 test.Next(_L("Resize"));
900 test.Next(_L("Grow"));
902 test.Next(_L("Shrink"));
904 test.Next(_L("BoundingRect"));
905 t.TestBoundingRect();
906 test.Next(_L("IsEmpty"));
908 test.Next(_L("Intersects"));
910 test.Next(_L("Intersection"));
911 t.TestIntersection();
912 test.Next(_L("Normalize"));
914 test.Next(_L("Contains"));
916 test.Next(_L("Center"));
922 LOCAL_C void test_3Dpoint(TestTPoint3D t)
924 test.Start(_L("Setting values"));
926 test.Next(_L("Addition"));
928 test.Next(_L("Subtraction"));
930 test.Next(_L("Unary minus"));
935 GLDEF_C TInt E32Main()
942 // Test the TPoint type.
944 TestTPoint tp1(1,2, 3,5, 8,13, 20,33);
945 TestTPoint tp2(10,-12, -55,29, -222,-666, 0,0);
946 TestTPoint tp3(345678,10, -9,987654, -1234567,-9876543, 222222,33333);
947 TestTPoint tp4(-1,-2,-3,-4,-5,-6,-7,-8);
948 TestTPoint tp5(0,0, 1000000,0, 0,2000000, 3000000,4000000);
950 test.Start(_L("class TPoint 1"));
952 test.Next(_L("class TPoint 2"));
954 test.Next(_L("class TPoint 3"));
956 test.Next(_L("class TPoint 4"));
958 test.Next(_L("class TPoint 5"));
961 // Test the TSize type.
963 TestTSize sp1(5,4, 9,5, 17,33, 44,75);
964 TestTSize sp2(12,-10, -29,55, -666,-222, 0,0);
965 TestTSize sp3(456789,20, -3,876543, -2345678,-8765432, 33333,11111);
966 TestTSize sp4(-1,-2,-3,-4,-5,-6,-7,-8);
967 TestTSize sp5(0,0, 2000000,0, 0,3000000, 1000000,6000000);
969 test.Next(_L("class TSize 1"));
971 test.Next(_L("class TSize 2"));
973 test.Next(_L("class TSize 3"));
975 test.Next(_L("class TSize 4"));
977 test.Next(_L("class TSize 5"));
982 TestTRect tr1(0,0,1,2, 10,20,14,19, 33,11,44,55);
983 TestTRect tr2(-10,-20,11,22, -100,-200,-90,-199, 3000,1100,-4400,-5500);
984 TestTRect tr3(0,0,0,0, 1,1,2,2, -1,-1,0,0);
986 test.Next(_L("class TRect 1"));
988 test.Next(_L("class TRect 2"));
990 test.Next(_L("class TRect 3"));
994 // Test the TPoint3D type.
996 TestTPoint3D t3dp1(1,2,3, 4,5,6, 7 ,8,9, 10,11,12);
997 TestTPoint3D t3dp2(28,-12,75, -55,-98, -222, -788,-666,-155, 0,0,0);
998 TestTPoint3D t3dp3(89823,-45,12121,-78454,345678,10, -9,987654, -1234567,-9876543, 222222,33333);
999 TestTPoint3D t3dp4(-12,-32,-53,-84,-95,-456,-467,-4658,-45,-908,-65,-908);
1000 TestTPoint3D t3dp5(0,0,0, 23,1000000,0,10677,-3,2000000, 3000000,4000000,501);
1003 test.Start(_L("class TPoint3D 1"));
1004 test_3Dpoint(t3dp1);
1005 test.Next(_L("class TPoint3D 2"));
1006 test_3Dpoint(t3dp2);
1007 test.Next(_L("class TPoint3D 3"));
1008 test_3Dpoint(t3dp3);
1009 test.Next(_L("class TPoint3D 4"));
1010 test_3Dpoint(t3dp4);
1011 test.Next(_L("class TPoint3D 5"));
1012 test_3Dpoint(t3dp5);
1014 test.Printf(_L("T_GRAPH: TEST Successfully Completed \n"));