Skip to content

Commit

Permalink
Update libpalaso depdencies
Browse files Browse the repository at this point in the history
* This brings in a new version of L10nSharp with API changes
  • Loading branch information
jasonleenaylor committed Nov 26, 2024
1 parent b530168 commit f2f6b3b
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 175 deletions.
18 changes: 18 additions & 0 deletions src/Chorus.Tests/ChorusFixtureSetup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using L10NSharp;
using NUnit.Framework;

namespace Chorus.Tests
{
internal class ChorusFixtureSetup
{
[SetUpFixture]
public class SetupFixture
{
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
LocalizationManager.StrictInitializationMode = false;
}
}
}
}
1 change: 0 additions & 1 deletion src/Chorus.Tests/clone/ClonerTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
Expand Down
4 changes: 2 additions & 2 deletions src/Chorus/Chorus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="SIL.Windows.Forms" Version="12.0.0-*" />
<PackageReference Include="SIL.ReleaseTasks" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="SIL.Windows.Forms" Version="15.0.0-*" />
<PackageReference Include="Vulcan.Uczniowie.HelpProvider" Version="1.0.16" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Chorus/ChorusSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public static void SetUpLocalization(string desiredUiLangId,
var versionObj = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// We don't need to reload strings for every "revision" (that might be every time we build).
var version = "" + versionObj.Major + "." + versionObj.Minor + "." + versionObj.Build;
LocalizationManager.Create(TranslationMemory.XLiff, desiredUiLangId, "Chorus",
LocalizationManager.Create(desiredUiLangId, "Chorus",
Application.ProductName, version, directoryOfInstalledXlfFiles,
directoryOfUserModifiedXlfFiles,
Icon.FromHandle(Properties.Resources.chorus32x32.GetHicon()), // should call DestroyIcon, but when?
"[email protected]", "Chorus");
"[email protected]", new [] {"Chorus"});
}

[Obsolete("Only one kind of TranslationMemory is supported: XLF; there is no need for the kind parameter.")]
Expand Down
4 changes: 2 additions & 2 deletions src/ChorusHub/ChorusHub.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="SIL.BuildTasks" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="SIL.ReleaseTasks" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="SIL.BuildTasks" Version="3.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/ChorusHubApp/ChorusHubApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="SIL.Windows.Forms" Version="12.0.0-*" />
<PackageReference Include="SIL.ReleaseTasks" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="SIL.Windows.Forms" Version="15.0.0-*" />
<PackageReference Include="Vulcan.Uczniowie.HelpProvider" Version="1.0.16" />
</ItemGroup>

Expand Down
15 changes: 15 additions & 0 deletions src/ChorusHubTests/ChorusHubFixtureSetup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using L10NSharp;
using NUnit.Framework;

namespace ChorusHubTests
{
[SetUpFixture]
public class ChorusHubFixtureSetup
{
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
LocalizationManager.StrictInitializationMode = false;
}
}
}
2 changes: 1 addition & 1 deletion src/ChorusMerge.Tests/ChorusMerge.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.2"/>
<PackageReference Include="SIL.TestUtilities" Version="12.0.0-*" />
<PackageReference Include="SIL.TestUtilities" Version="15.0.0-*" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/ChorusMerge.Tests/ChorusMergeFixtureSetup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using L10NSharp;
using NUnit.Framework;

namespace ChorusMerge.Tests
{
[SetUpFixture]
public class ChorusMergeFixtureSetup
{
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
LocalizationManager.StrictInitializationMode = false;
}
}
}
6 changes: 3 additions & 3 deletions src/LibChorus.TestUtilities/LibChorus.TestUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="SIL.Core" Version="12.0.0-*" />
<PackageReference Include="SIL.ReleaseTasks" Version="2.5.0" PrivateAssets="All" />
<PackageReference Include="SIL.TestUtilities" Version="12.0.0-*" />
<PackageReference Include="SIL.Core" Version="15.0.0-*" />
<PackageReference Include="SIL.ReleaseTasks" Version="3.0.0" PrivateAssets="All" />
<PackageReference Include="SIL.TestUtilities" Version="15.0.0-*" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/LibChorusTests/LibChorus.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.2"/>
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="SIL.Core" Version="12.0.0-*" />
<PackageReference Include="SIL.TestUtilities" Version="12.0.0-*" />
<PackageReference Include="SIL.WritingSystems.Tests" Version="12.0.0-*" />
<PackageReference Include="SIL.Core" Version="15.0.0-*" />
<PackageReference Include="SIL.TestUtilities" Version="15.0.0-*" />
<PackageReference Include="SIL.WritingSystems.Tests" Version="15.0.0-*" />
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
</ItemGroup>

Expand Down
11 changes: 11 additions & 0 deletions src/LibChorusTests/MiscTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using L10NSharp;
using LibChorus.TestUtilities;
using NUnit.Framework;

