Skip to content

Commit

Permalink
[Tests] Fix Designer Tests to use ` AndroidSdkResolver.GetMaxInstalle…
Browse files Browse the repository at this point in the history
…dPlatform ()` (#8488)

Our designer tests were not using ` AndroidSdkResolver.GetMaxInstalledPlatform ()`.
As a result if the `android-27` platform was NOT installed the unit
tests would fail. Lets update the system to use the helper method to
find the latest installed platform and use that.
  • Loading branch information
dellis1972 authored Nov 7, 2023
1 parent 8928f11 commit c663ee1
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ GenerateResourceDesigner CreateTask (string path)
};
task.CaseMapFile = Path.Combine (Root, path, "case_map.txt");
task.IsApplication = true;
task.JavaPlatformJarPath = Path.Combine (AndroidSdkDirectory, "platforms", "android-27", "android.jar");
int platform = AndroidSdkResolver.GetMaxInstalledPlatform ();
task.JavaPlatformJarPath = Path.Combine (AndroidSdkDirectory, "platforms", $"android-{platform}", "android.jar");
return task;
}

Expand Down Expand Up @@ -496,7 +497,8 @@ public void UpdateLayoutIdIsIncludedInDesigner ([Values(true, false)] bool useRt
task.CaseMapFile = Path.Combine (Root, path, "case_map.txt");
File.WriteAllText (task.ResourceFlagFile, string.Empty);
task.IsApplication = true;
task.JavaPlatformJarPath = Path.Combine (AndroidSdkDirectory, "platforms", "android-27", "android.jar");
int platform = AndroidSdkResolver.GetMaxInstalledPlatform ();
task.JavaPlatformJarPath = Path.Combine (AndroidSdkDirectory, "platforms", $"android-{platform}", "android.jar");
Assert.IsTrue (task.Execute (), "Task should have executed successfully.");
Assert.IsTrue (File.Exists (task.NetResgenOutputFile), $"{task.NetResgenOutputFile} should have been created.");
var expected = Path.Combine (ExpectedOutputDir, "GenerateDesignerFileExpected.cs");
Expand Down Expand Up @@ -811,7 +813,8 @@ int styleable ElevenAttributes_attr09 9
task.ResourceDirectory = Path.Combine (Root, path, "res");
task.Resources = new TaskItem [] {};
task.IsApplication = true;
task.JavaPlatformJarPath = Path.Combine (AndroidSdkDirectory, "platforms", "android-27", "android.jar");
int platform = AndroidSdkResolver.GetMaxInstalledPlatform ();
task.JavaPlatformJarPath = Path.Combine (AndroidSdkDirectory, "platforms", $"android-{platform}", "android.jar");
Assert.IsTrue (task.Execute (), "Task should have executed successfully.");
Assert.IsTrue (File.Exists (task.NetResgenOutputFile), $"{task.NetResgenOutputFile} should have been created.");
var expected = Path.Combine (ExpectedOutputDir, "GenerateDesignerFileWithElevenStyleableAttributesExpected.cs");
Expand Down

0 comments on commit c663ee1

Please sign in to comment.