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
2518fa83
Kaydet (Commit)
2518fa83
authored
Haz 12, 2016
tarafından
Terry Jan Reedy
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #27239: Continue refactoring idlelib.macosx and adding macosx tests.
üst
7670e3c1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
16 deletions
+53
-16
htest.py
Lib/idlelib/idle_test/htest.py
+0
-2
test_macosx.py
Lib/idlelib/idle_test/test_macosx.py
+35
-7
macosx.py
Lib/idlelib/macosx.py
+18
-7
No files found.
Lib/idlelib/idle_test/htest.py
Dosyayı görüntüle @
2518fa83
...
@@ -66,7 +66,6 @@ outwin.OutputWindow (indirectly being tested with grep test)
...
@@ -66,7 +66,6 @@ outwin.OutputWindow (indirectly being tested with grep test)
'''
'''
from
importlib
import
import_module
from
importlib
import
import_module
from
idlelib.macosx
import
_init_tk_type
import
tkinter
as
tk
import
tkinter
as
tk
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
...
@@ -338,7 +337,6 @@ def run(*tests):
...
@@ -338,7 +337,6 @@ def run(*tests):
root
=
tk
.
Tk
()
root
=
tk
.
Tk
()
root
.
title
(
'IDLE htest'
)
root
.
title
(
'IDLE htest'
)
root
.
resizable
(
0
,
0
)
root
.
resizable
(
0
,
0
)
_init_tk_type
(
root
)
# a scrollable Label like constant width text widget.
# a scrollable Label like constant width text widget.
frameLabel
=
tk
.
Frame
(
root
,
padx
=
10
)
frameLabel
=
tk
.
Frame
(
root
,
padx
=
10
)
...
...
Lib/idlelib/idle_test/test_macosx.py
Dosyayı görüntüle @
2518fa83
'''Test idlelib.macosx.py
'''Test idlelib.macosx.py.
Coverage: 71
%
on Windows.
'''
'''
from
idlelib
import
macosx
from
idlelib
import
macosx
from
test.support
import
requires
from
test.support
import
requires
...
@@ -6,8 +8,8 @@ import sys
...
@@ -6,8 +8,8 @@ import sys
import
tkinter
as
tk
import
tkinter
as
tk
import
unittest
import
unittest
import
unittest.mock
as
mock
import
unittest.mock
as
mock
from
idlelib.filelist
import
FileList
MAC
=
sys
.
platform
==
'darwin'
mactypes
=
{
'carbon'
,
'cocoa'
,
'xquartz'
}
mactypes
=
{
'carbon'
,
'cocoa'
,
'xquartz'
}
nontypes
=
{
'other'
}
nontypes
=
{
'other'
}
alltypes
=
mactypes
|
nontypes
alltypes
=
mactypes
|
nontypes
...
@@ -20,21 +22,23 @@ class InitTktypeTest(unittest.TestCase):
...
@@ -20,21 +22,23 @@ class InitTktypeTest(unittest.TestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
requires
(
'gui'
)
requires
(
'gui'
)
cls
.
root
=
tk
.
Tk
()
cls
.
root
=
tk
.
Tk
()
cls
.
orig_platform
=
macosx
.
platform
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
cls
.
root
.
update_idletasks
()
cls
.
root
.
update_idletasks
()
cls
.
root
.
destroy
()
cls
.
root
.
destroy
()
del
cls
.
root
del
cls
.
root
macosx
.
platform
=
cls
.
orig_platform
def
test_init_sets_tktype
(
self
):
def
test_init_sets_tktype
(
self
):
"Test that _init_tk_type sets _tk_type according to platform."
"Test that _init_tk_type sets _tk_type according to platform."
for
root
in
(
None
,
self
.
root
):
for
platform
,
types
in
(
'darwin'
,
alltypes
),
(
'other'
,
nontypes
):
with
self
.
subTest
(
root
=
root
):
with
self
.
subTest
(
platform
=
platform
):
macosx
.
platform
=
platform
macosx
.
_tk_type
==
None
macosx
.
_tk_type
==
None
macosx
.
_init_tk_type
(
root
)
macosx
.
_init_tk_type
()
self
.
assertIn
(
macosx
.
_tk_type
,
self
.
assertIn
(
macosx
.
_tk_type
,
types
)
mactypes
if
MAC
else
nontypes
)
class
IsTypeTkTest
(
unittest
.
TestCase
):
class
IsTypeTkTest
(
unittest
.
TestCase
):
...
@@ -65,5 +69,29 @@ class IsTypeTkTest(unittest.TestCase):
...
@@ -65,5 +69,29 @@ class IsTypeTkTest(unittest.TestCase):
(
func
())
(
func
())
class
SetupTest
(
unittest
.
TestCase
):
"Test setupApp."
@classmethod
def
setUpClass
(
cls
):
requires
(
'gui'
)
cls
.
root
=
tk
.
Tk
()
@classmethod
def
tearDownClass
(
cls
):
cls
.
root
.
update_idletasks
()
cls
.
root
.
destroy
()
del
cls
.
root
def
test_setupapp
(
self
):
"Call setupApp with each possible graphics type."
root
=
self
.
root
flist
=
FileList
(
root
)
for
tktype
in
alltypes
:
with
self
.
subTest
(
tktype
=
tktype
):
macosx
.
_tk_type
=
tktype
macosx
.
setupApp
(
root
,
flist
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
(
verbosity
=
2
)
unittest
.
main
(
verbosity
=
2
)
Lib/idlelib/macosx.py
Dosyayı görüntüle @
2518fa83
"""
"""
A number of functions that enhance IDLE on Mac OSX.
A number of functions that enhance IDLE on Mac OSX.
"""
"""
import
sys
from
sys
import
platform
# Used in _init_tk_type, changed by test.
import
tkinter
import
tkinter
import
warnings
import
warnings
## Define functions that query the Mac graphics type.
## _tk_type and its initializer are private to this section.
_tk_type
=
None
_tk_type
=
None
def
_init_tk_type
(
idleroot
=
None
):
def
_init_tk_type
():
"""
"""
Initializes OS X Tk variant values for
Initializes OS X Tk variant values for
isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz().
"""
"""
global
_tk_type
global
_tk_type
if
sys
.
platform
==
'darwin'
:
if
platform
==
'darwin'
:
root
=
idleroot
or
tkinter
.
Tk
()
root
=
tkinter
.
Tk
()
ws
=
root
.
tk
.
call
(
'tk'
,
'windowingsystem'
)
ws
=
root
.
tk
.
call
(
'tk'
,
'windowingsystem'
)
if
'x11'
in
ws
:
if
'x11'
in
ws
:
_tk_type
=
"xquartz"
_tk_type
=
"xquartz"
...
@@ -24,8 +28,7 @@ def _init_tk_type(idleroot=None):
...
@@ -24,8 +28,7 @@ def _init_tk_type(idleroot=None):
_tk_type
=
"cocoa"
_tk_type
=
"cocoa"
else
:
else
:
_tk_type
=
"carbon"
_tk_type
=
"carbon"
if
not
idleroot
:
root
.
destroy
()
root
.
destroy
else
:
else
:
_tk_type
=
"other"
_tk_type
=
"other"
...
@@ -62,6 +65,7 @@ def isXQuartz():
...
@@ -62,6 +65,7 @@ def isXQuartz():
_init_tk_type
()
_init_tk_type
()
return
_tk_type
==
"xquartz"
return
_tk_type
==
"xquartz"
def
tkVersionWarning
(
root
):
def
tkVersionWarning
(
root
):
"""
"""
Returns a string warning message if the Tk version in use appears to
Returns a string warning message if the Tk version in use appears to
...
@@ -82,6 +86,9 @@ def tkVersionWarning(root):
...
@@ -82,6 +86,9 @@ def tkVersionWarning(root):
else
:
else
:
return
False
return
False
## Fix the menu and related functions.
def
addOpenEventSupport
(
root
,
flist
):
def
addOpenEventSupport
(
root
,
flist
):
"""
"""
This ensures that the application will respond to open AppleEvents, which
This ensures that the application will respond to open AppleEvents, which
...
@@ -233,9 +240,13 @@ def setupApp(root, flist):
...
@@ -233,9 +240,13 @@ def setupApp(root, flist):
isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which
isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which
are initialized here as well.
are initialized here as well.
"""
"""
_init_tk_type
(
root
)
if
isAquaTk
():
if
isAquaTk
():
hideTkConsole
(
root
)
hideTkConsole
(
root
)
overrideRootMenu
(
root
,
flist
)
overrideRootMenu
(
root
,
flist
)
addOpenEventSupport
(
root
,
flist
)
addOpenEventSupport
(
root
,
flist
)
fixb2context
(
root
)
fixb2context
(
root
)
if
__name__
==
'__main__'
:
from
unittest
import
main
main
(
'idlelib.idle_test.test_macosx'
,
verbosity
=
2
)
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