This commit is contained in:
Stephane Delcroix 2018-11-26 08:50:46 +01:00
Родитель 9d9140eeb6 7ae81e375c
Коммит 27e0b8e01c
8 изменённых файлов: 67 добавлений и 13 удалений

Просмотреть файл

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 4138, "[iOS] NavigationPage.TitleIcon no longer centered",
PlatformAffected.iOS)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Navigation)]
#endif
public class Issue4138 : TestNavigationPage
{
protected override void Init()
{
ContentPage contentPage = new ContentPage();
NavigationPage.SetTitleIcon(contentPage, "coffee.png");
PushAsync(contentPage);
}
#if UITEST && __IOS__
[Test]
public void TitleIconIsCentered()
{
var element = RunningApp.WaitForElement("coffee.png")[0];
var rect = RunningApp.RootViewRect();
Assert.AreEqual(element.Rect.CenterX, rect.CenterX);
}
#endif
}
}

Просмотреть файл

@ -850,6 +850,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Controls\ContactsPage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\FailImageSource.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Controls\ICacheService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue4138.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla22229.xaml">
@ -1057,4 +1058,4 @@
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>
</Project>

Просмотреть файл

@ -50,7 +50,7 @@
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="2.2.6" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseViewContainerRemoteAndroid.cs" />
@ -91,4 +91,4 @@
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -55,7 +55,7 @@
<PackageReference Include="Selenium.Support" Version="3.14.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.14.0" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="2.2.6" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@ -97,4 +97,4 @@
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -50,7 +50,7 @@
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="NUnit" Version="2.6.4" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="2.2.6" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
</ItemGroup>
<ItemGroup>
<Compile Include="BaseViewContainerRemoteiOS.cs" />
@ -95,4 +95,4 @@
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -53,7 +53,7 @@
<PackageReference Include="ServiceStack.Interfaces" Version="4.5.12" />
<PackageReference Include="ServiceStack.Text" Version="4.5.12" />
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.UITest" Version="2.2.6" />
<PackageReference Include="Xamarin.UITest" Version="2.2.7" />
<PackageReference Include="Xamarin.UITest.Desktop" Version="0.0.7" />
</ItemGroup>
<ItemGroup>
@ -90,4 +90,4 @@
</ItemGroup>
<Copy SourceFiles="@(_XamarinUITestFiles)" DestinationFolder="$(SolutionDir)packages\Xamarin.UITest.AnyVersion\%(RecursiveDir)" ContinueOnError="true" Retries="0" />
</Target>
</Project>
</Project>

Просмотреть файл

@ -172,10 +172,15 @@ namespace Xamarin.Forms.Platform.Android
UpdateInputTransparent();
UpdatePadding();
ElementChanged?.Invoke(this, new VisualElementChangedEventArgs(oldElement, ImageButton));
OnElementChanged(new ElementChangedEventArgs<ImageButton>(oldElement, ImageButton));
ImageButton?.SendViewInitialized(Control);
}
protected virtual void OnElementChanged(ElementChangedEventArgs<ImageButton> e)
{
ElementChanged?.Invoke(this, new VisualElementChangedEventArgs(e.OldElement, e.NewElement));
}
public override void Draw(Canvas canvas)
{
if (ImageButton == null)
@ -258,8 +263,7 @@ namespace Xamarin.Forms.Platform.Android
_inputTransparent = ImageButton.InputTransparent;
}
// Image related
void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
protected virtual void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == VisualElement.InputTransparentProperty.PropertyName)
UpdateInputTransparent();

Просмотреть файл

@ -1470,10 +1470,14 @@ namespace Xamarin.Forms.Platform.iOS
if (_child?.Element != null)
{
var layoutBounds = new Rectangle(IconWidth, 0, Bounds.Width - IconWidth, height);
Rectangle layoutBounds = new Rectangle(IconWidth, 0, Bounds.Width - IconWidth, height);
if (_child.Element.Bounds != layoutBounds)
Layout.LayoutChildIntoBoundingRegion(_child.Element, layoutBounds);
}
else if(_icon != null && Superview != null)
{
_icon.Center = new PointF(Superview.Frame.Width / 2 - Frame.X, Superview.Frame.Height / 2);
}
}
protected override void Dispose(bool disposing)