patch 9.1.0871: getcellpixels() can be further improved

Problem:  getcellpixels() can be further improved
Solution: Fix floating point exception, implement getcellpixels() in the
          UI (mikoto2000)

closes: #16059

Signed-off-by: mikoto2000 <mikoto2000@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index f555621..8b2518f 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -4160,10 +4160,9 @@
 endfunc
 
 
-" Test for getcellpixels()
+" Test for getcellpixels() for unix system
 " Pixel size of a cell is terminal-dependent, so in the test, only the list and size 2 are checked.
-func Test_getcellpixels()
-  " Not yet Windows-compatible
+func Test_getcellpixels_for_unix()
   CheckNotMSWindows
   CheckRunVimInTerminal
 
@@ -4180,13 +4179,30 @@
   call StopVimInTerminal(buf)
 endfunc
 
+" Test for getcellpixels() for windows system
+" Windows terminal vim is not support. check return `[]`.
+func Test_getcellpixels_for_windows()
+  CheckMSWindows
+  CheckRunVimInTerminal
+
+  let buf = RunVimInTerminal('', #{rows: 6})
+
+  " write getcellpixels() result to current buffer.
+  call term_sendkeys(buf, ":redi @\"\<CR>")
+  call term_sendkeys(buf, ":echo getcellpixels()\<CR>")
+  call term_sendkeys(buf, ":redi END\<CR>")
+  call term_sendkeys(buf, "P")
+
+  call WaitForAssert({-> assert_match("\[\]", term_getline(buf, 3))}, 1000)
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " Test for getcellpixels() on gVim
 func Test_getcellpixels_gui()
-  " Not yet Windows-compatible
-  CheckNotMSWindows
   if has("gui_running")
     let cellpixels = getcellpixels()
-    call assert_equal(0, len(cellpixels))
+    call assert_equal(2, len(cellpixels))
   endif
 endfunc