Your IP : 172.28.240.42


Current Path : /usr/share/apport/testsuite/
Upload File :
Current File : //usr/share/apport/testsuite/test_ui_gtk.pyc


Yc@sjdZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlmZ
ddlmZddlZe
je
jje
jjBejjdrdZdZnHejjejjd	d
dZejjejjd	d
dZejd
ejZdejfdYZejdS(s GTK Apport user interface tests.iN(tGLibtGtk(tunicode_gettext(tpatchtAPPORT_TEST_LOCALsgtk/apport-gtksdata/kernel_oopstAPPORT_DATA_DIRs/usr/share/apports
apport-gtktkernel_oopsttTcBseZedZdZdZdZdZdZdZ	dZ
dZd	Zd
Z
ejeddZd
ZdZejeddZejeddZejeddZejeddZdZdZejeddZejeddZejeddZdZdZdZRS(cCs1tj}|j|djd|_dS(Nt
DistroReleasei(tapporttReporttadd_os_infotsplittdistro(tklasstr((s*/usr/share/apport/testsuite/test_ui_gtk.pyt
setUpClass&s
cCsTtj|_|jtj_|jtjd<tjd}t	tjd<t
|_|tjd<tjj
jdi|j_tjj|jd|j_tj|j_d|jjd<d|jjd<d|jjd	<|j|jjd
<t|jjd}|jjj|WdQXtj|_|jtj_|jtj_dS(NtAPPORT_REPORT_DIRis
bash.crashs	/bin/bashtExecutablePatht11tSignalRtCoreDumpR	tw(ttempfiletmkdtempt
report_dirR
t	fileutilstostenvirontsystargvtapport_gtk_pathtGTKUserInterfacetapptcrashdb_impltmemoryt
CrashDatabasetNonetcrashdbtpathtjointreport_fileRtreportRtopentwritethook_dirt	_hook_dirt_common_hook_dir(tselftsavedtf((s*/usr/share/apport/testsuite/test_ui_gtk.pytsetUp,s&


cCs$tj|jtj|jdS(N(tshutiltrmtreeRR.(R1((s*/usr/share/apport/testsuite/test_ui_gtk.pyttearDownLscs\jjdjtfd}tj|jjt}j|ddS(sBClicking the close button on the window does not report the crash.tsend_error_reportcsjjdjdS(Ntdialog_crash_new(R"Rtdestroy(targs(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pytcTsR+N(R"Rt
set_activetTrueRtidle_addtui_present_report_detailstassertFalse(R1R<tresult((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_close_buttonPs

cCsd|jjd<tjtj|jjt|j|jj	dj
|j|j|jj	djt
d|j|jj	d}|j|jd|j|j|j|jj	djd|j|jj	d	jd|j|jj	d	jt
d
|j|jj	djd|j|jj	djd|j|jj	d
jddS(s
        +-----------------------------------------------------------------+
        | [ logo] YourDistro has experienced an internal error.           |
        |                                                                 |
        |            [x] Send an error report to help fix this problem.   |
        |                                                                 |
        | [ Show Details ]                                   [ Continue ] |
        +-----------------------------------------------------------------+
        tKernelCrashtProblemTypeR9ttitle_labels,Sorry, %s has experienced an internal error.R8tvisibletshow_detailstcontinue_buttontContinuet
closed_buttontsubtitle_labeltignore_future_problemsN(R"R+RR?Rt	main_quitR@R>tassertEqualRt	get_titleRtget_textt_t
assertTruetget_propertyt
get_activet	get_labelRA(R1R8((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_kernel_crash_layoutZs"

""
""cCsd|jjd<d|jjd<tjtj|jjt|j|jj	dj
|j|j|jj	djt
d|jj	d}|j|jd|j|j|j|jj	d	jd|j|jj	d
jd|j|jj	d
jt
d|j|jj	djd|j|jj	d
jd|j|jj	d
jt
ddS(si
        +-----------------------------------------------------------------+
        | [ error  ] Sorry, a problem occurred while installing software. |
        |            Package: apport 1.2.3~0ubuntu1                       |
        |                                                                 |
        |            [x] Send an error report to help fix this problem.   |
        |                                                                 |
        | [ Show Details ]                                   [ Continue ] |
        +-----------------------------------------------------------------+
        tPackageREsapport 1.2.3~0ubuntu1R9RFs4Sorry, a problem occurred while installing software.R8RGRHRIRJRKRLsPackage: apport 1.2.3~0ubuntu1N(R"R+RR?RRNR@R>RORRPRRQRRRSRTRURVRA(R1R8((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_package_crash_layoutvs&

""
""cCsd|jjd<d|jjd<d|jjd<tjQ}|jd|j|j|jjd<tjt	j
|jjtWd	QX|j
|jjd
j|j|j
|jjdjtd|jjd
}|j|jd|j|j|j|jjdjd|j|jjdjd|j
|jjdjtd|j|jjdjd|j|jjdjd|j|jjdjd|j|jjdjjdd	S(si
        +-----------------------------------------------------------------+
        | [ apport ] The application Apport has closed unexpectedly.      |
        |                                                                 |
        |            [x] Send an error report to help fix this problem.   |
        |            [ ] Ignore future problems of this program version.  |
        |                                                                 |
        | [ Show Details ]                                   [ Continue ] |
        +-----------------------------------------------------------------+
        tCrashREt1tCrashCountersapport 1.2.3~0ubuntu1RXs8[Desktop Entry]
Version=1.0
Name=Apport
Type=ApplicationtDesktopFileNR9RFs/The application Apport has closed unexpectedly.R8RGRHRIRJRKRLRMsof this program version(R"R+RtNamedTemporaryFileR-tflushtnameRR?RRNR@R>RORRPRRQRRRSRTRURVRAtendswith(R1tfpR8((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_regular_crash_layouts4


""
"""cCs1t|j_d|jjd<d|jjd<d|jjd<d|jjd<tjQ}|jd	|j|j|jjd
<t	j
tj|jj
tWdQX|j|jjdj|j|j|jjd
jtd|jjd}|j|jd|j|j|j|jjdjd|j|jjdjd|j|jjdjtd|j|jjdjd|j|jjdjd|j|jjdjd|j|jjdjjddS(si
        +-----------------------------------------------------------------+
        | [ apport ] The application Apport has closed unexpectedly.      |
        |                                                                 |
        |            [x] Send an error report to help fix this problem.   |
        |            [ ] Ignore future problems of this program version.  |
        |                                                                 |
        | [ Show Details ]                 [ Leave Closed ]  [ Relaunch ] |
        +-----------------------------------------------------------------+
        RZRER[R\sapport-bug apporttProcCmdlinesapport 1.2.3~0ubuntu1RXs8[Desktop Entry]
Version=1.0
Name=Apport
Type=ApplicationR]NR9RFs/The application Apport has closed unexpectedly.R8RGRHRItRelaunchRKRLRMsof this program version(R>R"t
offer_restartR+RR^R-R_R`RR?RRNR@RORRPRRQRRRSRTRURVRARa(R1RbR8((s*/usr/share/apport/testsuite/test_ui_gtk.pyt!test_regular_crash_layout_restarts8


""
"""cCs\d|jjd<d|jjd<d|jjd<d|jjd<tjQ}|jd	|j|j|jjd
<tjt	j
|jjtWdQX|j
|jjdj|j|j
|jjd
jtd|j|jjdjd|j
|jjdjtd|j|jjdjddS(si
        +-----------------------------------------------------------------+
        | [ apport ] The application Apport has closed unexpectedly.      |
        |                                                                 |
        |            [x] Send an error report to help fix this problem.   |
        |            [ ] Ignore future problems of this program version.  |
        |                                                                 |
        | [ Show Details ]                                   [ Continue ] |
        +-----------------------------------------------------------------+
        RZRER[R\sapport-bug apportRdsapport 1.2.3~0ubuntu1RXs8[Desktop Entry]
Version=1.0
Name=Apport
Type=ApplicationR]NR9RFs/The application Apport has closed unexpectedly.RIRGRJRK(R"R+RR^R-R_R`RR?RRNR@R>RORRPRRQRRRSRTRVRA(R1Rb((s*/usr/share/apport/testsuite/test_ui_gtk.pyt#test_regular_crash_layout_norestarts$
%
"
cCsd|jjd<d|jjd<d|jjd<tjtj|jjt|j|jj	dj
|j|j|jj	djt
d	|j|j|jj	d
jt
d|j|jj	d
jd|jj	d
}|j|jd|j|j|j|jj	djd|j|jj	djd|j|jj	djt
d|j|jj	djd|j|jj	djd|j|jj	djjddS(s
        +---------------------------------------------------------------+
        | [ logo ] Sorry, YourDistro has experienced an internal error. |
        |          If you notice further problems, try restarting the   |
        |          computer                                             |
        |                                                               |
        |            [x] Send an error report to help fix this problem. |
        |            [ ] Ignore future problems of this type.           |
        |                                                               |
        | [ Show Details ]                                 [ Continue ] |
        +---------------------------------------------------------------+
        RZRER[R\sbash 5RXR9RFs,Sorry, %s has experienced an internal error.RLs<If you notice further problems, try restarting the computer.RGR8RHRIRJRKRMsof this typeN(R"R+RR?RRNR@R>RORRPRRQRRRSRTRURVRARa(R1R8((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_system_crash_layout
s.


"""
""cCsGd|jjd<d|jjd<d|jjd<d|jjd<d	|j_tjtj|jjt|j	|jj
d
j|j|j	|jj
dj
td|j	|jj
d
j
td|j|jj
d
jd|jj
d}|j|jd|j|j|j|jj
djd|j|jj
djd|j	|jj
djtd|j|jj
djd|jjd=tjtj|jjt|j	|jj
dj
td|j|jj
djddS(s
        +-------------------------------------------------------------------+
        | [ ubuntu ] Sorry, the application apport has closed unexpectedly. |
        |            If you notice further problems, try restarting the     |
        |            computer                                               |
        |                                                                   |
        |            [x] Send an error report to help fix this problem.     |
        |                                                                   |
        | [ Show Details ]                                     [ Continue ] |
        +-------------------------------------------------------------------+
        RZREsbash 5RXs*LANGUAGE=en_GB:en
SHELL=/bin/sh
TERM=xtermtProcEnvirons/usr/bin/apportRR
R9RFs6Sorry, the application apport has closed unexpectedly.RLs<If you notice further problems, try restarting the computer.RGR8RHRIRJRKs&Sorry, apport has closed unexpectedly.RMN(R"R+tcur_packageRR?RRNR@R>RORRPRRQRRRSRTRURVRA(R1R8((s*/usr/share/apport/testsuite/test_ui_gtk.pyt%test_system_crash_from_console_layout/s8


"""
"

tcan_examine_locallycGsd|jjd<d|jjd<tjtjt|jj_|jj	t
|j|jjdj
dtj|jjdjt
|jj_|jj	t
}|j|jjdj
d|j|ddS(s9
        +---------------------------------------------------------------------+
        | [ apport ] The application Apport has closed unexpectedly.          |
        |                                                                     |
        |            [x] Send an error report to help fix this problem.       |
        |                                                                     |
        | [ Show Details ] [ Examine locally ]  [ Leave Closed ] [ Relaunch ] |
        +---------------------------------------------------------------------+
        RZREsbash 5RXtexamineRGN(R"R+RR?RRNtFalseRmtreturn_valueR@R>RARRTtclickedRS(R1R;RB((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_examine_button^s""cCsd
|j_tjtj|jjt|j	|jj
djtd|j
|jj
djd|jj
d}|j
|jd|j|j|j
|jj
djd|j|jj
djd|j	|jj
djtd|j
|jj
d	jd|j|jj
d
jd|j|jj
djd|j|jj
djd
S(s
        +-------------------------------------------------------------------+
        | [ error  ] Send problem report to the developers?                 |
        |                                                                   |
        |            +----------------------------------------------------+ |
        |            | |> ApportVersion                                   | |
        |            | ...                                                | |
        |            +----------------------------------------------------+ |
        |                                                                   |
        | [ Cancel ]                                               [ Send ] |
        +-------------------------------------------------------------------+
        RFs&Send problem report to the developers?RLRGR8RHRItSendRKt
cancel_buttontdetails_scrolledwindowR9N(R&R"R*RR?RRNR@R>RORRQRRRARTRSRURVt
get_resizable(R1R8((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_apport_bug_package_layoutws"

"""
"""cCs_tjtj|jjt|jjd}|j|j	d|j|j
dS(NR8RG(RR?RRNR"R@RoRRARTRU(R1R8((s*/usr/share/apport/testsuite/test_ui_gtk.pyt%test_administrator_disabled_reportings
topen_urlcsd_fd}fdtjd|jjjjjjjj	djjj
d}j|ddj|ddjjtj|d	j
d
jd|dkjd
|kjjjjddS(s$Crash report without showing detailscsFjjdjstSjjdjtjdtS(NRIi(R"Rtget_visibleR>RqRttimeout_addRo(R;(R1tcheck_progress(s*/usr/share/apport/testsuite/test_ui_gtk.pytconts
cs"jjdjd_tS(Ntwindow_information_collectionRG(R"RRTtvisible_progressRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR|s	iiRERZRs	/bin/bashRXsbash tlibctDependenciest
StacktraceN(R&RRttimeout_add_secondsR"t	run_crashR*ROR't	latest_idtdownloadR>RSt
startswithRyt
call_count(R1R;R}R((R1R|s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_crash_nodetailss	cs/d_fd}fdfdtjd|jjjjjjjj	djjj
d}j|ddj|dd	jjtj|d
j
djd|d
kjd|kjjjjddS(s!Crash report with showing detailscsFjjdjstSjjdjtjdtS(NRHi(R"RRzR>RqRR{Ro(R;(R}R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyRHs
csejjjdkrtSjjjdjjjdjt	j
dtS(NRIi(R"t
tree_modeltget_iter_firstR&R>RSRRzRqRR{Ro(R;(R1R|(s*/usr/share/apport/testsuite/test_ui_gtk.pyR}scs"jjdjd_tS(NR~RG(R"RRTRRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR|s	iiRERZRs	/bin/bashRXsbash RRRiN(R&RRR{R"RR*ROR'RRRoRSRRyR(R1R;RHR((R}R1R|s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_crash_detailss	
cs*d_fd}fdtjd|dgjjjd<jjjjj	jjj
dj	jjjdj	jt
jj}j	|dd	j	|d
dj|djd
jd|dkjd|kdS(s(Crash report with non-accepting crash DBcsFjjdjstSjjdjtjdtS(NRIi(R"RRzR>RqRR{Ro(R;(R1R|(s*/usr/share/apport/testsuite/test_ui_gtk.pyR}s
cs"jjdjd_tS(NR~RG(R"RRTRRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR|s	itbugt
problem_typesiiRERZRs	/bin/bashRXsbash RRRN(R&RRRR"R'toptionsRR*RORRyRRoR+RSR(R1R;R}R((R1R|s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_crash_noaccepts	cs1fd}tjjjtjtgdtj}|jdj	|j
dtjd|jj
j	jjjdjjjd}j	|ddj	|ddjd	|d
kjd|kjd|d
kj	jjjddS(s*Kernel oops report without showing detailscs6jjdjstSjjdjtS(NRI(R"RRzR>RqRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR}ststdins!Plasma conduit phase misalignmentiiREt
KernelOopstOopsTexttlinuxRXRsPlasma conduittTitleN(RtremoveR"R*t
subprocesstPopentkernel_oops_pathtPIPEtcommunicateROt
returncodeRRtrun_crashesR'RRRSRyR(R1R;R}RR((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_kerneloops_nodetailss 

csdj_djj_fd}tjd|jjjjj	ddjjj	ddj
jj	djdjjj	d	d
dS(s Bug report for installed packagetbashcs6jjdjstSjjdjtS(NRt(R"RRzR>RqRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR<?siREtBugt
SourcePackageRXsbash RRN(
R&R"R*RtpackageRRtrun_report_bugROR+RSRtassertNotEqual(R1R<((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyt!test_bug_report_installed_package:s
 cstjj}dj_|jj_fd}tj	d|jj
jjjddjjjdtjj
|jjjdd|dS(	s"Bug report for uninstalled packagecs6jjdjstSjjdjtS(NRt(R"RRzR>RqRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR<SsiRERRRXs%s (not installed)N(R
t	packagingtget_uninstalled_packageR&R"R*RRRRRROR+t
get_source(R1tpkgR<((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyt#test_bug_report_uninstalled_packageLs
cs
d
j_fd}jjji}j|ddjj_djj_t	j
d|jjjjjjdjjj
d}j|djdjd|dkjd	|kjjjjdd
S(sUpdating an existing reportcs6jjjdkrtSjjdjtS(NRI(R"RRR&R>RRqRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR}fsiRiRXsbash RRR	N(R&R"R*R'tuploadRORt
update_reportRRR{trun_update_reportRRRSRRyR(R1R;R}tidR((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_update_report`s
csdj_fd}tjj}tjj|}j||djtjj|dd|j	t
tjj|ttj
jjd|d}|jdWdQXjjji}j|d	d	jj_|jj_tjd
|jjjjjjd	jjjd	}jd|kjd|kjd
|kj|ddjjjjd	dS(s]Updating an existing report on a source package which does not have a binary of the same namecs6jjjdkrtSjjdjtS(NRI(R"RRR&R>RRqRo(R;(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyR}ssIthis test assumes that the kernel binary package != kernel source packageRs@this test assumes that the kernel binary package %s is installedssource_%s.pyRs0def add_info(r, ui):
 r["MachineType"]="Laptop"
NiiRjR	tUnametMachineTypetLaptop(R&R"R*R
Rtget_kernel_packageRRtget_versiontassertRaisest
ValueErrorR,RR(R)R.R-R'RRORRRRR{RRRRSRyR(R1R;R}t
kernel_pkgt
kernel_srcR3RR((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyt*test_update_report_different_binary_sources0(
tget_desktop_entrycGsnd|jjd<d|jjd<d|jjjj_d|jjjj_tjtj	|jj
tdS(NRZREsapport 1.2.3~0ubuntu1RXtnonexistentR
(R"R+RRptgetIcontgetNameRR?RRNR@R>(R1R;((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_missing_iconscsfd}fdfdi}tjd||jjjjj|dd|dddj|d|d	j|d
j|dj|dd
S(s.Problem report window resizability and sizing.csjjdjstSjjdj|d<jjdj|d<jjdjtjd|t	S(NRHR9t	orig_sizetorig_resizablei(
R"RRzR>tget_sizeRvRqRR{Ro(tdata(R1thide_details(s*/usr/share/apport/testsuite/test_ui_gtk.pyRHscsjjjdkrtSjjdj|d<jjdj|d<jjdjt	j
d|tS(NR9tdetail_sizetdetail_resizableRHi(R"RRR&R>RRRvRqRR{Ro(R(tdetails_hiddenR1(s*/usr/share/apport/testsuite/test_ui_gtk.pyRscsbjjdjrtSjjdj|d<jjdj|d<tjdS(NRuR9thidden_sizethidden_resizable(R"RRzR>RRvRRN(R(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pyRs
iRiRidRRRRN(	RR{R"RR*t
assertGreaterRORARS(R1RHR((RR1Rs*/usr/share/apport/testsuite/test_ui_gtk.pyt
test_resizings
	$csfd}tjd|djjdjddjdtjd|djjddtjd|djjddjdtjd|djjddd	S(
sNon-ASCII title/text in dialogscs'jjstSjjj|tS(N(R"tmdR>tresponseRo(R(R1(s*/usr/share/apport/testsuite/test_ui_gtk.pytclosesiis	title ♩sUTF-8stext ♪ttitleshttp://example.com ♪N(RR{R"tui_info_messagetdecode(R1R((R1s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_dialog_nonasciis%cCs@|jjdjtjtj|jj|jjdS(s Close details window immediatelyR9N(	R"RR:RR?RRNRR*(R1((s*/usr/share/apport/testsuite/test_ui_gtk.pyttest_immediate_closes( t__name__t
__module__tclassmethodRR4R7RCRWRYRcRgRhRiRlRtobjectR!RrRwRxRRRRRRRRRRRR(((s*/usr/share/apport/testsuite/test_ui_gtk.pyR%s4	 		
			)	+	!	%	/		&0%"		!2
	0	( t__doc__tunittestRRRtimpR
R5Rt
gi.repositoryRRRRRtmockRtapport.crashdb_impl.memorytlog_set_always_fatalt
LogLevelFlagst
LEVEL_WARNINGtLEVEL_CRITICALRtgetR RR(R)tload_sourceR!tTestCaseRtmain(((s*/usr/share/apport/testsuite/test_ui_gtk.pyt<module>s.	$$