Expand All @@ -18,4 +19,14 @@ public void AllSettingsUseCrossPlatformProvider()
}
}
}

[SetUpFixture]
public class SetupFixture
{
[OneTimeSetUp]
public void RunBeforeAnyTests()
{
LocalizationManager.StrictInitializationMode = false;
}
}
}
160 changes: 1 addition & 159 deletions src/LibChorusTests/merge/xml/lift/MultiTextMergingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using NUnit.Framework;


namespace LiftIO.Tests.Merging
namespace LibChorus.Tests.merge.xml.lift
{
[TestFixture]
public class MultiTextMergingTests
Expand Down Expand Up @@ -84,163 +84,5 @@ public void SkipConvertingElementToTextElementInAnotherFile()
Assert.That(doc.DocumentElement.OuterXml, Does.Not.Contain("<text>myStuff</text>"), "Converted <element> element to <text>, but should not have.");
Assert.That(doc.DocumentElement.OuterXml, Does.Contain("<element name=\"text\">myStuff</element>"), "Element <element> went away, but should have been present.");
}
/*
[Test]
public void MergeMultiTextNodes_OneAddedNewMultiTextElement()
{
string red = @"<lexical-unit/>";
string ancestor = red;
string blue = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
CheckBothWays(red, blue, ancestor, "lexical-unit/form[@lang='one']/text[text()='first']");
}
// private void CheckBothWays(string red, string blue, string ancestor, string xpath)
// {
// XmlNode result= LiftSavvyMergeStrategy.MergeMultiTextPieces(red, blue, ancestor);
// XmlTestHelper.AssertXPathMatchesExactlyOne(result.OuterXml, xpath);
// result= LiftSavvyMergeStrategy.MergeMultiTextPieces(blue, red, ancestor);
// XmlTestHelper.AssertXPathMatchesExactlyOne(result.OuterXml, xpath);
// }
private void CheckBothWays(string red, string blue, string ancestor, params string[] xpaths)
{
CheckOneWay(red, blue, ancestor, xpaths);
CheckOneWay(blue, red, ancestor, xpaths);
}
private void CheckOneWay(string ours, string theirs, string ancestor, params string[] xpaths)
{
XmlNode result = MultiTextMerger.MergeMultiTextPieces(ours, theirs, ancestor);
foreach (string xpath in xpaths)
{
XmlTestHelper.AssertXPathMatchesExactlyOne(result.OuterXml, xpath);
}
}
[Test]
public void MergeMultiTextNodes_EachAddedDifferentAlternatives_GetBoth()
{
string ancestor = @"<lexical-unit>
</lexical-unit>";
string red = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
string blue = @"<lexical-unit>
<form lang='two'>
<text>second</text>
</form>
</lexical-unit>";
CheckBothWays(red, blue, ancestor,
"lexical-unit/form[@lang='one']/text[text()='first']",
"lexical-unit/form[@lang='two']/text[text()='second']");
}
[Test]
public void MergeMultiTextNodes_OneAddedAnAlternatives_GetBoth()
{
string red = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
string ancestor = red;
string blue = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
<form lang='two'>
<text>second</text>
</form>
</lexical-unit>";
CheckBothWays(red, blue, ancestor,
"lexical-unit/form[@lang='one']/text[text()='first']",
"lexical-unit/form[@lang='two']/text[text()='second']");
}
[Test]
public void MergeMultiTextNodes_OnePutSomethingInPreviouslyEmptyForm()
{
string red = @"<lexical-unit>
<form lang='one'/>
</lexical-unit>";
string ancestor = red;
string blue = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
Assert.That(Utilities.AreXmlElementsEqual(red, blue), Is.False);
CheckBothWays(red, blue, ancestor,
"lexical-unit/form[@lang='one']/text[text()='first']");
}
[Test]
public void MergeMultiTextNodes_OnePutSomethingInPreviouslyEmptyFormText()
{
string red = @"<lexical-unit>
<form lang='one'><text/></form>
</lexical-unit>";
string ancestor = red;
string blue = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
CheckBothWays(red, blue, ancestor,
"lexical-unit/form[@lang='one']/text[text()='first']");
}
[Test]
public void WeDeletedAForm_FormRemoved()
{
string red = @"<lexical-unit></lexical-unit>";
string blue = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
string ancestor = blue;
CheckOneWay(blue, red, ancestor, "lexical-unit[ not(form)]");
}
[Test]
public void TheyDeleteAForm_FormRemoved()
{
string red = @"<lexical-unit></lexical-unit>";
string blue = @"<lexical-unit>
<form lang='one'>
<text>first</text>
</form>
</lexical-unit>";
string ancestor = blue;
CheckOneWay(blue, red, ancestor, "lexical-unit[ not(form)]");
}
*/
}
}

0 comments on commit f2f6b3b

Please sign in to comment.