Ejemplo n.º 1
0
void
load_data()
{

    LcShm lc;
    char *shmaddr;

    string con1 = "lc_reply";
    if (!lc.connect(con1)) {
        if (errno == EACCES) {
            runtest.untested("Couldn't map input file, permission problems!!");
        } else {
            runtest.unresolved("LcShm::connect()");
        }
        exit(0);
    }

    shmaddr = reinterpret_cast<char*>(lc.begin());
//    if (memcmp(shmaddr, con1.c_str():
    // Since this is a test case, populate the memory with known good data
    string srcdir = SRCDIR;
    srcdir += "/segment.raw";
    int fd = ::open(srcdir.c_str(), O_RDONLY);
    void *dataptr = mmap(0, 64528, PROT_READ, MAP_SHARED, fd, 0);

    if (dataptr != (void*)-1) {
        memcpy(shmaddr, dataptr, 64528);
    } else {
        if (errno == EACCES) {
            runtest.unresolved("Couldn't map input file, permission problems!!");
        } else {
            runtest.unresolved("Couldn't map input file!");
            log_debug("Error was: %s", strerror(errno));
        }
        exit(0);
    }

    ::close(fd);
}
Ejemplo n.º 2
0
void
test_geometry(Renderer *renderer, const std::string &type)
{
    cout << "\t" << type << " geometry tests" << endl;
    
    if (!renderer) {
        runtest.unresolved("No renderer to test!");
        return;
    }
    
    int x = 10;
    int y = 10;
    geometry::Point2d nz(200, 0);
    geometry::Point2d z(x, y);
    geometry::Range2d<int> pixelbounds;
    geometry::Range2d<int> worldbounds;
    Timer tpixtow("pixel_to_world(int, int)");
    z = renderer->pixel_to_world(x, y);
    tpixtow.stop();
    
    if ((z.x >= 199) || (z.y >= 199)) {
        runtest.pass(std::string("pixel_to_world(int, int) ") + tpixtow.elapsed());
    } else {
        runtest.fail(std::string("pixel_to_world(int, int) ") + tpixtow.elapsed());
    }
    
#if 0
    Timer tpixtow2("pixel_to_world(pixelbounds)");
    worldbounds = renderer->pixel_to_world(pixelbounds);
    tpixtow2.stop();
    if (worldbounds.isNull()) {
        runtest.pass(std::string("pixel_to_world(geometry::Range2d<int>) ") + tpixtow2.elapsed());
    } else {
        runtest.fail(std::string("pixel_to_world(geometry::Range2d<int>) ") + tpixtow2.elapsed());
    }
#else
    runtest.untested("pixel_to_world(geometry::Range2d<int>)");
#endif
    
    Timer twtop("world_to_pixel(geometry::Range2d<int>)");
    pixelbounds = renderer->world_to_pixel(worldbounds);
    twtop.stop();
    if (pixelbounds.isNull()) {
        runtest.pass(std::string("world_to_pixel(geometry::Range2d<int>) ") + twtop.elapsed());
    } else {
        runtest.fail(std::string("world_to_pixel(geometry::Range2d<int>) ") + twtop.elapsed());
    }
    
    SWFRect bounds;
    Timer tbounds1("bounds_in_clipping_area(SWFRect)");
    bool ret = renderer->bounds_in_clipping_area(bounds);
    tbounds1.stop();
    if (ret) {
        runtest.pass(std::string("bounds_in_clipping_area(SWFRect) ") + tbounds1.elapsed());
    } else {
        runtest.fail(std::string("bounds_in_clipping_area(SWFRect) ") + tbounds1.elapsed());
    }
    
    InvalidatedRanges ranges;
    Timer tbounds2("bounds_in_clipping_area(InvalidatedRanges)");
    ret = renderer->bounds_in_clipping_area(ranges);
    tbounds2.stop();
    if (!ret) {
        runtest.pass(std::string("bounds_in_clipping_area(InvalidatedRanges) ") + tbounds2.elapsed());
    } else {
        runtest.fail(std::string("bounds_in_clipping_area(InvalidatedRanges) ") + tbounds2.elapsed());
    }

    Timer tbounds3("bounds_in_clipping_area(geometry::Range2d<int>)");
    ret = renderer->bounds_in_clipping_area(pixelbounds);
    tbounds3.stop();
    if (!ret) {
        runtest.pass(std::string("bounds_in_clipping_area(geometry::Range2d<int>) ") + tbounds3.elapsed());
    } else {
        runtest.fail(std::string("bounds_in_clipping_area(geometry::Range2d<int>) ") + tbounds3.elapsed());
    }
}
Ejemplo n.º 3
0
void
test_renderer(Renderer *renderer, const std::string &type)
{
    cout << "Testing " << type << " Renderer" << endl;
//    Timer trend("Renderer Tests", true);
    
    if (!renderer) {
        runtest.unresolved("No renderer to test!");
        return;
    }
    
    if (renderer > 0) {
        runtest.pass("Got Renderer");
    } else {
        runtest.fail("Couldn't get Renderer");
    }

    if (!renderer->description().empty()) {
        if (renderer->description() == type) {
            runtest.pass("description is correct");
        } else {
            runtest.fail("description is wrong");
        }
    } else {
        runtest.fail("Couldn't get description!");
    }

#if 0
    if (renderer->getBitsPerPixel()) {
        runtest.pass("getBitsPerPixel()");
    } else {
        runtest.fail("getBitsPerPixel()");
    }
#endif
    
    image::GnashImage *frame1 = new image::ImageRGBA(10, 12);
    std::auto_ptr<image::GnashImage> im1(frame1);
    CachedBitmap *cb = renderer->createCachedBitmap(im1);
    if (cb) {
        image::GnashImage &gi = cb->image();
        if ((gi.width() == 10) && (gi.height() == 12)) {
            runtest.pass("createCachedBitmap()");
        } else {
            runtest.fail("createCachedBitmap()");
        }
    } else {
        runtest.unresolved("createCachedBitmap()");
    }

#if 0
    // FIXME: initTestBuffer() is going away, replaced by the fake
    // framebuffer code.
    // Initializes the renderer for off-screen rendering used by the testsuite.
    if (renderer->initTestBuffer(10, 10)) {
        runtest.pass("initTestBuffer()");
    } else {
        runtest.fail("initTestBuffer()");
    }
#endif
    
    /// @coords an array of 16-bit signed integer coordinates. Even indices
    ///         (and 0) are x coordinates, while uneven ones are y coordinates.
    /// @vertex_count the number of x-y coordinates (vertices).
    /// @color the color to be used to draw the line strip.
    /// @mat the SWFMatrix to be used to transform the vertices.
    boost::uint16_t x = 10;
    boost::uint16_t y = 10;
    boost::uint16_t h = 10;
    std::vector<point> box = boost::assign::list_of
        (point(x, y))
        (point(x, y + h));

    rgba color(0, 0, 0, 255);
    SWFMatrix mat;
    mat.set_scale_rotation(1, 3, 0);

    Timer tdrawline("drawline");
    renderer->drawLine(box, color, mat);
    tdrawline.stop();
    
    // if (1) {
    //     runtest.pass("drawLine()");
    // } else {
    //     runtest.fail("drawLine()");
    // }
    runtest.unresolved(std::string("drawLine() ") + tdrawline.elapsed());

    //drawVideoFrame(image::GnashImage* frame, const Transform& xform, const SWFRect* bounds, bool smooth);
#if 0
    image::GnashImage *frame;
    const Transform xform;
    const SWFRect bounds;
    bool smooth;
    Timer tdrawvideo("drawVideoFrame");
    renderer->drawVideoFrame(frame, xform, bounds, smooth);
    tdrawvideo.stop();
#endif
    runtest.untested("drawVideoFrame()");

    point *corners = 0;
    size_t corner_count = 0;
    rgba fill(0, 0, 0, 255);;
    rgba outline(0, 0, 0, 255);;
    bool masked = true;
    Timer tdrawpoly("drawPoly");
    renderer->draw_poly(corners, corner_count, fill, outline, mat, masked);
    tdrawpoly.stop();
    runtest.unresolved(std::string("drawPoly() ") + tdrawpoly.elapsed());
    
//    SWF::ShapeRecord shape;
    SWFMatrix mat2(0x10000, 0x0, 0x0, 0x10000, 0x0, 0x0);
    SWFCxForm cxform;
    //(0x100, 0x100, 0x100, 0x100, 0x0, 0x0, 0x0, 0x0);
    Transform xform(mat2, cxform);
    SWF::ShapeRecord shape;
    // _bounds = {0x80000000, 0x7fffffff,
    //            0x80000000, 0x80000000,
    //            0x80000000, 0x80000000}}
    Timer drawshape("drawShape");
    renderer->drawShape(shape, xform);
    runtest.unresolved("drawShape()");
    drawshape.stop();
    
//    SWF::ShapeRecord rec;
    // rgba color;
    // SWFMatrix mat;
//    Timer drawGlyph("drawGlyph");
//    renderer->drawGlyph(rec, color, mat);
    runtest.untested("drawGlyph()");
//   drawglyph.stop();

#if 0
    boost::shared_ptr<IOChannel> io;
    FileType ftype;
    Timer renderi("renderToImage");
    renderer->renderToImage(io, ftype);
    renderi.stop();
#endif
    runtest.untested("renderToImage()");

    CachedBitmap *bitmap = 0;
    image::GnashImage *frame2 = new image::ImageRGBA(10, 10);
    std::auto_ptr<image::GnashImage> im(frame2);
    Timer cbit("createCachedBitmap");
    bitmap = renderer->createCachedBitmap(im);
    cbit.stop();
    if (bitmap) {
        runtest.pass(std::string("createCachedBitmap() ") + cbit.elapsed());
    } else {
        runtest.fail(std::string("createCachedBitmap() ") + cbit.elapsed());
    }
    
}
Ejemplo n.º 4
0
int
main(int argc, char *argv[])
{
    // FIXME: for now, always run verbose till this supports command line args
    dbglogfile.setVerbosity();

    rawfb::RawFBDevice rfb;
    
    if (!rfb.initDevice(argc, argv)) {
        runtest.fail("RawFBDevice:InitDevice()");
    } else {
        runtest.pass("RawFBDevice:InitDevice()");
    }

    bool ret = rfb.attachWindow(rfb.getHandle());
    if (rfb.getFBMemory()) {
        runtest.pass("RawFBDevice::attachWindow()");
    } else {
        runtest.fail("RawFBDevice::attachWindow()");
    }
    
#ifdef ENABLE_DOUBLE_BUFFERING
    if (rfb.getOffscreenBuffer()) {
        runtest.pass("RawFBDevice::getOffscreenBuffer()");
    } else {
        runtest.fail("RawFBDevice::getOffscreenBuffer()");
    }
#else
    runtest.untested("RawFBDevice::getOffscreenBuffer()");
#endif
    
    if (ret && rfb.getStride()) {
        runtest.pass("RawFBDevice::getStride()");
    } else {
        runtest.fail("RawFBDevice::getStride()");
    }
    
    if (ret && rfb.getWidth()) {
        runtest.pass("RawFBDevice::getWidth()");
    } else {
        runtest.fail("RawFBDevice::getWidth()");
    }
    
    if (ret && rfb.getHeight()) {
        runtest.pass("RawFBDevice::getHeight()");
    } else {
        runtest.fail("DirecTFBDevice::getHeight()");
    }

    if (ret && rfb.isSingleBuffered()) {
        runtest.pass("RawFBDevice::is*Buffered()");
    } else {
        runtest.fail("RawFBDevice::is*Buffered()");
    }
    
    if (ret && rfb.getDepth()) {
        runtest.pass("RawFBDevice::getDepth()");
    } else {
        runtest.fail("RawFBDevice::getDepth()");
    }
    
    if (ret && rfb.getRedSize() > 0) {
        runtest.pass("RawFBDevice::getRedSize()");
    } else {
        runtest.fail("RawFBDevice::getRedSize()");
    }

    if (ret && rfb.getGreenSize() > 0) {
        runtest.pass("RawFBDevice::getGreenSize()");
    } else {
        runtest.fail("RawFBDevice::getGreenSize()");
    }

    if (ret && rfb.getBlueSize() > 0) {
        runtest.pass("RawFBDevice::getBlueSize()");
    } else {
        runtest.fail("RawFBDevice::getBlueSize()");
    }

#if 0
    if (rfb.setGrayscaleLUT8()) {
        runtest.pass("RawFBDevice::setGrayscaleLUT8()");
    } else {
        runtest.fail("RawFBDevice::setGrayscaleLUT8()");
    }
#endif
    
    // AGG uses these to calculate the poixel format
#ifdef RENDERER_AGG
    if (ret && rfb.getRedOffset() > 0) {
        runtest.pass("RawFBDevice::getRedOffset()");
    } else {
        runtest.fail("RawFBDevice::getRedOffset()");
    }
    
    if (ret && rfb.getGreenOffset() > 0) {
        runtest.pass("RawFBDevice::getGreenOffset()");
    } else {
        runtest.fail("RawFBDevice::getGreenOffset()");
    }
    
    if (ret && rfb.getBlueOffset() == 0) {
        runtest.pass("RawFBDevice::getBlueOffset()");
    } else {
        runtest.fail("RawFBDevice::getBlueOffset()");
    }
#endif

    // This is a manual test to see if we can draw a line on the
    // raw framebuffer to make sure it got initialized correctly.
    int x = 0, y = 0;
    long location = 0;
    int line_length = rfb.getStride();

    std::uint8_t *fbp = 0;
    fbp = rfb.getFBMemory();

    if (fbp > 0) {
        runtest.pass("RawFBDevice::getFBMemory()");
    } else {
        runtest.fail("RawFBDevice::getFBMemory()");
        exit;
    }
    
    for(y=100; y<102; y++);            /* Where we are going to put the pixel */
    
    for(x=0; x<200; x++) {
        /* Figure out where in memory to put the pixel */
        location = x * (rfb.getDepth()/8) + y * line_length;
        
        *(fbp + location) = 89;    /* Some blue */
        *(fbp + location + 1) = 40; /* A little green */
        *(fbp + location + 2) = 200; /* A lot of red */
        *(fbp + location + 3) = 0; /* No transparency */
    }
    return 0;
}
Ejemplo n.º 5
0
int
main (int /*argc*/, char** /*argv*/) {
    RcInitFile& rc = RcInitFile::getDefaultInstance();

    LogFile& dbglogfile = LogFile::getDefaultInstance();
    dbglogfile.setVerbosity();

    int diff = 0;
    
    // Parse the test config file
    if (rc.parseFile("gnashrc")) {
        runtest.pass ("rc.parseFile()");
    } else {
        runtest.fail ("rc.parseFile()");
    }

// If we don't have support for mallinfo(), this code is useless
#if HAVE_MALLINFO
    Memory mem;

    mem.startStats();
    mem.addStats(__LINE__);             // take a sample
    mem.addStats(__LINE__);             // take a sample
    diff = mem.diffStats();
    if (mem.diffStats() == 0) {
        runtest.pass("No allocations yet");
    } else {
        runtest.fail("No allocations yet");
    }
    
    Memory m1;
    mem.addStats(__LINE__);             // take a sample
    diff = mem.diffStats();
//    cerr << "Memory::Memory: " << diff << endl;
    if ((diff >= 8) || (diff <= 16)) {
        runtest.pass("Memory::Memory");
    } else {
        runtest.fail("Memory::Memory");
    }
    
    if (mem.diffStamp() > 0) {
        runtest.pass("Memory::diffStamp()");
    } else {
        runtest.fail("Memory::diffStamp()");
    }

    if (mem.diffStats() > 0) {
        runtest.pass("Memory::diffStats()");
    } else {
        runtest.fail("Memory::diffStats()");
    }

    char *x = new char[120];
    mem.addStats(__LINE__);             // take a sample
    diff = mem.diffStats();
//    cerr << "Buffer allocation: " << diff << endl;
    if ((diff >= 104) && (diff <= 136)) {
        runtest.pass("Buffer allocation");
    } else {
        runtest.fail("Buffer allocation");
    }
    
    vector<string> sv;
    sv.push_back("Hello World");
    mem.addStats(__LINE__);             // take a sample
    diff = mem.diffStats();
//    cerr << "First string allocated: " << diff << endl;
    if ((diff >= 40) && (diff <= 48)) {
        runtest.pass("First string allocated");
    } else {
        runtest.fail("First string allocated");
    }

    sv.push_back("Aloha");
    delete x;
    mem.addStats(__LINE__);             // take a sample
    diff = mem.diffStats();
//    cerr << "Second string allocated: " << diff << endl;
    if ((diff >= -104) && (diff <= -96)) {
        runtest.pass("Second string allocated");
    } else {
        runtest.fail("Second string allocated");
    }

    sv.push_back("Guten Tag");
    mem.addStats(__LINE__);             // take a sample
    diff = mem.diffStats();
//    cerr << "Third string allocated: " << diff << endl;
    if ((diff >= 40) && (diff <= 48)){
        runtest.pass("Third string allocated");
    } else {
        runtest.fail("Third string allocated");
    }

    mem.startCheckpoint();
    test_leak();
    if (mem.endCheckpoint()) {
        runtest.fail("leak");
    } else {
        runtest.pass("leak");
    }    
    mem.addStats(__LINE__);             // take a sample
    if (mem.diffStats() == 32) {
        runtest.pass("test_leak");
    } else {
        runtest.fail("test_leak");
    }

    mem.startCheckpoint();
    test_noleak();
    mem.addStats(__LINE__);             // take a sample
    if (mem.endCheckpoint()) {
        runtest.pass("noleak");
    } else {
        runtest.fail("noleak");
    }
    diff = mem.diffStats();
    if ((diff >= 0) && (diff <= 8)) {
        runtest.pass("test_noleak");
    } else {
        runtest.fail("test_noleak");
    }
    
    mem.endStats();

//    mem.dump();

    mem.analyze();
#else
    runtest.untested("No support for mallinfo()");
#endif // end of HAVE_MALLINFO
}
Ejemplo n.º 6
0
void
test_egl(EGLDevice &egl, GnashDevice::rtype_t rtype, int argc, char *argv[])
{
    bool hwinit = false;

    if (EGLDevice::getRenderableTypes()) {
        runtest.pass("EGLDevice::getRenderableTypes()");
    } else {
        runtest.fail("EGLDevice::getRenderableTypes()");
    }
    
    // This is a utility method for converting integer error codes to
    // something human readable for debugging.
    string result = "EGL_BAD_CONFIG";
    if (egl.getErrorString(EGL_BAD_CONFIG) == result) {
        runtest.pass("EGLDevice::getErrorString()");
    } else {
        runtest.fail("EGLDevice::getErrorString()");
    }

    if (egl.initDevice(argc, argv)) {
        runtest.pass("EGLDevice::initDevice()");
        hwinit = true;
    } else {
        runtest.fail("EGLDevice::initDevice()");
    }

    if (hwinit) {
        if (egl.bindClient(rtype)) {
            runtest.pass("EGLDevice::bindClient()");
        } else {
            runtest.fail("EGLDevice::bindClient()");
        }
    } else {
        runtest.untested("EGLDevice::bindClient()");
    }

//    egl.printEGLConfig();
    
    // If there are more than zero configurations, something beyond
    // initializing is working
    if (hwinit) {
        if (egl.queryEGLConfig()) {
            runtest.pass("EGLDevice::queryEGLConfig()");
        } else {
            runtest.fail("EGLDevice::queryEGLConfig()");
        }
    } else {
        runtest.untested("EGLDevice::queryEGLConfig()");
    }

    // Init'ing to zero uses the root screen as the display. Otherwise
    // the argument should be an EGLNativeWindowType.
    int win = 0;
#ifdef ENABLE_FAKE_FRAMEBUFFER
    win = open("/tmp/fbe_buffer", O_RDWR);
#else
# ifdef BUILD_RAWFB_DEVICE
    win = open("/dev/fb0", O_RDWR);
# endif
# ifdef BUILD_X11_DEVICE
    x11::X11Device x11(egl.getNativeVisual());
    win = x11.getHandle();
# endif
#endif
    if (egl.attachWindow(win)) {
        runtest.pass("EGLDevice::attachWindow()");
    } else {
        runtest.fail("EGLDevice::attachWindow()");
        hwinit = false;
    }
    
    if (hwinit) {
        if (egl.supportsRenderer(rtype)) {
            runtest.pass("EGLDevice::supportsRenderer()");
        } else {
            runtest.fail("EGLDevice::supportsRenderer()");
        }
    } else {
        runtest.untested("EGLDevice::supportsRenderer()");
    }

    // pixel formats are either 8,8,8 or 5,6,5
    if (hwinit) {    
        if ((egl.getRedSize() == 8) || (egl.getRedSize() == 5)) {
            runtest.pass("EGLDevice::getRedSize()");
        } else {
            runtest.fail("EGLDevice::getRedSize()");
        }    
    } else {
        runtest.untested("EGLDevice::getRedSize()");
    }
    
    if (hwinit) {
        if ((egl.getGreenSize() == 8) || (egl.getGreenSize() == 6)) {
            runtest.pass("EGLDevice::getGreenSize()");
        } else {
            runtest.fail("EGLDevice::getGreenSize()");
        }    
    } else {
        runtest.untested("EGLDevice::getGreenSize()");
    }
    
    if (hwinit) {
        if ((egl.getBlueSize() == 8) || (egl.getBlueSize() == 5)) {
            runtest.pass("EGLDevice::getBlueSize()");
        } else {
            runtest.fail("EGLDevice::getBlueSize()");
        }
    } else {
        runtest.untested("EGLDevice::getBlueSize()");
    }

    // Surface config info tests
    if (hwinit) {
        if ((egl.getSurfaceID() > 0) && (egl.getSurfaceID() <= 10)) {
            runtest.pass("EGLDevice::getSurfaceID()");
        } else {
            runtest.fail("EGLDevice::getSurfaceID()");
        }
    } else {
        runtest.untested("EGLDevice::getSurfaceID()");
    }
    
    if (hwinit) {
        if (egl.getWidth() < 16000) {
            runtest.pass("EGLDevice::getWidth()");
        } else {
            runtest.fail("EGLDevice::getWidth()");
        }
    } else {
        runtest.untested("EGLDevice::getWidth()");
    }
    
    if (hwinit) {
        if (egl.getHeight() < 16000) {
            runtest.pass("EGLDevice::getHeigth()");
        } else {
            runtest.fail("EGLDevice::getHeigth()");
        }
    } else {
        runtest.untested("EGLDevice::getHeigth()");
    }

    if (hwinit) {
        if (egl.isSingleBuffered() != egl.isBackBuffered()) {
            runtest.pass("EGLDevice::is*Buffered()");
        } else {
            runtest.fail("EGLDevice::is*Buffered()");
        }
    } else {
        runtest.untested("EGLDevice::is*Buffered()");
    }

    // these are often the same as width and height, but not on all
    // displays. When EGL is back buffered, the size of the display
    // horizontally is doubled.
    if (hwinit) {
        if (egl.getVerticalRes() == 480) {
            runtest.pass("EGLDevice::getVerticalRes()");
        } else {
            runtest.fail("EGLDevice::getVerticalRes()");
        }
    } else {
        runtest.untested("EGLDevice::getVerticalRes()");
    }

    
    if (hwinit) {
        int newval = 800;
        if (egl.isBackBuffered()) {
            newval += newval;
        }
        if (egl.getHorzRes() == 1600) {
            runtest.pass("EGLDevice::getHorzRes()");
        } else {
            runtest.fail("EGLDevice::getHorzRes()");
        }
    } else {
        runtest.untested("EGLDevice::getHorzRes()");
    }
    
    // When running in a framebuffer, EGL_SWAP_BEHAVIOR is EGL_BUFFER_PRESERVED
    if (hwinit) {
        if (egl.isBufferDestroyed()) {
            runtest.fail("EGLDevice::isBufferDestroyed()");
        } else {
            runtest.pass("EGLDevice::isBufferDestroyed()");
        }
    } else {
        runtest.untested("EGLDevice::isBufferDestroyed()");
    }
    
    if (hwinit) {
        if (!egl.isMultiSample()) {
            runtest.pass("EGLDevice::isMultiSample()");
        } else {
            runtest.fail("EGLDevice::isMultiSample()");
        }
    } else {
        runtest.untested("EGLDevice::isMultiSample()");
    }

    // Context accessor tests
    if (hwinit) {
        if (egl.getContextID() < 10) {
            runtest.pass("EGLDevice::getContextID()");
        } else {
            runtest.fail("EGLDevice::getContextID()");
        }
    } else {
        runtest.untested("EGLDevice::getContextID()");
    }

#if 0
    if (egl.supportsClient(rtype)) {
        runtest.pass("EGLDevice::supportsClient()");
    } else {
        runtest.fail("EGLDevice::supportsClient()");
    }
#endif
    
    if (hwinit) {
        if (egl.isContextSingleBuffered() != egl.isContextBackBuffered()) {
            runtest.pass("EGLDevice::isContext*Buffered()");
        } else {
            runtest.fail("EGLDevice::isContext*Buffered()");
        }
    } else {
        runtest.untested("EGLDevice::isContext*Buffered()");
    }

    // When running in a framebuffer, EGL_NATIVE_RENDERABLE is false
    if (hwinit) {
        if (egl.isNativeRender()) {
            runtest.fail("EGLDevice::isNativeRender()");
        } else {
            runtest.pass("EGLDevice::isNativeRender()");
        }
    } else {
        runtest.untested("EGLDevice::isNativeRender()");
    }

    if (hwinit) {
        if (egl.getSamples() == 0) {
            runtest.pass("EGLDevice::getSamples()");
        } else {
            runtest.fail("EGLDevice::getSamples()");
        }
    } else {
        runtest.untested("EGLDevice::getSamples()");
    }
    
    if (hwinit) {
        if (egl.getSampleBuffers() == 0) {
            runtest.pass("EGLDevice::getSampleBuffers()");
        } else {
            runtest.fail("EGLDevice::getSampleBuffers()");
        }
    } else {
        runtest.untested("EGLDevice::getSampleBuffers()");
    }
    
    if (hwinit) {
        if ((egl.getDepth() == 32) || (egl.getDepth() == 16)) {
            runtest.pass("EGLDevice::getDepth()");
        } else {
            runtest.fail("EGLDevice::getDepth()");
        }
    } else {
        runtest.untested("EGLDevice::getDepth()");
    }
    
    if (hwinit) {
        if (egl.getMaxSwapInterval() == 1) {
            runtest.pass("EGLDevice::getMaxSwapInterval()");
        } else {
            runtest.fail("EGLDevice::getMaxSwapInterval()");
        }
    } else {
        runtest.untested("EGLDevice::getMaxSwapInterval()");
    }
    
    if (hwinit) {
        if (egl.getMinSwapInterval() == 1) {
            runtest.pass("EGLDevice::getMinSwapInterval()");
        } else {
            runtest.fail("EGLDevice::getMinSwapInterval()");
        }
    } else {
        runtest.untested("EGLDevice::getMinSwapInterval()");
    }

    // Test Pbuffers
    if (hwinit) {
        EGLSurface surf = egl.createPbuffer(200, 200);
        if ((egl.getWidth(surf) == 200) && (egl.getHeight(surf) == 200)) {
            runtest.pass("EGLDevice::createPbuffer(int, int)");
        } else {
            runtest.fail("EGLDevice::createPbuffer(int, int)");
        }
    } else {
        runtest.untested("EGLDevice::createPbuffer(int, int)");
    }
    
    // EGLSurface surf1 = egl[0];
    // if ((surf1 != EGL_NO_SURFACE) && (egl.getWidth(surf1) == 200)
    //     && (egl.getHeight(surf1) == 200)) {
    //     runtest.pass("EGLDevice::operator[]()");
    // } else {
    //     runtest.fail("EGLDevice::operator[]()");
    // }

    if (hwinit) {
        if (egl.totalPbuffers() == 3) {
            runtest.pass("EGLDevice::totalPbuffers(2)");
        } else {
            runtest.fail("EGLDevice::totalPbuffers(2)");
        }
    }

    // Since we're EGL_SINGLE_BUFFER'd, this is a nop
    if (hwinit) {
        if (egl.swapBuffers()) {
            runtest.pass("EGLDevice::swapBuffers()");
        } else {
            runtest.fail("EGLDevice::swapBuffers()");
        }
    } else {
        runtest.untested("EGLDevice::swapBuffers()");
    }

    egl.makePbufferCurrent(1);
    // The current surface is fullscreen
    EGLSurface surf4 = eglGetCurrentSurface(EGL_DRAW);
    if (hwinit) {
        if ((egl.getWidth(surf4) == 800) && ((egl.getHeight(surf4) == 480))) {
            runtest.pass("EGLDevice::makePbufferCurrent(int)");
        } else {
            runtest.fail("EGLDevice::makePbufferCurrent(int)");
        }
    } else {
        runtest.untested("EGLDevice::makePbufferCurrent(int)");
    }

    // This should trigger an error as the number is more than we
    // have created
    if (hwinit) {
        if (!egl.makePbufferCurrent(10)) {
            runtest.pass("EGLDevice::makePbufferCurrent(maxed)");
        } else {
            runtest.fail("EGLDevice::makePbufferCurrent(maxed)");
        }
    } else {
        runtest.untested("EGLDevice::makePbufferCurrent(maxed)");
    }
    
#if 0
    if (!egl.copyPbuffers(1)) {
        runtest.pass("EGLDevice::copyPbuffers()");
    } else {
        runtest.fail("EGLDevice::copyPbuffers()");
    }
#endif
    
    // EGLSurface surf5 = eglGetCurrentSurface(EGL_DRAW);
    // egl.printEGLSurface(surf5);
#ifndef BUILD_X11_DEVICE
    close(win);
#endif
}