private void NavigateListLayout(string menuItem, MenuInputButton nextButton, MenuInputButton prevButton) { var menu = context.Desktop.ActiveWorkspace.ActiveWindow as Menu; ListLayout layout = menu.Layout as ListLayout; var target = layout.Items.SingleOrDefault(w => w.Name.Equals(menuItem, StringComparison.OrdinalIgnoreCase)); if (target == null) { throw new InvalidOperationException($"Could not find {menuItem} in {menu.Name}. Active workspace: {context.Desktop.ActiveWorkspace}"); } var targetIndex = layout.IndexOf(target); while (targetIndex > layout.FocusIndex) { Desktop.ClearAnimations(); instructor.SendButtonPress(nextButton); } while (targetIndex < layout.FocusIndex) { instructor.SendButtonPress(prevButton); } }
public void LL_NoNulls() { Action add = () => ListLayout.Add(null); Action insert = () => ListLayout.Insert(3, null); add.Should().Throw <ArgumentNullException>(); insert.Should().Throw <ArgumentNullException>(); }
protected void TestSizeMetrics(Size expectedIdealSize) { var sizeMetrics = new SizeMetrics(); var renderContext = new Mock <IWidgetRenderContext>(); var idealSize = ListLayout.ComputeIdealSize(Size.Empty, renderContext.Object); idealSize.Should().Be(expectedIdealSize); }
// ======================================== // field // ======================================== // ======================================== // constructor // ======================================== public UmlClassFigure() { Padding = Padding.GetTopChanged(4); Layout = new ListLayout() { Padding = new Insets( 0, DefaultHeight, 0, 0 ), ItemSpace = -1, ExtendLast = true, }; }
public void LL_WidgetCapturesInput() { var inputWidget = CommonMocks.Widget("test"); int ignoreNext = 3; inputWidget .Setup(x => x.ProcessEvent(It.IsAny <WidgetEventArgs>())) .Callback <WidgetEventArgs>(e => { if (e.EventType != WidgetEventType.ButtonDown) { return; } if (ignoreNext > 0) { ignoreNext--; e.Handled = true; return; } }); ListLayout.Insert(3, inputWidget.Object); ListLayout.FocusIndex = 2; ListLayout.FocusIndex.Should().Be(2); ignoreNext.Should().Be(3); NextItem(); ListLayout.FocusIndex.Should().Be(3); ignoreNext.Should().Be(3); NextItem(); ListLayout.FocusIndex.Should().Be(3); ignoreNext.Should().Be(2); NextItem(); ListLayout.FocusIndex.Should().Be(3); ignoreNext.Should().Be(1); NextItem(); ListLayout.FocusIndex.Should().Be(3); ignoreNext.Should().Be(0); NextItem(); ListLayout.FocusIndex.Should().Be(4); }
// ======================================== // field // ======================================== // ======================================== // constructor // ======================================== public UmlInterfaceFigure() { Padding = Padding.GetTopChanged(4); TextHorizontalAlignment = HorizontalAlignment.Center; TextVerticalAlignment = VerticalAlignment.Top; Layout = new ListLayout() { Padding = new Insets( 0, DefaultHeight, 0, 0 ), ItemSpace = -1, ExtendLast = true, }; }
public async Task <IActionResult> UpdateLayout(Guid listId, [FromBody] ListLayout todoListLayoutModel) { var userEmail = User.FindFirst(c => c.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress").Value; todoListLayoutModel.AccountId = User.ReadClaimAsGuidValue("urn:codefliptodo:accountid"); todoListLayoutModel.ListId = listId; var list = await _dapperQuery.GetListAsync(listId); var todoListAuthorizationValidator = new TodoListAuthorizationValidator(list.Contributors, userEmail); if (todoListAuthorizationValidator.IsUserAuthorized()) { await _mediator.Send(todoListLayoutModel); return(Ok()); } return(Forbid()); }
public void LL_ListBehavior() { var item = new Mock <IWidget>().Object; var item3 = ListLayout[3]; ListLayout.IndexOf(item3).Should().Be(3); ListLayout.Contains(item).Should().BeFalse(); ListLayout.Insert(3, item); ListLayout[3].Should().Be(item); ListLayout[4].Should().Be(item3); ListLayout.IndexOf(item).Should().Be(3); ListLayout.IndexOf(item3).Should().Be(4); ListLayout.Count.Should().Be(11); ListLayout.Contains(item).Should().BeTrue(); ListLayout.Remove(item).Should().BeTrue(); ListLayout[3].Should().Be(item3); ListLayout.Count.Should().Be(10); ListLayout.Contains(item).Should().BeFalse(); ListLayout.RemoveAt(3); ListLayout.IndexOf(item3).Should().Be(-1); ListLayout.Contains(item3).Should().BeFalse(); ListLayout.Count.Should().Be(9); IWidget[] array = new IWidget[9]; ListLayout.CopyTo(array, 0); var index = 0; foreach (var listItem in ListLayout) { listItem.Should().Be(array[index]); index++; } }
public void LL_Clear() { ListLayout.Clear(); ListLayout.Count.Should().Be(0); }
protected void Send(MenuInputButton button) { ListLayout.InputEvent(WidgetEventArgs.ButtonDown(button)); ListLayout.InputEvent(WidgetEventArgs.ButtonUp(button)); }
protected void Add(IWidget widget) { ListLayout.Add(widget); }