void wxExGuiReportTestFixture::testTextFileWithListView() { wxExTool tool(ID_TOOL_REPORT_FIND); wxExFrameWithHistory* frame = (wxExFrameWithHistory *)wxTheApp->GetTopWindow(); const wxExFileName fn(TEST_FILE); wxExListViewFileName* report = new wxExListViewFileName( frame, wxExListViewFileName::LIST_FIND); wxExFindReplaceData::Get()->SetFindString("xx"); CPPUNIT_ASSERT(wxExTextFileWithListView::SetupTool(tool, frame, report)); wxExTextFileWithListView textFile(fn, tool); CPPUNIT_ASSERT( textFile.RunTool()); CPPUNIT_ASSERT(!textFile.GetStatistics().GetElements().GetItems().empty()); CPPUNIT_ASSERT(!textFile.IsOpened()); // file should be closed after running tool CPPUNIT_ASSERT( textFile.RunTool()); // do the same test CPPUNIT_ASSERT(!textFile.GetStatistics().GetElements().GetItems().empty()); CPPUNIT_ASSERT(!textFile.IsOpened()); // file should be closed after running tool wxExTextFileWithListView textFile2(fn, tool); CPPUNIT_ASSERT( textFile2.RunTool()); CPPUNIT_ASSERT(!textFile2.GetStatistics().GetElements().GetItems().empty()); }
void fixture::testTextFile() { // Test find. wxExTextFile textFile(GetTestFile(), ID_TOOL_REPORT_FIND); CPPUNIT_ASSERT( textFile.GetFileName() == GetTestFile()); CPPUNIT_ASSERT( textFile.GetTool().GetId() == ID_TOOL_REPORT_FIND); wxExFindReplaceData::Get()->SetFindString("test"); wxExFindReplaceData::Get()->SetMatchCase(true); wxExFindReplaceData::Get()->SetMatchWord(true); wxExFindReplaceData::Get()->SetUseRegEx(false); wxStopWatch sw; sw.Start(); CPPUNIT_ASSERT( textFile.RunTool()); const long elapsed = sw.Time(); CPPUNIT_ASSERT(elapsed < 20); Report(wxString::Format( "wxExTextFile::matching %d items in %ld ms", textFile.GetStatistics().Get(_("Actions Completed")), elapsed).ToStdString()); CPPUNIT_ASSERT(!textFile.GetStatistics().GetElements().GetItems().empty()); CPPUNIT_ASSERT( textFile.GetStatistics().Get(_("Actions Completed")) == 193); // Test replace. wxExTextFile textFile2(GetTestFile(), ID_TOOL_REPORT_REPLACE); wxExFindReplaceData::Get()->SetReplaceString("test"); wxStopWatch sw2; sw2.Start(); CPPUNIT_ASSERT( textFile2.RunTool()); const long elapsed2 = sw2.Time(); CPPUNIT_ASSERT(elapsed2 < 100); Report(wxString::Format( "wxExTextFile::replacing %d items in %ld ms", textFile2.GetStatistics().Get(_("Actions Completed")), elapsed2).ToStdString()); CPPUNIT_ASSERT(!textFile2.GetStatistics().GetElements().GetItems().empty()); CPPUNIT_ASSERT( textFile2.GetStatistics().Get(_("Actions Completed")) == 194); }
void wxExTestFixture::testTextFile() { wxExTextFile textFile(wxExFileName(TEST_FILE), ID_TOOL_REPORT_COUNT); CPPUNIT_ASSERT( textFile.RunTool()); CPPUNIT_ASSERT(!textFile.GetStatistics().GetElements().GetItems().empty()); CPPUNIT_ASSERT(!textFile.IsOpened()); // file should be closed after running tool CPPUNIT_ASSERT( textFile.RunTool()); // do the same test CPPUNIT_ASSERT(!textFile.GetStatistics().GetElements().GetItems().empty()); CPPUNIT_ASSERT(!textFile.IsOpened()); // file should be closed after running tool wxExTextFile textFile2(wxExFileName(TEST_FILE), ID_TOOL_REPORT_KEYWORD); CPPUNIT_ASSERT( textFile2.RunTool()); // we have no lexers, so no keywords CPPUNIT_ASSERT( textFile2.GetStatistics().GetKeywords().GetItems().empty()); }
void ShortLocater::Initializations(){ IPsoc->resetRelays(); IPsoc->srcImpedanceSelection(SRC_IMP_0E); // IPsoc->shLocatorDetection(); m_nADCtimer = new QTimer(this); IBackPlane->writeBackPlaneRegister(0x0FFF,0x001E);//clear all interrupts IBackPlane->writeBackPlaneRegister(0x0000,0x0020);//disable all interrupts IBackPlane->writeBackPlaneRegister(0x0000,0x0024);//disable global interrupt IBackPlane->writeBackPlaneRegister(0x0100,0x0020);//enabling psoc INT0embedded key interrupt) IPTKeyEvent->InvokeGPIOEvent(this,"/dev/input/event2","pt_kpp",&m_nPTKeyCode); IGPIOEvent->InvokeGPIOEvent(this,"/dev/input/event7","gpioevent",&m_nGPIOCode); IBackPlane->writeBackPlaneRegister(0x0001,0x0024); // IBackPlane->writeBackPlaneRegister(); ohms=QChar(0x2126); micro=QChar(0x00B5); //~~~~~~~~~~~~~Reading Short Values from File~~~~~~~~~~~~~~~~~~~~~~ QStringList stringList; bool ok=true; QFile textFile; textFile.setFileName("shortValuesI.txt"); if (textFile.open(QIODevice::ReadOnly)) { QTextStream textStream(&textFile); while (!textStream.atEnd()) { stringList.append(textStream.readLine()); } r200EShortValue=stringList.value(0).toDouble(&ok); qDebug()<<"200E Short Value:"<<r200EShortValue; r2EShortValue=stringList.value(1).toDouble(&ok); qDebug()<<"2E Short Value:"<<r2EShortValue; r200mEShortValue=stringList.value(2).toDouble(&ok); qDebug()<<"200mE Short Value:"<<r200mEShortValue; }else{ r200EShortValue=r200mEShortValue=r2EShortValue=0.0; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~Check for debug panel~~~~~~~~~~~~~~~~~~~~~~~~ QStringList debugPanel; QFile textFile2("debugPanel.txt"); if (textFile2.open(QIODevice::ReadOnly)) { QTextStream textStream(&textFile2); while (!textStream.atEnd()) { debugPanel.append(textStream.readLine()); if(debugPanel.value(0)=="1") ToolBox(true); else ToolBox(false); } }else{ ToolBox(false); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ IDMMLib->ApplyDACOffset(false); dis->setValue("OL"); IBackPlane->writeBackPlaneRegister(0x0,0x16); // Beep(false); AutoFlag=false; on_Auto_clicked(); OffsetFlag=false; BuzzerFlag=false; msgBoxLive=false; ui.progressBar_2->setValue(0); for(int i=0;i<100;i++) avgRetval[i]=0.0; retval=retval2=retval3=0.0; nullify=0.0; nullit=0.0; avg=0; noOFsamples=1; rangePrevValue=33; ui.uE->setText(micro+ohms); on_r200But_clicked(); ui.holdCap->setVisible(false); runFlag=true; startStop(); ui.openShortEnable->setChecked(true); m_nAvgCount=0; movingAverage=5; ui.splashWidget->setVisible(false); usleep(1000); }