diff --git a/bsa/bsa_file.h b/bsa/bsa_file.h index 9ecd3e6b0..3b6cbcd2b 100644 --- a/bsa/bsa_file.h +++ b/bsa/bsa_file.h @@ -70,7 +70,7 @@ class BSAFile /// Used for error messages std::string filename; - /// Non-case sensitive string comparison + /// Case insensitive string comparison struct iltstr { bool operator()(const char *s1, const char *s2) const @@ -79,7 +79,7 @@ class BSAFile /** A map used for fast file name lookup. The value is the index into the files[] vector above. The iltstr ensures that file name - checks are non-case sensitive. + checks are case insensitive. */ typedef std::map Lookup; Lookup lookup; diff --git a/nifogre/tests/Makefile b/nifogre/tests/Makefile new file mode 100644 index 000000000..977262bca --- /dev/null +++ b/nifogre/tests/Makefile @@ -0,0 +1,13 @@ +GCC=g++ + +all: ogre_manualresource_test + +I_OGRE=$(shell pkg-config --cflags OGRE) +L_OGRE=$(shell pkg-config --libs OGRE) + +ogre_manualresource_test: ogre_manualresource_test.cpp + $(GCC) $^ -o $@ $(I_OGRE) $(L_OGRE) + +clean: + rm *_test + diff --git a/nifogre/tests/ogre_manualresource_test.cpp b/nifogre/tests/ogre_manualresource_test.cpp new file mode 100644 index 000000000..721c56112 --- /dev/null +++ b/nifogre/tests/ogre_manualresource_test.cpp @@ -0,0 +1,68 @@ +#include +#include +#include + +using namespace std; +using namespace Ogre; + +struct MyMeshLoader : ManualResourceLoader +{ + void loadResource(Resource *resource) + { + Mesh *mesh = dynamic_cast(resource); + assert(mesh); + + const String& name = mesh->getName(); + cout << "Manually loading mesh " << name << endl; + + // Create the mesh here + } +}; + +MyMeshLoader mml; + +int main() +{ + // When the test is done, consider disabling the rendering part + // unless a command line parameter is given (and write a note about + // this to console.) This allows you to run the test from scripts + // and still do some meaningful testing, even if you can't inpsect + // the result visually. + + /* + // Disable Ogre logging + new LogManager; + Log *log = LogManager::getSingleton().createLog(""); + log->setDebugOutputEnabled(false); + */ + + // Set up Root. + Root *root = new Root("plugin.cfg","ogre.cfg",""); + + if(!root->restoreConfig()) + if(!root->showConfigDialog()) + return 1; + + // Create a window + RenderWindow *window = root->initialise(true, "Test"); + + // We might need input managment too + + // More initialization + SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC); + Camera *cam = mgr->createCamera("cam"); + ViewPort *vp = window->addViewport(cam); + cam->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight())); + cam->setFOVy(Degree(55)); + + // Background color + vp->setBackgroundColour(ColourValue(0,0,0)); + + // Declare a couple of manual meshes + ResourceGroupManager::getSingleton().declareResource("mesh1.mm", "Mesh", "General", &mml); + ResourceGroupManager::getSingleton().declareResource("mesh2.mm", "Mesh", "General", &mml); + + // Display the meshes here + + return 0; +} diff --git a/nifogre/tests/test.sh b/nifogre/tests/test.sh new file mode 100755 index 000000000..b1ca6f1a6 --- /dev/null +++ b/nifogre/tests/test.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +make || exit + +mkdir -p output + +PROGS=*_test + +for a in $PROGS; do + if [ -f "output/$a.out" ]; then + echo "Running $a:" + $a | diff output/$a.out - + else + echo "Creating $a.out" + $a > "output/$a.out" + git add "output/$a.out" + fi +done