]> Git trees. - libqmvoc.git/commitdiff
* The test doesn't link the other was broken
authorCarsten Niehaus <cniehaus@gmx.de>
Wed, 7 Jun 2006 11:52:27 +0000 (11:52 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Wed, 7 Jun 2006 11:52:27 +0000 (11:52 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=549089

libscience/cml/xml_cml.h
libscience/tests/CMakeLists.txt
libscience/tests/cml2test.cpp

index f82fe1a26f8aed1bd1cd538b9c916edcb0e4757a..77b20ddffa3e2795425bd9aef3d44754350f6fe6 100644 (file)
@@ -34,7 +34,11 @@ class QString;
 class CMLParser : public QXmlDefaultHandler
 {
        public:
-               CMLParser( )
+               CMLParser()
+               {
+               };
+
+               ~CMLParser()
                {
                };
        
index 6b33e394ab93fd480b8217e0052dbebc7438259f..1068de39d56cacd980e8098d4137e11146279c50 100644 (file)
@@ -18,17 +18,17 @@ endif(KDE4_BUILD_TESTS)
 
 ########### next target ###############
 
-set(isotopereadingtest_SRCS isotopereadingtest.cpp )
+#set(isotopereadingtest_SRCS isotopereadingtest.cpp )
 
-kde4_automoc(${isotopereadingtest_SRCS})
+#kde4_automoc(${isotopereadingtest_SRCS})
 
-if(KDE4_BUILD_TESTS)
+#if(KDE4_BUILD_TESTS)
 
-kde4_add_executable(isotopereadingtest ${isotopereadingtest_SRCS})
+#kde4_add_executable(isotopereadingtest ${isotopereadingtest_SRCS})
 
-target_link_libraries(isotopereadingtest  ${KDE4_KDECORE_LIBS} science )
+#target_link_libraries(isotopereadingtest  ${KDE4_KDECORE_LIBS} science )
 
-endif(KDE4_BUILD_TESTS)
+#endif(KDE4_BUILD_TESTS)
 
 ########### next target ###############
 
index b9a89f8b4da050dac184b0d03a93a639ee6030ce..cf2af2882518e0c2905209a395b53542bbfa5904 100644 (file)
@@ -1,10 +1,14 @@
-/* Sample parsing with QT's SAX2 by Riku Leino <tsoots@gmail.com> */
-
-#include "../elementparser.h"
-#include "../element.h"
 #include <kdebug.h>
 #include <iostream>
 
+#include <qtextstream.h>
+#include <qfile.h>
+#include <qdatetime.h>
+#include <qxml.h>
+
+#include "../cml/xml_cml.h"
+#include "../cml/cmlclasses.h"
+
 int main(int argc, char *argv[])
 {
        if (argc < 2 || argc > 2) {
@@ -12,45 +16,22 @@ int main(int argc, char *argv[])
                return 1;
        }
 
-       ElementSaxParser * parser = new ElementSaxParser();
-       QFile xmlFile(argv[1]);
-       QXmlInputSource source(xmlFile);
-       QXmlSimpleReader reader;
-
-       reader.setContentHandler(parser);
-       reader.parse(source);
-
-       QList<Element*> v = parser->getElements();
-
-       foreach( Element* e, v ){
-               if ( e )
-               {
-                       QList<ChemicalDataObject*> list = e->data();
-
-                       //Test: Check if the string-comparison works
-//X                    if ( e->data( ChemicalDataObject::name ) == "Helium" )
-//X                            kDebug() << "Mass: " << e->dataAsString( ChemicalDataObject::mass ) << endl;
-                       
-                       //Test: Check if the double-comparison works
-//X                    if ( e->data( ChemicalDataObject::mass ) == 4.002602 )
-//X                            kDebug() << "Correct mass found" << endl;
-
-                       //Test: Give me the name of the element
-//X                    kDebug() << "Name: " << e->dataAsString( ChemicalDataObject::name ) << endl;
-                       
-                       //Test: give me all data available
-                       foreach( ChemicalDataObject*o, list ){
-                               if ( o )
-                               {
-                                       QString unit = o->unitAsString();
-                                       if ( unit == "bo:noUnit" )
-                                               unit = "";
-                                       kDebug() << "Name: " << o->dictRef() << " " << o->valueAsString()  <<" "  << unit << endl;
-                               }
-                       }
-               }
-
-       }
+       CMLParser *handler = new CMLParser();
+       
+       QFile xmlFile(argv[1]);
+       
+       if ( !xmlFile.open( IO_ReadOnly ) ) 
+               return false;
+       
+       QTextStream t1( &xmlFile );
+       
+       QXmlInputSource source;
+//     source.setData( t1 );
+       
+       QXmlSimpleReader xmlReader;
+       xmlReader.setContentHandler( handler );
+       
+       xmlReader.parse( source );
 
        return 0;
 }