示例#1
0
	void init(int argc, char* argv[])
	{
		m_qt_app = new QApplication(argc, argv);
		QFile file("editor/stylesheet.qss");
		file.open(QFile::ReadOnly);
		m_qt_app->setStyleSheet(QLatin1String(file.readAll()));

		m_main_window = new RenderTest();
		m_main_window->show();

		HWND hwnd = (HWND)m_main_window->centralWidget()->winId();
		Lumix::Renderer::setInitData(hwnd);
		m_engine = Lumix::Engine::create(NULL, m_allocator);
		Lumix::Pipeline* pipeline_object = static_cast<Lumix::Pipeline*>(
			m_engine->getResourceManager()
				.get(Lumix::ResourceManager::PIPELINE)
				->load(Lumix::Path("pipelines/main.json")));
		ASSERT(pipeline_object);
		if (pipeline_object)
		{
			m_pipeline = Lumix::PipelineInstance::create(
				*pipeline_object, m_engine->getAllocator());
		}

		m_universe_context = &m_engine->createUniverse();
		m_pipeline->setScene((Lumix::RenderScene*)m_universe_context->getScene(
			Lumix::crc32("renderer")));
		m_pipeline->resize(600, 400);

		enumerateTests();
	}
bool TestOptimizations::doTest()
{
	typedef std::deque<unsigned int> TestSet;
	
	StringVector testVector = enumerateTests(getPTXFiles(path),
		getOptimizations(optimizations));
	
	status << " Enumerated " << testVector.size() << " tests\n";
	
	TestSet tests;
	
	for(auto test = testVector.begin(); test != testVector.end(); ++test)
	{
		tests.push_back(std::distance(testVector.begin(), test));
	}
	
	hydrazine::Timer timer;
	timer.start();
	
	unsigned int count = 0;
	
	for(unsigned int i = 0, e = tests.size(); i != e; ++i)
	{
		if(timer.seconds() > timeLimit) break;
		
		unsigned int index = random() % tests.size();
	
		TestSet::iterator testPosition = tests.begin() + index;
	
		std::string test = testVector[*testPosition];
	
		status << " Running test '" << test << "'\n";
	
		if(!runTest(test)) return false;
	
		tests.erase(testPosition);
	
		++count;
	}
	
	status << "Finished running " << count << " tests...\n";
	
	return true;
}