Towards Graph Foundation Models: A Study on the Generalization of Positional and Structural Encodings