Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c0ed707b
Kaydet (Commit)
c0ed707b
authored
Haz 09, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #24408: Added more tkinter.Font tests.
üst
d0040711
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
5 deletions
+65
-5
test_font.py
Lib/tkinter/test/test_tkinter/test_font.py
+65
-5
No files found.
Lib/tkinter/test/test_tkinter/test_font.py
Dosyayı görüntüle @
c0ed707b
...
...
@@ -6,14 +6,54 @@ from tkinter.test.support import AbstractTkTest
requires
(
'gui'
)
fontname
=
"TkDefaultFont"
class
FontTest
(
AbstractTkTest
,
unittest
.
TestCase
):
def
test_font_eq
(
self
):
fontname
=
"TkDefaultFont"
@classmethod
def
setUpClass
(
cls
):
AbstractTkTest
.
setUpClass
()
try
:
f
=
font
.
Font
(
root
=
self
.
root
,
name
=
fontname
,
exists
=
True
)
except
tkinter
.
_tkinter
.
TclError
:
f
=
font
.
Font
(
root
=
self
.
root
,
name
=
fontname
,
exists
=
False
)
cls
.
font
=
font
.
Font
(
root
=
cls
.
root
,
name
=
fontname
,
exists
=
True
)
except
tkinter
.
TclError
:
cls
.
font
=
font
.
Font
(
root
=
cls
.
root
,
name
=
fontname
,
exists
=
False
)
def
test_configure
(
self
):
options
=
self
.
font
.
configure
()
self
.
assertGreaterEqual
(
set
(
options
),
{
'family'
,
'size'
,
'weight'
,
'slant'
,
'underline'
,
'overstrike'
})
for
key
in
options
:
self
.
assertEqual
(
self
.
font
.
cget
(
key
),
options
[
key
])
self
.
assertEqual
(
self
.
font
[
key
],
options
[
key
])
for
key
in
'family'
,
'weight'
,
'slant'
:
self
.
assertIsInstance
(
options
[
key
],
str
)
self
.
assertIsInstance
(
self
.
font
.
cget
(
key
),
str
)
self
.
assertIsInstance
(
self
.
font
[
key
],
str
)
sizetype
=
int
if
self
.
wantobjects
else
str
for
key
in
'size'
,
'underline'
,
'overstrike'
:
self
.
assertIsInstance
(
options
[
key
],
sizetype
)
self
.
assertIsInstance
(
self
.
font
.
cget
(
key
),
sizetype
)
self
.
assertIsInstance
(
self
.
font
[
key
],
sizetype
)
def
test_actual
(
self
):
options
=
self
.
font
.
actual
()
self
.
assertGreaterEqual
(
set
(
options
),
{
'family'
,
'size'
,
'weight'
,
'slant'
,
'underline'
,
'overstrike'
})
for
key
in
options
:
self
.
assertEqual
(
self
.
font
.
actual
(
key
),
options
[
key
])
for
key
in
'family'
,
'weight'
,
'slant'
:
self
.
assertIsInstance
(
options
[
key
],
str
)
self
.
assertIsInstance
(
self
.
font
.
actual
(
key
),
str
)
sizetype
=
int
if
self
.
wantobjects
else
str
for
key
in
'size'
,
'underline'
,
'overstrike'
:
self
.
assertIsInstance
(
options
[
key
],
sizetype
)
self
.
assertIsInstance
(
self
.
font
.
actual
(
key
),
sizetype
)
def
test_name
(
self
):
self
.
assertEqual
(
self
.
font
.
name
,
fontname
)
self
.
assertEqual
(
str
(
self
.
font
),
fontname
)
def
test_eq
(
self
):
font1
=
font
.
Font
(
root
=
self
.
root
,
name
=
fontname
,
exists
=
True
)
font2
=
font
.
Font
(
root
=
self
.
root
,
name
=
fontname
,
exists
=
True
)
self
.
assertIsNot
(
font1
,
font2
)
...
...
@@ -21,6 +61,26 @@ class FontTest(AbstractTkTest, unittest.TestCase):
self
.
assertNotEqual
(
font1
,
font1
.
copy
())
self
.
assertNotEqual
(
font1
,
0
)
def
test_measure
(
self
):
self
.
assertIsInstance
(
self
.
font
.
measure
(
'abc'
),
int
)
def
test_metrics
(
self
):
metrics
=
self
.
font
.
metrics
()
self
.
assertGreaterEqual
(
set
(
metrics
),
{
'ascent'
,
'descent'
,
'linespace'
,
'fixed'
})
for
key
in
metrics
:
self
.
assertEqual
(
self
.
font
.
metrics
(
key
),
metrics
[
key
])
self
.
assertIsInstance
(
metrics
[
key
],
int
)
self
.
assertIsInstance
(
self
.
font
.
metrics
(
key
),
int
)
def
test_families
(
self
):
families
=
font
.
families
(
self
.
root
)
self
.
assertIn
(
self
.
font
.
actual
(
'family'
),
families
)
def
test_names
(
self
):
names
=
font
.
names
(
self
.
root
)
self
.
assertIn
(
fontname
,
names
)
tests_gui
=
(
FontTest
,
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment