diff options
Diffstat (limited to 'tests/macFont.test')
-rw-r--r-- | tests/macFont.test | 139 |
1 files changed, 60 insertions, 79 deletions
diff --git a/tests/macFont.test b/tests/macFont.test index 7bec629..972f81d 100644 --- a/tests/macFont.test +++ b/tests/macFont.test @@ -10,18 +10,12 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: macFont.test,v 1.3 1999/04/16 01:51:38 stanton Exp $ +# RCS: @(#) $Id: macFont.test,v 1.4 2001/09/21 20:38:18 hobbs Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { source [file join [pwd] [file dirname [info script]] defs.tcl] } -if {$tcl_platform(platform)!="macintosh"} { - puts "skipping: Mac only tests..." - ::tcltest::cleanupTests - return -} - catch {destroy .b} toplevel .b update idletasks @@ -52,219 +46,219 @@ if {[font actual $gothic -family] != [font actual system -family]} { set ::tcltest::testConfig(gothic) 1 } -test macFont-1.1 {TkpFontPkgInit} { +test macFont-1.1 {TkpFontPkgInit} {macOnly} { } {} -test macfont-2.1 {TkpGetNativeFont: not native} { +test macfont-2.1 {TkpGetNativeFont: not native} {macOnly} { list [catch {font measure {} xyz} msg] $msg } {1 {font "" doesn't exist}} -test macFont-2.2 {TkpGetNativeFont: native} { +test macFont-2.2 {TkpGetNativeFont: native} {macOnly} { font measure system "0" font measure application "0" set x {} } {} -test macFont-3.1 {TkpGetFontFromAttributes: no family} { +test macFont-3.1 {TkpGetFontFromAttributes: no family} {macOnly} { font actual {-underline 1} -family } [font actual system -family] -test macFont-3.2 {TkpGetFontFromAttributes: long family name} { +test macFont-3.2 {TkpGetFontFromAttributes: long family name} {macOnly} { set x "12345678901234567890123456789012345678901234567890" set x "$x$x$x$x$x$x" font actual "-family $x" -family } [font actual system -family] -test macFont-3.3 {TkpGetFontFromAttributes: family} { +test macFont-3.3 {TkpGetFontFromAttributes: family} {macOnly} { font actual {-family Courier} -family } {Courier} -test macFont-3.4 {TkpGetFontFromAttributes: Times fonts} { +test macFont-3.4 {TkpGetFontFromAttributes: Times fonts} {macOnly} { set x {} lappend x [font actual {-family "Times"} -family] lappend x [font actual {-family "Times New Roman"} -family] } {Times Times} -test macFont-3.5 {TkpGetFontFromAttributes: Courier fonts} { +test macFont-3.5 {TkpGetFontFromAttributes: Courier fonts} {macOnly} { set x {} lappend x [font actual {-family "Courier"} -family] lappend x [font actual {-family "Courier New"} -family] } {Courier Courier} -test macFont-3.6 {TkpGetFontFromAttributes: Helvetica fonts} { +test macFont-3.6 {TkpGetFontFromAttributes: Helvetica fonts} {macOnly} { set x {} lappend x [font actual {-family "Geneva"} -family] lappend x [font actual {-family "Helvetica"} -family] lappend x [font actual {-family "Arial"} -family] } {Geneva Helvetica Helvetica} -test macFont-3.7 {TkpGetFontFromAttributes: try aliases} { +test macFont-3.7 {TkpGetFontFromAttributes: try aliases} {macOnly} { font actual {arial 10} -family } {Helvetica} -test macFont-3.8 {TkpGetFontFromAttributes: try fallbacks} { +test macFont-3.8 {TkpGetFontFromAttributes: try fallbacks} {macOnly} { font actual {{ms sans serif} 10} -family } {Chicago} -test macFont-3.9 {TkpGetFontFromAttributes: styles} { +test macFont-3.9 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-weight normal} -weight } {normal} -test macFont-3.10 {TkpGetFontFromAttributes: styles} { +test macFont-3.10 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-weight bold} -weight } {bold} -test macFont-3.11 {TkpGetFontFromAttributes: styles} { +test macFont-3.11 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-slant roman} -slant } {roman} -test macFont-3.12 {TkpGetFontFromAttributes: styles} { +test macFont-3.12 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-slant italic} -slant } {italic} -test macFont-3.13 {TkpGetFontFromAttributes: styles} { +test macFont-3.13 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-underline false} -underline } {0} -test macFont-3.14 {TkpGetFontFromAttributes: styles} { +test macFont-3.14 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-underline true} -underline } {1} -test macFont-3.15 {TkpGetFontFromAttributes: styles} { +test macFont-3.15 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-overstrike false} -overstrike } {0} -test macFont-3.16 {TkpGetFontFromAttributes: styles} { +test macFont-3.16 {TkpGetFontFromAttributes: styles} {macOnly} { font actual {-overstrike true} -overstrike } {0} -test macFont-4.1 {TkpDeleteFont} { +test macFont-4.1 {TkpDeleteFont} {macOnly} { font actual {-family xyz} set x {} } {} -test macFont-5.1 {TkpGetFontFamilies} { +test macFont-5.1 {TkpGetFontFamilies} {macOnly} { expr {[lsearch [font families] Geneva] > 0} } {1} -test macFont-6.1 {TkpGetSubFonts} {gothic} { +test macFont-6.1 {TkpGetSubFonts} {gothic macOnly} { .b.l config -text "abc\u4e4e" update set x [testfont subfonts $fixed] } "Monaco [font actual $gothic -family]" -test macFont-7.1 {Tk_MeasureChars: unbounded right margin} { +test macFont-7.1 {Tk_MeasureChars: unbounded right margin} {macOnly} { .b.l config -wrap 0 -text "000000" getsize } "[expr $ax*6] $ay" -test macFont-7.2 {Tk_MeasureChars: static width buffer exceeded} { +test macFont-7.2 {Tk_MeasureChars: static width buffer exceeded} {macOnly} { .b.l config -wrap 100000 -text "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" getsize } "[expr $ax*256] $ay" -test macFont-7.3 {Tk_MeasureChars: all chars did fit} { +test macFont-7.3 {Tk_MeasureChars: all chars did fit} {macOnly} { .b.l config -wrap [expr $ax*10] -text "00000000" getsize } "[expr $ax*8] $ay" -test macFont-7.4 {Tk_MeasureChars: not all chars fit} { +test macFont-7.4 {Tk_MeasureChars: not all chars fit} {macOnly} { .b.l config -wrap [expr $ax*6] -text "00000000" getsize } "[expr $ax*6] [expr $ay*2]" -test macFont-7.5 {Tk_MeasureChars: already saw space in line} { +test macFont-7.5 {Tk_MeasureChars: already saw space in line} {macOnly} { .b.l config -wrap [expr $ax*12] -text "000000 0000000" getsize } "[expr $ax*7] [expr $ay*2]" -test macFont-7.6 {Tk_MeasureChars: internal spaces significant} { +test macFont-7.6 {Tk_MeasureChars: internal spaces significant} {macOnly} { .b.l config -wrap [expr $ax*12] -text "000 00 00000" getsize } "[expr $ax*7] [expr $ay*2]" -test macFont-7.7 {Tk_MeasureChars: include last partial char} { +test macFont-7.7 {Tk_MeasureChars: include last partial char} {macOnly} { .b.c dchars $t 0 end .b.c insert $t 0 "0000" .b.c index $t @[expr int($ax*2.5)],1 } {2} -test macFont-7.8 {Tk_MeasureChars: at least one char on line} { +test macFont-7.8 {Tk_MeasureChars: at least one char on line} { macOnly} { .b.l config -text "000000" -wrap 1 getsize } "$ax [expr $ay*6]" -test macFont-7.9 {Tk_MeasureChars: whole words} { +test macFont-7.9 {Tk_MeasureChars: whole words} {macOnly} { .b.l config -wrap [expr $ax*8] -text "000000 0000" getsize } "[expr $ax*6] [expr $ay*2]" -test macFont-7.10 {Tk_MeasureChars: make first part of word fit} { +test macFont-7.10 {Tk_MeasureChars: make first part of word fit} {macOnly} { .b.l config -wrap [expr $ax*12] -text "0000000000000000" getsize } "[expr $ax*12] [expr $ay*2]" -test macFont-7.11 {Tk_MeasureChars: numBytes == 0} { +test macFont-7.11 {Tk_MeasureChars: numBytes == 0} {macOnly} { font measure system {} } {0} -test macFont-7.12 {Tk_MeasureChars: maxLength < 0} { +test macFont-7.12 {Tk_MeasureChars: maxLength < 0} {macOnly} { font measure $courier abcd } "[expr $cx*4]" -test macFont-7.13 {Tk_MeasureChars: loop on each char} { +test macFont-7.13 {Tk_MeasureChars: loop on each char} {macOnly} { font measure $courier abcd } "[expr $cx*4]" -test macFont-7.14 {Tk_MeasureChars: p == end} { +test macFont-7.14 {Tk_MeasureChars: p == end} {macOnly} { font measure $courier abcd } "[expr $cx*4]" -test macFont-7.15 {Tk_MeasureChars: p > end} { +test macFont-7.15 {Tk_MeasureChars: p > end} {macOnly} { font measure $courier abc\xc2 } "[expr $cx*4]" -test macFont-7.16 {Tk_MeasureChars: thisFamilyPtr != lastFamilyPtr} {gothic} { +test macFont-7.16 {Tk_MeasureChars: thisFamilyPtr != lastFamilyPtr} {gothic macOnly} { font measure $courier abc\u4e4edef } [expr $cx*6+$mx] -test macFont-7.17 {Tk_MeasureChars: measure no chars (in loop)} {gothic} { +test macFont-7.17 {Tk_MeasureChars: measure no chars (in loop)} {gothic macOnly} { font measure $courier \u4e4edef } [expr $mx+$cx*3] -test macFont-7.18 {Tk_MeasureChars: final measure} {gothic} { +test macFont-7.18 {Tk_MeasureChars: final measure} {gothic macOnly} { font measure $courier \u4e4edef } [expr $mx+$cx*3] -test macFont-7.19 {Tk_MeasureChars: final measure (no chars)} {gothic} { +test macFont-7.19 {Tk_MeasureChars: final measure (no chars)} {gothic macOnly} { font measure $courier \u4e4e } [expr $mx] -test macFont-7.20 {Tk_MeasureChars: maxLength >= 0} { +test macFont-7.20 {Tk_MeasureChars: maxLength >= 0} {macOnly} { .b.l config -wrap [expr $ax*8] -text "000" getsize } "[expr $ax*3] $ay" -test macFont-7.21 {Tk_MeasureChars: loop on each char} { +test macFont-7.21 {Tk_MeasureChars: loop on each char} {macOnly} { .b.l config -wrap [expr $ax*8] -text "000" getsize } "[expr $ax*3] $ay" -test macFont-7.22 {Tk_MeasureChars: p == end} { +test macFont-7.22 {Tk_MeasureChars: p == end} {macOnly} { .b.l config -wrap [expr $ax*8] -text "000" getsize } "[expr $ax*3] $ay" -test macFont-7.23 {Tk_MeasureChars: p > end} { +test macFont-7.23 {Tk_MeasureChars: p > end} {macOnly} { .b.l config -wrap [expr $ax*8] -text "00\xc2" getsize } "[expr $ax*3] $ay" -test macFont-7.24 {Tk_MeasureChars: thisFamilyPtr != lastFamilyPtr} {gothic} { +test macFont-7.24 {Tk_MeasureChars: thisFamilyPtr != lastFamilyPtr} {gothic macOnly} { .b.l config -wrap [expr $ax*8] -text "00\u4e4e00" getsize } "[expr $ax*4+$mx] $ay" -test macFont-7.25 {Tk_MeasureChars: measure no chars (in loop)} {gothic} { +test macFont-7.25 {Tk_MeasureChars: measure no chars (in loop)} {gothic macOnly} { .b.l config -wrap [expr $ax*8] -text "\u4e4e00" getsize } "[expr $mx+$ax*2] $ay" -test macFont-7.26 {Tk_MeasureChars: rest == NULL} {gothic} { +test macFont-7.26 {Tk_MeasureChars: rest == NULL} {gothic macOnly} { .b.l config -wrap [expr $ax*20] -text "000000\u4e4e\u4e4e00" getsize } "[expr $ax*8+$mx*2] $ay" -test macFont-7.27 {Tk_MeasureChars: rest != NULL in first segment} {gothic} { +test macFont-7.27 {Tk_MeasureChars: rest != NULL in first segment} {gothic macOnly} { .b.l config -wrap [expr $ax*5] -text "000000\u4e4e\u4e4f00" getsize } "[expr $ax*5] [expr $ay*3]" -test macFont-7.28 {Tk_MeasureChars: rest != NULL in next segment} {gothic} { +test macFont-7.28 {Tk_MeasureChars: rest != NULL in next segment} {gothic macOnly} { # even some of the "0"s would fit after \u4e4d, they should all wrap to next line. .b.l config -wrap [expr $ax*8] -text "\u4e4d\u4e4d000000\u4e4e\u4e4f00" getsize } "[expr $ax*6+$mx] [expr $ay*3]" -test macFont-7.29 {Tk_MeasureChars: final measure} {gothic} { +test macFont-7.29 {Tk_MeasureChars: final measure} {gothic macOnly} { .b.l config -wrap [expr $ax*8] -text "\u4e4e00" getsize } "[expr $mx+$ax*2] $ay" -test macFont-7.30 {Tk_MeasureChars: final measure (no chars)} {gothic} { +test macFont-7.30 {Tk_MeasureChars: final measure (no chars)} {gothic macOnly} { .b.l config -wrap [expr $ax*8] -text "\u4e4e" getsize } "$mx $ay" -test macFont-7.31 {Tk_MeasureChars: rest == NULL} { +test macFont-7.31 {Tk_MeasureChars: rest == NULL} {macOnly} { .b.l config -wrap [expr $ax*1000] -text 0000 getsize } "[expr $ax*4] $ay" -test macFont-7.32 {Tk_MeasureChars: rest != NULL} { +test macFont-7.32 {Tk_MeasureChars: rest != NULL} {macOnly} { .b.l config -wrap [expr $ax*6] -text "00000000" getsize } "[expr $ax*6] [expr $ay*2]" -test macFont-8.1 {Tk_DrawChars procedure} { +test macFont-8.1 {Tk_DrawChars procedure} {macOnly} { .b.l config -text "a" update } {} -test macFont-9.1 {AllocMacFont: use old font} { +test macFont-9.1 {AllocMacFont: use old font} {macOnly} { font create xyz button .c -font xyz font configure xyz -family times @@ -272,13 +266,13 @@ test macFont-9.1 {AllocMacFont: use old font} { destroy .c font delete xyz } {} -test macFont-9.2 {AllocMacFont: extract info from style} { +test macFont-9.2 {AllocMacFont: extract info from style} {macOnly} { font actual {Monaco 9 bold italic underline overstrike} } {-family Monaco -size 9 -weight bold -slant italic -underline 1 -overstrike 0} -test macFont-9.3 {AllocMacFont: extract text metrics} { +test macFont-9.3 {AllocMacFont: extract text metrics} {macOnly} { font metric {Geneva 10} -fixed } {0} -test macFont-9.4 {AllocMacFont: extract text metrics} { +test macFont-9.4 {AllocMacFont: extract text metrics} {macOnly} { font metric "Monaco 9" -fixed } {1} @@ -287,16 +281,3 @@ destroy .b # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - - |