Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dev/rolf/codeql-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Feb 11, 2025
2 parents 1e2ec22 + e438c22 commit 0c02e28
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/rsp/dotnet/macos-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-d:HAS_COREDATA
-d:HAS_COREFOUNDATION
-d:HAS_COREGRAPHICS
-d:HAS_COREHAPTICS
-d:HAS_COREIMAGE
-d:HAS_CORELOCATION
-d:HAS_COREMEDIA
Expand Down
23 changes: 15 additions & 8 deletions tests/dotnet/UnitTests/ProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ public void BuildBundledResources (string platform, string prefix, bool? bundleO
var project_path = Path.Combine (project_dir, $"{assemblyName}.csproj");

Clean (project_path);
var result = DotNet.AssertBuild (project_path, verbosity);

var properties = GetDefaultProperties ();
if (bundleOriginalResources.HasValue)
properties ["BundleOriginalResources"] = bundleOriginalResources.Value ? "true" : "false";
var result = DotNet.AssertBuild (project_path, properties);
var lines = BinLog.PrintToLines (result.BinLogPath);
// Find the resulting binding assembly from the build log
var assemblies = FilterToAssembly (lines, assemblyName);
Expand All @@ -263,14 +267,17 @@ public void BuildBundledResources (string platform, string prefix, bool? bundleO
var asm = assemblies.First ();
Assert.That (asm, Does.Exist, "Assembly existence");

// Verify that there's one resource in the binding assembly, and its name
// Verify the resource count in the binding assembly, and their names
var ad = AssemblyDefinition.ReadAssembly (asm, new ReaderParameters { ReadingMode = ReadingMode.Deferred });
Assert.That (ad.MainModule.Resources.Count, Is.EqualTo (3), "3 resources");
// Sort the resources before we assert, since we don't care about the order, and sorted order makes the asserts simpler.
var resources = ad.MainModule.Resources.OrderBy (v => v.Name).ToArray ();
Assert.That (resources [0].Name, Is.EqualTo ($"__{prefix}_content_basn3p08__with__loc.png"), $"__{prefix}_content_basn3p08__with__loc.png");
Assert.That (resources [1].Name, Is.EqualTo ($"__{prefix}_content_basn3p08.png"), $"__{prefix}_content_basn3p08.png");
Assert.That (resources [2].Name, Is.EqualTo ($"__{prefix}_content_xamvideotest.mp4"), $"__{prefix}_content_xamvideotest.mp4");
var resources = ad.MainModule.Resources.Select (v => v.Name).ToArray ();
var expectedResources = new string [] {
"basn3p08.png",
"basn3p08__with__loc.png",
"xamvideotest.mp4",
};
var oldPrefixed = expectedResources.Select (v => $"__{prefix}_content_{v}").ToArray ();
var newPrefixed = expectedResources.Select (v => $"__{prefix}_item_BundleResource_{v}").ToArray ();
Assert.That (resources, Is.EquivalentTo (oldPrefixed).Or.EquivalentTo (newPrefixed), "Resources");
}

[TestCase ("iOS")]
Expand Down

0 comments on commit 0c02e28

Please sign in to comment.