void TestGetSetCompareProperty(CuTest* tc) { TextProperty* pro; char* data; int repeat; // test null pro = createTextProperty(); setTextProperty(pro, NULL); CuAssertPtrEquals(tc, NULL, getTextProperty(pro)); // test empty pro = createTextProperty(); setTextProperty(pro, ""); CuAssertStrEquals(tc, "", getTextProperty(pro)); // test lots of random variations for (repeat=0; repeat<NUM_FAST_TESTS; repeat++) { data = randomString(); pro = createTextProperty(); setTextProperty(pro, data); CuAssertStrEquals(tc, data, getTextProperty(pro)); CuAssertIntEquals(tc, 0, strcmp(getTextProperty(pro), data)); deleteTextProperty(pro); } }
CompString PrivateTextScreen::getWindowName (Window id) { CompString name; name = getUtf8Property (id, visibleNameAtom); if (name.empty ()) name = getUtf8Property (id, wmNameAtom); if (name.empty ()) name = getTextProperty (id, XA_WM_NAME); return name; }
void TestCreateTextProperty(CuTest* tc) { TextProperty* pro = createTextProperty(); CuAssertPtrEquals(tc, NULL, getTextProperty(pro)); deleteTextProperty(pro); }
void ECMAscriptTest::runAllTests() { static const QByteArray include = "$INCLUDE(\""; QFETCH(QString, filename); QByteArray expectedError; QFile input( filename ); foreach ( const QByteArray &skip, skips.keys() ) { if ( skip == QTest::currentDataTag() ) QSKIP( skips[ skip ], SkipSingle ); } QVERIFY( input.open( QIODevice::ReadOnly ) ); const QByteArray testdata = input.readAll(); QVERIFY( ! testdata.isEmpty() ); RefPtr<KJS::Interpreter> interp = new KJS::Interpreter(global); KJS::Interpreter::setShouldPrintExceptions(true); QByteArray testscript; // test is expected to fail if ( testdata.indexOf( "@negative" ) >= 0 ) { expectedError = getTextProperty( "@negative", testdata ); if ( expectedError.isEmpty() ) expectedError = "."; } int from = 0; while ( ( from = testdata.indexOf( include, from ) ) >= 0 ) { int endq = testdata.indexOf( "\"", from + include.length() ); QVERIFY( endq >= 0 ); const QByteArray includeFile = testdata.mid( from + include.length(), endq - from - include.length() ); if ( ! includes.contains( includeFile ) ) QVERIFY( loadInclude( includeFile ) ); testscript += includes[ includeFile ]; from = endq; } testscript += testrunner; testscript += testdata; const QFileInfo info( input ); const QString scriptutf = QString::fromUtf8( testscript.constData() ); KJS::Completion completion = interp->evaluate(info.fileName().toAscii().constData(), 0, scriptutf); const bool knownBroken = expectedBroken.contains( QString::fromAscii( QTest::currentDataTag() ) ); if ( expectedError.isEmpty() ) { ECMATEST_VERIFY( completion.complType() != KJS::Throw ); } else { if ( knownBroken && completion.complType() != KJS::Throw ) { QEXPECT_FAIL(QTest::currentDataTag(), "It is known that KJS doesn't pass this test", Abort); m_failed++; } QCOMPARE( completion.complType(), KJS::Throw ); QVERIFY( completion.value() != NULL ); const QString eMsg = exceptionToString( interp->execState(), completion.value() ); if ( expectedError == "^((?!NotEarlyError).)*$" ) { ECMATEST_VERIFY( eMsg.indexOf( "NotEarlyError" ) == -1 ); } else if ( expectedError == "." ) { // means "every exception passes } else { ECMATEST_VERIFY( eMsg.indexOf( expectedError ) >= 0 ); } } }
char *getNucleotidesProperty(const NucleotidesProperty *pro) { if (pro) return getTextProperty(pro->nucleotides); else return NULL; }
char* getURIProperty(const URIProperty* pro) { if (pro) return (char *)getTextProperty(pro->uri); else return NULL; }
char* getSBOLCompoundObjectDescription(const SBOLCompoundObject* obj) { if (obj) return getTextProperty(obj->description); else return NULL; }
char* getSBOLCompoundObjectName(const SBOLCompoundObject* obj) { if (obj) return getTextProperty(obj->name); else return NULL; }
char* getSBOLCompoundObjectDisplayID(const SBOLCompoundObject* obj) { if (obj) return getTextProperty(obj->displayID); else return NULL; }