TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsArabicThaiHanLatin) { UChar mixedString[] = {0x628, 0x64A, 0x629, 0xE20, 0x65E5, 0x62}; TextRun mixed(mixedString, 6); HarfBuzzShaper shaper(&font, mixed); RefPtr<ShapeResult> result = shaper.shapeResult(); ASSERT_EQ(4u, testInfo(result)->numberOfRunsForTesting()); ASSERT_TRUE( testInfo(result)->runInfoForTesting(0, startIndex, numGlyphs, script)); EXPECT_EQ(0u, startIndex); EXPECT_EQ(3u, numGlyphs); EXPECT_EQ(HB_SCRIPT_ARABIC, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(1, startIndex, numGlyphs, script)); EXPECT_EQ(3u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_THAI, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(2, startIndex, numGlyphs, script)); EXPECT_EQ(4u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_HAN, script); ASSERT_TRUE( testInfo(result)->runInfoForTesting(3, startIndex, numGlyphs, script)); EXPECT_EQ(5u, startIndex); EXPECT_EQ(1u, numGlyphs); EXPECT_EQ(HB_SCRIPT_LATIN, script); }
void TestQgsDistanceArea::collections() { //test measuring for collections QgsDistanceArea myDa; myDa.setSourceAuthId( "EPSG:4030" ); myDa.setEllipsoidalMode( true ); myDa.setEllipsoid( "WGS84" ); //collection of lines, should be sum of line length QgsGeometry lines( QgsGeometryFactory::geomFromWkt( "GeometryCollection( LineString(0 36.53, 5.76 -48.16), LineString(0 25.54, 24.20 36.70) )" ) ); double result = myDa.measureLength( &lines ); QGSCOMPARENEAR( result, 12006159, 1 ); result = myDa.measureArea( &lines ); QVERIFY( qgsDoubleNear( result, 0 ) ); //collection of polygons QgsGeometry polys( QgsGeometryFactory::geomFromWkt( "GeometryCollection( Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ); result = myDa.measureArea( &polys ); QGSCOMPARENEAR( result, 670434859475LL, 1 ); result = myDa.measureLength( &polys ); QVERIFY( qgsDoubleNear( result, 0 ) ); //mixed collection QgsGeometry mixed( QgsGeometryFactory::geomFromWkt( "GeometryCollection( LineString(0 36.53, 5.76 -48.16), LineString(0 25.54, 24.20 36.70), Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ); //measure area specifically result = myDa.measureArea( &mixed ); QGSCOMPARENEAR( result, 670434859475LL, 1 ); //measure length result = myDa.measureLength( &mixed ); QGSCOMPARENEAR( result, 12006159, 1 ); }
int main(){ maxlen(); //sets maxlen to 3 straight(); mixed(); straightRev(); singlecount(); conversion(); return 0; }
void tester::test<12>() { BankSelection mixed(mixed_list); ensure_equals("Has 2 wildcards", mixed.fWildCards.size(), 2u); ensure_equals("Has 8 exact matches", mixed.fMatches.size(), 8u); std::string msg; msg = "Explicit set does Include()s "; for (size_t i =0; i < mixed_list.size(); ++i){ ensure(msg + mixed_list[i].str(),mixed.Includes(mixed_list[i])); } }
EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) { /* Memoization storage. This could be potentially called for each * color merge so a cache is useful (there are few colours anyway) */ static EDA_COLOR_T mix_cache[NBCOLORS][NBCOLORS]; // TODO how is alpha used? it's a mac only thing, I have no idea aColor1 = ColorGetBase( aColor1 ); aColor2 = ColorGetBase( aColor2 ); // First easy thing: a black gives always the other colour if( aColor1 == BLACK ) return aColor2; if( aColor2 == BLACK) return aColor1; /* Now we are sure that black can't occur, so the rule is: * BLACK means not computed yet. If we're lucky we already have * an answer */ EDA_COLOR_T candidate = mix_cache[aColor1][aColor2]; if( candidate != BLACK ) return candidate; // Blend the two colors (i.e. OR the RGB values) const StructColors &c1 = g_ColorRefs[aColor1]; const StructColors &c2 = g_ColorRefs[aColor2]; // Ask the palette for the nearest color to the mix wxColour mixed( c1.m_Red | c2.m_Red, c1.m_Green | c2.m_Green, c1.m_Blue | c2.m_Blue ); candidate = ColorFindNearest( mixed ); /* Here, BLACK is *not* a good answer, since it would recompute the next time. * Even theorically its not possible (with the current rules), but * maybe the metric will change in the future */ if( candidate == BLACK ) candidate = DARKDARKGRAY; // Store the result in the cache. The operation is commutative, too mix_cache[aColor1][aColor2] = candidate; mix_cache[aColor2][aColor1] = candidate; return candidate; }
void shakil::turna() {ne2=0; long int xxx; for(xxx=1;xxx<=11;xxx++) { result=0; if(xxx==1) easy(); if(xxx>1) {n=xxx; get();} mixed(); if(ne2==10) break; } }
void shakil::easy() { n=5; x=400/n;y=400/n;c12=80/n; for(i=0;i<n;i++) {p=50+i*y;q=50; for(j=0;j<n;j++) {xp1[i][j]=q+j*x; xp2[i][j]=q+(j+1)*x-c12; yp1[i][j]=p; yp2[i][j]=p+y-c12; vm[i][j]=5; }} vm[0][0]=0;result=0;res1[0][0]=0; res1[0][1]=1;res1[0][2]=2;res1[0][3]=3;res1[0][4]=4; res1[1][0]=6;res1[1][1]=7;res1[1][2]=8;res1[1][3]=9;res1[1][4]=5; res1[2][0]=11;res1[2][1]=12;res1[2][2]=13;res1[2][3]=14;res1[2][4]=10; res1[3][0]=16;res1[3][1]=17;res1[3][2]=18;res1[3][3]=19;res1[3][4]=15; res1[4][0]=21;res1[4][1]=22;res1[4][2]=23;res1[4][3]=24;res1[4][4]=20; mixed(); }
int main (int argc, char **argv) { char *locale; tests_start_mpfr (); #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) /* currently, we just check with 'C' locale */ locale = setlocale (LC_ALL, "C"); #endif bug20111102 (); native_types (); hexadecimal (); binary (); decimal (); mixed (); check_emax (); check_emin (); #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) #if MPFR_LCONV_DPTS locale_da_DK (); /* Avoid a warning by doing the setlocale outside of this #if */ #endif setlocale (LC_ALL, locale); #endif if (getenv ("MPFR_CHECK_LIBC_PRINTF")) { /* check against libc */ random_double (); bug20081214 (); bug20080610 (); } tests_end_mpfr (); return 0; }
void shakil::get() { hidemouseptr(); cleardevice(); showmouseptr(); x=400/n;y=400/n; c12=80/n; for(i=0;i<n;i++) {p=50+i*y;q=50; for(j=0;j<n;j++) {xp1[i][j]=q+(j*x); xp2[i][j]=q+((j+1)*x)-c12; yp1[i][j]=p; yp2[i][j]=p+y-c12;}} p=n*n; for(i=0;i<p-1;i++) { do {ra[i]=rand()%(p-1); ra[i]=ra[i]+1;q=0; for(j=i-1;j>=0;j--) if(ra[j]==ra[i]) {q=5;break;} }while(q!=0); } k=-1; for(i=0;i<n;i++) {for(j=0;j<n;j++) {if(i!=0||j!=0) {k=k+1; res1[i][j]=ra[k]; vm[i][j]=5; }}} vm[0][0]=0; res1[i][j]=0; result=0; mixed(); }
void shakil::save2() { long int pp[5],cc=0,i1,nm=0,pp1[5]={0}; FILE *p11,*p22,*p33,*p44,*p1; p11=fopen("sav11","r"); fscanf(p11,"%ld",&pp[0]); if(pp[0]==1) fscanf(p11,"%ld",&pp1[0]); fclose(p11); p22=fopen("sav22","r"); fscanf(p22,"%ld",&pp[1]); if(pp[1]==1) fscanf(p22,"%ld",&pp1[1]); fclose(p22); p33=fopen("sav33","r"); fscanf(p33,"%ld",&pp[2]); if(pp[2]==1) fscanf(p33,"%ld",&pp1[2]); fclose(p33); p44=fopen("sav44","r"); fscanf(p44,"%ld",&pp[3]); if(pp[3]==1) fscanf(p44,"%ld",&pp1[3]); fclose(p44); pp[4]=5; settextstyle(1,0,1); for(i=1;i<=5;i++) {setcolor(123); rectangle(470,270+i*20+4,580,290+i*20); setfillstyle(SOLID_FILL,123); floodfill(477,270+i*20+6,123); setcolor(RED); if(pp[i-1]==0) outtextxy(473,270+i*20,"EMPTY"); if(pp[i-1]==1) outtextxy(473,270+i*20,"FULL"); if(pp[i-1]==5) outtextxy(473,270+i*20,"EXIT"); if(pp1[i-1]!=0) { setcolor(RED); switch(pp1[i-1]) {case 2:outtextxy(518,270+i*20,"(2:2)"); break; case 3:outtextxy(518,270+i*20,"(3:3)"); break; case 4:outtextxy(518,270+i*20,"(4:4)"); break; case 5:outtextxy(518,270+i*20,"(5:5)"); break; case 6:outtextxy(518,270+i*20,"(6:6)"); break; case 7:outtextxy(518,270+i*20,"(7:7)"); break; case 8:outtextxy(518,270+i*20,"(8:8)"); break; case 9:outtextxy(518,270+i*20,"(9:9)"); break; case 10:outtextxy(518,270+i*20,"(10:10)"); break; case 11:outtextxy(518,270+i*20,"(11:11)"); break; } } } while(1) {getmousepos(&button,&x,&y); if((button & 1)==1) {if(x>=470&&x<=580) for(i1=1;i1<=5;i1++) {tm=270+i1*20+4;tm1=290+i1*20; if(y>tm&&y<tm1) { switch(i1) {case 1: if(pp[i1-1]==1) {p1=fopen("sav11","r"); fscanf(p1,"%ld %ld",&m,&n); for(i=0;i<n;i++) for(j=0;j<n;j++) fscanf(p1," %ld %ld",&res1[i][j],&vm[i][j]); fclose(p1); x=400/n;y=400/n; c12=80/n; for(i=0;i<n;i++) {p=50+i*y;q=50; for(j=0;j<n;j++) {xp1[i][j]=q+(j*x); xp2[i][j]=q+((j+1)*x)-c12; yp1[i][j]=p; yp2[i][j]=p+y-c12;}} } break; case 2: if(pp[i1-1]==1) {p1=fopen("sav22","r"); fscanf(p1,"%ld %ld",&m,&n); for(i=0;i<n;i++) for(j=0;j<n;j++) fscanf(p1," %ld %ld",&res1[i][j],&vm[i][j]); fclose(p1); x=400/n;y=400/n; c12=80/n; for(i=0;i<n;i++) {p=50+i*y;q=50; for(j=0;j<n;j++) {xp1[i][j]=q+(j*x); xp2[i][j]=q+((j+1)*x)-c12; yp1[i][j]=p; yp2[i][j]=p+y-c12;}} } break; case 3: if(pp[i1-1]==1) {p1=fopen("sav33","r"); fscanf(p1,"%ld %ld",&m,&n); for(i=0;i<n;i++) for(j=0;j<n;j++) fscanf(p1," %ld %ld",&res1[i][j],&vm[i][j]); fclose(p1); x=400/n;y=400/n; c12=80/n; for(i=0;i<n;i++) {p=50+i*y;q=50; for(j=0;j<n;j++) {xp1[i][j]=q+(j*x); xp2[i][j]=q+((j+1)*x)-c12; yp1[i][j]=p; yp2[i][j]=p+y-c12;}}} break; case 4: if(pp[i1-1]==1) {p1=fopen("sav44","r"); fscanf(p1,"%ld %ld",&m,&n); for(i=0;i<n;i++) for(j=0;j<n;j++) fscanf(p1," %ld %ld",&res1[i][j],&vm[i][j]); fclose(p1); x=400/n;y=400/n; c12=80/n; for(i=0;i<n;i++) {p=50+i*y;q=50; for(j=0;j<n;j++) {xp1[i][j]=q+(j*x); xp2[i][j]=q+((j+1)*x)-c12; yp1[i][j]=p; yp2[i][j]=p+y-c12;}}} break; case 5:nm=5; break; } cc=5; break; }} } if(cc==5) break; } hidemouseptr(); cleardevice(); showmouseptr(); if(nm==0) mixed(); }