Skip to content

Commit

Permalink
Failing tests and examples for issue #20
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-j-engdahl committed Oct 2, 2018
1 parent 326e94e commit c18a4a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions NGettext.Wpf.Example/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:enumTranslation="clr-namespace:NGettext.Wpf.EnumTranslation;assembly=NGettext.Wpf"
xmlns:system="clr-namespace:System;assembly=mscorlib"

SizeToContent="Height"
Title="{Binding ElementName=Window, Path=Header}"
mc:Ignorable="d" Height="400" Width="525" x:Name="Window">
mc:Ignorable="d" Width="525" x:Name="Window">
<Window.Resources>
<!-- The following ensures all enum values are translated when displayed -->
<enumTranslation:LocalizeEnumConverter x:Key="LocalizeEnumConverter" />
Expand Down Expand Up @@ -65,6 +65,7 @@
<!--<TextBlock Text="{wpf:Gettext 'Enclosing single-quotes (\') are optional'}" HorizontalAlignment="Center" />-->
<TextBlock Text="{wpf:Gettext 'Enclosing single-quotes (apostrophes) are optional.'}" HorizontalAlignment="Center" />
<TextBlock Text="{wpf:Gettext Unenclosed escaped single-quotes (\') are supported.}" HorizontalAlignment="Center" />
<TextBlock Text="{wpf:Gettext Unicode™ in msgIds is supported}" HorizontalAlignment="Center" />
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" Margin="40">
<Button Content="{wpf:Gettext Run TrackCurrentCultureBehavior memory leak test}" Width="340"
Click="OpenMemoryLeakTestWindow" Margin="15,4,15,4" />
Expand Down
14 changes: 12 additions & 2 deletions XGetText.Xaml/XGetText-Xaml.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Describe "XGetText-Xaml" {
<TextBlock Text="{wpf:Gettext Quotes are optional}"/>
<TextBlock Text="{wpf:Gettext ''Quotes are optional''}"/>
<TextBlock Text="{wpf:Gettext Escaped single-quotes (\'') are supported.}"/>
<TextBlock Text="{wpf:Gettext Unicode™ in msgIds is supported.}" />
</StackPanel>
</Grid>
</Window>'
Expand All @@ -50,13 +51,13 @@ Describe "XGetText-Xaml" {
}

It "Does not ignore casing of msgids when joining" {
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o TestDrive:\Output.pot
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o $TestDrive\Output.pot
"TestDrive:\Output.pot" | Should -FileContentMatchExactly "^msgid ""German""$"
"TestDrive:\Output.pot" | Should -FileContentMatchExactly "^msgid ""german""$"
}

It "Writes output to specified file" {
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o TestDrive:\Output.pot
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o $TestDrive\Output.pot
'TestDrive:\Output.pot' | Should -FileContentMatchMultiline '#, fuzzy\nmsgid ""\nmsgstr ""'
}

Expand All @@ -68,4 +69,13 @@ Describe "XGetText-Xaml" {
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o - | Should -Match ([regex]::Escape("msgid ""Escaped single-quotes (') are supported."""))
}

It "Supports unicode in msgIds when writing to stdout" {
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o - | Should -Match ([regex]::Escape("msgid ""Unicode™ in msgIds is supported."""))
}

It "Supports unicode in msgIds when writing to .pot" {
XGetText-Xaml TestDrive:\TestFile.xaml -k Gettext -o $TestDrive\Output.pot
'TestDrive:\Output.pot' | Should -FileContentMatchExactly "msgid ""Unicode™ in msgIds is supported."""
}

}

0 comments on commit c18a4a7

Please sign in to comment.