void ReleaseDesignerOutlets() { if (TestText != null) { TestText.Dispose(); TestText = null; } if (LimitedLengthTextField != null) { LimitedLengthTextField.Dispose(); LimitedLengthTextField = null; } if (MultiLineTextField != null) { MultiLineTextField.Dispose(); MultiLineTextField = null; } if (TextField != null) { TextField.Dispose(); TextField = null; } }
public static string GetTestText(TestText testText) { string result = "FormattedLabel.GetTestText()"; switch (testText) { case TestText.Demo: result = "This [c 01F573FF]sentence[C FFFFFFFF] is [c FF6666FF]too[C FFFFFFFF] long so it will be [BC 1B07F5FF]split[BC ?] into multiple lines.\nNormal, [F ArialBold]bold, [font ArialItalic]italic, [F Arial][FA u]underline[FA -u], [FA S]strikethrough[FA -s].\n[F Arial 10]10, [F Arial 16]16, [F Arial 24]24, [F Arial 48]48, [F Arial 72]72[F Arial 16]\n[HA L]Left\n[HA C]Center\n[HA R]Right\n[HA L]20 pixels further:[S 20]*\nDefault vertical aligment: [F Arial 10]10, [F Arial 24]24, [F Arial 10]10[FS 16]\n[VA B]Bottom vertical aligment: [F Arial 10]10, [F Arial 24]24, [F Arial 10]10[FS 16][VA ?]\nThis is a [FA U][H hyperlink_value]hyperlink[-H][FA -U]."; break; case TestText.Fireball: result = "[HA Center][C FA8C8CFF][FS 24]Fireball[FS 16][color FFFFFFFF]\n\nHurls a ball of fire that [F ArialBold]explodes[F Arial] on [FA U]contact[FA -U] and damages all nearby [FA S]foes [FA -S]enemies.\n\n[VA B][C FF6666FF][F ArialBold 18]8[FS 16][C FFFFFFFF][F Arial] to [C FF6666FF][F ArialBold 18]12[F Arial 16][C FFFFFFFF][F ArialItalic] fire[F Arial] damage[VA ?]"; break; case TestText.Hyperlink: result = "This is a hidden [H hidden]hyperlink[-H].\nThis is a visible [FA U][H visible]hyperlink[-H][FA -U]."; break; case TestText.SpecialText: result = "Escaped backslash \\\nEscaped bracket [[\nClosing bracket ]\n"; break; default: Debug.Log("Invalid index '" + testText.ToString() + "'"); break; } return(result); }
/// <summary> /// Qualify Goal 1 by testing the sample input from the site /// </summary> private static void UnitTest() { // Example const string TestText = @"abc a b c ab ac a a a a b"; int sample = Goal1(TestText.Split('\n')); if (sample != 11) { throw new InvalidOperationException($"Expected 11, got {sample}"); } sample = Goal2(TestText.Split('\n')); if (sample != 6) { throw new InvalidOperationException($"Expected 6, got {sample}"); } }
public void Uses_indent_of_first_line() { var command = CreateSUT(); var inputText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux | ", "| quux| corge| ", ""); var textView = CreateTextView(inputText); inputText.MoveCaretTo(textView, -2, 0); command.PostExec(textView, '|'); // this does not enter the char itself var expectedText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux |", " | quux | corge |", ""); Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText()); }
public void Uses_configured_line_ending() { var command = CreateSUT(); var inputText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux | ", "| quux| corge| ", ""); var configuredNewLine = "\n"; var textView = CreateTextView(inputText, configuredNewLine); textView.StubEditorOptions.ReplicateNewLineCharacterOption = false; textView.StubEditorOptions.NewLineCharacterOption = configuredNewLine; inputText.MoveCaretTo(textView, -2, 0); command.PostExec(textView, '|'); // this does not enter the char itself var expectedText = new TestText( "Feature: foo", "Scenario: bar", "Given table", " | foo | bar |", " | bazbaz | qux |", " | quux | corge |", ""); Assert.Equal(expectedText.ToString(configuredNewLine), textView.TextSnapshot.GetText()); }
public void TestBasicProperties() { TestsObject.AssertEqual(TestFloat, 42.0f, "TestFloat"); TestsObject.AssertEqual(TestDouble, 108.0, "TestDouble"); TestsObject.AssertEqual(TestBool, false, "TestBool"); TestsObject.AssertEqual(TestSByte, 43, "TestSByte"); TestsObject.AssertEqual(TestInt16, 44, "TestInt16"); TestsObject.AssertEqual(TestInt, 42, "TestInt"); TestsObject.AssertEqual(TestInt64, 4815162342108, "TestInt64"); TestsObject.AssertEqual(TestByte, 43, "TestByte"); TestsObject.AssertEqual(TestUInt16, 44, "TestUInt16"); TestsObject.AssertEqual(TestUInt32, 0xc001beef, "TestUInt32"); TestsObject.AssertEqual(TestUInt64, 0xdeadbeefdeadbeef, "TestUInt64"); TestsObject.AssertEqual(TestEnum, PixelFormat.A8R8G8B8, "TestEnum"); TestsObject.AssertEqual(TestEnumCpp, ControllerHand.Special7, "TestEnumCpp"); TestsObject.AssertEqual(TestText.ToString(), "Bork bork bork", "TestText"); TestFloat = -42.0f; TestDouble = -108.0; TestInt = -42; TestInt64 = -4815162342108; TestEnum = PixelFormat.BC4; TestEnumCpp = ControllerHand.AnyHand; TestsObject.AssertEqual(TestFloat, -42.0f, "TestFloat-Write"); TestsObject.AssertEqual(TestDouble, -108.0, "TestDouble-Write"); TestsObject.AssertEqual(TestInt, -42, "TestInt-Write"); TestsObject.AssertEqual(TestInt64, -4815162342108, "TestInt64-Write"); TestsObject.AssertEqual(TestEnum, PixelFormat.BC4, "TestEnum-Write"); TestsObject.AssertEqual(TestEnumCpp, ControllerHand.AnyHand, "TestEnumCpp-Write"); TestsObject.AssertEqual(TestPropertyInitializer, 5, "TestPropertyInitializer"); TestsObject.AssertEqual(TestGetOnlyPropertyInitializer, true, "TestGetOnlyPropertyInitializer"); }
public void Dispose() { TestText?.Dispose(); Keyword?.Dispose(); IsValidKeyword?.Dispose(); IsInvalidKeyword?.Dispose(); }
protected override void OnReset() { TestFloat = 42.0f; TestDouble = 108.0; TestBool = false; TestSByte = 43; TestInt16 = 44; TestInt = 42; TestInt64 = 4815162342108; TestByte = 43; TestUInt16 = 44; TestUInt32 = 0xc001beef; TestUInt64 = 0xdeadbeefdeadbeef; TestTestsObject = null; TestEnum = PixelFormat.A8R8G8B8; TestEnumCpp = ControllerHand.Special7; TestVector3 = new OpenTK.Vector3(42.0f, 42.0f, 42.0f); TestName = new Name("Meef"); TestRotator = new Rotator(42.0f, 42.0f, 42.0f); TestColor = new Color(42, 42, 42, 42); TestString = "Meef"; TestText.SetFromString("Bork bork bork"); TestSubclassOf = new SubclassOf <UnrealEngine.Engine.Actor>(typeof(UnrealEngine.Engine.Light)); TestStruct = new MonoTestsStruct { TestStructFloat = 42.0f, TestStructInt32 = -42, TestStructWeakObject = TestsObject, TestSubStruct = new MonoTestsSubStruct { TestBool1 = true, TestBool2 = false, }, }; TestIntArray.Clear(); TestIntArray.Add(2); TestIntArray.Add(4); TestIntArray.Add(6); TestIntArray.Add(0); TestIntArray.Add(1); TestObjArray.Clear(); TestObjArray.Add(this); TestObjArray.Add(TestsObject); TestNameArray.Clear(); TestNameArray.Add(new Name("Foo")); TestNameArray.Add(new Name("Bar")); TestNameArray.Add(new Name("Hoobajoob")); TestNameArray.Add(new Name("Doowacky")); TestWeakObject = this; }
protected void AssertLinesSelected(IWpfTextView textView, TestText expectedText, int selectionStartLine, int?selectionEndLine) { // commented line is selected Assert.Equal(expectedText.GetLineStartPosition(selectionStartLine), textView.Selection.Start.Position); Assert.Equal(expectedText.GetLineEndPosition(selectionEndLine ?? selectionStartLine), textView.Selection.End.Position); // cursor moved to end of selection Assert.Equal(textView.Selection.End.Position, textView.Caret.Position.BufferPosition.Position); }
public void ShouldReturnProvidedValue() { //Arrange TestText subject = new TestText("TheValue"); //Act string actual = subject; //Assert actual.Should().Be("TheValue"); }
public void TestDrawTextWithDefaultTransform() { TestText test = new TestText(); this.textBatch.Begin(); try { this.textBatch.DrawText(test, Color.White); } finally { this.textBatch.End(); } }
public void Can_uncomment_lines(string test, int selectionStartLine, int selectionStartColumn, int?selectionEndLine, int?selectionEndColumn, string inputTextValue) { Console.WriteLine($"running: {test}"); var command = new UncommentCommand(null, null, _monitoringService); var inputText = new TestText(inputTextValue); var textView = CreateTextView(inputText, selectionStartLine, selectionStartColumn, selectionEndLine, selectionEndColumn); command.PreExec(textView, command.Targets.First()); var expectedText = new TestText( "Feature: foo", "Scenario: bar", ""); Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText()); AssertLinesSelected(textView, expectedText, selectionStartLine, selectionEndLine); }
public void TestDrawTextWithCustomTransform() { TestText test = new TestText(); Matrix testMatrix = new Matrix( 1.1f, 1.2f, 1.3f, 1.4f, 2.1f, 2.2f, 2.3f, 2.4f, 3.1f, 3.2f, 3.3f, 3.4f, 4.1f, 4.2f, 4.3f, 4.4f ); this.textBatch.Begin(); try { this.textBatch.DrawText(test, testMatrix, Color.White); } finally { this.textBatch.End(); } }
public void ThenAllSectionOfTypesShouldBeHighlightedAs(string[] keywordTypes, string expectedContent) { var expectedContentText = new TestText(expectedContent); var tags = GetDeveroomTags(_wpfTextView).Where(t => keywordTypes.Contains(t.Type)).ToArray(); var testTextSections = expectedContentText.Sections.Where(s => keywordTypes.Contains(s.Label)).ToArray(); testTextSections.Should().NotBeEmpty("there should be something to expect"); foreach (var section in testTextSections) { tags.Should().Contain(t => t.Type == section.Label && t.Span.Start == expectedContentText.GetSnapshotPoint(t.Span.Snapshot, section.Start.Line, section.Start.Column) && t.Span.End == expectedContentText.GetSnapshotPoint(t.Span.Snapshot, section.End.Line, section.End.Column), $"the section '{section}' should be highlighted" ); } tags.Should().HaveCount(testTextSections.Length); }
public IHttpActionResult word([FromBody] TestText input) { if (input != null) { if (input.data.Length != 4) { return(BadRequest("the data needs have only and exclusive 4 characters")); } else { TestText salida = new TestText(); salida.data = input.data.ToUpper(); return(Json <TestText>(salida)); } } else { return(BadRequest()); } }
protected IWpfTextView CreateTextView(TestText inputText, int selectionStartLine, int selectionStartColumn, int?selectionEndLine, int?selectionEndColumn) { var textBuffer = VsxStubObjects.CreateTextBuffer(inputText.ToString()); IWpfTextView textView = new StubWpfTextView(textBuffer); if (selectionEndColumn != null && selectionEndLine != null) { textView.Selection.Select(new SnapshotSpan( inputText.GetSnapshotPoint(textView.TextSnapshot, selectionStartLine, selectionStartColumn), inputText.GetSnapshotPoint(textView.TextSnapshot, selectionEndLine.Value, selectionEndColumn.Value)), false); } int caretLine = selectionEndLine ?? selectionStartLine; int caretColumn = selectionEndColumn ?? selectionStartColumn; textView.Caret.MoveTo(inputText.GetSnapshotPoint(textView.TextSnapshot, caretLine, caretColumn)); return(textView); }
public void Should_not_remove_unfinished_cells_when_formattig_table() { var command = CreateSUT(); var inputText = new TestText( @"Feature: foo", @"Scenario: bar", @"Given table", @" | foo | bar ", @" | foo | bar baz ", @" | foo ", @" | ", @" | foo | ", @" | foo | \| ", @" | foo | \|", @" | foo | bar \\| ", @" | foo | bar ", @""); var textView = CreateTextView(inputText); inputText.MoveCaretTo(textView, -2, -1); textView.SimulateType(command, '|'); var expectedText = new TestText( @"Feature: foo", @"Scenario: bar", @"Given table", @" | foo | bar", @" | foo | bar baz", @" | foo", @" |", @" | foo |", @" | foo | \|", @" | foo | \|", @" | foo | bar \\ |", @" | foo | bar |", @""); Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText()); }
public void Formats_data_table_when_pipe_typed_of_an_incomplete_table() { var command = CreateSUT(); var inputText = _unformattedText.Replace(-2, @"| c\n\| |"); // remove last cell var textView = CreateTextView(inputText); inputText.MoveCaretTo(textView, -2, -1); textView.SimulateType(command, '|'); var expectedText = new TestText( @"Feature: foo", @"Scenario: bar", @"Given table", @" | foo | bar |", @" | bazbaz | qux |", @" | qu\\ |", @""); Assert.Equal(expectedText.ToString(), textView.TextSnapshot.GetText()); }
public void TestDrawTextWithCustomEffect() { TestText test = new TestText(); BasicEffect effect = new BasicEffect( this.mockedGraphicsDeviceService.GraphicsDevice #if XNA_3 , null #endif ); try { this.textBatch.Begin(); try { this.textBatch.DrawText(test, effect); } finally { this.textBatch.End(); } } finally { effect.Dispose(); } }
public IHttpActionResult gettime([FromUri] string value) { if (value != null) { DateTime receibedTime = new DateTime(); if (DateTime.TryParseExact(value, "HH:mm", CultureInfo.CurrentCulture.DateTimeFormat, System.Globalization.DateTimeStyles.None, out receibedTime)) { TestText output = new TestText(); DateTime newtime = DateTime.Now; //receibedTime.AddSeconds(newtime.Second); output.data = receibedTime.ToString("yyyy-MM-ddTHH:mm:ssZ"); return(Json <TestText>(output)); } else { return(BadRequest("the input time isn't in the HH:mm format ")); } } else { return(BadRequest()); } }
public void ThenAllSectionOfTypesShouldBeHighlightedAs(string[] keywordTypes, string expectedContent) { var expectedContentText = new TestText(expectedContent); var tags = GetDeveroomTags(_wpfTextView).Where(t => keywordTypes.Contains(t.Type)).ToArray(); var testTextSections = expectedContentText.Sections.Where(s => keywordTypes.Contains(s.Label)).ToArray(); testTextSections.Should().NotBeEmpty("there should be something to expect"); var matchedTags = tags.ToList(); foreach (var section in testTextSections) { var matchedTag = tags.FirstOrDefault( t => t.Type == section.Label && t.Span.Start == expectedContentText.GetSnapshotPoint(t.Span.Snapshot, section.Start.Line, section.Start.Column) && t.Span.End == expectedContentText.GetSnapshotPoint(t.Span.Snapshot, section.End.Line, section.End.Column) ); matchedTag.Should().NotBeNull($"the section '{section}' should be highlighted"); matchedTags.Remove(matchedTag); } matchedTags.Should().BeEmpty(); }
public void TestVerticesProperty() { Text test = new TestText(); Assert.AreEqual(123, test.Vertices.Length); }
public void TestWidthProperty() { Text test = new TestText(); Assert.AreEqual(12.34f, test.Width); }
public void TestHeightProperty() { Text test = new TestText(); Assert.AreEqual(56.78f, test.Height); }
public void TestPrimitiveTypeProperty() { Text test = new TestText(); Assert.AreEqual(PrimitiveType.TriangleList, test.PrimitiveType); }
public async Task <ApiResponse <string> > WriteTextToFile([FromBody] TestText testText) { var response = await _textFileManager.WriteText(testText.FileName, testText.Text); return(response); }
public void StartTest() { testsInfo = TestsLoader.LoadTestsFromFile(@"Resources/Tasks.test"); if (randomizeTasks) { testsInfo = RandomizeArray(testsInfo); } if (testsArr != null) { for (int i = 0; i < testsArr.Length; i++) { testsArr[i].Dispose(); } } TestSelector.Items.Clear(); testsArr = new BaseTest[testsInfo.Length]; Padding singleAnswerPadding = new Padding(35, 0, 0, 0); Padding multyAnswerPadding = new Padding(80, 0, 0, 0); int imageBottomPadding = 55; for (int i = 0; i < testsArr.Length; i++) { TestInfo info = testsInfo[i]; switch (info.TestType) { case TestType.Text: TestText testText = new TestText(); testText.Parent = TestPanelHolder; testText.Size = TestPanelHolder.Size; TextBox textBox = new TextBox(); testText.AnswerBox = textBox; textBox.Parent = testText; textBox.Font = new Font(textBox.Font.FontFamily, 32); textBox.BackColor = Color.FromArgb(255, 4, 13, 21); textBox.ForeColor = Color.FromKnownColor(KnownColor.Control); textBox.TextAlign = HorizontalAlignment.Center; textBox.Width = 650; textBox.Anchor = AnchorStyles.Left; textBox.Left = (testText.Width - textBox.Width) / 2; textBox.Top = (testText.Height - textBox.Height) / 2; textBox.CharacterCasing = CharacterCasing.Upper; testsArr[i] = testText; break; case TestType.SingleAnswer: TestSingleAnswer testSingleAnswer = new TestSingleAnswer(); testSingleAnswer.Parent = TestPanelHolder; testSingleAnswer.Size = TestPanelHolder.Size; testSingleAnswer.LayoutPanel.Size = testSingleAnswer.Size; testSingleAnswer.RadioButtons = new RadioButton[info.Tasks.Length]; for (int x = 0; x < info.Tasks.Length; x++) { RadioButton button = new RadioButton(); testSingleAnswer.RadioButtons[x] = button; button.Parent = testSingleAnswer.LayoutPanel; button.ForeColor = Color.FromKnownColor(KnownColor.Control); button.Text = (x + 1) + ") " + info.Tasks[x]; button.Padding = singleAnswerPadding; button.Font = new Font(button.Font.FontFamily, 20); Size size = testSingleAnswer.LayoutPanel.Size; size.Width = size.Width / 2 - 9; size.Height = (size.Height / (int)Math.Ceiling(info.Tasks.Length * 0.5)) - 3; button.Size = size; } testsArr[i] = testSingleAnswer; break; case TestType.MultyAnswer: TestMultyAnswer testMultyAnswer = new TestMultyAnswer(); testMultyAnswer.Parent = TestPanelHolder; testMultyAnswer.Size = TestPanelHolder.Size; testMultyAnswer.LayoutPanel.Size = testMultyAnswer.Size; testMultyAnswer.CheckBoxes = new CheckBox[info.Tasks.Length]; testMultyAnswer.MultyAnswer = new string[info.Tasks.Length]; for (int x = 0; x < info.Tasks.Length; x++) { CheckBox checkBox = new CheckBox(); testMultyAnswer.CheckBoxes[x] = checkBox; checkBox.Parent = testMultyAnswer.LayoutPanel; checkBox.ForeColor = Color.FromKnownColor(KnownColor.Control); checkBox.Text = (x + 1) + ") " + info.Tasks[x]; checkBox.Padding = multyAnswerPadding; checkBox.Font = new Font(checkBox.Font.FontFamily, 20); Size size = testMultyAnswer.LayoutPanel.Size; size.Height = (size.Height / info.Tasks.Length) - 3; checkBox.Size = size; } testsArr[i] = testMultyAnswer; break; case TestType.Image: TestImage testImage = new TestImage(); testImage.Parent = TestPanelHolder; testImage.Size = TestPanelHolder.Size; testImage.LayoutPanel.Size = testImage.Size; testImage.RadioButtons = new RadioButton[info.Tasks.Length]; for (int x = 0; x < info.Tasks.Length; x++) { RadioButton button = new RadioButton(); testImage.RadioButtons[x] = button; button.Parent = testImage.LayoutPanel; button.ForeColor = Color.FromKnownColor(KnownColor.Control); button.Text = (x + 1) + ") " + info.Tasks[x]; button.Font = new Font(button.Font.FontFamily, 14); Size size = testImage.LayoutPanel.Size; size.Width = size.Width / 2 - 9; size.Height = (size.Height / (int)Math.Ceiling(info.Tasks.Length * 0.5)) - 3; button.Size = size; Padding padding = new Padding(button.Width / 2, button.Height - imageBottomPadding, 0, 0); button.Padding = padding; PictureBox picture = new PictureBox(); string picturePath = @"Resources/"; picturePath += info.Pictures[x]; picture.Image = Image.FromFile(picturePath); picture.Parent = button; picture.SizeMode = PictureBoxSizeMode.Zoom; int imageSideSize = button.Height - imageBottomPadding - 4; picture.Size = new Size(imageSideSize, imageSideSize); picture.Left = (button.Width / 2) - (imageSideSize / 2); picture.Top = 4; } testsArr[i] = testImage; break; case TestType.Connection: testsArr[i] = new TestConnection(); break; default: break; } testsArr[i].TestInfo = info; testsArr[i].Hide(); TestSelector.Items.Add((i + 1) + ") " + info.TestTitle); } selectedTask = 0; Question.Text = "Вопрос: " + testsInfo[selectedTask].TestTask; testsArr[selectedTask].Show(); }
// Use this for initialization public override void Start() { // Initialize InitAll(); Logger.debug = true; // Set up input listeners Inputs.SetKeyListeners(_keyListeners); // Beats logo TestLogo.Init(); TestLogo logo = TestLogo.Instantiate(); logo.position = new Vector3(Screens.xmid, Screens.ymid, Screens.zmin); // Arrow in each corner TestArrow.Init(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { float posX = (x == 0) ? Screens.xmin : (x == 1) ? Screens.xmid : Screens.xmax; float posY = (y == 0) ? Screens.ymin : (y == 1) ? Screens.ymid : Screens.ymax; float posZ = Screens.zmin; TestArrow arrow = TestArrow.Instantiate(); arrow.name = String.Format("_arrow({0}, {1})", x, y); arrow.position = new Vector3(posX, posY, posZ); } } _randomArrow = TestArrow.Instantiate(); _randomArrow.name = "_randomArrow"; _randomArrow.position = new Vector3(Screens.xmax - 75f, Screens.ymax - 50f, Screens.zmin); // Two random holds TestHold.Init(); _hold1 = TestHold.Instantiate(Screens.height - _randomArrow.height); _hold1.name = "_hold1"; _hold1.position = new Vector3(Screens.xmax - (_hold1.width / 2), Screens.ymid, Screens.zmid); _hold2 = TestHold.Instantiate(_randomArrow.height * 4); _hold2.name = "_hold2"; _hold2.position = new Vector3(_hold1.x - _hold1.width * 2, Screens.ymid, Screens.zmid); // Background image TestBackground background = TestBackground.Instantiate(); background.name = "_background2"; background.position = new Vector3(Screens.xmid, Screens.ymid, Screens.zmax); background.color = new Color(background.color.r, background.color.g, background.color.b, 0.75f); // Generated arrows _arrows = new List <TestArrow>(); _addTimer = ADD_INTERVAL; _arrowCount = 0; // Text label FontMeshData squareTextData = new FontMeshData( "_SquareFont", SysInfo.GetPath("Sandbox/Square.png"), SysInfo.GetPath("Sandbox/Square.fnt") ); float textWidth = squareTextData.width * (_randomArrow.height / 2) / squareTextData.height; float textHeight = (_randomArrow.height / 2); _sysInfo = TestText.Instantiate( squareTextData, "_SysInfo", textWidth * 0.7f, textHeight * 0.7f, TextAnchor.UpperLeft ); _sysInfo.position = new Vector3(Screens.xmin, Screens.ymax, Screens.zdebug); _sysInfo.color = new Color(1f, 1f, 1f, 0.5f); // Semi-transparent Gray _sysInfo.text = SysInfo.InfoString(); _audioTime = TestText.Instantiate( squareTextData, "_AudioTime", textWidth, textHeight, TextAnchor.LowerLeft ); _audioTime.position = new Vector3(Screens.xmin, Screens.ymin + (_randomArrow.height / 2), Screens.zdebug); _touchLog = TestText.Instantiate( squareTextData, "_Touch Log", textWidth, textHeight, TextAnchor.LowerLeft ); _touchLog.position = new Vector3(Screens.xmin, Screens.ymin, Screens.zdebug); _touchLog.color = new Color(255f / 255f, 204f / 255f, 0f); // Tangerine _collisionLog = TestText.Instantiate( squareTextData, "_Collision Log", textWidth, textHeight, TextAnchor.LowerRight ); _collisionLog.position = new Vector3(Screens.xmax, Screens.ymin, Screens.zdebug); _collisionLog.color = Color.red; // FPS Counter _fpsCounter = FpsCounter.Instantiate(squareTextData, textHeight); _fpsCounter.position = new Vector3(Screens.xmax, Screens.ymax, Screens.zdebug); // Load music _audioPlayer = AudioPlayer.Instantiate(); _audioPlayer.Set(AudioClips.SANDBOX_SONG); _audioPlayer.loop = true; _audioPlayer.Play(); TestMine.Init(); _mine = TestMine.Instantiate(); _mine.gameObject.transform.position = new Vector3(Screens.xmid, (Screens.ymin + Screens.ymid) / 2, Screens.zmin - 10); SettingsFile testIniFile = new SettingsFile(SysInfo.GetPath("Sandbox/Test.ini")); testIniFile.Set("Beats", "Version", "MODIFIED"); testIniFile.Write(SysInfo.GetPath("Sandbox/Test2.ini")); }
public void ThenTheEditorShouldBeUpdatedTo(string expectedContentValue) { var expectedContent = new TestText(expectedContentValue); Assert.Equal(expectedContent.ToString(), _wpfTextView.TextSnapshot.GetText()); }
// Use this for initialization public override void Start() { // Initialize InitAll(); Logger.debug = true; // Set up input listeners Inputs.SetKeyListeners(_keyListeners); // Beats logo TestLogo.Init(); TestLogo logo = TestLogo.Instantiate(); logo.position = new Vector3(Screens.xmid, Screens.ymid, Screens.zmin); // Arrow in each corner TestArrow.Init(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { float posX = (x == 0) ? Screens.xmin : (x == 1) ? Screens.xmid : Screens.xmax; float posY = (y == 0) ? Screens.ymin : (y == 1) ? Screens.ymid : Screens.ymax; float posZ = Screens.zmin; TestArrow arrow = TestArrow.Instantiate(); arrow.name = String.Format("_arrow({0}, {1})", x, y); arrow.position = new Vector3(posX, posY, posZ); } } _randomArrow = TestArrow.Instantiate(); _randomArrow.name = "_randomArrow"; _randomArrow.position = new Vector3(Screens.xmax - 75f, Screens.ymax - 50f, Screens.zmin); // Two random holds TestHold.Init(); _hold1 = TestHold.Instantiate(Screens.height - _randomArrow.height); _hold1.name = "_hold1"; _hold1.position = new Vector3(Screens.xmax - (_hold1.width / 2), Screens.ymid, Screens.zmid); _hold2 = TestHold.Instantiate(_randomArrow.height * 4); _hold2.name = "_hold2"; _hold2.position = new Vector3(_hold1.x - _hold1.width * 2, Screens.ymid, Screens.zmid); // Background image TestBackground background = TestBackground.Instantiate(); background.name = "_background2"; background.position = new Vector3(Screens.xmid, Screens.ymid, Screens.zmax); background.color = new Color(background.color.r, background.color.g, background.color.b, 0.75f); // Generated arrows _arrows = new List<TestArrow>(); _addTimer = ADD_INTERVAL; _arrowCount = 0; // Text label FontMeshData squareTextData = new FontMeshData( "_SquareFont", SysInfo.GetPath("Sandbox/Square.png"), SysInfo.GetPath("Sandbox/Square.fnt") ); float textWidth = squareTextData.width * (_randomArrow.height / 2) / squareTextData.height; float textHeight = (_randomArrow.height / 2); _sysInfo = TestText.Instantiate( squareTextData, "_SysInfo", textWidth * 0.7f, textHeight * 0.7f, TextAnchor.UpperLeft ); _sysInfo.position = new Vector3(Screens.xmin, Screens.ymax, Screens.zdebug); _sysInfo.color = new Color(1f, 1f, 1f, 0.5f); // Semi-transparent Gray _sysInfo.text = SysInfo.InfoString(); _audioTime = TestText.Instantiate( squareTextData, "_AudioTime", textWidth, textHeight, TextAnchor.LowerLeft ); _audioTime.position = new Vector3(Screens.xmin, Screens.ymin + (_randomArrow.height / 2), Screens.zdebug); _touchLog = TestText.Instantiate( squareTextData, "_Touch Log", textWidth, textHeight, TextAnchor.LowerLeft ); _touchLog.position = new Vector3(Screens.xmin, Screens.ymin, Screens.zdebug); _touchLog.color = new Color(255f / 255f, 204f/255f, 0f); // Tangerine _collisionLog = TestText.Instantiate( squareTextData, "_Collision Log", textWidth, textHeight, TextAnchor.LowerRight ); _collisionLog.position = new Vector3(Screens.xmax, Screens.ymin, Screens.zdebug); _collisionLog.color = Color.red; // FPS Counter _fpsCounter = FpsCounter.Instantiate(squareTextData,textHeight); _fpsCounter.position = new Vector3(Screens.xmax, Screens.ymax, Screens.zdebug); // Load music _audioPlayer = AudioPlayer.Instantiate(); _audioPlayer.Set(AudioClips.SANDBOX_SONG); _audioPlayer.loop = true; _audioPlayer.Play(); TestMine.Init(); _mine = TestMine.Instantiate(); _mine.gameObject.transform.position = new Vector3(Screens.xmid, (Screens.ymin + Screens.ymid) / 2, Screens.zmin - 10); SettingsFile testIniFile = new SettingsFile(SysInfo.GetPath("Sandbox/Test.ini")); testIniFile.Set("Beats", "Version", "MODIFIED"); testIniFile.Write(SysInfo.GetPath("Sandbox/Test2.ini")); }
private StubWpfTextView CreateTextView(TestText inputText, string newLine = null) { return(StubWpfTextView.CreateTextView(_ideScope, inputText, newLine)); }
public void TestIndicesProperty() { Text test = new TestText(); Assert.AreEqual(1234, test.Indices.Length); }
public void TestDrawTextWithCustomEffect() { TestText test = new TestText(); BasicEffect effect = new BasicEffect( this.mockedGraphicsDeviceService.GraphicsDevice #if !XNA_4 , null #endif ); try { this.textBatch.Begin(); try { this.textBatch.DrawText(test, effect); } finally { this.textBatch.End(); } } finally { effect.Dispose(); } }