mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
some more refinements to FS and GFX tests
svn-id: r50286
This commit is contained in:
parent
bc3a7ba915
commit
6e27ad3b2b
@ -15,12 +15,9 @@ namespace Testbed {
|
||||
* compares the message contained in it, with what it expects.
|
||||
*
|
||||
*/
|
||||
bool FStests::readDataFromFile(Common::FSNode &directory, const char *file) {
|
||||
bool FStests::readDataFromFile(Common::FSDirectory *directory, const char *file) {
|
||||
|
||||
|
||||
Common::FSDirectory nestedDir(directory);
|
||||
|
||||
Common::SeekableReadStream *readStream = nestedDir.createReadStreamForMember(file);
|
||||
Common::SeekableReadStream *readStream = directory->createReadStreamForMember(file);
|
||||
|
||||
if (!readStream) {
|
||||
printf("LOG:Can't open game file for reading\n");
|
||||
@ -29,7 +26,7 @@ bool FStests::readDataFromFile(Common::FSNode &directory, const char *file) {
|
||||
|
||||
Common::String msg = readStream->readLine();
|
||||
delete readStream;
|
||||
printf("LOG: Message Extracted from %s/%s : %s\n",directory.getName().c_str(), file, msg.c_str());
|
||||
printf("LOG: Message Extracted from %s/%s : %s\n",directory->getFSNode().getName().c_str(), file, msg.c_str());
|
||||
|
||||
|
||||
Common::String expectedMsg = "It works!";
|
||||
@ -45,10 +42,10 @@ bool FStests::readDataFromFile(Common::FSNode &directory, const char *file) {
|
||||
|
||||
bool FStests::testReadFile() {
|
||||
const Common::String &path = ConfMan.get("path");
|
||||
Common::FSNode gameRoot(path);
|
||||
Common::FSDirectory gameRoot(path);
|
||||
int numFailed = 0;
|
||||
|
||||
if (!gameRoot.isDirectory()) {
|
||||
if (!gameRoot.getFSNode().isDirectory()) {
|
||||
printf("LOG:game Path should be a directory");
|
||||
return false;
|
||||
}
|
||||
@ -59,7 +56,7 @@ bool FStests::testReadFile() {
|
||||
for (unsigned int i = 0; i < ARRAYSIZE(dirList); i++) {
|
||||
Common::String dirName = dirList[i];
|
||||
Common::String fileName = file[i];
|
||||
Common::FSNode directory = gameRoot.getChild(dirName);
|
||||
Common::FSDirectory *directory = gameRoot.getSubDirectory(dirName);
|
||||
|
||||
if (!readDataFromFile(directory, fileName.c_str())) {
|
||||
printf("LOG : reading from %s/%s failed\n", dirName.c_str(), fileName.c_str());
|
||||
@ -68,7 +65,7 @@ bool FStests::testReadFile() {
|
||||
|
||||
dirName.toLowercase();
|
||||
fileName.toLowercase();
|
||||
directory = gameRoot.getChild(dirName);
|
||||
directory = gameRoot.getSubDirectory(dirName);
|
||||
|
||||
if (!readDataFromFile(directory, fileName.c_str())) {
|
||||
printf("LOG : reading from %s/%s failed\n", dirName.c_str(), fileName.c_str());
|
||||
@ -77,7 +74,7 @@ bool FStests::testReadFile() {
|
||||
|
||||
dirName.toUppercase();
|
||||
fileName.toUppercase();
|
||||
directory = gameRoot.getChild(dirName);
|
||||
directory = gameRoot.getSubDirectory(dirName);
|
||||
|
||||
if (!readDataFromFile(directory, fileName.c_str())) {
|
||||
printf("LOG : reading from %s/%s failed\n", dirName.c_str(), fileName.c_str());
|
||||
|
@ -12,7 +12,7 @@ namespace FStests {
|
||||
// from commandline
|
||||
|
||||
// Helper functions for FS tests
|
||||
bool readDataFromFile(Common::FSNode &directory, const char *file);
|
||||
bool readDataFromFile(Common::FSDirectory *directory, const char *file);
|
||||
|
||||
// will contain function declarations for FS tests
|
||||
bool testReadFile();
|
||||
|
@ -436,13 +436,14 @@ bool GFXtests::palettizedCursors() {
|
||||
printf("LOG: Couldn't use Game palette for rendering cursor\n");
|
||||
passed = false;
|
||||
}
|
||||
g_system->delayMillis(1000);
|
||||
|
||||
if (!Testsuite::handleInteractiveInput("Did Cursor tests went as you were expecting?")) {
|
||||
passed = false;
|
||||
}
|
||||
|
||||
Testsuite::clearScreen();
|
||||
// Done with cursors
|
||||
CursorMan.popAllCursors();
|
||||
return passed;
|
||||
}
|
||||
|
||||
@ -578,6 +579,9 @@ bool GFXtests::scaledCursors() {
|
||||
printf("LOG: Switcing to initial state failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Done with cursors
|
||||
CursorMan.popAllCursors();
|
||||
|
||||
Testsuite::clearScreen();
|
||||
return true;
|
||||
@ -651,16 +655,15 @@ bool GFXtests::overlayGraphics() {
|
||||
|
||||
Graphics::PixelFormat pf = g_system->getOverlayFormat();
|
||||
|
||||
OverlayColor buffer[20 * 40];
|
||||
OverlayColor buffer[50 * 100];
|
||||
OverlayColor value = pf.RGBToColor(0, 255, 0);
|
||||
|
||||
for (int i = 0; i < 20 * 40; i++) {
|
||||
for (int i = 0; i < 50 * 100; i++) {
|
||||
buffer[i] = value;
|
||||
}
|
||||
|
||||
// FIXME: Not Working.
|
||||
g_system->showOverlay();
|
||||
g_system->copyRectToOverlay(buffer, 40, 100, 100, 40, 20);
|
||||
g_system->copyRectToOverlay(buffer, 100, 270, 175, 100, 50);
|
||||
g_system->updateScreen();
|
||||
|
||||
g_system->delayMillis(1000);
|
||||
@ -762,7 +765,7 @@ bool GFXtests::pixelFormats() {
|
||||
colors[4] = iter->RGBToColor(181, 126, 145);
|
||||
colors[5] = iter->RGBToColor(47, 78, 36);
|
||||
|
||||
Common::Point pt(0, 10);
|
||||
Common::Point pt(0, 170);
|
||||
char msg[100];
|
||||
// XXX: Can use snprintf?
|
||||
snprintf(msg, sizeof(msg), "Testing Pixel Formats, %d of %d", numFormatsTested, pfList.size());
|
||||
@ -777,7 +780,7 @@ bool GFXtests::pixelFormats() {
|
||||
// Draw 6 rectangles centred at (50, 160), piled over one another
|
||||
// each with color in colors[]
|
||||
for (int i = 0; i < 6; i++) {
|
||||
screen->fillRect(Common::Rect::center(160, 50 + i * 10, 100, 10), colors[i]);
|
||||
screen->fillRect(Common::Rect::center(160, 20 + i * 10, 100, 10), colors[i]);
|
||||
}
|
||||
|
||||
g_system->unlockScreen();
|
||||
|
Loading…
x
Reference in New Issue
Block a user