@@ -472,7 +472,10 @@ def setUp(self):
472
472
super (TC_30_Gui_daemon , self ).setUp ()
473
473
self .init_default_template ()
474
474
475
- async def _test_clipboard (self , test_string ):
475
+ async def _test_clipboard (self , test_string ,
476
+ set_features = None ,
477
+ expect_content = None ,
478
+ expect_source_name = None ):
476
479
testvm1 = self .app .add_new_vm (
477
480
qubes .vm .appvm .AppVM ,
478
481
name = self .make_vm_name ('vm1' ), label = 'red' )
@@ -483,6 +486,9 @@ async def _test_clipboard(self, test_string):
483
486
await testvm2 .create_on_disk ()
484
487
self .app .save ()
485
488
489
+ for feature , value in (set_features or {}).items ():
490
+ testvm1 .features [feature ] = value
491
+
486
492
await asyncio .gather (
487
493
testvm1 .start (),
488
494
testvm2 .start ())
@@ -514,18 +520,23 @@ async def _test_clipboard(self, test_string):
514
520
515
521
clipboard_content = \
516
522
open ('/var/run/qubes/qubes-clipboard.bin' , 'r' ).read ().strip ()
523
+
524
+ if expect_content is not None :
525
+ test_string = expect_content
517
526
self .assertEqual (clipboard_content , test_string ,
518
527
"Clipboard copy operation failed - content" )
528
+ if expect_source_name is None :
529
+ expect_source_name = testvm1 .name
519
530
clipboard_source = \
520
531
open ('/var/run/qubes/qubes-clipboard.bin.source' ,
521
532
'r' ).read ().strip ()
522
- self .assertEqual (clipboard_source , testvm1 . name ,
533
+ self .assertEqual (clipboard_source , expect_source_name ,
523
534
"Clipboard copy operation failed - owner" )
524
535
525
536
# Then paste it to the other window
526
537
window_title = 'user@{}' .format (testvm2 .name )
527
538
p = await testvm2 .run (
528
- 'zenity --entry --title={} > /tmp/test.txt' .format (window_title ))
539
+ 'zenity --text-info --editable --title={} > /tmp/test.txt' .format (window_title ))
529
540
await self .wait_for_window_coro (window_title )
530
541
531
542
subprocess .check_call (['xdotool' , 'key' , '--delay' , '100' ,
@@ -553,6 +564,38 @@ def test_000_clipboard(self):
553
564
test_string = "test123"
554
565
self .loop .run_until_complete (self ._test_clipboard (test_string ))
555
566
567
+ @unittest .skipUnless (
568
+ spawn .find_executable ('xdotool' ),
569
+ "xdotool not installed" )
570
+ def test_001_clipboard_64k (self ):
571
+ test_string = "test123abc" * 6400
572
+ self .loop .run_until_complete (self ._test_clipboard (test_string ))
573
+
574
+ @unittest .skipUnless (
575
+ spawn .find_executable ('xdotool' ),
576
+ "xdotool not installed" )
577
+ def test_002_clipboard_200k_truncated (self ):
578
+ test_string = "test123abc" * 20000
579
+ self .loop .run_until_complete (self ._test_clipboard (test_string ,
580
+ expect_content = "" , expect_source_name = "" ))
581
+
582
+ @unittest .skipUnless (
583
+ spawn .find_executable ('xdotool' ),
584
+ "xdotool not installed" )
585
+ def test_002_clipboard_200k (self ):
586
+ test_string = "test123abc" * 20000
587
+ self .loop .run_until_complete (self ._test_clipboard (test_string ,
588
+ set_features = {"gui-max-clipboard-size" : 200_000 }))
589
+
590
+ @unittest .skipUnless (
591
+ spawn .find_executable ('xdotool' ),
592
+ "xdotool not installed" )
593
+ def test_002_clipboard_300k (self ):
594
+ test_string = "test123abc" * 30000
595
+ self .loop .run_until_complete (self ._test_clipboard (test_string ,
596
+ expect_content = "Qube clipboard size over 256KiB and X11 INCR "
597
+ "protocol support is not implemented!" ))
598
+
556
599
557
600
class TC_05_StandaloneVMMixin (object ):
558
601
def setUp (self ):
0 commit comments