# Path: tests/classes_test.py
# def generate_minimal_font(format_version=2):
#     font = GSFont()
#     font.format_version = format_version
#     font.appVersion = 895
#     font.date = datetime.datetime.today()
#     font.familyName = "MyFont"
# 
#     master = GSFontMaster()
#     master.ascender = 0
#     master.capHeight = 0
#     master.descender = 0
#     master.id = "id"
#     master.xHeight = 0
#     font.masters.append(master)
# 
#     font.upm = 1000
#     font.versionMajor = 1
#     font.versionMinor = 0
# 
#     return font
# 
# def generate_instance_from_dict(instance_dict):
#     instance = GSInstance()
#     instance.name = instance_dict["name"]
#     for custom_parameter in instance_dict.get("customParameters", []):
#         cp = GSCustomParameter()
#         cp.name = custom_parameter["name"]
#         cp.value = custom_parameter["value"]
#         instance.customParameters.append(cp)
#     return instance
# 
# def add_glyph(font, glyphname):
#     glyph = GSGlyph()
#     glyph.name = glyphname
#     font.glyphs.append(glyph)
#     layer = GSLayer()
#     layer.layerId = font.masters[0].id
#     layer.associatedMasterId = font.masters[0].id
#     layer.width = 0
#     glyph.layers.append(layer)
#     return glyph
# 
# def add_anchor(font, glyphname, anchorname, x, y):
#     for glyph in font.glyphs:
#         if glyph.name == glyphname:
#             for master in font.masters:
#                 layer = glyph.layers[master.id]
#                 layer.anchors = getattr(layer, "anchors", [])
#                 anchor = GSAnchor()
#                 anchor.name = anchorname
#                 anchor.position = (x, y)
#                 layer.anchors.append(anchor)
# 
# def add_component(font, glyphname, componentname, transform):
#     for glyph in font.glyphs:
#         if glyph.name == glyphname:
#             for layer in glyph.layers.values():
#                 component = GSComponent()
#                 component.name = componentname
#                 component.transform = transform
#                 layer.components.append(component)
# 
# Path: tests/test_helpers.py
# class ParametrizedUfoModuleTestMixin(object):
# 
#     ufo_module = None  # subclasses must override this
# 
#     def to_ufos(self, *args, **kwargs):
#         kwargs["ufo_module"] = self.ufo_module
#         return to_ufos(*args, **kwargs)
# 
#     def to_designspace(self, *args, **kwargs):
#         kwargs["ufo_module"] = self.ufo_module
#         return to_designspace(*args, **kwargs)


import collections
import logging
import unittest
import tempfile
import os
import shutil
import glyphsLib
import defcon
import ufoLib2
from textwrap import dedent
from fontTools.misc.loggingTools import CapturingLogHandler
from glyphsLib import builder
from glyphsLib.classes import (
    GSComponent,
    GSFeature,
    GSFont,
    GSFontMaster,
    GSGlyph,
    GSLayer,
    GSPath,
    GSNode,
    GSAlignmentZone,
    GSGuide,
)
from glyphsLib.types import Point
from glyphsLib.builder import to_glyphs
from glyphsLib.builder.builders import UFOBuilder, GlyphsBuilder
from glyphsLib.builder.paths import to_ufo_paths
from glyphsLib.builder.names import build_stylemap_names
from glyphsLib.builder.filters import parse_glyphs_filter
from glyphsLib.builder.constants import (
    COMPONENT_INFO_KEY,
    GLYPHS_PREFIX,
    GLYPHLIB_PREFIX,
    FONT_CUSTOM_PARAM_PREFIX,
)
from ..classes_test import (
    generate_minimal_font,
    generate_instance_from_dict,
    add_glyph,
    add_anchor,
    add_component,
)
from ..test_helpers import ParametrizedUfoModuleTestMixin

        ufo = self.to_ufos(font)[0]

        originalWidth_key = GLYPHLIB_PREFIX + "originalWidth"
        self.assertEqual(ufo["dieresiscomb"].width, 0)
        self.assertEqual(ufo["dieresiscomb"].lib.get(originalWidth_key), 100)
        self.assertEqual(ufo["foo"].width, 0)
        self.assertEqual(ufo["foo"].lib.get(originalWidth_key), 200)
        self.assertEqual(ufo["bar"].width, 0)
        self.assertFalse(originalWidth_key in ufo["bar"].lib)

    def test_GDEF(self):
        font = generate_minimal_font()
        for glyph in (
            "space",
            "A",
            "A.alt",
            "wigglylinebelowcomb",
            "wigglylinebelowcomb.alt",
            "fi",
            "fi.alt",
            "t_e_s_t",
            "t_e_s_t.alt",
        ):
            add_glyph(font, glyph)
        add_anchor(font, "A", "bottom", 300, -10)
        add_anchor(font, "wigglylinebelowcomb", "_bottom", 100, 40)
        add_anchor(font, "fi", "caret_1", 150, 0)
        add_anchor(font, "t_e_s_t.alt", "caret_1", 200, 0)
        add_anchor(font, "t_e_s_t.alt", "caret_2", 400, 0)

