Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Igualdad de objetos ImageData con Jasmine

Quiero probar dos objetos ImageData para la igualdad con Jasmine. El problema es que las dimensiones de la imagen se ignoran por completo en la comparación. ¿Qué me estoy perdiendo?

 var img = new Uint8ClampedArray([138, 162, 148 255, 70, 29, 70, 20 0, 0, 0, 255, 255, 255, 255, 255, 46, 46, 46, 17, 139, 139, 139, 255]); var imgA = new ImageData(img, 3, 2); var imgB = new ImageData(img, 2, 3); expect(imgA).toEqual(imgB); done(); //SUCCESS
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Escribe una comparación personalizada para que verifique lo que quieres que verifique. En tu caso, puedes usar algo como

 // comparator; note: untested code const imageEquality = (first, second) => { if (first.constructor == ImageData && second.constructor == ImageData) { return first.height == second.height && first.width == second.width && first.data.every((e,i) => e == second.data[i])); } return undefined; // we do not know how to compare that }; // register to ensure that it is used in comparations beforeEach(function() { jasmine.addCustomEqualityTester(imageEquality); });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!