Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Link check with lychee (non-blocking)
uses: lycheeverse/lychee-action@v2.0.2
uses: lycheeverse/lychee-action@v2.8.0
with:
# Limit concurrency and accept 429 (rate-limited) as non-fatal
args: >-
Expand Down
2 changes: 1 addition & 1 deletion Build/SilVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
=============================================================
-->
<PropertyGroup Label="SIL Ecosystem Versions">
<SilLcmVersion>11.0.0-beta0156</SilLcmVersion>
<SilLcmVersion>11.0.0-beta0158</SilLcmVersion>
<SilLibPalasoVersion>17.0.0</SilLibPalasoVersion>
<SilChorusVersion>6.0.0-beta0063</SilChorusVersion>
<SilMachineVersion>3.7.13</SilMachineVersion>
Expand Down
10 changes: 5 additions & 5 deletions Build/Src/FwBuildTasks/FwBuildTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="18.0.2" />
<PackageReference Include="NUnit" Version="3.13.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="18.3.3" />
<PackageReference Include="NUnit" Version="3.14.0" PrivateAssets="All" />
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" PrivateAssets="All" />
<PackageReference Include="SIL.BuildTasks" Version="3.1.2-beta0012" />
<PackageReference Include="SIL.TestUtilities" Version="12.0.0-*" PrivateAssets="All" />
<PackageReference Include="System.Reflection.Metadata" Version="9.0.0" />
<PackageReference Include="SIL.BuildTasks" Version="3.2.0" />
<PackageReference Include="SIL.TestUtilities" Version="12.0.1" PrivateAssets="All" />
<PackageReference Include="System.Reflection.Metadata" Version="9.0.13" />
<Reference Include="netstandard" />
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="System.IO.Compression" />
Expand Down
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
<ItemGroup Label="Transitive Pins">
<!-- System.Drawing.Common: SIL.LCModel.Core pulls 6.0.0 transitively,
but ParatextData 9.5.x requires >= 9.0.9. Pin to 9.0.9. -->
<PackageVersion Include="System.Drawing.Common" Version="9.0.9" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.13" />
<!-- System.Resources.Extensions: required for non-string resources (images, icons)
in .NET Framework SDK-style projects. -->
<PackageVersion Include="System.Resources.Extensions" Version="9.0.0" />
<PackageVersion Include="System.Resources.Extensions" Version="9.0.13" />
<!-- DependencyModel: icu.net wants 2.0.4, ParatextData wants 9.0.9.
9.0.9 is backward compatible with 2.0.4 API surface. -->
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="9.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="9.0.13" />
<!-- System.Memory: ParatextData requires 4.6.3; other packages want 4.5.0–4.6.0. -->
<PackageVersion Include="System.Memory" Version="4.6.3" />
<!-- Microsoft.Bcl.HashCode: System.Resources.Extensions 9.0.0 requires HashCode. -->
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
<!-- System.Security.Permissions (LT-22394): ProDotNetZip needs >= 8.0.0,
System.Security.AccessControl needs >= 6.0.0. Pin to 9.0.9. -->
<PackageVersion Include="System.Security.Permissions" Version="9.0.9" />
<PackageVersion Include="System.Security.Permissions" Version="9.0.13" />
</ItemGroup>

