def test_sortBy_isMonospace_glyphs(self):
     font1 = self.getFont_sortBy_monospaceGlyphs()
     font2 = self.getFont_sortBy_monospaceGlyphs()
     font3 = self.getFont_sortBy_proportionalGlyphs()
     font4 = self.getFont_sortBy_proportionalGlyphs()
     fonts = FontList()
     fonts.extend([font1, font2, font3, font4])
     fonts.reverse()
     fonts.sortBy("isMonospace")
     expected = [font2, font1, font4, font3]
     self.assertEqual(fonts, expected)
 def test_sortBy_isMonospace_glyphs(self):
     font1 = self.getFont_sortBy_monospaceGlyphs()
     font2 = self.getFont_sortBy_monospaceGlyphs()
     font3 = self.getFont_sortBy_proportionalGlyphs()
     font4 = self.getFont_sortBy_proportionalGlyphs()
     fonts = FontList()
     fonts.extend([font1, font2, font3, font4])
     fonts.reverse()
     fonts.sortBy("isMonospace")
     expected = [font2, font1, font4, font3]
     self.assertEqual(fonts, expected)
 def test_sortBy_sortValueFunction(self):
     font1 = self.getFont_withGlyphCount(10)
     font2 = self.getFont_withGlyphCount(20)
     font3 = self.getFont_withGlyphCount(30)
     font4 = self.getFont_withGlyphCount(40)
     fonts = FontList()
     fonts.extend([font1, font2, font3, font4])
     fonts.reverse()
     def glyphCountSortValue(font):
         return len(font)
     fonts.sortBy(glyphCountSortValue)
     expected = [font1, font2, font3, font4]
     self.assertEqual(fonts, expected)
Example #4
0
 def test_sortBy_sortValueFunction(self):
     font1 = self.getFont_withGlyphCount(10)
     font2 = self.getFont_withGlyphCount(20)
     font3 = self.getFont_withGlyphCount(30)
     font4 = self.getFont_withGlyphCount(40)
     fonts = FontList()
     fonts.extend([font1, font2, font3, font4])
     fonts.reverse()
     def glyphCountSortValue(font):
         return len(font)
     fonts.sortBy(glyphCountSortValue)
     expected = [font1, font2, font3, font4]
     self.assertEqual(fonts, expected)