int main(int argc , char ** argv){ PPMImage *imageTinyCorrect; imageTinyCorrect = readPPM("flower_tiny_correct.ppm"); PPMImage *imageSmallCorrect; imageSmallCorrect = readPPM("flower_small_correct.ppm"); PPMImage *imageMediumCorrect; imageMediumCorrect = readPPM("flower_medium_correct.ppm"); PPMImage *imageTiny; imageTiny = readPPM("flower_tiny.ppm"); PPMImage *imageSmall; imageSmall = readPPM("flower_small.ppm"); PPMImage *imageMedium; imageMedium = readPPM("flower_medium.ppm"); printf("flower_tiny.ppm:\n"); int pass = testImage(imageTiny, imageTinyCorrect); printf("flower_small.ppm:\n"); pass = testImage(imageSmall, imageSmallCorrect); printf("flower_medium.ppm:\n"); pass = testImage(imageMedium, imageMediumCorrect); exit(0); }
int main() { SDL_Init(SDL_INIT_VIDEO); SDL_Window *window; SDL_Renderer *renderer; SDL_CreateWindowAndRenderer(600, 450, 0, &window, &renderer); int result = 0; result |= testImage(renderer, SCREENSHOT_DIRNAME "/" SCREENSHOT_BASENAME); // absolute path assert(result != 0); chdir(SCREENSHOT_DIRNAME); result = testImage(renderer, "./" SCREENSHOT_BASENAME); // relative path assert(result != 0); SDL_RenderPresent(renderer); printf("you should see an image.\n"); SDL_Quit(); REPORT_RESULT(); return 0; }
void PictureTest::storeTestInternImage() { KABC::Picture picture; picture.setData( testImage() ); QVERIFY( picture.isEmpty() == false ); QVERIFY( picture.isIntern() == true ); QVERIFY( picture.type() == QLatin1String( "jpeg" ) ); QVERIFY( picture.data() == testImage() ); QVERIFY( picture.rawData() == testImageRawJPEG() ); }
void PictureTest::equalsTestInternImage() { KABC::Picture picture1, picture2; picture1.setData( testImage() ); picture2.setData( testImage() ); QVERIFY( picture1 == picture2 ); // access rawData() so a QByteArray is created picture1.rawData(); QVERIFY( picture1 == picture2 ); }
int main(int argc, char *argv[]) { testArray(); testPlugin(); testList(); return 0; testByteArray(); testHash(); testImage(); testIO(); testMap(); testString(); testStringList(); testStruct(); testThreads(); testVariant1(); testVariant2(); testVariant3(); testVector(); testVectorOfList(); testObject(argc, argv); QColor color(255,128,10); QFont font; while(true) ; return 0; }
dtkSmartPointer<dtkAbstractData> medTestDbApp::CreateTestData( ) { // Create a data. dtkAbstractDataFactory *dataFactory = dtkAbstractDataFactory::instance(); CHECK_TEST_RESULT( dataFactory ); dtkSmartPointer<dtkAbstractData> testData = dataFactory->createSmartPointer(medQtDataImage::s_description()); CHECK_TEST_RESULT( testData ); medMetaDataKeys::PatientName.set(testData,"TestPatient"); medMetaDataKeys::StudyDescription.set(testData,"TestStudy"); medMetaDataKeys::SeriesDescription.set(testData,"TestSeries"); QImage testImage(QSize( 800, 500 ), QImage::Format_Mono ); QPainter painter(&testImage); painter.setRenderHints(QPainter::Antialiasing); painter.setPen(Qt::gray); painter.fillRect(testImage.rect(), Qt::black); painter.drawEllipse(QPoint(400,250), 300, 100); testData->setData( &testImage ); return testData; }
void GLBox::initializeGL() { // this method is called exactly once on program start clearImage(); glViewport(0, 0, m_winWidth, m_winHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-m_winWidth/2, m_winWidth/2, -m_winHeight/2, m_winHeight/2, 0, 1); glClear (GL_COLOR_BUFFER_BIT); std::cout << "Started..." << std::endl; // import .bmp Image testImage("C:/GIT/CGProject/input/tiles24.bmp"); // import .obj loadOBJ("C:/GIT/CGProject/input/teapot.obj", faces, &testImage); qDebug() << faces.size() << " Faces loaded!"; for (unsigned int i = 0; (i < faces.size()); i++){ Tree.Add(&faces[i]); } // Tree.printTree(); printf("Sizes: AABB %d; Node %d; Facecount: %u, Nodecount: %u, AABBcount: %u\n", sizeof(AABB), sizeof(Node), (unsigned int)faces.size(), Tree.nodecount, AABB::aabbcount); rayTrace(); }
int main() { // testElement(); testImage(); // testEncoded(); return 668; //a_Return of the neighbor of the beast
void ready(const char *f) { printf("ready!\n"); testImage("screenshot.jpg"); // relative path SDL_RenderPresent(renderer); }
void TerrainDescriptorWaterTest::processTest(void) { TerrainMesh terrain(100, 10, 200); TerrainDescriptorWater waterDescriptor; cv::Mat testImage(10, 10, CV_8UC3, cv::Scalar(255, 255, 255)); // fill half of the image with blue color cv::rectangle(testImage, cv::Point(0, 5), cv::Point(10, 10), cv::Scalar(255, 0, 0), CV_FILLED); // test water detection method with an image half filled with blue color // that test might lead to be 100 percent full of water => waterHeight == terrainHeight float waterHeight = waterDescriptor._determineWaterHeight(&terrain, testImage); // actually you shouldn't compare two floating point numbers with each other this way, // but in this case we know what actually has to be the result so we do it here, // nevertheless, it isn't a garantee that it'll works all the time on all platforms or // with all compiles. So, it's definitely necessary to replace it with a proper floating // point comparism function! CPPUNIT_ASSERT(waterHeight == 10.0f); // test water descriptor process. this process basically add a water entity // to the terrain. so, after this process the terrain might have one entity. waterDescriptor.process(&terrain, testImage); CPPUNIT_ASSERT(terrain.getNumberOfEntities() == 1); terrain.release(); }
/*! Procedurally generates an image then compares it to a known valid reference bitmap */ static bool testProceduralGeneration() { const char *referenceName = "procedural-reference.bmp"; util::Image *reference = generateTestImage(); bool result = false; try { std::stringstream ss; ss << basePath << "/" << referenceName; util::Image testImage(ss.str()); result = compareImageByteLevel(*reference, testImage); } catch (std::runtime_error &e) { report( "Error: failed to load test image for procedural generation" << e.what() ); delete reference; return false; } delete reference; if (!result) { report( "Error: comparison of procedurally generated image to file has failed." ); return false; } return true; }
TEST(DragImageTest, CreateDragImage) { // Tests that the DrageImage implementation doesn't choke on null values // of imageForCurrentFrame(). // FIXME: how is this test any different from test NullHandling? RefPtr<TestImage> testImage(TestImage::create(IntSize())); EXPECT_FALSE(DragImage::create(testImage.get())); }
void ready(const char *f) { printf("ready!\n"); testImage("screenshot.jpg", 1); SDL_Flip(screen); }
TEST(DragImageTest, NonNullHandling) { RefPtr<TestImage> testImage(TestImage::create(IntSize(2, 2))); std::unique_ptr<DragImage> dragImage = DragImage::create(testImage.get()); ASSERT_TRUE(dragImage); dragImage->scale(0.5, 0.5); IntSize size = dragImage->size(); EXPECT_EQ(1, size.width()); EXPECT_EQ(1, size.height()); }
void PictureTest::assignmentTestIntern() { KABC::Picture picture1, picture2; picture1.setData( testImage() ); picture2 = picture1; QVERIFY( picture1 == picture2 ); }
void PictureTest::differsTest() { KABC::Picture picture1, picture2; picture1.setUrl( QLatin1String( "http://myhomepage.com/foto.png" ), QLatin1String( "png" ) ); picture2.setData( testImage() ); QVERIFY( picture1 != picture2 ); }
void PictureTest::equalsTestInternImageAndRawData() { KABC::Picture picture1, picture2; picture1.setData( testImage() ); picture2.setRawData( testImageRawJPEG(), QLatin1String( "jpeg" ) ); QVERIFY( picture1.rawData() == picture2.rawData() ); }
static QByteArray testImageRawJPEG() { static QByteArray raw; if ( raw.isNull() ) { QBuffer buffer( &raw ); buffer.open( QIODevice::WriteOnly ); testImage().save( &buffer, "JPEG" ); } return raw; }
int main() { SDL_Init(SDL_INIT_VIDEO); screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE); testImage("screenshot.jpg", 0); printf("prepare..\n"); assert(emscripten_run_preload_plugins("screenshot.jpg", ready, NULL) == 0); return 0; }
void ImageServer::emitTestImage() { if(m_v4l2) { VideoFrame f = m_v4l2->readFrame(); if(f.isValid()) m_frame = f; //qglClearColor(Qt::black); //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); QImage image((const uchar*)m_frame.byteArray.constData(),m_frame.size.width(),m_frame.size.height(),QImage::Format_RGB32); //emit testImage(image.scaled(160,120), m_frame.captureTime); emit testImage(image, QTime::currentTime()); //m_frame.captureTime); } else { emit testImage(m_testImage, QTime::currentTime()); } }
int main() { SDL_Init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE); int result = 0; result |= testImage(screen, SCREENSHOT_DIRNAME "/" SCREENSHOT_BASENAME); // absolute path assert(result != 0); chdir(SCREENSHOT_DIRNAME); result = testImage(screen, "./" SCREENSHOT_BASENAME); // relative path assert(result != 0); SDL_Flip(screen); printf("you should see an image.\n"); SDL_Quit(); REPORT_RESULT(); return 0; }
void PictureTest::serializeTestInternImage() { KABC::Picture picture1, picture2; picture1.setData( testImage() ); QByteArray data; QDataStream s( &data, QIODevice::WriteOnly ); s << picture1; QDataStream t( &data, QIODevice::ReadOnly ); t >> picture2; QVERIFY( picture1 == picture2 ); }
int main() { SDL_Init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(600, 450, 32, SDL_SWSURFACE); int result = 0; result |= testImage(screen, "screenshot.jpg"); // absolute path assert(result != 0); SDL_Flip(screen); printf("you should see an image.\n"); SDL_Quit(); return 0; }
ImageUploadDialog::ImageUploadDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ImageUploadDialog){ ui->setupUi(this); connect(ui->pushButtonChoose, SIGNAL(clicked()), this, SLOT(selectImage())); connect(ui->pushButtonTest, SIGNAL(clicked()), this, SLOT(testImage())); }
void ready() { testImage(); SDL_Flip(screen); }
void HalftonePreviewView::preview(float gamma, float min, Halftone::DitherType ditherType, bool color) { const color_space kColorSpace = B_RGB32; const float right = Bounds().Width(); const float bottom = Bounds().Height(); BRect rect(0, 0, right, bottom); BBitmap testImage(rect, kColorSpace, true); BBitmap preview(rect, kColorSpace); BView view(rect, "", B_FOLLOW_ALL, B_WILL_DRAW); // create test image testImage.Lock(); testImage.AddChild(&view); // color bars const int height = Bounds().IntegerHeight()+1; const int width = Bounds().IntegerWidth()+1; const int delta = height / 4; const float red_bottom = delta - 1; const float green_bottom = red_bottom + delta; const float blue_bottom = green_bottom + delta; const float gray_bottom = height - 1; for (int x = 0; x <= right; x ++) { uchar value = x * 255 / width; BPoint from(x, 0); BPoint to(x, red_bottom); // red view.SetHighColor(255, value, value); view.StrokeLine(from, to); // green from.y = to.y+1; to.y = green_bottom; view.SetHighColor(value, 255, value); view.StrokeLine(from, to); // blue from.y = to.y+1; to.y = blue_bottom; view.SetHighColor(value, value, 255); view.StrokeLine(from, to); // gray from.y = to.y+1; to.y = gray_bottom; view.SetHighColor(value, value, value); view.StrokeLine(from, to); } view.Sync(); testImage.RemoveChild(&view); testImage.Unlock(); // create preview image Halftone halftone(kColorSpace, gamma, min, ditherType); halftone.setBlackValue(Halftone::kLowValueMeansBlack); const int widthBytes = (width + 7) / 8; // byte boundary uchar* buffer = new uchar[widthBytes]; const uchar* src = (uchar*)testImage.Bits(); uchar* dstRow = (uchar*)preview.Bits(); const int numPlanes = color ? 3 : 1; if (color) { halftone.setPlanes(Halftone::kPlaneRGB1); } for (int y = 0; y < height; y ++) { for (int plane = 0; plane < numPlanes; plane ++) { // halftone the preview image halftone.dither(buffer, src, 0, y, width); // convert the plane(s) to RGB32 ColorRGB32Little* dst = (ColorRGB32Little*)dstRow; const uchar* bitmap = buffer; for (int x = 0; x < width; x ++, dst ++) { const int bit = 7 - (x % 8); const bool isSet = (*bitmap & (1 << bit)) != 0; uchar value = isSet ? 255 : 0; if (color) { switch (plane) { case 0: dst->red = value; break; case 1: dst->green = value; break; case 2: dst->blue = value; break; } } else { dst->red = dst->green = dst->blue = value; } if (bit == 0) { bitmap ++; } } } // next row src += testImage.BytesPerRow(); dstRow += preview.BytesPerRow(); } delete[] buffer; SetViewBitmap(&preview); Invalidate(); }