void TestQgsCoordinateTransform::isShortCircuited()
{
  QgsCoordinateTransform tr;
  //invalid transform shortcircuits
  QVERIFY( tr.isShortCircuited() );

  QgsCoordinateReferenceSystem srs1;
  srs1.createFromSrid( 3994 );
  QgsCoordinateReferenceSystem srs2;
  srs2.createFromSrid( 4326 );

  // valid source, invalid destination
  QgsCoordinateTransform tr2( srs1, QgsCoordinateReferenceSystem() );
  QVERIFY( tr2.isShortCircuited() );

  // invalid source, valid destination
  QgsCoordinateTransform tr3( QgsCoordinateReferenceSystem(), srs2 );
  QVERIFY( tr3.isShortCircuited() );

  // equal, valid source and destination
  QgsCoordinateTransform tr4( srs1, srs1 );
  QVERIFY( tr4.isShortCircuited() );

  // valid but different source and destination
  QgsCoordinateTransform tr5( srs1, srs2 );
  QVERIFY( !tr5.isShortCircuited() );

  // try to short circuit by changing dest
  tr5.setDestinationCrs( srs1 );
  QVERIFY( tr5.isShortCircuited() );
}
void TestQgsCoordinateTransform::isValid()
{
  QgsCoordinateTransform tr;
  QVERIFY( !tr.isValid() );

  QgsCoordinateReferenceSystem srs1;
  srs1.createFromSrid( 3994 );
  QgsCoordinateReferenceSystem srs2;
  srs2.createFromSrid( 4326 );

  // valid source, invalid destination
  QgsCoordinateTransform tr2( srs1, QgsCoordinateReferenceSystem() );
  QVERIFY( !tr2.isValid() );

  // invalid source, valid destination
  QgsCoordinateTransform tr3( QgsCoordinateReferenceSystem(), srs2 );
  QVERIFY( !tr3.isValid() );

  // valid source, valid destination
  QgsCoordinateTransform tr4( srs1, srs2 );
  QVERIFY( tr4.isValid() );

  // try to invalidate by setting source as invalid
  tr4.setSourceCrs( QgsCoordinateReferenceSystem() );
  QVERIFY( !tr4.isValid() );

  QgsCoordinateTransform tr5( srs1, srs2 );
  // try to invalidate by setting destination as invalid
  tr5.setDestinationCrs( QgsCoordinateReferenceSystem() );
  QVERIFY( !tr5.isValid() );
}
Example #3
0
void test_SHARC2() {
	SumOfSines vox1(196), vox2(196), vox3(196), vox4(196), vox5(196);
	SHARC_Library * lib;
	SHARC_Spectrum * sp1, * sp2, * sp3, * sp4, * sp5;
	lib = new SHARC_Library("../../../Code/sharc");
							// access a spectrum, load it into a SumOfSines, and scale it by a triangle envelope
	sp1 = lib->spectrum_named("altoflute_vibrato", "g3");	
	vox1.add_partials(csl_min(sp1->_num_partials, 20), sp1->_partials);
	vox1.create_cache();			// cache the waveform (since it's a harmonic overtone spectrum)
	Triangle tr1(3, 0.75); 			
	vox1.set_scale(tr1);
							// repeat for 3 other delayed examples
	sp2 = lib->spectrum_named("bass_clarinet", "g3");	
	vox2.add_partials(csl_min(sp2->_num_partials, 20), sp2->_partials);
	vox2.create_cache();			// cache the waveform
	Triangle tr2(3, 0.75); 		
	vox2.set_scale(tr2);
	sp3 = lib->spectrum_named("cello_vibrato", "g3");	
	vox3.add_partials(csl_min(sp3->_num_partials, 20), sp3->_partials);
	vox3.create_cache();			// cache the waveform
	Triangle tr3(3, 0.75); 		
	vox3.set_scale(tr3);
	sp4 = lib->spectrum_named("trombone", "g3");	
	vox4.add_partials(csl_min(sp4->_num_partials, 20), sp4->_partials);
	vox4.create_cache();			// cache the waveform
	Triangle tr4(3, 0.75); 		
	vox4.set_scale(tr4);
	sp5 = lib->spectrum_named("violin_martele", "g3");	
	vox5.add_partials(csl_min(sp4->_num_partials, 20), sp4->_partials);
	vox5.create_cache();			// cache the waveform
	Triangle tr5(3, 0.75); 		
	vox5.set_scale(tr5);

	Mixer mix(2);		// create a stereo mixer
	mix.add_input(vox1);	mix.add_input(vox2); 	
	mix.add_input(vox3); 	mix.add_input(vox4); 	mix.add_input(vox5);
	
	logMsg("playing SumOfSines mix...");	// I don't use run_test() here because I need to trigger the envelopes while it's playing	
	gIO->set_root(mix);			// turn it on
	tr1.trigger();				// trigger the 1st envelope
	usleep(1500000);			// wait 1.5 sec
	tr2.trigger();				// trigger the 2nd envelope
	usleep(1500000);			// wait 1.5 sec
	tr3.trigger();				// trigger the 3rd envelope
	usleep(1500000);			// wait 1.5 sec
	tr4.trigger();				// trigger the 4th envelope
	usleep(1500000);			// wait 1.5 sec
	tr5.trigger();				// trigger the 5th envelope
	usleep(3000000);			// wait 3 seconds
	gIO->clear_root();			// turn it off
	logMsg("SumOfSines done.");
}
Example #4
0
void loop() {	stateChanged=false;
int pn1=random(0,11);
switch (pn1) {
	case 0:
		//None
		tr2();
		break;
	case 1:
		//None
		tr3();
		break;
	case 2:
		//None
		tr4();
		break;
	case 3:
		//None
		tr5();
		break;
	case 4:
		//None
		tr7();
		break;
	case 5:
		//wait 1 milli
		tr8();
		break;
	case 6:
		//None
		tr9();
		break;
	case 7:
		//None
		tr10();
		break;
	case 8:
		//None
		tr11();
		break;
	case 9:
		//None
		tr6();
		break;
	case 10:
		//None
		tr12();
		break;
	}
if (stateChanged){
	outputStatusLine();}
}
Example #5
0
void
sce_recv_complete(
		  scsit_handle_t	handle,
		  void *		opaque,
		  char *		buffer,
		  unsigned int		count,
		  scsit_return_t	sr)
{
	ipc_kmsg_t new_kmsg = (ipc_kmsg_t)opaque;
	sce_softc_t ssc = *((sce_softc_t *)(&net_kmsg(new_kmsg)->header[0]));
	TR_DECL("sce_recv_complete");

	tr5("enter 0x%x 0x%x 0x%x 0x%x", handle, opaque, buffer, count);
	if (sce_prime(ssc, new_kmsg))
	    scerecv(ssc, new_kmsg, count);
}
Example #6
0
void CTTypes::RunTestCaseL(TInt aCurTestCase)
	{
	switch(aCurTestCase)
		{
	case 1:
		{
		__UHEAP_MARK;
		TestRgb tr1(0,0,0, this);
		TestRgb tr2(100,100,100, this);
		TestRgb tr3(10,20,30, this);
		TestRgb tr4(110,160,210, this);
		TestRgb tr5(255,255,255, this);
		INFO_PRINTF1(_L("TRgb"));
		tr1.Test();
		tr2.Test();
		tr3.Test();
		tr4.Test();
		tr5.Test();
		((CTTypesStep*)iStep)->CloseTMSGraphicsStep();
		__UHEAP_MARKEND;
		}
		break;
	case 2:
		{
		INFO_PRINTF1(_L("TTypeface"));
		TestTypeface ttf1(_L(""), 0, this);
		TestTypeface ttf2(_L("Font name"), 1, this);
		TestTypeface ttf3(_L("Font name"), 2, this);
		TestTypeface ttf4(_L("Font name"), 3, this);
		TestTypeface ttf5(_L("Font name"), 4, this);
		TestTypeface ttf6(_L("Font name"), 5, this);
		TestTypeface ttf7(_L("Font name"), 6, this);
		TestTypeface ttf8(_L("Another font name"), 7, this);
		ttf1.Test();
		ttf2.Test();
		ttf3.Test();
		ttf4.Test();
		ttf5.Test();
		ttf6.Test();
		ttf7.Test();
		ttf8.Test();
		}
		break;
	case 3:
		{
		TestMargins tm1(0,0,0,0, this);
		TestMargins tm2(10,20,30,40, this);
		TestMargins tm3(-10,-20,-30,-40, this);
		INFO_PRINTF1(_L("TMargins"));
		tm1.Test();
		tm2.Test();
		tm3.Test();
		}
		break;
	case 4:
		{
		TestPageSpec tps1(TPageSpec::EPortrait,TSize(0,0), this);
		TestPageSpec tps2(TPageSpec::ELandscape,TSize(0,0), this);
		TestPageSpec tps3(TPageSpec::EPortrait,TSize(10,-5), this);
		TestPageSpec tps4(TPageSpec::ELandscape,TSize(15,-20), this);
		TestPageSpec tps5(TPageSpec::EPortrait,TSize(1000,1500), this);
		TestPageSpec tps6(TPageSpec::ELandscape,TSize(2000,500), this);
		INFO_PRINTF1(_L("TPageSpec"));
		tps1.Test();
		tps2.Test();
		tps3.Test();
		tps4.Test();
		tps5.Test();
		tps6.Test();
		}
		break;
	case 5:
		{
		INFO_PRINTF1(_L("FontEffect"));
        	((CTTypesStep*)iStep)->SetTestStepID(_L("GRAPHICS-GDI-0002"));
		TestFontEffect te(this); 
		((CTTypesStep*)iStep)->RecordTestResultL();
		te.Test();
		}
		break;
	case 6:
		{
		INFO_PRINTF1(_L("TFontSyle"));
		TestTFontStyle ts(this);
		ts.Test();
		}
		break;
	case 7:
		{
		TTypeface typeface;
		typeface.iName=_L("Font name");
		TFontStyle fontstyle;
		TestFontSpec tfspec(typeface,200,fontstyle, this);
		INFO_PRINTF1(_L("TFontSpec"));
		tfspec.Test();
		}
		break;
	case 8:
		{
/*
		TestLine tl1(TPoint(10,10),TPoint(90,90), this);
		TestLine tl2(TPoint(100,150),TPoint(50,-50), this);
		TestLine tl3(TPoint(-50,50),TPoint(60,-40), this);
		TestLine tl4(TPoint(-100,0),TPoint(0,200), this);
		TestLine tl5(TPoint(150,-50),TPoint(50,75), this);
		TestLine tl6(TPoint(0,-100),TPoint(-50,-150), this);
		TestLine tl7(TPoint(-1000,-1000),TPoint(1000,1000), this);
		TestLine tl8(TPoint(1000,-1000),TPoint(-1000,1000), this);
		TestLine tl9(TPoint(500,-1000),TPoint(-500,1000), this);
		TestLine tl10(TPoint(-500,-1000),TPoint(500,1000), this);
		TestLine tl11(TPoint(1000,-500),TPoint(-1000,500), this);
		TestLine tl12(TPoint(1000,500),TPoint(-1000,-500), this);
		INFO_PRINTF1(_L("TLinearDDA"));
		tl1.Test();
		tl2.Test();
		tl3.Test();
		tl4.Test();
		tl5.Test();
		tl6.Test();
		tl7.Test();
		tl8.Test();
		tl9.Test();
		tl10.Test();
		tl11.Test();
		tl12.Test();
*/
		INFO_PRINTF1(_L("TLinearDDA is only for Graphics team. Removed."));
		}
		break;
	case 9:
		{
		INFO_PRINTF1(_L("CTypefaceStore"));
		TestTFStore ttfs(this);
		ttfs.Test();
		}
		break;
	case 10:
		{
		INFO_PRINTF1(_L("CFontCache"));
		TestFontCache tfc(this);
		tfc.Test();
		}
		break;
	case 11:
		{
/*
		INFO_PRINTF1(_L("CScaleCropPicture"));
		TestPicture tp(this);
		tp.Test();
*/
		INFO_PRINTF1(_L("CScaleCropPicture is only for Graphics team. Removed."));
		}
		break;
	case 12:
		{
/*
		INFO_PRINTF1(_L("CPalette"));
		TestPalette tpal(this);
		tpal.Test();
*/
		INFO_PRINTF1(_L("CPalette is only for Graphics team. Removed."));
		}
		break;
	case 13:
		{
		INFO_PRINTF1(_L("TDisplayModeUtils"));
		TestDisplayModeUtils tdmu(this);
		tdmu.Test();
		}
		break;
	case 14:
        	((CTTypesStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-GDI-0001"));
		((CTTypesStep*)iStep)->RecordTestResultL();
		((CTTypesStep*)iStep)->CloseTMSGraphicsStep();
		TestComplete();		
		break;
		}
	}