diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.CustomAttributes | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.CustomAttributes')
4 files changed, 861 insertions, 0 deletions
diff --git a/Xamarin.Forms.CustomAttributes/Properties/AssemblyInfo.cs b/Xamarin.Forms.CustomAttributes/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..ce51278d --- /dev/null +++ b/Xamarin.Forms.CustomAttributes/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Xamarin.Forms.CustomAttributes")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Xamarin.Forms.CustomAttributes")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Xamarin.Forms.CustomAttributes/TestAttributes.cs b/Xamarin.Forms.CustomAttributes/TestAttributes.cs new file mode 100644 index 00000000..7aa9fb04 --- /dev/null +++ b/Xamarin.Forms.CustomAttributes/TestAttributes.cs @@ -0,0 +1,737 @@ +using System; +using System.Diagnostics; + +namespace Xamarin.Forms.CustomAttributes +{ + [Conditional ("DEBUG")] + [AttributeUsage ( + AttributeTargets.Class | + AttributeTargets.Event | + AttributeTargets.Property | + AttributeTargets.Method | + AttributeTargets.Delegate, + AllowMultiple = true + )] + public class PlatformAttribute : Attribute + { + readonly string _platform; + public PlatformAttribute (object platform) + { + _platform = platform.ToString (); + } + + public string Platform => "Issue: " + _platform; + } + + public enum IssueTracker + { + Github, + Bugzilla, + None + } + + public enum NavigationBehavior + { + PushAsync, + PushModalAsync, + SetApplicationRoot, + Default + } + + [Conditional ("DEBUG")] + [AttributeUsage ( + AttributeTargets.Class | + AttributeTargets.Method, + AllowMultiple = true + )] + public class IssueAttribute : Attribute + { + bool _modal; + + public IssueAttribute (IssueTracker issueTracker, int issueNumber, string description, NavigationBehavior navigationBehavior = NavigationBehavior.Default) + { + IssueTracker = issueTracker; + IssueNumber = issueNumber; + Description = description; + PlatformsAffected = PlatformAffected.Default; + NavigationBehavior = navigationBehavior; + } + + public IssueAttribute (IssueTracker issueTracker, int issueNumber, string description, PlatformAffected platformsAffected, NavigationBehavior navigationBehavior = NavigationBehavior.Default) + { + IssueTracker = issueTracker; + IssueNumber = issueNumber; + Description = description; + PlatformsAffected = platformsAffected; + NavigationBehavior = navigationBehavior; + } + + public IssueTracker IssueTracker { get; } + + public int IssueNumber { get; } + + public string Description { get; } + + public PlatformAffected PlatformsAffected { get; } + + public NavigationBehavior NavigationBehavior { get; } + } + + [Conditional ("DEBUG")] + public class UiTestExemptAttribute : Attribute + { + // optional string reason + readonly string _exemptReason; + readonly string _description; + + public UiTestExemptAttribute (ExemptReason exemptReason, string description = null) + { + _exemptReason = Enum.GetName (typeof(ExemptReason), exemptReason); + _description = description; + } + + public string ExemptReason => "Exempt: " + _exemptReason; + + public string Description => "Description: " + _description; + } + + [Conditional ("DEBUG")] + public class UiTestFragileAttribute : Attribute + { + // optional string reason + readonly string _description; + + public UiTestFragileAttribute (string description = null) + { + _description = description; + } + + public string Description => "Description: " + _description; + } + + [Conditional ("DEBUG")] + [AttributeUsage (AttributeTargets.All, AllowMultiple = true)] + public class UiTestBrokenAttribute : Attribute + { + // optional string reason + readonly string _exemptReason; + readonly string _description; + + public UiTestBrokenAttribute (BrokenReason exemptReason, string description = null) + { + _exemptReason = Enum.GetName (typeof(ExemptReason), exemptReason); + _description = description; + } + + public string ExemptReason => "Exempt: " + _exemptReason; + + public string Description => "Description: " + _description; + } + + [Flags] + public enum PlatformAffected + { + iOS = 1 << 0, + Android = 1 << 1, + WinPhone = 1 << 2, + WinRT = 1 << 3, + All = ~0, + Default = 0 + } + + public enum ExemptReason + { + None, + AbstractClass, + IsUnitTested, + NeedsUnitTest, + BaseClass, + TimeConsuming, + CannotTest + } + + public enum BrokenReason + { + UITestBug, + CalabashBug, + CalabashUnsupported, + CalabashiOSUnsupported, + CalabashAndroidUnsupported, + } + + public static class Test + { + public enum Features + { + Binding, + XAML, + Maps + } + + public enum Views + { + Label, + TableView, + SwitchCell, + ViewCell, + Image, + ListView, + ScrollView, + Switch, + Button, + TextCell, + Entry, + SearchBar, + ImageCell, + EntryCell, + Editor, + DatePicker + } + + public enum Layouts + { + StackLayout, + Grid + } + + public enum Pages + { + NavigationPage, + MasterDetailPage, + TabbedPage, + ContentPage, + CarouselPage + } + + public enum Button + { + Clicked, + Command, + Text, + TextColor, + Font, + BorderWidth, + BorderColor, + BorderRadius, + Image, + } + + public enum VisualElement + { + IsEnabled, + Navigation, + InputTransparent, + Layout, + X, + Y, + AnchorX, + AnchorY, + TranslationX, + TranslationY, + Width, + Height, + Bounds, + Rotation, + RotationX, + RotationY, + Scale, + IsVisible, + Opacity, + BackgroundColor, + IsFocused, + Focus, + Unfocus, + Focused, + Unfocused, + Default + } + + public enum Cell + { + Tapped, + Appearing, + Disappearing, + IsEnabled, + RenderHeight, + Height, + ContextActions, + } + + public enum EntryCell + { + Completed, + Text, + Label, + Placeholder, + LabelColor, + Keyboard, + XAlign, + } + + public enum TextCell + { + Command, + Text, + Detail, + TextColor, + DetailColor, + } + + public enum ImageCell + { + ImageSource, + } + + public enum GestureRecognizer + { + Parent, + } + + public enum Binding + { + Path, + Converter, + ConverterParameter, + Create, + } + + public enum TapGestureRecognizer + { + Tapped, + Command, + CommandParameter, + NumberOfTapsRequired, + TappedCallBack, + TappedCallBackParameter + } + + public enum Device + { + OS, + Idiom, + OnPlatform, + OnPlatformGeneric, + OpenUri, + BeginInvokeOnMainThread, + StartTimer, + Styles + } + + public enum ValueChangedEventArgs + { + OldValue, + NewValue, + } + + public enum View + { + GestureRecognizers, + } + + public enum Page + { + BackgroundImage, + ToolbarItems, + IsBusy, + DisplayAlert, + DisplayAlertAccept, + DisplayActionSheet, + Title, + Icon, + Appearing, + Disappearing, + } + + public enum NavigationPage + { + GetBackButtonTitle, + SetBackButtonTitle, + GetHasNavigationBar, + SetHasNavigationBar, + Tint, + BarBackgroundColor, + BarTextColor, + BarGetTitleIcon, + BarSetTitleIcon, + Popped, + PushAsync, + PopAsync, + PopToRootAsync, + } + + public enum MultiPage + { + CurrentPageChanged, + CurrentPagesChanged, + ItemsSource, + ItemTemplate, + SelectedItem, + CurrentPage, + Children, + } + + public enum MenuItem + { + Text, + Command, + IsDestructive, + Icon, + Clicked, + IsEnabled + } + + public enum ToolbarItem + { + Activated, + Name, + Order, + Priority + } + + public enum SwitchCell + { + OnChanged, + On, + Text, + } + + public enum ViewCell + { + View, + } + + public enum ListView + { + ItemAppearing, + ItemDisappearing, + ItemSelected, + ItemTapped, + SelectedItem, + HasUnevenRows, + RowHeight, + GroupHeaderTemplate, + IsGroupingEnabled, + GroupDisplayBinding, + GroupShortNameBinding, + ScrollTo + } + + public enum TableView + { + Root, + Intent, + RowHeight, + HasUnevenRows, + } + + public enum TableSectionBase + { + Title, + } + + public enum Layout + { + IsClippedToBounds, + Padding, + RaiseChild, + LowerChild, + GenericChildren, + } + + public enum AbsoluteLayout + { + Children, + SetLayoutFlags, + SetLayoutBounds, + } + + public enum ActivityIndicator + { + IsRunning, + Color, + } + + public enum ContentView + { + View, + } + + public enum DatePicker + { + DateSelected, + Format, + Date, + MinimumDate, + MaximumDate, + Focus, + IsVisible + } + + public enum InputView + { + Keyboard, + } + + public enum Editor + { + Completed, + TextChanged, + Text, + TextColor, + FontAttributes, + FontFamily, + FontSize + } + + public enum Entry + { + Completed, + TextChanged, + Placeholder, + IsPassword, + Text, + TextColor, + Keyboard, + HorizontalTextAlignmentStart, + HorizontalTextAlignmentCenter, + HorizontalTextAlignmentEnd, + HorizontalTextAlignmentPlaceholderStart, + HorizontalTextAlignmentPlaceholderCenter, + HorizontalTextAlignmentPlaceholderEnd, + FontAttributes, + FontFamily, + FontSize, + PlaceholderColor, + TextDisabledColor, + PlaceholderDisabledColor, + PasswordColor + } + + public enum Frame + { + OutlineColor, + HasShadow + } + + public enum Image + { + Source, + Aspect, + IsOpaque, + IsLoading, + AspectFill, + AspectFit, + Fill + } + + public enum ImageSource + { + FromFile, + FromStream, + FromResource, + FromUri, + Cancel, + } + + public enum UriImageSource + { + Uri, + CachingEnabled, + CacheValidity, + } + + public enum Keyboard + { + Create, + Default, + Email, + Text, + Url, + Numeric, + Telephone, + Chat, + } + + public enum Label + { + TextColor, + Text, + FormattedText, + FontAttibutesBold, + FontAttributesItalic, + FontNamedSizeMicro, + FontNamedSizeSmall, + FontNamedSizeMedium, + FontNamedSizeLarge, + LineBreakModeNoWrap, + LineBreakModeWordWrap, + LineBreakModeCharacterWrap, + LineBreakModeHeadTruncation, + LineBreakModeTailTruncation, + LineBreakModeMiddleTruncation, + HorizontalTextAlignmentStart, + HorizontalTextAlignmentCenter, + HorizontalTextAlignmentEnd, + VerticalTextAlignmentStart, + VerticalTextAlignmentCenter, + VerticalTextAlignmentEnd, + } + + public enum MasterDetailPage { + Master, + Detail, + IsGestureEnabled, + IsPresented, + MasterBehavior + } + + public enum OpenGlView { + OnDisplay, + HasRenderLoop, + Display + } + + public enum ProgressBar { + Progress + } + + public enum RelativeLayout { + Children, + SetBoundsConstraint + } + + public enum ScrollView { + ContentSize, + Orientation, + Content + } + + public enum SearchBar + { + SearchButtonPressed, + TextChanged, + SearchCommand, + Text, + PlaceHolder, + CancelButtonColor, + FontAttributes, + FontFamily, + FontSize, + TextAlignmentStart, + TextAlignmentCenter, + TextAlignmentEnd, + PlaceholderAlignmentStart, + PlaceholderAlignmentCenter, + PlaceholderAlignmentEnd, + TextColor, + PlaceholderColor + } + + public enum Slider { + Minimum, + Maximum, + Value + } + + public enum StackLayout { + Orientation, + Spacing + } + + public enum Stepper { + Maximum, + Minimum, + Value, + Increment + } + + public enum Switch { + IsToggled + } + + public enum TimePicker { + Format, + Time, + Focus + } + + public enum WebView { + UrlWebViewSource, + HtmlWebViewSource, + LoadHtml + } + + public enum UrlWebViewSource { + Url + } + + public enum HtmlWebViewSource { + BaseUrl, + Html + } + + public enum Grid { + Children, + SetRow, + SetRowSpan, + SetColumn, + SetColumnSpan, + RowSpacing, + ColumnSpacing, + ColumnDefinitions, + RowDefinitions + } + + public enum ContentPage { + Content + } + + public enum Picker { + Title, + Items, + SelectedIndex, + Focus + } + + public enum FileImageSource { + File, + Cancel + } + + public enum StreamImageSource { + Stream + } + + public enum OnPlatform { + WinPhone, + Android, + iOS + } + + public enum OnIdiom { + Phone, + Tablet + } + + public enum Span { + Text, + ForeGroundColor, + BackgroundColor, + Font, + PropertyChanged + } + + public enum FormattedString { + ToStringOverride, + Spans, + PropertyChanged + } + + public enum BoxView + { + Color + } + + } +} + diff --git a/Xamarin.Forms.CustomAttributes/UiTestAttribute.cs b/Xamarin.Forms.CustomAttributes/UiTestAttribute.cs new file mode 100644 index 00000000..0eef90eb --- /dev/null +++ b/Xamarin.Forms.CustomAttributes/UiTestAttribute.cs @@ -0,0 +1,33 @@ +using System; +using System.Diagnostics; + +namespace Xamarin.Forms.CustomAttributes +{ + [Conditional ("DEBUG")] + [AttributeUsage ( + AttributeTargets.Class | + AttributeTargets.Event | + AttributeTargets.Property | + AttributeTargets.Method | + AttributeTargets.Delegate, + AllowMultiple = true + )] + public class UiTestAttribute : Attribute + { + public UiTestAttribute (Type formsType) + { + Type = formsType; + MemberName = ""; + } + + public UiTestAttribute (Type formsType, string memberName) + { + Type = formsType; + MemberName = memberName; + } + + public Type Type { get; } + + public string MemberName { get; } + } +} diff --git a/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj b/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj new file mode 100644 index 00000000..229f3029 --- /dev/null +++ b/Xamarin.Forms.CustomAttributes/Xamarin.Forms.CustomAttributes.csproj @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{4DCD0420-1168-4B77-86DB-6196EE4BD491}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Xamarin.Forms.CustomAttributes</RootNamespace> + <AssemblyName>Xamarin.Forms.CustomAttributes</AssemblyName> + <DefaultLanguage>en-US</DefaultLanguage> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TargetFrameworkProfile>Profile259</TargetFrameworkProfile> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\Turkey\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>AnyCPU</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemGroup> + <!-- A reference to the entire .NET Framework is automatically included --> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="TestAttributes.cs" /> + <Compile Include="UiTestAttribute.cs" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file |