@@ -565,8 +565,18 @@ public void SingleProject_ApplicationId ([Values (false, true)] bool testOnly)
565
565
}
566
566
567
567
[ Test ]
568
- public void AppWithStyleableUsageRuns ( [ Values ( true , false ) ] bool isRelease , [ Values ( true , false ) ] bool linkResources )
568
+ public void AppWithStyleableUsageRuns ( [ Values ( true , false ) ] bool useCLR , [ Values ( true , false ) ] bool isRelease ,
569
+ [ Values ( true , false ) ] bool linkResources , [ Values ( true , false ) ] bool useStringTypeMaps )
569
570
{
571
+ // Not all combinations are valid, ignore those that aren't
572
+ if ( ! useCLR && useStringTypeMaps ) {
573
+ Assert . Ignore ( "String-based typemaps mode is used only in CoreCLR apps" ) ;
574
+ }
575
+
576
+ if ( useCLR && isRelease && useStringTypeMaps ) {
577
+ Assert . Ignore ( "String-based typemaps mode is available only in Debug CoreCLR builds" ) ;
578
+ }
579
+
570
580
var rootPath = Path . Combine ( Root , "temp" , TestName ) ;
571
581
var lib = new XamarinAndroidLibraryProject ( ) {
572
582
ProjectName = "Styleable.Library"
@@ -615,6 +625,7 @@ public MyLibraryLayout (Android.Content.Context context, Android.Util.IAttribute
615
625
proj = new XamarinAndroidApplicationProject ( ) {
616
626
IsRelease = isRelease ,
617
627
} ;
628
+ proj . SetProperty ( "UseMonoRuntime" , useCLR ? "false" : "true" ) ;
618
629
proj . AddReference ( lib ) ;
619
630
620
631
proj . AndroidResources . Add ( new AndroidItem . AndroidResource ( "Resources\\ values\\ styleables.xml" ) {
@@ -652,15 +663,27 @@ public MyLayout (Android.Content.Context context, Android.Util.IAttributeSet att
652
663
}
653
664
" ) ;
654
665
655
- var abis = new string [ ] { "armeabi-v7a" , "arm64-v8a" , "x86" , "x86_64" } ;
666
+ string [ ] abis = useCLR switch {
667
+ true => new string [ ] { "arm64-v8a" , "x86_64" } ,
668
+ false => new string [ ] { "armeabi-v7a" , "arm64-v8a" , "x86" , "x86_64" } ,
669
+ } ;
670
+
656
671
proj . SetAndroidSupportedAbis ( abis ) ;
657
672
var libBuilder = CreateDllBuilder ( Path . Combine ( rootPath , lib . ProjectName ) ) ;
658
673
Assert . IsTrue ( libBuilder . Build ( lib ) , "Library should have built succeeded." ) ;
659
674
builder = CreateApkBuilder ( Path . Combine ( rootPath , proj . ProjectName ) ) ;
660
675
661
-
662
676
Assert . IsTrue ( builder . Install ( proj ) , "Install should have succeeded." ) ;
663
- RunProjectAndAssert ( proj , builder ) ;
677
+
678
+ Dictionary < string , string > ? environmentVariables = null ;
679
+ if ( useCLR && ! isRelease && useStringTypeMaps ) {
680
+ // The variable must have content to enable string-based typemaps
681
+ environmentVariables = new ( StringComparer . Ordinal ) {
682
+ { "CI_TYPEMAP_DEBUG_USE_STRINGS" , "yes" }
683
+ } ;
684
+ }
685
+
686
+ RunProjectAndAssert ( proj , builder , environmentVariables : environmentVariables ) ;
664
687
665
688
var didStart = WaitForActivityToStart ( proj . PackageName , "MainActivity" ,
666
689
Path . Combine ( Root , builder . ProjectDirectory , "startup-logcat.log" ) ) ;
0 commit comments