• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

rocs/App

  • sources
  • kde-4.14
  • kdeedu
  • rocs
  • App
  • Tests
TestIncludeManager.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Rocs.
3  Copyright 2010 Wagner Reck <wagner.reck@gmail.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19  */
20 
21 #include "TestIncludeManager.h"
22 #include <QtTest/QTest>
23 #include <QtCore/QFile>
24 #include "IncludeManager.h"
25 #include <KLocalizedString>
26 #include <KDebug>
27 
28 void TestIncludeManager::inittestcase()
29 {
30  IncludeManager man;
31  QFile f(QDir::currentPath() + "/file.js");
32  if (f.open(QFile::WriteOnly)) {
33  QTextStream tx(&f);
34  tx << "include (otherFile.js)\n";
35  tx << "include (file.js)";
36  }
37  f.close();
38 }
39 
40 void TestIncludeManager::includeSimple()
41 {
42  IncludeManager man;
43  QString str = QString("Not include file.js");
44  QCOMPARE(man.include(str), str);
45 }
46 
47 void TestIncludeManager::appendToTempPath()
48 {
49  IncludeManager man;
50  QString path1("/home/something/");
51  QString path2("c:/somePlace/in/Path");
52  man.addPath(path1);
53  man.addPath(path2);
54 
55  man.include(QString());
56  QVERIFY(man.tempPath().contains(path1));
57 // kDebug () << man.tempPath();
58  QVERIFY(man.tempPath().contains(path2 + '/'));
59 }
60 
61 void TestIncludeManager::doublePathInsert()
62 {
63  IncludeManager man;
64  QStringList inserted1;
65  inserted1 << "/home/something/";
66  inserted1 << "c:\\somePlace\\in\\Path";
67  man.addPath(inserted1);
68  QStringList inserted2;
69  inserted2 << "/home/something";
70  man.addPath(inserted2);
71 
72  QCOMPARE(man.tempPath().count(inserted1.at(0)), 1);
73  man.addPath(inserted2.at(0));
74  QCOMPARE(man.tempPath().count(inserted1.at(0)), 1);
75 }
76 
77 //FIXME not working test
78 void TestIncludeManager::findInclude()
79 {
80 // IncludeManager man;
81 // QString str = "include ( file.js)";
82 //
83 // man.addPath(QDir::currentPath());
84 //
85 // QCOMPARE (man.include(str,QDir::currentPath(), "file.js"), QString("debug(\"Cannot open file %1.\")\n").arg("otherFile.js"));
86 }
87 
88 
89 QTEST_MAIN(TestIncludeManager)
QList::at
const T & at(int i) const
TestIncludeManager.h
QDir::currentPath
QString currentPath()
QFile
QTextStream
QString
QStringList
TestIncludeManager
Definition: TestIncludeManager.h:26
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:16:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

rocs/App

Skip menu "rocs/App"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal