예제 #1
0
        public void Types()
        {
            if (Platform.IsWindows ||
                Platform.IsDarwin)
            {
                return;
            }

#if NETCOREAPP2_1
            var runInAzureDevOps = false; // 本地测试
#else
            var runInAzureDevOps = true;
#endif
            if (runInAzureDevOps)
            {
                // TODO Azure DevOps 有时测试无法通过
                return;
            }

            this.closeCount = 0;

            Tty ttyIn = this.loop.CreateTty(TtyType.In);
            Assert.True(ttyIn.IsReadable);
            Assert.False(ttyIn.IsWritable);

            Tty ttyOut = this.loop.CreateTty(TtyType.Out);
            Assert.False(ttyOut.IsReadable);
            Assert.True(ttyOut.IsWritable);

            /*
             * int width;
             * int height;
             * ttyOut.WindowSize(out width, out height);
             *
             * // Is it a safe assumption that most people have terminals larger than
             * // 10x10?
             * Assert.True(width > 10);
             * Assert.True(height > 10);
             */

            /* Turn on raw mode. */
            ttyIn.Mode(TtyMode.Raw);

            /* Turn off raw mode. */
            ttyIn.Mode(TtyMode.Normal);

            /* Calling uv_tty_reset_mode() repeatedly should not clobber errno. */
            Tty.ResetMode();
            Tty.ResetMode();
            Tty.ResetMode();

            ttyIn.CloseHandle(this.OnClose);
            ttyOut.CloseHandle(this.OnClose);

            this.loop.RunDefault();

            Assert.Equal(2, this.closeCount);
        }
예제 #2
0
 public void DumpTty()
 {
     using (FileStream fs = File.Open("../../../../dump/tty.txt", FileMode.Create))
     {
         using (StreamWriter sw = new StreamWriter(fs))
         {
             sw.Write(Tty.ToString());
         }
     }
 }
예제 #3
0
파일: TtyTests.cs 프로젝트: heng83/NetUV
 void OnClose(Tty handle)
 {
     handle.Dispose();
     this.closeCount++;
 }