Skip to content

Commit

Permalink
adding some of the support for saving Annotation files. Trying to add…
Browse files Browse the repository at this point in the history
… a Unit test for

a plugin but having problems. Adding support for CTest and CDash. 

svn path=/trunk/KDE/kdeedu/marble/; revision=1009661
  • Loading branch information
mansona committed Aug 10, 2009
1 parent 9e917e9 commit 1ea40ce
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
SET(CTEST_PROJECT_NAME "Marble")
SET(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
SET(CTEST_NIGHTLY_START_TIME "00:00:00 UTC")

IF(NOT DEFINED CTEST_DROP_METHOD)
SET(CTEST_DROP_METHOD "http")
ENDIF(NOT DEFINED CTEST_DROP_METHOD)

IF(CTEST_DROP_METHOD STREQUAL "http")
SET(CTEST_DROP_SITE "my.cdash.org")
SET(CTEST_DROP_LOCATION "/submit.php?project=test")
SET(CTEST_TRIGGER_SITE "")
SET(CTEST_DROP_LOCATION "/submit.php?project=Marble")
set(CTEST_DROP_SITE_CDASH TRUE)
ENDIF(CTEST_DROP_METHOD STREQUAL "http")
9 changes: 2 additions & 7 deletions src/plugins/render/osmannotate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ INCLUDE_DIRECTORIES(
INCLUDE(${QT_USE_FILE})

FILE( GLOB geodata_handlers_osm_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} osm/*.cpp )
FILE( GLOB osmannotate_local_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp )

set( osmannotate_SRCS
OsmAnnotatePlugin.cpp
PlacemarkTextAnnotation.cpp
TmpGraphicsItem.cpp
TextAnnotation.cpp
AreaAnnotation.cpp
GeoWidgetBubble.cpp
TextEditor.cpp
${osmannotate_local_SRCS}
${geodata_handlers_osm_SRCS} )

marble_add_plugin( OsmAnnotatePlugin ${osmannotate_SRCS} )
19 changes: 19 additions & 0 deletions src/plugins/render/osmannotate/PlacemarkTextAnnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "AbstractProjection.h"
#include "GeoDataPlacemark.h"
#include "GeoDocument.h"
#include "GeoPainter.h"
#include "GeoWidgetBubble.h"
#include "ViewportParams.h"
Expand Down Expand Up @@ -136,16 +137,34 @@ QString PlacemarkTextAnnotation::name() const
return m_textEditor->name();
}

void PlacemarkTextAnnotation::setName( const QString &name )
{
m_textEditor->setName( name );
}

QString PlacemarkTextAnnotation::description() const
{
return m_textEditor->description();
}

void PlacemarkTextAnnotation::setDescription( const QString &description )
{
m_textEditor->setDescription( description );
}

GeoDataGeometry PlacemarkTextAnnotation::geometry() const
{
return GeoDataPoint( coordinate() );
}

void PlacemarkTextAnnotation::setGeometry( const GeoDataGeometry &geometry )
{
//FIXME: undefined reference
// if( geometry.nodeType() == GeoDataTypes::GeoDataPointType ) {
setCoordinate( GeoDataCoordinates( static_cast<GeoDataPoint>(geometry) ) );
// }
}


bool PlacemarkTextAnnotation::mousePressEvent( QMouseEvent* event )
{
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/render/osmannotate/PlacemarkTextAnnotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ class PlacemarkTextAnnotation : public TextAnnotation, public TmpGraphicsItem

//TextAnnotation
virtual QString name() const;
virtual void setName( const QString &name );
virtual QString description() const;
virtual void setDescription( const QString &description );
virtual GeoDataGeometry geometry() const;
virtual void setGeometry( const GeoDataGeometry &geometry );

private:
GeoWidgetBubble* bubble;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/render/osmannotate/TextAnnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ GeoDataPlacemark TextAnnotation::toGeoData() const

placemark.setName( name() );
placemark.setDescription( description() );
//allow for HTML in the description
placemark.setDescriptionCDATA( true );

//FIXME: make this work for all geometries and not just points
// placemark.setGeometry( geometry() );
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/render/osmannotate/TextAnnotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ class TextAnnotation
virtual ~TextAnnotation();

virtual QString name() const = 0 ;
virtual void setName( const QString& name ) = 0;
virtual QString description() const = 0;
virtual void setDescription( const QString& description ) = 0;
virtual GeoDataGeometry geometry() const = 0;
virtual void setGeometry( const GeoDataGeometry &geometry ) = 0;

GeoDataPlacemark toGeoData() const;

Expand Down
10 changes: 10 additions & 0 deletions src/plugins/render/osmannotate/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,19 @@ QString TextEditor::name() const
return m_name->text();
}

void TextEditor::setName(const QString &name )
{
m_name->setText( name );
}

QString TextEditor::description() const
{
return m_description->toHtml();
}

void TextEditor::setDescription( const QString &description )
{
m_description->setHtml( description );
}

}
2 changes: 2 additions & 0 deletions src/plugins/render/osmannotate/TextEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ class TextEditor : public QWidget

//return the plain text name
QString name() const;
void setName( const QString &name );
//return the HTML description
QString description() const;
void setDescription( const QString &description );

private:
QAction* m_boldAction;
Expand Down
22 changes: 22 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,27 @@ add_definitions( -DTESTSRCDIR=\\"${CMAKE_CURRENT_SOURCE_DIR}\\" )

#############################################################


#############################################################
# Add extra Libs for testing Plugins
#############################################################
#FIXME: Find a better way to do this!
set(osmannotate_SRCS
../src/plugins/render/osmannotate/TextAnnotation.cpp
../src/plugins/render/osmannotate/PlacemarkTextAnnotation.cpp
../src/plugins/render/osmannotate/GeoWidgetBubble.cpp
../src/plugins/render/osmannotate/TmpGraphicsItem.cpp
../src/plugins/render/osmannotate/TextEditor.cpp )

add_library(OsmAnnotatePluginTestLib SHARED ${osmannotate_SRCS} )
target_link_libraries( OsmAnnotatePluginTestLib
${QT_QTGUI_LIBRARY}
${QT_QTMAIN_LIBRARY}
${QT_QTCORE_LIBRARY}
marblewidget )

#############################################################

# MarbleWidget test
marble_add_test( MarbleWidgetSpeedTest )

Expand Down Expand Up @@ -71,4 +92,5 @@ marble_add_test( PluginManagerTest )
marble_add_test( MarbleWidgetTest )
add_definitions( -DCITIES_PATH="\\\"${CMAKE_CURRENT_SOURCE_DIR}/../../../data/placemarks/cityplacemarks.kml\\\"" )
marble_add_test( KMLTest )

marble_add_test( TestOsmAnnotation )
2 changes: 1 addition & 1 deletion tests/TestGeoDataWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void TestGeoDataWriter::initTestCase()
QVERIFY( file.open( QIODevice::ReadOnly ) );

//Parser and verify
QVERIFY( parser->read( &file ) );
QVERIFY2( parser->read( &file ), filename.toAscii() );

parsers.insert( filename, parserPointer );

Expand Down
7 changes: 5 additions & 2 deletions tests/TestOsmAnnotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ private slots:
void saveAnnotations_data();
void saveAnnotations();
private:
QList<QSharedPointer<TextAnnotation> > textAnnotations;
QMap< QString, QSharedPointer<TextAnnotation> > textAnnotations;
};

void TestOsmAnnotation::initTestCase()
{

PlacemarkTextAnnotation* standard;
// uncomment the following to get the Undefined references
// standard = new PlacemarkTextAnnotation();
// standard->setName( "Standard Annon" );
}

void TestOsmAnnotation::saveAnnotations_data()
Expand Down
2 changes: 1 addition & 1 deletion tests/data/CDATATest.kml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<Placemark>
<name>Feature.kml</name>
Expand Down

0 comments on commit 1ea40ce

Please sign in to comment.