63 lines
2.1 KiB
OpenEdge ABL
63 lines
2.1 KiB
OpenEdge ABL
VERSION 1.0 CLASS
|
|
BEGIN
|
|
MultiUse = -1 'True
|
|
END
|
|
Attribute VB_Name = "s_ExColor"
|
|
Attribute VB_GlobalNameSpace = False
|
|
Attribute VB_Creatable = False
|
|
Attribute VB_PredeclaredId = False
|
|
Attribute VB_Exposed = False
|
|
Option Explicit
|
|
|
|
' TODO:
|
|
' Public Function ColorGetRGB(nColorID&, aDocument As Object) As Long
|
|
' Public Function QueryColor(nColorID&, aDocument As Object) As ColorDetails
|
|
|
|
Public Function Setup()
|
|
' Mandatory setup function
|
|
End Function
|
|
|
|
Public Function Teardown()
|
|
' Mandatory teardown function
|
|
End Function
|
|
|
|
Public Function t_GetLuma()
|
|
On Error GoTo PROPAGATE_ERROR
|
|
|
|
Call Dev_ExpectEQ(255, ColorGetLuma(RGB(255, 255, 255)), "White")
|
|
Call Dev_ExpectEQ(0, ColorGetLuma(RGB(0, 0, 0)), "Black")
|
|
Call Dev_ExpectEQ(54, ColorGetLuma(RGB(255, 0, 0)), "Red")
|
|
Call Dev_ExpectEQ(182, ColorGetLuma(RGB(0, 255, 0)), "Green")
|
|
Call Dev_ExpectEQ(18, ColorGetLuma(RGB(0, 0, 255)), "Blue")
|
|
|
|
Exit Function
|
|
PROPAGATE_ERROR:
|
|
Call Dev_LogError(Err.Number, Err.Description)
|
|
End Function
|
|
|
|
Public Function t_ColorString()
|
|
On Error GoTo PROPAGATE_ERROR
|
|
|
|
Call Dev_NewCase("Invalid input")
|
|
Call Dev_ExpectEQ(HC_INVALID, ConvertStringToRGB("99999999999"), "Overflow long")
|
|
Call Dev_ExpectEQ(HC_INVALID, ConvertStringToRGB(RGB(255, 255, 255)), "Overflow integer")
|
|
Call Dev_ExpectEQ(HC_INVALID, ConvertStringToRGB("RGB(256,0,0)"), "Invalid color value")
|
|
Call Dev_ExpectEQ("RGB(255,255,255)", ConvertRGBtoString(&HFFFFFFFF), "Overflow color")
|
|
|
|
Call Dev_NewCase("White")
|
|
Call Dev_ExpectEQ(RGB(255, 255, 255), ConvertStringToRGB("RGB(255,255,255)"))
|
|
Call Dev_ExpectEQ("RGB(255,255,255)", ConvertRGBtoString(RGB(255, 255, 255)))
|
|
|
|
Call Dev_NewCase("Black")
|
|
Call Dev_ExpectEQ(RGB(0, 0, 0), ConvertStringToRGB("RGB(0,0,0)"))
|
|
Call Dev_ExpectEQ("RGB(0,0,0)", ConvertRGBtoString(RGB(0, 0, 0)))
|
|
|
|
Call Dev_NewCase("Generic color")
|
|
Call Dev_ExpectEQ(RGB(165, 137, 99), ConvertStringToRGB("RGB(165,137,99)"))
|
|
Call Dev_ExpectEQ("RGB(55,67,77)", ConvertRGBtoString(RGB(55, 67, 77)))
|
|
|
|
Exit Function
|
|
PROPAGATE_ERROR:
|
|
Call Dev_LogError(Err.Number, Err.Description)
|
|
End Function
|