void TEST_cppwriter::test_writeClass() { CppWriterTest* cpp = new CppWriterTest(); UMLClassifier* c = new UMLClassifier("Customer", "12345678"); UMLAttribute* attr; attr = c->createAttribute("name_"); attr = c->createAttribute("address_"); UMLOperation* op; op = c->createOperation("getName"); op = c->createOperation("getAddress"); cpp->writeClass(c); // does the just created file exist? QFile fileHeader(temporaryPath() + cpp->findFileName(c, QLatin1String(".h"))); QFile fileCPP(temporaryPath() + cpp->findFileName(c, QLatin1String(".cpp"))); QCOMPARE(fileHeader.exists(), true); QCOMPARE(fileCPP.exists(), true); }
QDir MainApplication::temporaryDir() { QDir temporaryPath(QString(QDir::tempPath() + "/" + MainApplication::APPLICATION_NAME)); if (!temporaryPath.exists()) { temporaryPath.mkpath(temporaryPath.path()); } return temporaryPath; }
void TEST_pythonwriter::test_writeClass() { PythonWriterTest* py = new PythonWriterTest(); UMLClassifier* c = new UMLClassifier("Customer", "12345678"); UMLAttribute* attr; attr = c->createAttribute("name_"); attr = c->createAttribute("address_"); py->writeClass(c); // does the just created file exist? QFile file(temporaryPath() + py->findFileName(c, QLatin1String(".py"))); QCOMPARE(file.exists(), true); }