F:/KPlato/koffice/libs/flake/tests/TestPathShape.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 #include "TestPathShape.h"
00020 
00021 #include <QPainterPath>
00022 #include "KoPathShape.h"
00023 
00024 void TestPathShape::close()
00025 {
00026     KoPathShape path;
00027     path.lineTo( QPointF( 10, 0 ) );
00028     QPainterPath ppath( QPointF( 0, 0 ) );
00029     ppath.lineTo( QPointF( 10, 0 ) );
00030 
00031     path.lineTo( QPointF( 10, 10 ) );
00032     ppath.lineTo( 10, 10 );
00033     path.close();
00034     ppath.closeSubpath();
00035     QVERIFY( ppath == path.outline() );
00036     path.lineTo( QPointF( 0, 10 ) );
00037     ppath.lineTo( 0, 10 );
00038     QVERIFY( ppath == path.outline() );
00039 }
00040 
00041 void TestPathShape::moveTo()
00042 {
00043     KoPathShape path;
00044     path.moveTo( QPointF( 10, 10 ) );
00045     QPainterPath ppath( QPointF( 10, 10 ) );
00046     path.lineTo( QPointF( 20, 20 ) );
00047     ppath.lineTo( 20, 20 );
00048     QVERIFY( ppath == path.outline() );
00049     path.moveTo( QPointF( 30, 30 ) );
00050     ppath.moveTo( 30, 30 );
00051     path.lineTo( QPointF( 40, 40 ) );
00052     ppath.lineTo( QPointF( 40, 40 ) );
00053     QVERIFY( ppath == path.outline() );
00054 }
00055 
00056 void TestPathShape::normalize()
00057 {
00058     KoPathShape path;
00059     path.moveTo( QPointF( 10, 10 ) );
00060     path.lineTo( QPointF( 20, 20 ) );
00061     path.normalize();
00062     QPainterPath ppath( QPointF( 0, 0 ) );
00063     ppath.lineTo( 10, 10 );
00064     QVERIFY( ppath == path.outline() );
00065 }
00066 
00067 QTEST_MAIN(TestPathShape)
00068 #include "TestPathShape.moc"

Généré le Wed Nov 22 23:41:00 2006 pour KPlato par  doxygen 1.5.1-p1