diff options
Diffstat (limited to 'kexi/plugins/macros/tests/commontests.cpp')
-rw-r--r-- | kexi/plugins/macros/tests/commontests.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/kexi/plugins/macros/tests/commontests.cpp b/kexi/plugins/macros/tests/commontests.cpp index 41234eca..9d43ac41 100644 --- a/kexi/plugins/macros/tests/commontests.cpp +++ b/kexi/plugins/macros/tests/commontests.cpp @@ -94,7 +94,7 @@ namespace KoMacroTest { } -typedef TQValueList< KSharedPtr<KoMacro::MacroItem> >::size_type sizetype; +typedef TQValueList< TDESharedPtr<KoMacro::MacroItem> >::size_type sizetype; CommonTests::CommonTests() : KUnitTest::SlotTester() @@ -164,7 +164,7 @@ void CommonTests::testAction() TQDomElement const domelement = d->doomdocument->documentElement(); - KSharedPtr<KoMacro::Macro> macro = KoMacro::Manager::self()->createMacro("testMacro"); + TDESharedPtr<KoMacro::Macro> macro = KoMacro::Manager::self()->createMacro("testMacro"); //Is our XML parseable ? KOMACROTEST_ASSERT(macro->parseXML(domelement),true); @@ -172,19 +172,19 @@ void CommonTests::testAction() //?? macro->execute(this); - //create list of KSharedPtr from the childs of the macro - TQValueList< KSharedPtr<KoMacro::MacroItem> >& items = macro->items(); + //create list of TDESharedPtr from the childs of the macro + TQValueList< TDESharedPtr<KoMacro::MacroItem> >& items = macro->items(); //check that there is one KOMACROTEST_ASSERT( items.count(), sizetype(1) ); //fetch the first one - KSharedPtr<KoMacro::Action> actionptr = items[0]->action(); + TDESharedPtr<KoMacro::Action> actionptr = items[0]->action(); //How do we know that an action exist ? //-> check that it is not null KOMACROTEST_XASSERT(sizetype(actionptr.data()), sizetype(0)); //fetch the "teststring"-variable - KSharedPtr<KoMacro::Variable> variableptr = actionptr->variable("teststring"); + TDESharedPtr<KoMacro::Variable> variableptr = actionptr->variable("teststring"); //check that it is not null KOMACROTEST_XASSERT(sizetype(variableptr.data()), sizetype(0)); //check that it is " " @@ -249,7 +249,7 @@ void CommonTests::testAction() //commontests.cpp: In member function 'void KoMacroTest::CommonTests::testAction()': //commontests.cpp:249: error: call of overloaded 'setVariable(const char [8], int)' is ambiguous - //../lib/macroitem.h:131: note: candidates are: TQStringList KoMacro::MacroItem::setVariable(const TQString&, KSharedPtr<KoMacro::Variable>) + //../lib/macroitem.h:131: note: candidates are: TQStringList KoMacro::MacroItem::setVariable(const TQString&, TDESharedPtr<KoMacro::Variable>) //../lib/macroitem.h:137: note: TQStringList KoMacro::MacroItem::setVariable(const TQString&, const TQVariant&) macroitem->setVariable("testint",(int) 0); @@ -285,7 +285,7 @@ void CommonTests::testXmlhandler() kdDebug()<<"===================== testXmlhandler() ======================" << endl; // Local Init - KSharedPtr<KoMacro::Macro> macro = KoMacro::Manager::self()->createMacro("testMacro"); + TDESharedPtr<KoMacro::Macro> macro = KoMacro::Manager::self()->createMacro("testMacro"); TQDomElement domelement; // Save old doomdocument @@ -428,9 +428,9 @@ void CommonTests::testFunction() "</function>" )); - //create an KomacroFunction with our data, and put it into a KSharedPtr - KSharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); - //cast KSharedPtr to KoMacro-"Function" + //create an KomacroFunction with our data, and put it into a TDESharedPtr + TDESharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + //cast TDESharedPtr to KoMacro-"Function" KoMacro::Function* func = dynamic_cast<KoMacro::Function*>( functionptr.data() ); //check that function is not null KOMACROTEST_XASSERT((int) func, 0); @@ -449,12 +449,12 @@ void CommonTests::testFunction() KOMACROTEST_ASSERT( TQString(func->slot()), TQString("myslot(const TQString&,int)") ); //create KoMacro-MetaObject from receiverObject - KSharedPtr<KoMacro::MetaObject> receivermetaobject = func->receiverObject(); + TDESharedPtr<KoMacro::MetaObject> receivermetaobject = func->receiverObject(); //check that receivermetaobject.data is not null KOMACROTEST_XASSERT((int) receivermetaobject.data(), 0); //create KoMacro-MetaMethod from receiverObject - KSharedPtr<KoMacro::MetaMethod> receivermetamethod = receivermetaobject->slot( func->slot().latin1() ); + TDESharedPtr<KoMacro::MetaMethod> receivermetamethod = receivermetaobject->slot( func->slot().latin1() ); //check that receivermetamethod.data is not null KOMACROTEST_XASSERT((int) receivermetamethod.data(), 0); @@ -469,7 +469,7 @@ void CommonTests::testFunction() // firstrun we have a TQString, secondrun we have an int switch(i) { case 0: { // returnvalue - KOMACROTEST_ASSERT(*it, KSharedPtr<KoMacro::Variable>(NULL)); + KOMACROTEST_ASSERT(*it, TDESharedPtr<KoMacro::Variable>(NULL)); } break; case 1: { // first parameter //check first variable of func is the same as argument1 @@ -491,10 +491,10 @@ void CommonTests::testFunction() KOMACROTEST_ASSERT( funcvariables.count(), uint(3) ); // check that the first argument (the returnvalue) is empty - KOMACROTEST_ASSERT( funcvariables[0], KSharedPtr<KoMacro::Variable>(NULL) ); + KOMACROTEST_ASSERT( funcvariables[0], TDESharedPtr<KoMacro::Variable>(NULL) ); //create a KoMacro-Variable-Ptr from first func argument - KSharedPtr<KoMacro::Variable> stringvar = funcvariables[1]; + TDESharedPtr<KoMacro::Variable> stringvar = funcvariables[1]; //check that it is not null KOMACROTEST_XASSERT((int) stringvar.data(),0); //check via TQVariant type that stringvar is from Type Variant @@ -505,7 +505,7 @@ void CommonTests::testFunction() KOMACROTEST_ASSERT( stringvar->toString(), argument1 ); //create a KoMacro-Variable-Ptr from second func argument - KSharedPtr<KoMacro::Variable> intvar = funcvariables[2]; + TDESharedPtr<KoMacro::Variable> intvar = funcvariables[2]; //check that it is not null KOMACROTEST_XASSERT((int) intvar.data(), 0); //check via TQVariant type that stringvar is from Type Variant @@ -516,7 +516,7 @@ void CommonTests::testFunction() KOMACROTEST_ASSERT( intvar->toInt(), argument2 ); //returnvalue see testobject .... - KSharedPtr<KoMacro::Variable> funcreturnvalue = receivermetamethod->invoke( funcvariables ); + TDESharedPtr<KoMacro::Variable> funcreturnvalue = receivermetamethod->invoke( funcvariables ); kdDebug() << "CommonTests::testFunction() RETURNVALUE =====> " << funcreturnvalue->toString() << endl; KOMACROTEST_ASSERT( funcreturnvalue->toInt(), argument2 ); @@ -543,8 +543,8 @@ void CommonTests::testIntFunction() "</function>" )); - //create an KomacroFunction with our data, and put it into a KSharedPtr - KSharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + //create an KomacroFunction with our data, and put it into a TDESharedPtr + TDESharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); //Cast data to function KoMacro::Function* func = dynamic_cast<KoMacro::Function*>( functionptr.data() ); //check that it is not null @@ -573,8 +573,8 @@ void CommonTests::testDoubleFunction() "</function>" )); - //create an KomacroFunction with our data, and put it into a KSharedPtr - KSharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + //create an KomacroFunction with our data, and put it into a TDESharedPtr + TDESharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); //Cast data to function KoMacro::Function* func = dynamic_cast<KoMacro::Function*>( functionptr.data() ); //check that it is not null @@ -602,8 +602,8 @@ void CommonTests::testTQStringFunction() "</function>" )); - //create an KomacroFunction with our data, and put it into a KSharedPtr - KSharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + //create an KomacroFunction with our data, and put it into a TDESharedPtr + TDESharedPtr<KoMacro::Action> functionptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); //Cast data to function KoMacro::Function* func = dynamic_cast<KoMacro::Function*>( functionptr.data() ); //check that it is not null @@ -621,7 +621,7 @@ void CommonTests::testMacro() TQDomElement const domelement = d->doomdocument->documentElement(); - KSharedPtr<KoMacro::Macro> macro = KoMacro::Manager::self()->createMacro("testMacro"); + TDESharedPtr<KoMacro::Macro> macro = KoMacro::Manager::self()->createMacro("testMacro"); //Is our XML parseable ? KOMACROTEST_ASSERT(macro->parseXML(domelement),true); @@ -639,7 +639,7 @@ void CommonTests::testMacro() // )); // // //create Macro -// // KSharedPtr<KoMacro::Action> macroptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); +// // TDESharedPtr<KoMacro::Action> macroptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); // //cast data to Macro // KoMacro::Macro* macro = dynamic_cast<KoMacro::Macro*>( macroptr.data() ); //check that it is not null @@ -661,11 +661,11 @@ void CommonTests::testMacro() */ //create list of KsharedPtr from the childs of the macro - TQValueList< KSharedPtr<KoMacro::MacroItem> >& items = macro->items(); + TQValueList< TDESharedPtr<KoMacro::MacroItem> >& items = macro->items(); //check that there is one KOMACROTEST_ASSERT( items.count(), sizetype(1) ); //fetch the first one - KSharedPtr<KoMacro::Action> actionptr = items[0]->action(); + TDESharedPtr<KoMacro::Action> actionptr = items[0]->action(); //How do we know that an action exist ? //-> check that it is not null KOMACROTEST_XASSERT(sizetype(actionptr.data()), sizetype(0)); @@ -677,7 +677,7 @@ void CommonTests::testMacro() // KOMACROTEST_ASSERT( actionptr->comment(), TQString("") ); /* //fetch the second one - KSharedPtr<KoMacro::Action> myfuncptr = children[1]; + TDESharedPtr<KoMacro::Action> myfuncptr = children[1]; //cast it to function KoMacro::Function* myfunc = dynamic_cast<KoMacro::Function*>( myfuncptr.data() ); @@ -700,12 +700,12 @@ void CommonTests::testMacro() myfunc->activate(); */ //create another macro - KSharedPtr<KoMacro::Macro> yanMacro = KoMacro::Manager::self()->createMacro("testMacro2"); + TDESharedPtr<KoMacro::Macro> yanMacro = KoMacro::Manager::self()->createMacro("testMacro2"); KOMACROTEST_ASSERT(yanMacro->parseXML(domelement),true); //create two more macros - //KSharedPtr<KoMacro::Action> yanActionptr2 = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); - //KSharedPtr<KoMacro::Action> yanActionptr3 = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + //TDESharedPtr<KoMacro::Action> yanActionptr2 = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + //TDESharedPtr<KoMacro::Action> yanActionptr3 = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); //check that they aren?t null KOMACROTEST_XASSERT(sizetype(yanMacro.data()), sizetype(0)); @@ -713,7 +713,7 @@ void CommonTests::testMacro() //KOMACROTEST_XASSERT((int) yanActionptr3.data(), 0); //create a list of the children from yanMacro - //TQValueList< KSharedPtr<KoMacro::Action> > yanChildren = yanMacro->children(); + //TQValueList< TDESharedPtr<KoMacro::Action> > yanChildren = yanMacro->children(); //check that there are two //KOMACROTEST_ASSERT(yanChildren.count(), uint(2)); /* @@ -769,7 +769,7 @@ void CommonTests::testDom() { "</function>" )); //create functiom - KSharedPtr<KoMacro::Action> macroptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + TDESharedPtr<KoMacro::Action> macroptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); //try to execute function and catch exception KOMACROTEST_ASSERTEXCEPTION(KoMacro::Exception&, macroptr->activate()); @@ -853,21 +853,21 @@ void CommonTests::testVariables() )); //create an macro - KSharedPtr<KoMacro::Action> macroptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); + TDESharedPtr<KoMacro::Action> macroptr = ::KoMacro::Manager::self()->createAction( domdocument.documentElement() ); //cast data to macro KoMacro::Macro* macro = dynamic_cast<KoMacro::Macro*>( macroptr.data() ); //check that it is not null KOMACROTEST_XASSERT((int) macro, 0); //create a list of its children - TQValueList< KSharedPtr<KoMacro::Action> > children = macro->children(); + TQValueList< TDESharedPtr<KoMacro::Action> > children = macro->children(); //Check that there are two children. The first child is always the returnvalue. KOMACROTEST_ASSERT( children.count(), uint(2) ); //fetch the children - KSharedPtr<KoMacro::Action> func1ptr = children[1]; + TDESharedPtr<KoMacro::Action> func1ptr = children[1]; //create new context - KSharedPtr<KoMacro::Context> context = new KoMacro::Context(macroptr); + TDESharedPtr<KoMacro::Context> context = new KoMacro::Context(macroptr); { //try to execute function with non-functional variable @@ -882,7 +882,7 @@ void CommonTests::testVariables() //execute function func1ptr->activate(context); //fetch return value - KSharedPtr<KoMacro::Variable> returnvariable = context->variable("$MyReturnVariable"); + TDESharedPtr<KoMacro::Variable> returnvariable = context->variable("$MyReturnVariable"); //check that it is not null KOMACROTEST_XASSERT( (int) returnvariable.data(), 0); //check that it is "Some String" @@ -895,7 +895,7 @@ void CommonTests::testVariables() //execute function func1ptr->activate(context); //fetch return value - KSharedPtr<KoMacro::Variable> returnvariable = context->variable("$MyReturnVariable"); + TDESharedPtr<KoMacro::Variable> returnvariable = context->variable("$MyReturnVariable"); //check that it is not null KOMACROTEST_XASSERT( (int) returnvariable.data(), 0); //check that it is 12345 |