# Path: tests/classes_test.py
# def generate_minimal_font(format_version=2):
#     font = GSFont()
#     font.format_version = format_version
#     font.appVersion = 895
#     font.date = datetime.datetime.today()
#     font.familyName = "MyFont"
# 
#     master = GSFontMaster()
#     master.ascender = 0
#     master.capHeight = 0
#     master.descender = 0
#     master.id = "id"
#     master.xHeight = 0
#     font.masters.append(master)
# 
#     font.upm = 1000
#     font.versionMajor = 1
#     font.versionMinor = 0
# 
#     return font
# 
# def generate_instance_from_dict(instance_dict):
#     instance = GSInstance()
#     instance.name = instance_dict["name"]
#     for custom_parameter in instance_dict.get("customParameters", []):
#         cp = GSCustomParameter()
#         cp.name = custom_parameter["name"]
#         cp.value = custom_parameter["value"]
#         instance.customParameters.append(cp)
#     return instance
# 
# def add_glyph(font, glyphname):
#     glyph = GSGlyph()
#     glyph.name = glyphname
#     font.glyphs.append(glyph)
#     layer = GSLayer()
#     layer.layerId = font.masters[0].id
#     layer.associatedMasterId = font.masters[0].id
#     layer.width = 0
#     glyph.layers.append(layer)
#     return glyph
# 
# def add_anchor(font, glyphname, anchorname, x, y):
#     for glyph in font.glyphs:
#         if glyph.name == glyphname:
#             for master in font.masters:
#                 layer = glyph.layers[master.id]
#                 layer.anchors = getattr(layer, "anchors", [])
#                 anchor = GSAnchor()
#                 anchor.name = anchorname
#                 anchor.position = (x, y)
#                 layer.anchors.append(anchor)
# 
# def add_component(font, glyphname, componentname, transform):
#     for glyph in font.glyphs:
#         if glyph.name == glyphname:
#             for layer in glyph.layers.values():
#                 component = GSComponent()
#                 component.name = componentname
#                 component.transform = transform
#                 layer.components.append(component)
# 
# Path: tests/test_helpers.py
# class ParametrizedUfoModuleTestMixin(object):
# 
#     ufo_module = None  # subclasses must override this
# 
#     def to_ufos(self, *args, **kwargs):
#         kwargs["ufo_module"] = self.ufo_module
#         return to_ufos(*args, **kwargs)
# 
#     def to_designspace(self, *args, **kwargs):
#         kwargs["ufo_module"] = self.ufo_module
#         return to_designspace(*args, **kwargs)


# Path: tests/builder/builder_test.py
import collections
import logging
import unittest
import tempfile
import os
import shutil
import glyphsLib
import defcon
import ufoLib2
from textwrap import dedent
from fontTools.misc.loggingTools import CapturingLogHandler
from glyphsLib import builder
from glyphsLib.classes import (
    GSComponent,
    GSFeature,
    GSFont,
    GSFontMaster,
    GSGlyph,
    GSLayer,
    GSPath,
    GSNode,
    GSAlignmentZone,
    GSGuide,
)
from glyphsLib.types import Point
from glyphsLib.builder import to_glyphs
from glyphsLib.builder.builders import UFOBuilder, GlyphsBuilder
from glyphsLib.builder.paths import to_ufo_paths
from glyphsLib.builder.names import build_stylemap_names
from glyphsLib.builder.filters import parse_glyphs_filter
from glyphsLib.builder.constants import (
    COMPONENT_INFO_KEY,
    GLYPHS_PREFIX,
    GLYPHLIB_PREFIX,
    FONT_CUSTOM_PARAM_PREFIX,
)
from ..classes_test import (
    generate_minimal_font,
    generate_instance_from_dict,
    add_glyph,
    add_anchor,
    add_component,
)
from ..test_helpers import ParametrizedUfoModuleTestMixin


        ufo = self.to_ufos(font)[0]

        originalWidth_key = GLYPHLIB_PREFIX + "originalWidth"
        self.assertEqual(ufo["dieresiscomb"].width, 0)
        self.assertEqual(ufo["dieresiscomb"].lib.get(originalWidth_key), 100)
        self.assertEqual(ufo["foo"].width, 0)
        self.assertEqual(ufo["foo"].lib.get(originalWidth_key), 200)
        self.assertEqual(ufo["bar"].width, 0)
        self.assertFalse(originalWidth_key in ufo["bar"].lib)

    def test_GDEF(self):
        font = generate_minimal_font()
        for glyph in (
            "space",
            "A",
            "A.alt",
            "wigglylinebelowcomb",
            "wigglylinebelowcomb.alt",
            "fi",
            "fi.alt",
            "t_e_s_t",
            "t_e_s_t.alt",
        ):
            add_glyph(font, glyph)
        add_anchor(font, "A", "bottom", 300, -10)
        add_anchor(font, "wigglylinebelowcomb", "_bottom", 100, 40)
        add_anchor(font, "fi", "caret_1", 150, 0)
        add_anchor(font, "t_e_s_t.alt", "caret_1", 200, 0)
        add_anchor(font, "t_e_s_t.alt", "caret_2", 400, 0)

        add_anchor(font, "t_e_s_t.alt", "caret_3", 600, 0)