<!--
Expand Down Expand Up @@ -148,9 +148,9 @@
-->
<ItemGroup Label="Test Infrastructure">
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit" Version="3.14.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="NUnitForms" Version="1.3.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
</ItemGroup>
</Project>
26 changes: 26 additions & 0 deletions Obj/FwBuildTasks/FwBuildTasks.csproj.nuget.g.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/dependabot/dependabot-updater/repo/packages</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/dependabot/dependabot-updater/repo/packages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/dependabot/dependabot-updater/repo/packages/" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)/nunit/3.14.0/build/NUnit.props" Condition="Exists('$(NuGetPackageRoot)/nunit/3.14.0/build/NUnit.props')" />
<Import Project="$(NuGetPackageRoot)/sil.buildtasks/3.2.0/build/SIL.BuildTasks.props" Condition="Exists('$(NuGetPackageRoot)/sil.buildtasks/3.2.0/build/SIL.BuildTasks.props')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.props" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.props')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.props')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.extensions.telemetry/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.extensions.telemetry/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Extensions.Telemetry.props')" />
<Import Project="$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.props" Condition="Exists('$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgSIL_BuildTasks Condition=" '$(PkgSIL_BuildTasks)' == '' ">/home/dependabot/dependabot-updater/repo/packages/sil.buildtasks/3.2.0</PkgSIL_BuildTasks>
</PropertyGroup>
</Project>
11 changes: 11 additions & 0 deletions Obj/FwBuildTasks/FwBuildTasks.csproj.nuget.g.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)/system.text.json/9.0.11/buildTransitive/net462/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)/system.text.json/9.0.11/buildTransitive/net462/System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)/system.resources.extensions/9.0.0/buildTransitive/net462/System.Resources.Extensions.targets" Condition="Exists('$(NuGetPackageRoot)/system.resources.extensions/9.0.0/buildTransitive/net462/System.Resources.Extensions.targets')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.targets" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.targets')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.targets')" />
<Import Project="$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.targets" Condition="Exists('$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.targets')" />
<Import Project="$(NuGetPackageRoot)/microsoft.netframework.referenceassemblies.net48/1.0.3/build/Microsoft.NETFramework.ReferenceAssemblies.net48.targets" Condition="Exists('$(NuGetPackageRoot)/microsoft.netframework.referenceassemblies.net48/1.0.3/build/Microsoft.NETFramework.ReferenceAssemblies.net48.targets')" />
</ImportGroup>
</Project>
101 changes: 101 additions & 0 deletions Src/views/Test/TestVwTextBoxes.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,45 @@ namespace TestViews
IPicturePtr m_qPicture;
};

// View constructor that displays a single string inside a concordance paragraph.
// The keyword region (ichMin..ichLim) is aligned at dmpAlign.
// If textAlign is set to ktalRight, the paragraph gets right alignment so that
// DoSpecialAlignment uses the right edge of the keyword for positioning.
class ConcParaVc : public DummyBaseVc
{
public:
int m_ichMinItem;
int m_ichLimItem;
int m_dmpAlign;
int m_textAlign; // ktalLeft or ktalRight

ConcParaVc(int ichMin, int ichLim, int dmpAlign, int textAlign)
: m_ichMinItem(ichMin), m_ichLimItem(ichLim),
m_dmpAlign(dmpAlign), m_textAlign(textAlign)
{
}

STDMETHOD(Display)(IVwEnv * pvwenv, HVO hvo, int frag)
{
pvwenv->put_IntProperty(ktptAlign, ktpvEnum, m_textAlign);
pvwenv->OpenConcPara(m_ichMinItem, m_ichLimItem,
(VwConcParaOpts)kcpoDefault, m_dmpAlign);
pvwenv->AddStringProp(kflidStTxtPara_Contents, NULL);
pvwenv->CloseParagraph();
return S_OK;
}
STDMETHOD(EstimateHeight)(HVO hvo, int frag, int dxAvailWidth, int * pdyHeight)
{
*pdyHeight = 20;
return S_OK;
}
STDMETHOD(LoadDataFor)(IVwEnv * pvwenv, HVO * prghvo, int chvo, HVO hvoParent,
int tag, int frag, int ihvoMin)
{
return S_OK;
}
};

class TestVwParagraphBox : public unitpp::suite
{
// Maximum number of previous strings to add before testing strings
Expand Down Expand Up @@ -1207,6 +1246,68 @@ namespace TestViews
}
}

