Changeset 632 for trunk/ab5.0


Ignore:
Timestamp:
Sep 23, 2008, 10:49:35 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

[627]への対応

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/TestCase/SimpleTestCase/SimpleTestCase.ab

    r545 r632  
    22
    33#console
    4 
    5 Dim hStdOut = _System_hConsoleOut
    64
    75Function GetTempDirectory() As String
     
    2826'Initialize()
    2927
    30 Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
    31 GetConsoleScreenBufferInfo(hStdOut, csbi)
     28Dim prevBackColor = System.Console.BackgroundColor
     29Dim prevForeColor = System.Console.ForegroundColor
    3230
    3331#include "SimpleTestCase.idx"
    3432
     33Imports System
     34
    3535Dim failureCount = 0 As DWord
     36
     37Sub SetFailureColor()
     38    Console.BackgroundColor = ConsoleColor.Yellow
     39    Console.ForegroundColor = ConsoleColor.Black
     40End Sub
    3641
    3742Sub UnitTest( msg As String, isSuccessful As Boolean )
     
    4550
    4651    If Not isSuccessful Then
    47         SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
     52        SetFailureColor()
    4853    End If
    4954
     
    5156
    5257    If Not isSuccessful Then
    53         SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
     58        Console.ResetColor()
    5459    End If
    5560End Sub
     
    5964        Print Ex"OK      "; msg
    6065    Else
    61         SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
     66        SetFailureColor()
    6267        Print Ex"FAILURE!"; msg
    6368        Print "  期待 = '" + expectation + "'" + " 結果 = '" + test + "'"
    64         SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
     69        Console.ResetColor()
    6570        failureCount++
    6671    End If
Note: See TracChangeset for help on using the changeset viewer.