func_code_string: #include <bits/stdc++.h>   #define mid (tl+tr)/2   #define mod 1000000007   #define fain(arr) for(ll i=0;i<n;i++)cin>>arr[i];   #define all(x) x.begin(),x.end()   #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);   #define bugv(n1) if(DEBUG)cout<<#n1<<  is  <<n1<<  n ;   #define buga(A) cout<<#A<<  is : <<endl ; for(auto x:A)cout<<x<<   ; cout<<endl;   #define FILE freopen( input.txt , r ,stdin);   #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))   #define endl   n    #define ll long long    #define pii pair<ll,ll>   #define pll pair<long long ,long long >   #define pi acos(-1)   #define sz(x) ((ll)x.size())   #define clr(x) memset(x, 0, sizeof(x))   #define init(x, a) memset(x, a, sizeof(x))   #define DEBUG true   using namespace std;      int main(){    // FILE;    SPEED;    ll t;    cin>>t;    while(t--){          int n,m;          cin>>n>>m;             char arr[n][m];             for(int i=0;i<n;i++){           for(int j=0;j<m;j++){            cin>>arr[i][j];           }          }                int left[n][m];          int right[n][m];          int up[n][m];             for(int i=0;i<n;i++){            for(int j=m-1;j>=0;j--){              if(j==m-1){                right[i][j]=arr[i][j]== * ?1:0;              }              else{               if(arr[i][j]== * )               right[i][j]=right[i][j+1]+1;               else               right[i][j]=0;              }            }          }              for(int i=0;i<n;i++){            for(int j=0;j<m;j++){              if(j==0){                left[i][j]=arr[i][j]== * ?1:0;              }              else{               if(arr[i][j]== * )               left[i][j]=left[i][j-1]+1;               else               left[i][j]=0;              }            }          }          int ans=0;          for(int i=0;i<n;i++){            for(int j=0;j<m;j++){              if(i==0){                up[i][j]=arr[i][j]== * ?1:0;              }              else{               up[i][j]=min({left[i][j],right[i][j],1+up[i-1][j]});              }              ans+=up[i][j];            }          }             cout<<ans<<endl;       }   }