public override ColorAnimation Create(DeterministicRandom random) { ColorAnimation colorAnimation = new ColorAnimation(); /* * Randomly combinate From, To, By */ if (random.NextBool()) { colorAnimation.By = ByValue; } if (random.NextBool()) { colorAnimation.From = FromValue; } if (random.NextBool()) { colorAnimation.To = ToValue; } colorAnimation.IsAdditive = random.NextBool(); colorAnimation.IsCumulative = random.NextBool(); ApplyTimelineProperties(colorAnimation, random); return(colorAnimation); }
public override ThicknessAnimation Create(DeterministicRandom random) { ThicknessAnimation thicknessAnimation = new ThicknessAnimation(); if (random.NextBool()) { thicknessAnimation.From = FromValue; } if (random.NextBool()) { thicknessAnimation.To = ToValue; } if (random.NextBool()) { thicknessAnimation.By = ByValue; } thicknessAnimation.IsAdditive = IsAdditive; thicknessAnimation.IsCumulative = IsCumulative; thicknessAnimation.EasingFunction = EasingFunction; ApplyTimelineProperties(thicknessAnimation, random); return(thicknessAnimation); }
public override DecimalAnimation Create(DeterministicRandom random) { DecimalAnimation decimalAnimation = new DecimalAnimation(); if (random.NextBool()) { decimalAnimation.From = FromValue; } if (random.NextBool()) { decimalAnimation.To = ToValue; } if (random.NextBool()) { decimalAnimation.By = ByValue; } decimalAnimation.IsAdditive = IsAdditive; decimalAnimation.IsCumulative = IsCumulative; decimalAnimation.EasingFunction = EasingFunction; ApplyTimelineProperties(decimalAnimation, random); return(decimalAnimation); }
/// <summary/> /// <param name="random"/> /// <returns>Return a new ByteAnimation</returns> public override ByteAnimation Create(DeterministicRandom random) { ByteAnimation byteAnimation = new ByteAnimation(); byteAnimation.IsAdditive = IsAdditive; byteAnimation.IsCumulative = IsCumulative; byteAnimation.EasingFunction = EasingFunction; if (random.NextBool()) { byteAnimation.From = FromValue; } if (random.NextBool()) { byteAnimation.To = ToValue; } if (random.NextBool()) { byteAnimation.By = ByValue; } ApplyTimelineProperties(byteAnimation, random); return(byteAnimation); }
public override PointAnimation Create(DeterministicRandom random) { PointAnimation pointAnimation = new PointAnimation(); if (random.NextBool()) { pointAnimation.From = FromValue; } if (random.NextBool()) { pointAnimation.To = ToValue; } if (random.NextBool()) { pointAnimation.By = ByValue; } pointAnimation.IsAdditive = IsAdditive; pointAnimation.IsCumulative = IsCumulative; pointAnimation.EasingFunction = EasingFunction; ApplyTimelineProperties(pointAnimation, random); return(pointAnimation); }
private void SetChildrenLayout(GridType grid, DeterministicRandom random) { int childrenCount = grid.Children.Count; //Add more rows and columns to make sure they are enough to set children layout. for (int i = 0; i < childrenCount; i++) { grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.RowDefinitions.Add(new RowDefinition()); } //Set children layout foreach (UIElement item in grid.Children) { int startRow = random.Next() % grid.RowDefinitions.Count; int startColumn = random.Next() % grid.ColumnDefinitions.Count; Grid.SetColumn(item, startColumn); Grid.SetRow(item, startRow); if (random.NextBool()) { int spanColumn = random.Next() % (grid.ColumnDefinitions.Count - startColumn) + 1; Grid.SetColumnSpan(item, spanColumn); } if (random.NextBool()) { int spanRow = random.Next() % (grid.RowDefinitions.Count - startRow) + 1; Grid.SetRowSpan(item, spanRow); } } }
public override Vector3DAnimation Create(DeterministicRandom random) { Vector3DAnimation vector3DAnimation = new Vector3DAnimation(); /* * Randomly combinate From, To, By */ if (random.NextBool()) { vector3DAnimation.By = ByValue; } if (random.NextBool()) { vector3DAnimation.From = FromValue; } if (random.NextBool()) { vector3DAnimation.To = ToValue; } vector3DAnimation.IsAdditive = random.NextBool(); vector3DAnimation.IsCumulative = random.NextBool(); ApplyTimelineProperties(vector3DAnimation, random); return(vector3DAnimation); }
public override QuaternionAnimation Create(DeterministicRandom random) { QuaternionAnimation quaternionAnimation = new QuaternionAnimation(); if (random.NextBool()) { quaternionAnimation.From = FromValue; } if (random.NextBool()) { quaternionAnimation.To = ToValue; } if (random.NextBool()) { quaternionAnimation.By = ByValue; } quaternionAnimation.IsAdditive = IsAdditive; quaternionAnimation.IsCumulative = IsCumulative; quaternionAnimation.EasingFunction = EasingFunction; quaternionAnimation.UseShortestPath = UseShortestPath; ApplyTimelineProperties(quaternionAnimation, random); return(quaternionAnimation); }
public override SizeAnimation Create(DeterministicRandom random) { SizeAnimation sizeAnimation = new SizeAnimation(); if (random.NextBool()) { sizeAnimation.From = FromValue; } if (random.NextBool()) { sizeAnimation.To = ToValue; } if (random.NextBool()) { sizeAnimation.By = ByValue; } sizeAnimation.IsAdditive = IsAdditive; sizeAnimation.EasingFunction = EasingFunction; if (FromValue.Height > ToValue.Height || FromValue.Width > ToValue.Width) { sizeAnimation.IsCumulative = false; } else { sizeAnimation.IsCumulative = IsCumulative; } ApplyTimelineProperties(sizeAnimation, random); return(sizeAnimation); }
/// <summary> /// Apply common VirtualizingStackPanel properties. /// </summary> /// <param name="panel"/> /// <param name="random"/> protected void ApplyVirtualizingStackPanelProperties(PanelType panel, DeterministicRandom random) { ApplyCommonProperties(panel, random); panel.CanHorizontallyScroll = random.NextBool(); panel.CanVerticallyScroll = random.NextBool(); panel.Orientation = random.NextEnum <Orientation>(); panel.ScrollOwner = ScrollOwner; }
public override LineSegment Create(DeterministicRandom random) { LineSegment segment = new LineSegment(); segment.Point = Point; segment.IsStroked = random.NextBool(); segment.IsSmoothJoin = random.NextBool(); return(segment); }
public override ArcSegment Create(DeterministicRandom random) { ArcSegment segment = new ArcSegment(); segment.IsLargeArc = random.NextBool(); segment.RotationAngle = random.NextDouble() * 360; segment.IsSmoothJoin = random.NextBool(); segment.SweepDirection = random.NextEnum <SweepDirection>(); return(segment); }
public override QuadraticBezierSegment Create(DeterministicRandom random) { QuadraticBezierSegment segment = new QuadraticBezierSegment(); segment.Point1 = Point1; segment.Point2 = Point2; segment.IsStroked = random.NextBool(); segment.IsSmoothJoin = random.NextBool(); return(segment); }
/// <summary> /// Create a DataGridCell. /// </summary> /// <param name="random"></param> /// <returns></returns> public override DataGridCell Create(DeterministicRandom random) { DataGridCell dataGridCell = new DataGridCell(); ApplyContentControlProperties(dataGridCell); dataGridCell.IsEditing = random.NextBool(); dataGridCell.IsSelected = random.NextBool(); return(dataGridCell); }
public override ComboBox Create(DeterministicRandom random) { ComboBox comboBox = new ComboBox(); ApplySelectorProperties(comboBox, random); comboBox.IsDropDownOpen = random.NextBool(); comboBox.IsEditable = random.NextBool(); comboBox.MaxDropDownHeight = MaxDropDownHeight; comboBox.StaysOpenOnEdit = random.NextBool(); comboBox.Text = Text; return(comboBox); }
public override FlowDocumentReader Create(DeterministicRandom random) { FlowDocumentReader flowDocumentReader = new FlowDocumentReader(); flowDocumentReader.MinZoom = MinZoom; flowDocumentReader.MaxZoom = MinZoom * 50; flowDocumentReader.IsFindEnabled = random.NextBool(); flowDocumentReader.IsPrintEnabled = random.NextBool(); flowDocumentReader.ViewingMode = random.NextEnum <FlowDocumentReaderViewingMode>(); flowDocumentReader.Document = FlowDocument; return(flowDocumentReader); }
public override FlowDocumentScrollViewer Create(DeterministicRandom random) { FlowDocumentScrollViewer flowDocumentScrollViewer = new FlowDocumentScrollViewer(); flowDocumentScrollViewer.MinZoom = MinZoom; flowDocumentScrollViewer.MaxZoom = MinZoom * 50; flowDocumentScrollViewer.IsSelectionEnabled = random.NextBool(); flowDocumentScrollViewer.IsToolBarVisible = random.NextBool(); flowDocumentScrollViewer.HorizontalScrollBarVisibility = random.NextEnum <ScrollBarVisibility>(); flowDocumentScrollViewer.VerticalScrollBarVisibility = random.NextEnum <ScrollBarVisibility>(); flowDocumentScrollViewer.Document = FlowDocument; return(flowDocumentScrollViewer); }
public override PolyQuadraticBezierSegment Create(DeterministicRandom random) { PolyQuadraticBezierSegment segment = new PolyQuadraticBezierSegment(); PointCollection Points = new PointCollection(); Points.Add(Point1); Points.Add(Point2); segment.Points = Points; segment.IsStroked = random.NextBool(); segment.IsSmoothJoin = random.NextBool(); return(segment); }
public override Slider Create(DeterministicRandom random) { Slider slider = new Slider(); ApplyRangeBaseProperties(slider, random); slider.Orientation = random.NextEnum <Orientation>(); slider.AutoToolTipPlacement = random.NextEnum <AutoToolTipPlacement>(); slider.AutoToolTipPrecision = AutoToolTipPrecision; slider.IsDirectionReversed = random.NextBool(); slider.IsSelectionRangeEnabled = random.NextBool(); slider.IsSnapToTickEnabled = random.NextBool(); slider.TickPlacement = random.NextEnum <TickPlacement>(); return(slider); }
public override BitmapPalette Create(DeterministicRandom random) { if (Colors == null) { Colors = new List <Color>(); } if (random.NextBool()) { for (int i = 1; i <= random.Next(256) + 1; i++) { Colors.Add(Color.FromScRgb( (float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble())); } } else { for (int i = 1; i <= random.Next(256) + 1; i++) { Colors.Add(random.NextStaticProperty <Colors, Color>()); } } return(new BitmapPalette(Colors)); }
/// <summary> /// Apply common ListBoxItem properties. /// </summary> /// <param name="listBoxItem"></param> /// <param name="random"></param> protected void ApplyListBoxItemProperties(T listBoxItem, DeterministicRandom random) { ApplyContentControlProperties(listBoxItem); listBoxItem.IsSelected = random.NextBool(); listBoxItem.Selected += new RoutedEventHandler(OnSelected); listBoxItem.Unselected += new RoutedEventHandler(OnUnselected); }
public override MediaElement Create(DeterministicRandom random) { MediaElement mediaElement = new MediaElement(); mediaElement.Source = Uri; mediaElement.Volume = random.NextDouble(); mediaElement.ScrubbingEnabled = random.NextBool(); if (IsControledWithClock && Timeline != null) { mediaElement.Clock = Timeline.CreateClock(); } else { mediaElement.Source = Uri; } //Events mediaElement.BufferingEnded += new System.Windows.RoutedEventHandler(BufferingEnded); mediaElement.BufferingStarted += new System.Windows.RoutedEventHandler(BufferingStarted); mediaElement.MediaOpened += new System.Windows.RoutedEventHandler(MediaOpened); mediaElement.MediaFailed += new EventHandler <System.Windows.ExceptionRoutedEventArgs>(MediaFailed); mediaElement.MediaEnded += new System.Windows.RoutedEventHandler(MediaEnded); return(mediaElement); }
/// <summary> /// The constructor which randomly selects FlowDirection, TextAlignment, /// firstLineInParagraph, alwaysCollapsible, and TextWrapping. /// </summary> public override CustomTextParagraphProperties Create(DeterministicRandom random) { FlowDirection flowDirection = random.NextEnum <FlowDirection>(); TextAlignment alignment = random.NextEnum <TextAlignment>(); bool firstLineInParagraph = random.NextBool(); bool alwaysCollapsible = random.NextBool(); TextWrapping textWrap = random.NextEnum <TextWrapping>(); double lineHeight = 0; // Set to zero in order to automatically compute the appropriate line height size. double indent = random.NextDouble() * MaxLineIndent * Microsoft.Test.Display.Monitor.Dpi.x; double paragraphIndent = random.NextDouble() * MaxParagraphIndent * Microsoft.Test.Display.Monitor.Dpi.x; CustomTextParagraphProperties customTextParagraphProperties = new CustomTextParagraphProperties(flowDirection, alignment, firstLineInParagraph, alwaysCollapsible, TextRunProperties, textWrap, lineHeight, indent, paragraphIndent); return(customTextParagraphProperties); }
/// <summary> /// Apply common Grid properties. /// </summary> /// <param name="grid"/> /// <param name="random"/> protected void ApplyGridProperties(GridType grid, DeterministicRandom random) { ApplyCommonProperties(grid, random); HomelessTestHelpers.Merge(grid.ColumnDefinitions, ColumnDefinitions); HomelessTestHelpers.Merge(grid.RowDefinitions, RowDefinitions); SetChildrenLayout(grid, random); grid.ShowGridLines = random.NextBool(); }
/// <summary> /// Apply common Selector properties. /// </summary> /// <param name="selector"></param> /// <param name="random"></param> protected void ApplySelectorProperties(T selector, DeterministicRandom random) { ApplyItemsControlProperties(selector, random); selector.IsSynchronizedWithCurrentItem = random.NextBool(); selector.SelectedIndex = random.Next(selector.Items.Count); selector.SelectedItem = SelectedItem; selector.SelectedValue = SelectedValue; }
public override UIElement Create(DeterministicRandom random) { UIElement uIElement = new UIElement(); uIElement.AllowDrop = random.NextBool(); uIElement.ClipToBounds = random.NextBool(); uIElement.Focusable = random.NextBool(); uIElement.IsEnabled = random.NextBool(); uIElement.IsHitTestVisible = random.NextBool(); #if TESTBUILD_CLR40 uIElement.IsManipulationEnabled = random.NextBool(); #endif uIElement.Opacity = random.NextDouble(); uIElement.Visibility = random.NextEnum <Visibility>(); uIElement.Effect = Effect; uIElement.Clip = Geometry; uIElement.Opacity = random.NextDouble(); uIElement.OpacityMask = Brush; uIElement.RenderSize = Size; uIElement.RenderTransform = Transform; uIElement.RenderTransformOrigin = Point; uIElement.SnapsToDevicePixels = random.NextBool(); #if TESTBUILD_CLR40 uIElement.CacheMode = BitmapCache; #endif return(uIElement); }
public override Section Create(DeterministicRandom random) { Section section = new Section(); ApplyBlockProperties(section, random); HomelessTestHelpers.Merge(section.Blocks, Children); section.HasTrailingParagraphBreakOnPaste = random.NextBool(); return(section); }
/// <summary> /// Create a Menu. /// </summary> /// <param name="random"></param> /// <returns></returns> public override Menu Create(DeterministicRandom random) { Menu menu = new Menu(); ApplyItemsControlProperties(menu, random); menu.IsMainMenu = random.NextBool(); return(menu); }
public override DockPanel Create(DeterministicRandom random) { DockPanel dockPanel = new DockPanel(); ApplyCommonProperties(dockPanel, random); SetChildrenLayout(dockPanel, random); dockPanel.LastChildFill = random.NextBool(); return(dockPanel); }
/// <summary> /// Create a DynamicRenderer. /// </summary> /// <param name="random"></param> /// <returns></returns> public override DynamicRenderer Create(DeterministicRandom random) { DynamicRenderer dynamicRender = new DynamicRenderer(); dynamicRender.Enabled = random.NextBool(); dynamicRender.DrawingAttributes = DrawingAttributes; return(dynamicRender); }