ENG-4959: refactor variable "needPadding", add some test cases.