// Helper: lay out a single concordance paragraph and return the Left() of its first child box.
// The paragraph contains the given string with keyword at ichMin..ichLim aligned at dmpAlign.
int LayoutConcParaAndGetFirstBoxLeft(const OLECHAR * pszText, int cch,
int ichMin, int ichLim, int dmpAlign, int textAlign)
{
HVO hvoPara = 1;
ITsStringPtr qtss;
CheckHr(m_qtsf->MakeStringRgch(pszText, cch, g_wsEng, &qtss));
CheckHr(m_qcda->CacheStringProp(hvoPara, kflidStTxtPara_Contents, qtss));

IVwViewConstructorPtr qvc;
qvc.Attach(NewObj ConcParaVc(ichMin, ichLim, dmpAlign, textAlign));
m_qrootb->SetRootObject(hvoPara, qvc, 1, NULL);
HRESULT hr = m_qrootb->Layout(m_qvg32, 300);
unitpp::assert_true("ConcPara layout succeeded", hr == S_OK);

VwParagraphBox * ppbox = dynamic_cast<VwParagraphBox *>(m_qrootb->FirstBox());
unitpp::assert_true("Root contains a paragraph box", ppbox != NULL);
VwBox * pFirstChild = ppbox->FirstBox();
unitpp::assert_true("Paragraph has a child box", pFirstChild != NULL);

int result = pFirstChild->Left();

// Clean up so we can reuse the root box
m_qrootb->Close();
VwRootBox::CreateCom(NULL, IID_IVwRootBox, (void **) &m_qrootb);
m_qrootb->putref_DataAccess(m_qsda);
m_qrootb->putref_RenderEngineFactory(m_qref);
m_qrootb->putref_TsStrFactory(m_qtsf);
m_qrootb->SetSite(m_qdrs);

return result;
}

// Tests that DoSpecialAlignment uses the right edge of the keyword
// when the paragraph alignment is ktalRight, and the left edge when
// the alignment is ktalLeft. These should produce different box positions
// because the keyword has nonzero width.
void testConcParaAlignment_RightVsLeftEdge()
{
// Use a string where the keyword ("keyword") is in the middle.
// "Before keyword after end" - keyword at positions 7..14
const OLECHAR text[] = L"Before keyword after end";
int cch = (int)wcslen(text);
int ichMin = 7; // start of "keyword"
int ichLim = 14; // end of "keyword"
int dmpAlign = 36000; // 0.5 inch alignment point

int leftWithLeftAlign = LayoutConcParaAndGetFirstBoxLeft(
text, cch, ichMin, ichLim, dmpAlign, ktalLeft);
int leftWithRightAlign = LayoutConcParaAndGetFirstBoxLeft(
text, cch, ichMin, ichLim, dmpAlign, ktalRight);

// With left alignment, the left edge of "keyword" is placed at dmpAlign.
// With right alignment, the right edge of "keyword" is placed at dmpAlign.
// Since the keyword has nonzero width, the first child box should be
// shifted further left in the right-aligned case (by the width of the keyword).
unitpp::assert_true(
"Right-aligned conc para should shift boxes further left than left-aligned",
leftWithRightAlign < leftWithLeftAlign);
}

public:
TestVwParagraphBox();

Expand Down
6 changes: 5 additions & 1 deletion Src/views/VwTextBoxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10055,7 +10055,11 @@ void VwConcParaBox::DoSpecialAlignment(IVwGraphics * pvg)
return; // ignore any problems here, just don't align.
}

int dxsAlign = rgxdLefts[0] + psbox->Left();
int dxsAlign;
if (Style()->ParaAlign() == ktalRight)
dxsAlign = rgxdRights[cxd - 1] + psbox->Left();
else
dxsAlign = rgxdLefts[0] + psbox->Left();
int dxsGoalAlign = MulDiv(m_dmpAlign, dxsInch, kdzmpInch);
int dxsAdjust = dxsGoalAlign - dxsAlign;
// Now adjust all the box lefts by this amount
Expand Down
Loading