@@ -163,3 +163,25 @@ def test_write_pes_mismatched(self):
163163 write_pes (pattern , file1 )
164164 self .addCleanup (os .remove , file1 )
165165
166+ def test_pes_writes_stop (self ):
167+ """Test if pes can read/write a stop command."""
168+ file1 = "file.pes"
169+ pattern = EmbPattern ()
170+ pattern += "red"
171+ pattern += (0 , 0 ), (100 , 100 )
172+ pattern += STOP
173+ pattern += (100 , 0 ), (0 , 100 )
174+ pattern += "blue"
175+ pattern += (0 , 0 ), (100 , 100 )
176+ pattern += STOP
177+ pattern += (100 , 0 ), (0 , 100 )
178+ write_pes (pattern , file1 , {"version" : "6t" })
179+ loaded = read_pes (file1 )
180+ self .assertEqual (pattern .count_stitch_commands (STOP ), 2 )
181+ self .assertEqual (pattern .count_stitch_commands (COLOR_CHANGE ), 1 )
182+ self .assertEqual (pattern .count_threads (), 2 )
183+ self .assertEqual (loaded .count_stitch_commands (STOP ), 2 )
184+ self .assertEqual (loaded .count_stitch_commands (COLOR_CHANGE ), 1 )
185+ self .assertEqual (loaded .count_threads (), 2 )
186+ self .addCleanup (os .remove , file1 )
187+
0 commit comments